danny0405 commented on a change in pull request #1216: [CALCITE-3072] Generate
right SQL for FLOOR&SUBSTRING functions in SparkSqlDialect
URL: https://github.com/apache/calcite/pull/1216#discussion_r285165919
##########
File path:
core/src/main/java/org/apache/calcite/sql/dialect/SparkSqlDialect.java
##########
@@ -55,6 +70,32 @@ public SparkSqlDialect(SqlDialect.Context context) {
SqlNode fetch) {
unparseFetchUsingLimit(writer, offset, fetch);
}
+
+ @Override public void unparseCall(SqlWriter writer, SqlCall call,
+ int leftPrec, int rightPrec) {
+ if (call.getOperator() == SqlStdOperatorTable.SUBSTRING) {
+ SqlUtil.unparseFunctionSyntax(SPARKSQL_SUBSTRING, writer, call);
+ } else {
+ switch (call.getKind()) {
+ case FLOOR:
+ if (call.operandCount() != 2) {
+ super.unparseCall(writer, call, leftPrec, rightPrec);
Review comment:
Cause your logic has call operands as `!=2` and `=2`, we need to add test
cases for them separately.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services