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 2021/11/02 23:09:35 UTC

[GitHub] [pinot] xiangfu0 commented on pull request #7678: Fixing DISTINCT with AS function

xiangfu0 commented on pull request #7678:
URL: https://github.com/apache/pinot/pull/7678#issuecomment-958368030


   > I don't think we should introduce `AS` as a transform function. The fix should be purely on the query rewrite.
   > 
   > `select CAST(runs AS string) as ddd from baseballStats GROUP BY 1` should be rewritten to `select DISTINCT(CAST(runs AS string)) as ddd from baseballStats` instead of `select DISTINCT(CAST(runs AS string) as ddd) from baseballStats`. Notice the place of `as ddd`.
   > 
   > In fact, `select DISTINCT(CAST(runs AS string) as ddd) from baseballStats` is not a valid SQL query
   
   True, I think the tricky case here is that distinct can have multiple arguments, e.g. 
   ```
   select CAST(runs AS string) as a, CAST(num AS int) as b from baseballStats GROUP BY 1, 2
   ```
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

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