[ https://issues.apache.org/jira/browse/SOLR-8593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15664576#comment-15664576 ]
Julian Hyde commented on SOLR-8593: ----------------------------------- Regarding the alias for "count(*)". I guess one approach is to extend Calcite to allow a pluggable alias derivation (it has to be pluggable because you can't please everyone). Another approach is to leave the aliases as they are but generate field names for the JSON result set. Note that if you call SqlNode.getParserPosition() on each item in the select clause it will tell you the start and end point of that expression in the original SQL string, so you can extract the "count(*)" using that information. I don't think the the following should be valid, but under your proposed change it would be: {code} SELECT deptno FROM ( SELECT deptno, count(\*) FROM emp GROUP BY deptno) AS t WHERE t."count(*)" > 3 {code} Note that "count(\*)" is not an expression; it is a reference to a "column" produced by the sub-query. In my opinion, using a textual expression is very confusing, and we should not do it. Derived alias of {{count(\*)}} should be something not easily guessable, which will encourage users to use an alias: {code} SELECT deptno FROM ( SELECT deptno, count(\*) AS c FROM emp GROUP BY deptno) AS t WHERE t.c > 3 {code} > Integrate Apache Calcite into the SQLHandler > -------------------------------------------- > > Key: SOLR-8593 > URL: https://issues.apache.org/jira/browse/SOLR-8593 > Project: Solr > Issue Type: Improvement > Reporter: Joel Bernstein > Assignee: Joel Bernstein > Attachments: SOLR-8593.patch > > > The Presto SQL Parser was perfect for phase one of the SQLHandler. It was > nicely split off from the larger Presto project and it did everything that > was needed for the initial implementation. > Phase two of the SQL work though will require an optimizer. Here is where > Apache Calcite comes into play. It has a battle tested cost based optimizer > and has been integrated into Apache Drill and Hive. > This work can begin in trunk following the 6.0 release. The final query plans > will continue to be translated to Streaming API objects (TupleStreams), so > continued work on the JDBC driver should plug in nicely with the Calcite work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org