Using Apache Calcite, I’m trying to generate SQL Server conformant string concatenation, but the result always uses the default “||” operator. I’ve outlined what I’m trying to do below and am wondering if I’m going about this incorrectly.
I’m creating the RexNode with the CONCAT operator:
RexNode concatCall = rexBuilder.makeCall(SqlStdOperatorTable.CONCAT, leftStr, rightStr);
However, when generating the SQL it results in the “||” operator which is invalid for SQL Server:
... leftStr || rightStr ..., etc.
instead of
... leftStr + rightStr ..., etc.
I have the dialect set to MS SQL and stepping through the code I can see the MssqlSqlDialect is set. However, I don’t really even see any place within Calcite that this operator would even be translated to “+”, so I’m wondering if I’m even approaching this problem in the correct way.