Jackie-Jiang commented on pull request #7678:
URL: https://github.com/apache/pinot/pull/7678#issuecomment-958650890


   > > > > 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
   > > > ```
   > > 
   > > 
   > > For this query, can we rewrite it to `select CAST(runs AS string) as a, 
CAST(num AS int) as b, DISTINCT(a, b) from baseballStats`? This way it is still 
valid SQL
   > 
   > I think this query `select CAST(runs AS string) as a, CAST(num AS int) as 
b, DISTINCT(a, b) from baseballStats` actually changes the number of output 
columns?
   
   This should have the same behavior as `SELECT C1 AS ALIAS_C1, C2 AS 
ALIAS_C2, ADD(alias_c1, alias_c2) FROM Foo` which you just fixed in #7590. I 
think the alias part will be ignored


-- 
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-unsubscr...@pinot.apache.org

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



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

Reply via email to