mihaibudiu commented on code in PR #3423:
URL: https://github.com/apache/calcite/pull/3423#discussion_r1326342169
##########
core/src/main/java/org/apache/calcite/sql/fun/SqlItemOperator.java:
##########
@@ -78,7 +78,13 @@ public SqlItemOperator(String name,
SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
call.operand(0).unparse(writer, leftPrec, 0);
final SqlWriter.Frame frame = writer.startList("[", "]");
- call.operand(1).unparse(writer, 0, 0);
+ if (offset == 0) {
Review Comment:
In other words, should the following test pass?
```java
@Test void testOffset() {
sql("SELECT ARRAY[2,4,6][2]")
.ok("SELECT (ARRAY[2, 4, 6])[SAFE_ORDINAL(2)]");
sql("SELECT ARRAY[2,4,6][OFFSET(2)]")
.ok("SELECT (ARRAY[2, 4, 6])[OFFSET(2)]");
sql("SELECT ARRAY[2,4,6][SAFE_OFFSET(2)]")
.ok("SELECT (ARRAY[2, 4, 6])[SAFE_OFFSET(2)]");
sql("SELECT ARRAY[2,4,6][SAFE_ORDINAL(2)]")
.ok("SELECT (ARRAY[2, 4, 6])[SAFE_ORDINAL(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]