Conversation
Pull Request Test Coverage Report for Build 1913841843
💛 - Coveralls |
| subquery: Box<Query>, | ||
| negated: bool, | ||
| }, | ||
| /// `[ NOT ] IN UNNEST(array_expression)` |
There was a problem hiding this comment.
I was going to suggest making this somewhat more general with any expr (rather than specific for UNEST function) like:
/// [NOT] IN <expr>
InExpr {
expr: Box<Expr>,
in_expr: Box<Expr>,
negated: bool
}However, I see that https://cloud.google.com/bigquery/docs/reference/standard-sql/operators#in_operators treats it as a special case so I think it would be ok to do here as well.
Actually, looking more deeply, it seems like UNNEST actually supports with offset as well
There was a problem hiding this comment.
Thank you for your valuable review.
As you said, it seems to be treated as a special case and any other functions can't used, so I did like this.
Actually, looking more deeply, it seems like UNNEST actually supports with offset as well
I did not know about with offset, thank you.
However, WITH OFFSET seems to be available when UNNEST returns a table.
In the case of IN UNNSET(array_expression), WITH OFFSET cannot be used because this IN UNNEST(array_expression) is a syntax sugar of subquery:
IN (SELECT element FROM UNNEST(array_expression) AS element).
✅ SELECT * FROM UNNEST(ARRAY[1,2,3]) WITH OFFSET
✅ SELECT 1 IN UNNEST(ARRAY[1,2,3])
❌ SELECT 1 IN UNNEST(ARRAY[1,2,3]) WITH OFFSET
So, if we support with offset, I think it is better to separate it from this PR, because the implementation and testing will be completely different. (I will try it in the future, if possible).
There was a problem hiding this comment.
So, if we support with offset, I think it is better to separate it from this PR,
I agree -- that makes sense. If anyone needs WITH OFFSET support it can be added as a follow on 👍
| } | ||
|
|
||
| #[test] | ||
| fn parse_in_unnest() { |
There was a problem hiding this comment.
Can you please also add a test for NOT IN UNNEST as well?
There was a problem hiding this comment.
Thanks! I will fix it!
|
@alamb I fixed it! |
|
Thanks again @komukomo |
This PR adds support
IN UNNEST(array_expression)for BigQuery.https://cloud.google.com/bigquery/docs/reference/standard-sql/operators#in_operators