olivrlee commented on code in PR #3184:
URL: https://github.com/apache/calcite/pull/3184#discussion_r1181853492


##########
core/src/main/java/org/apache/calcite/sql/fun/SqlPositionFunction.java:
##########
@@ -53,12 +57,23 @@ public SqlPositionFunction(String name) {
       int leftPrec,
       int rightPrec) {
     final SqlWriter.Frame frame = writer.startFunCall(getName());
-    call.operand(0).unparse(writer, leftPrec, rightPrec);
-    writer.sep("IN");
-    call.operand(1).unparse(writer, leftPrec, rightPrec);
-    if (3 == call.operandCount()) {
-      writer.sep("FROM");
+    if (2 == call.operandCount() || 3 == call.operandCount()) {

Review Comment:
   nit: switch the ordering like `call.operandCount() == 2`



##########
core/src/main/java/org/apache/calcite/sql/fun/SqlPositionFunction.java:
##########
@@ -53,12 +57,23 @@ public SqlPositionFunction(String name) {
       int leftPrec,
       int rightPrec) {
     final SqlWriter.Frame frame = writer.startFunCall(getName());
-    call.operand(0).unparse(writer, leftPrec, rightPrec);
-    writer.sep("IN");
-    call.operand(1).unparse(writer, leftPrec, rightPrec);
-    if (3 == call.operandCount()) {
-      writer.sep("FROM");
+    if (2 == call.operandCount() || 3 == call.operandCount()) {
+      call.operand(0).unparse(writer, leftPrec, rightPrec);
+      writer.sep("IN");
+      call.operand(1).unparse(writer, leftPrec, rightPrec);
+      if (3 == call.operandCount()) {
+        writer.sep("FROM");
+        call.operand(2).unparse(writer, leftPrec, rightPrec);
+      }
+    }
+    if (4 == call.operandCount()) {
+      call.operand(0).unparse(writer, leftPrec, rightPrec);
+      writer.sep(",");
+      call.operand(1).unparse(writer, leftPrec, rightPrec);
+      writer.sep(",");

Review Comment:
   nit: switch the ordering like `call.operandCount() == 2`



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to