[
https://issues.apache.org/jira/browse/CALCITE-5331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rish K updated CALCITE-5331:
----------------------------
Description:
I'm using Apache Beam and Calcite and have a UDF such as:
{code:java}
public static String eval(@Parameter(name = "obj") Object obj,
@Parameter(name = "isSigned", optional = true)
Boolean isSigned) {
String hex = null;
if (obj instanceof Float) {
hex = Float.toHexString((Float) obj);
} else if (obj instanceof Double) {
hex = Double.toHexString((Double) obj);
}
return hex;
} {code}
In Calcite 1.20, the above code works totally fine.
After the calcite upgrade to 1.31, we are coming across the error:
{code:java}
java.lang.AssertionError: ANY at
org.apache.beam.vendor.calcite.v1_31_0.org.apache.calcite.sql.type.SqlTypeExplicitPrecedenceList.compareTypePrecedence(SqlTypeExplicitPrecedenceList.java:141)
{code}
+*Observation:*+
It seems like "Object" is not being recognized as the new calcite version has
strict type requirements.
This change has been introduced as part of the
https://issues.apache.org/jira/browse/CALCITE-2082
cc: [~julianhyde]
The main change impacting us is in SqlFunction.java:
Calcite 1.20 code:
{code:java}
SqlFunction function =
(SqlFunction)SqlUtil.lookupRoutine(validator.getOperatorTable(),
this.getNameAsId(), argTypes, argNames, this.getFunctionType(),
SqlSyntax.FUNCTION, this.getKind(),
validator.getCatalogReader().nameMatcher()); {code}
Calcite 1.31 code:
{code:java}
Object function =
(SqlFunction)SqlUtil.lookupRoutine(validator.getOperatorTable(),
validator.getTypeFactory(), this.getNameAsId(), argTypes, argNames,
this.getFunctionType(), SqlSyntax.FUNCTION, this.getKind(),
validator.getCatalogReader().nameMatcher(), false); {code}
Any idea what can be done to fix this?
was:
I'm using Apache Beam and Calcite and have a UDF such as:
{code:java}
public static String eval(@Parameter(name = "obj") Object obj,
@Parameter(name = "isSigned", optional = true)
Boolean isSigned) {
String hex = null;
if (obj instanceof Float) {
hex = Float.toHexString((Float) obj);
} else if (obj instanceof Double) {
hex = Double.toHexString((Double) obj);
}
return hex;
} {code}
In Calcite 1.20, the above code works totally fine.
After the calcite upgrade to 1.31, we are coming across the error:
{code:java}
java.lang.AssertionError: ANY at
org.apache.beam.vendor.calcite.v1_31_0.org.apache.calcite.sql.type.SqlTypeExplicitPrecedenceList.compareTypePrecedence(SqlTypeExplicitPrecedenceList.java:141)
{code}
+*Observation:*+
It seems like "Object" is not being recognized as the new calcite version has
strict type requirements.
This change has been introduced as part of the
https://issues.apache.org/jira/browse/CALCITE-2082
cc: [~julianhyde]
The main change impacting us is in SqlFunction.java:
Calcite 1.20 code:
{code:java}
SqlFunction function =
(SqlFunction)SqlUtil.lookupRoutine(validator.getOperatorTable(),
this.getNameAsId(), argTypes, argNames, this.getFunctionType(),
SqlSyntax.FUNCTION, this.getKind(),
validator.getCatalogReader().nameMatcher()); {code}
Calcite 1.31 code:
{code:java}
Object function =
(SqlFunction)SqlUtil.lookupRoutine(validator.getOperatorTable(),
validator.getTypeFactory(), this.getNameAsId(), argTypes, argNames,
this.getFunctionType(), SqlSyntax.FUNCTION, this.getKind(),
validator.getCatalogReader().nameMatcher(), false); {code}
Any idea what can be done to fix this?
> On using UDF, seeing java.lang.AssertionError: ANY
> ---------------------------------------------------
>
> Key: CALCITE-5331
> URL: https://issues.apache.org/jira/browse/CALCITE-5331
> Project: Calcite
> Issue Type: Bug
> Components: core, extensions
> Affects Versions: 1.31.0
> Reporter: Rish K
> Priority: Major
>
> I'm using Apache Beam and Calcite and have a UDF such as:
> {code:java}
> public static String eval(@Parameter(name = "obj") Object obj,
> @Parameter(name = "isSigned", optional = true)
> Boolean isSigned) {
> String hex = null;
> if (obj instanceof Float) {
> hex = Float.toHexString((Float) obj);
> } else if (obj instanceof Double) {
> hex = Double.toHexString((Double) obj);
> }
>
> return hex;
> } {code}
>
> In Calcite 1.20, the above code works totally fine.
> After the calcite upgrade to 1.31, we are coming across the error:
> {code:java}
> java.lang.AssertionError: ANY at
> org.apache.beam.vendor.calcite.v1_31_0.org.apache.calcite.sql.type.SqlTypeExplicitPrecedenceList.compareTypePrecedence(SqlTypeExplicitPrecedenceList.java:141)
> {code}
>
> +*Observation:*+
> It seems like "Object" is not being recognized as the new calcite version has
> strict type requirements.
> This change has been introduced as part of the
> https://issues.apache.org/jira/browse/CALCITE-2082
> cc: [~julianhyde]
>
> The main change impacting us is in SqlFunction.java:
> Calcite 1.20 code:
> {code:java}
> SqlFunction function =
> (SqlFunction)SqlUtil.lookupRoutine(validator.getOperatorTable(),
> this.getNameAsId(), argTypes, argNames, this.getFunctionType(),
> SqlSyntax.FUNCTION, this.getKind(),
> validator.getCatalogReader().nameMatcher()); {code}
> Calcite 1.31 code:
> {code:java}
> Object function =
> (SqlFunction)SqlUtil.lookupRoutine(validator.getOperatorTable(),
> validator.getTypeFactory(), this.getNameAsId(), argTypes, argNames,
> this.getFunctionType(), SqlSyntax.FUNCTION, this.getKind(),
> validator.getCatalogReader().nameMatcher(), false); {code}
>
> Any idea what can be done to fix this?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)