Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operator precedence on pushed down filters #265

Closed
gandola opened this issue Nov 5, 2020 · 1 comment
Closed

Operator precedence on pushed down filters #265

gandola opened this issue Nov 5, 2020 · 1 comment
Assignees

Comments

@gandola
Copy link

gandola commented Nov 5, 2020

Using AVRO as readDataFormat, the connector is pushing down the following filter query into BigQuery as expected.

df
.filter(
  (col("c1") >= to_date(lit("2020-09-01")) or col("c1").isNull)
  and
  (col("c2") >= to_date(lit("2020-09-15")) or col("c2").isNull)
  and
  (col("c3") <= to_date(lit("2020-09-15")) or col("c3").isNull)
)

However, the filter that comes in the logs is:

((`col1` >= '2020-09-01') OR (`col1` IS NULL) AND (`col2` >= '2020-09-15') OR (`col2` IS NULL) AND (`col3` <= '2020-09-15') OR (`col3` IS NULL))

Shouldn't ORs be enclosed into ()?
Due the operator precedence this won't give me the result that I expect from BQ.

Thank you,
Cheers

himanshukohli09 pushed a commit to himanshukohli09/spark-bigquery-connector that referenced this issue Mar 23, 2021
…r in case of nested AND and OR for AVRO readformat
davidrabinowitz pushed a commit that referenced this issue Mar 25, 2021
…d OR for AVRO readformat (#347)

Co-authored-by: Himanshu Kohli <himanshukohli@google.com>
@himanshukohli09
Copy link
Contributor

Hi Pedro,

Thanks for bringing this up. This issue has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants