[jira] [Created] (CALCITE-6911) SqlItemOperator.inferReturnType throws AssertionError for out of bounds accesses

2025-03-25 Thread Mihai Budiu (Jira)
Mihai Budiu created CALCITE-6911:


 Summary: SqlItemOperator.inferReturnType throws AssertionError for 
out of bounds accesses
 Key: CALCITE-6911
 URL: https://issues.apache.org/jira/browse/CALCITE-6911
 Project: Calcite
  Issue Type: Bug
  Components: core
Affects Versions: 1.39.0
Reporter: Mihai Budiu


Clearly, AssertionError is the wrong error to report for something that is a 
normal validation error.

Example: 

{code:sql}
select x[2] from (select ROW(1) as x)
{code}

Stack trace:
{code}
at 
org.apache.calcite.sql.fun.SqlItemOperator.inferReturnType(SqlItemOperator.java:179)
at 
org.apache.calcite.sql.SqlOperator.validateOperands(SqlOperator.java:531)
at org.apache.calcite.sql.SqlOperator.deriveType(SqlOperator.java:630)
at 
org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:7092)
at 
org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:7079)
at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:168)
at 
org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:2028)
at 
org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:2015)
at 
org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectItem(SqlValidatorImpl.java:507)
at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelectList(SqlValidatorImpl.java:5140)
at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:4134)
at 
org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:62)
at 
org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:96)
at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1208)
at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:1179)
at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:282)
at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:1145)
at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:851)
at 
org.apache.calcite.sql.test.AbstractSqlTester.assertExceptionIsThrown(AbstractSqlTester.java:106)
at 
org.apache.calcite.test.SqlValidatorFixture.fails(SqlValidatorFixture.java:202)

{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Created] (CALCITE-6912) Confusion around typing of byte[] versus ByteString in Enumerable code

2025-03-25 Thread Chris Dennis (Jira)
Chris Dennis created CALCITE-6912:
-

 Summary: Confusion around typing of byte[] versus ByteString in 
Enumerable code
 Key: CALCITE-6912
 URL: https://issues.apache.org/jira/browse/CALCITE-6912
 Project: Calcite
  Issue Type: Bug
  Components: avatica, core
Affects Versions: 1.35.0, 1.40.0
Reporter: Chris Dennis


The Enumerable convention code generation seems to be at odds with both Avatica 
and at other times with itself when trying to handle {{byte[]}} field types. 
This leads to a variety of failure either at during code generation, or at 
query execution time. I will push an example of a failing query in PR shortly 
after filing this... but I suspect most any query that attempts to project a 
byte[] typed column has a good chance of tripping over itself.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)