jhugomoore commented on code in PR #3184:
URL: https://github.com/apache/calcite/pull/3184#discussion_r1181870690
##########
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()) {
Review Comment:
As far as my understanding, this 4 argument position function doesn't exist
outside of calcite. I was basically left with the choice of adding another
keyword in the function (would get confusing and doesn't have a clear best
identifier), or to just default to comma separated operands (introduces
inconsistent syntax in calcite which isn't ideal), wasn't sure the best choice.
Let me know if you think I should switch it over.
--
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]