-
Notifications
You must be signed in to change notification settings - Fork 186
Field name is converted to lowercase if present in GROUP BY #373
Comments
I can pick up the issue as a practice. But need some direction. Here is a regression test to reproduce the bug:
Diving into executeJdbcRequest, not sure how opendistrosql plugin is in-play here. |
@chenqi0805 Thanks! When you run |
@dai-chen Is there a way I could monitor how different modules in sql are functioning in processing a sql request? Right now I lose track of what is happening in client().performRequest. |
@chenqi0805 yes, it is because the request is being sent to ES cluster in your workspace via restful client. You should be able to find ES log in |
After some deeper dive, the cause of the bug is from the normalization
where without lowercase normalization expressions in SELECT will fail to match those from GROUP BY due to the logic in Do not have a good strategy to fix yet. @dai-chen Suggestion is welcome. |
@chenqi0805 Thanks a lot for your investigation! @penghuo Could you provide some suggestion when you're available? |
For issued case, One solution is before make all the method to lowercase, we can keep the original select field and pass it to SQLAggregationParser. https://github.com/opendistro-for-elasticsearch/sql/blob/master/src/main/java/com/amazon/opendistroforelasticsearch/sql/query/planner/converter/SQLAggregationParser.java#L157 |
@penghuo Thanks. I will give it a try and see how many existing integration tests it might break. |
Looking closer, one needs to deal with nested expression, e.g. Also, a related bug is that extra args are omitted in the expression Name: Line 240 in 3730ac6
|
Yes, nameOfExpr should be rewrite to keep the function name and parameters as expected. |
@penghuo Will open a separate issue to keep the workflow clean. Might work on that if I have time. |
Field name with function is supposed to be exactly same as what it is in
SELECT
. We've already implemented for simple case. However, it is converted to lowercase if used inGROUP BY
.The text was updated successfully, but these errors were encountered: