[ 
https://issues.apache.org/jira/browse/CALCITE-2623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16655593#comment-16655593
 ] 

Julian Hyde commented on CALCITE-2623:
--------------------------------------

bq. My Understanding is that all instances of SqlOperator being used while 
building a RelNode should come from SqlStdOperatorTable

That's not true. When converting SQL to RelNode and RexNode, then 
SqlStdOperatorTable is convenient because it contains all of the standard 
operators. But if you are creating RexNode manually, you are welcome to use 
other operators. Even operators that are created on the fly and not stored in 
any table.

So, for example, looking at your PR, if you really want an infix "%" operator, 
you can just create one. It will handle its own un-parsing, so you won't need 
to add any special-case code to BigQueryDialect.

Review comment:
* BigQuery has a MOD operator. Why are you adding "%"?
* In standard SQL, UNION accepts either ALL or DISTINCT. DISTINCT is the 
default, so people tend to write "UNION" rather than "UNION DISTINCT", even if 
they mean the same thing. I'm not sure why you add it BigQuery. Does BigQuery 
not support UNION without DISTINCT?
* Let's not switch on operator name. Switch on operator.getKind() if possible. 
Better, if you need to use an operator with a non-standard syntax for a 
particular dialect, introduce it during RelToSql conversion, and let it unparse 
itself. That's usually better than modifying the dialect.
* Why did you break the line in "testSelectQueryWithLimitClause"?
* Rather than "sql(query).dialect(HiveSqlDialect.DEFAULT)" use 
"sql(query).withHive()". Similarly withBigQuery.

> Updating unparseCall() in SqlDialect(s) for dialect specifc SqlNode unparsing
> -----------------------------------------------------------------------------
>
>                 Key: CALCITE-2623
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2623
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: KrishnaKant Agrawal
>            Assignee: Julian Hyde
>            Priority: Minor
>
> Owing to the syntactical differences between Calcite SQL and certain other 
> Dialects, emulation for SqlNode unparsing needs to be added based on the 
> Dialect in RelToSqlConcverter.
> Saw some code in PostgreSqlDialect which is already doing this.
> Changes in other Dialects can follow suit.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to