# Debugging why query is not pushed down

**URL:** <https://community.dremio.com/t/debugging-why-query-is-not-pushed-down/6194>\
**Category:** Uncategorized\
**Created:** [September 2, 2020, 11:52am UTC](https://community.dremio.com/t/debugging-why-query-is-not-pushed-down/6194 "2020-09-02T11:52:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![froxCZ](https://avatars.discourse-cdn.com/v4/letter/f/ee7513/32.png) [@froxCZ](https://community.dremio.com/u/froxCZ)\
**Post date:** [September 2, 2020, 11:52am UTC](https://community.dremio.com/t/debugging-why-query-is-not-pushed-down/6194/1 "2020-09-02T11:52:26Z")

</div>

For some reason my dremio query for bigquery (custom ARP connector) is not pushed down. Even simple query with sum() is not pushed down, and the aggregation always happens in dremio.

What are the best ways how to find out why Dremio did not push some query down? I checked the ARP file several times and cannot figure out why it won’t push the query down. Some logs with info what prevents pushdown would be helpful!

---

<div class="post-metadata">

**Author:** ![Rakesh\_Malugu](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/rakesh_malugu/32/2384_2.png) [@Rakesh\_Malugu](https://community.dremio.com/u/Rakesh_Malugu)\
**Post date:** [September 2, 2020, 3:49pm UTC](https://community.dremio.com/t/debugging-why-query-is-not-pushed-down/6194/2 "2020-09-02T15:49:36Z")

</div>

Hello @froxCZ

Can you share the query profile with us?

Thanks,  
@Rakesh_Malugu

---

<div class="post-metadata">

**Author:** ![froxCZ](https://avatars.discourse-cdn.com/v4/letter/f/ee7513/32.png) [@froxCZ](https://community.dremio.com/u/froxCZ)\
**Post date:** [September 2, 2020, 4:03pm UTC](https://community.dremio.com/t/debugging-why-query-is-not-pushed-down/6194/3 "2020-09-02T16:03:37Z")

</div>

Sure,  
Query:

```auto
SELECT sum(t.latitude) AS col
FROM lukas_bigquery_westeros_knights."solar-melody-287313".my_own_data.bikeshare_stations AS t
limit 1000;

```

Pushed down:

```auto
SELECT `bikeshare_stations`.`latitude`
FROM `solar-melody-287313`.`my_own_data`.`bikeshare_stations`

```

[profile.zip](https://community.dremio.com/uploads/short-url/vpNubeKwLi8AlMhgyY2W3PtoRAw.zip) (8.6 KB)

Thanks @Rakesh_Malugu !

---

<div class="post-metadata">

**Author:** ![froxCZ](https://avatars.discourse-cdn.com/v4/letter/f/ee7513/32.png) [@froxCZ](https://community.dremio.com/u/froxCZ)\
**Post date:** [September 4, 2020, 8:35am UTC](https://community.dremio.com/t/debugging-why-query-is-not-pushed-down/6194/4 "2020-09-04T08:35:48Z")

</div>

@Rakesh_Malugu Did u have a chance to look at it please?

---

<div class="post-metadata">

**Author:** ![balaji.ramaswamy](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/balaji.ramaswamy/32/843_2.png) [@balaji.ramaswamy](https://community.dremio.com/u/balaji.ramaswamy)\
**Post date:** [September 8, 2020, 6:05am UTC](https://community.dremio.com/t/debugging-why-query-is-not-pushed-down/6194/5 "2020-09-08T06:05:02Z")

</div>

@froxCZ

Couple of things

1. Your query is only returning one row as you are doing a SUM() with no group by, so not sure why you need a LIMIT
2. We generally push down the entire SQL but I see your source is BigQuery, is this a customer built connector. What are the push down rules on this, for example a similar pushdown in Oracle would be

> Jdbc(sql=[SELECT \*  
> FROM (SELECT SUM(CAST(“EMPLOYEES”.“SALARY” AS NUMBER(38, 2))) “EXPR$0”  
> FROM “DREMIO”.“EMPLOYEES”) “EMPLOYEES”  
> WHERE ROWNUM \<= 5])

In Postgres would be

> Jdbc(sql=[SELECT CAST(SUM(“total\_sales”) AS NUMERIC(38, 6)) AS “EXPR$0”  
> FROM (SELECT CAST(“sales\_by\_store”.“total\_sales” AS DECIMAL(38, 6)) AS “total\_sales”  
> FROM “public”.“sales\_by\_store”) AS “sales\_by\_store” FETCH NEXT 1 ROWS ONLY])

---

<div class="post-metadata">

**Author:** ![froxCZ](https://avatars.discourse-cdn.com/v4/letter/f/ee7513/32.png) [@froxCZ](https://community.dremio.com/u/froxCZ)\
**Post date:** [September 8, 2020, 7:04am UTC](https://community.dremio.com/t/debugging-why-query-is-not-pushed-down/6194/6 "2020-09-08T07:04:28Z")

</div>

Hi @balaji.ramaswamy  
This is the connector [https://github.com/panoramichq/dremio-bigquery-connector](https://github.com/panoramichq/dremio-bigquery-connector) - it is mostly copy & paste from Snowflake connector, and modified where it was needed.

I could not figure out why this query is not pushed down. The sum seems to be correctly defined in the APR. What I am looking for is some information in Dremio Query plan, **why** certain query could not be pushed down. How can I **debug** this?

---

<div class="post-metadata">

**Author:** ![balaji.ramaswamy](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/balaji.ramaswamy/32/843_2.png) [@balaji.ramaswamy](https://community.dremio.com/u/balaji.ramaswamy)\
**Post date:** [September 26, 2020, 7:22am UTC](https://community.dremio.com/t/debugging-why-query-is-not-pushed-down/6194/7 "2020-09-26T07:22:42Z")

</div>

@froxCZ

I am wondering if you should first submit your connector and then take it forward

> **[Dremio Hub](https://www.dremio.com/hub/)**
>
> Dremio Hub provides community-supported connectors.
