-
Notifications
You must be signed in to change notification settings - Fork 82
fix(core): exclude relationship column and calculated field when selecting all in the analysis result #740
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
Conversation
assertThat(result.size()).isEqualTo(1); | ||
assertThat(result.get(0).getSelectItems().size()).isEqualTo(1); | ||
assertThat(result.get(0).getSelectItems().get(0).getExpression()).isEqualTo("customer_name"); | ||
assertThat(result.get(0).getSelectItems().get(0).getExprSources()).isEqualTo(List.of(new ExprSource("customer_name", "orders", "customer_name", new NodeLocation(1, 8)))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We won't dig into the expression of a calculated field. So, in the exprSource
, we only provide itself.
assertThat(result.get(0).getSelectItems().get(0).getExpression()).isEqualTo("customer_name"); | ||
assertThat(result.get(0).getSelectItems().get(0).getExprSources()).isEqualTo(List.of(new ExprSource("customer_name", "orders", "customer_name", new NodeLocation(1, 8)))); | ||
|
||
statement = parseSql("SELECT customer FROM orders"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A relationship column can't be selected directly. we won't fail the case to make the query stable. However, it's an invalid query for Wren engine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @goldmedal.
Hi @goldmedal, does this pr resolve #738? If it is, would you be able to connect the issue? |
Thanks. I have linked the issues. |
…cting all in the analysis result (#740) * provide Column instance to field * filter calcaulted field and relationship when selecting all * exclude relationship column when resolving * remove unused rewrite rule
Description
close #738
In the normal query, both
relationship
andcalculated field
won't be selected when selecting all from a model. We should also exclude them in the analysis result.