You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/09/28 22:08:20 UTC

[GitHub] [incubator-pinot] Jackie-Jiang opened a new pull request #6067: Always quote literal when converting from PinotQuery to BrokerRequest

Jackie-Jiang opened a new pull request #6067:
URL: https://github.com/apache/incubator-pinot/pull/6067


   ## Description
   For SQL queries, when converting from `PinotQuery` to `BrokerRequest`, the string literal in the aggregation function is treated as identifier, which can cause problem for certain queries such as `select idset(A, 'fpp=0.05') from mytable` where 'fpp=0.05' cannot be parsed as an identifier.
   This PR fixed the behavior by always quoting the literals within the expression (same as the behavior for `TransformExpressionTree.toString()`).
   Pinot has legacy behavior on PQL parsing where string literal is treated as identifier, but if the query is parsed via SQL parser, we should preserve the literals within the query.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] Jackie-Jiang commented on pull request #6067: Always quote literal when converting from PinotQuery to BrokerRequest

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on pull request #6067:
URL: https://github.com/apache/incubator-pinot/pull/6067#issuecomment-700373385


   @siddharthteotia Good question! This legacy behavior only applies to aggregation function, and the query example you give is transform function, where PQL has the same behavior as SQL.
   The affected functions are the aggregation function with literal parameters, such as `idSet`, `distinctCountThetaSketch`. There are only a few of them.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] siddharthteotia edited a comment on pull request #6067: Always quote literal when converting from PinotQuery to BrokerRequest

Posted by GitBox <gi...@apache.org>.
siddharthteotia edited a comment on pull request #6067:
URL: https://github.com/apache/incubator-pinot/pull/6067#issuecomment-700365888


   So this has been a known issue with SQL where the SQL compiler expects the string literals to be single-quoted as opposed to double quoted since it treats the latter as identifiers. How was this working all this while if the PinotQuery to BrokerRequest conversion wasn't doing the right thing?
   
   Is it only happening for transform/agg functions which can take string literals as arguments? Few weeks ago, I ran the following query in SQL  and it was worked fine:
   
   `"select TIMECONVERT(\"timestamp\", 'MILLISECONDS', 'SECONDS'), count(*) from foo group by TIMECONVERT(\"timestamp\", 'MILLISECONDS', 'SECONDS')"`
   
   The function is taking string arguments in single quotes (as needed by SQL) and query runs fine. Changing 'MILLISECONDS' to "MILLISECONDS" will fail because it will become an identifier. So, how come it is working for other functions and not for `idset(A, 'fpp=0.05')`?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] Jackie-Jiang closed pull request #6067: Always quote literal when converting from PinotQuery to BrokerRequest

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang closed pull request #6067:
URL: https://github.com/apache/incubator-pinot/pull/6067


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] siddharthteotia commented on pull request #6067: Always quote literal when converting from PinotQuery to BrokerRequest

Posted by GitBox <gi...@apache.org>.
siddharthteotia commented on pull request #6067:
URL: https://github.com/apache/incubator-pinot/pull/6067#issuecomment-700365888


   So this has been a known issue with SQL where the SQL compiler expects the string literals to be single-quoted as opposed to double quoted since it treats the latter as identifiers. How was this working all this while if the PinotQuery to BrokerRequest conversion wasn't doing the right thing?
   
   Is it only happening for transform/agg functions which can take string literals as arguments? Few weeks ago, I ran the following query in SQL  and it was worked fine:
   
   `"select TIMECONVERT(\"timestamp\", 'MILLISECONDS', 'SECONDS'), count(*) from foo group by TIMECONVERT(\"timestamp\", 'MILLISECONDS', 'SECONDS')"`
   
   The function is taking string arguments in single quotes (as needed by SQL) and query runs fine. Changing 'MILLISECONDS' to "MILLISECONDS" will fail because it will become an identifier. So, how come it is working for other functions and not for `idset(A, 'fpp=0.05')`


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] Jackie-Jiang commented on pull request #6067: Always quote literal when converting from PinotQuery to BrokerRequest

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on pull request #6067:
URL: https://github.com/apache/incubator-pinot/pull/6067#issuecomment-700440542


   Closing this PR because seems this will cause more inconsistency between SQL and PQL


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org