wenhuitang commented on a change in pull request #1862: [CALCITE-3864] Add Implementation for SqlLibraryOperators.CONCAT_FUNCTION in SqlFunctions and correct the return type inference of SqlLibraryOperators.CONCAT_FUNCTION URL: https://github.com/apache/calcite/pull/1862#discussion_r397160310
########## File path: core/src/main/java/org/apache/calcite/sql/dialect/MysqlSqlDialect.java ########## @@ -208,12 +212,52 @@ public boolean supportsAliasedValues() { unparseFloor(writer, call); break; - default: + if (call.getOperator() == SqlStdOperatorTable.CONCAT) { + unparseConcat(writer, call); + break; + } super.unparseCall(writer, call, leftPrec, rightPrec); } } + /** + * Unparses String concatenation operator for Mysql, Mysql uses Concat as string concatenation + * operator when PIPES_AS_CONCAT is not enabled. CONCAT concatenation characters are used by + * default. + * + * @param writer writer + * @param call call + */ + private void unparseConcat(SqlWriter writer, SqlCall call) { + List<SqlNode> expandOperandList = new ArrayList<>(); + expandConcatOperands(call, expandOperandList); Review comment: Expand operands for CONCAT, so we can generate CONCAT(`fname`, '_', '_', `lname`) instead of CONCAT(CONCAT(CONCAT(`fname`, '_'), '_'), `lname`) ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services