Details
-
Sub-task
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
Type is assignable conceptually, but in the runtime phase, explicite cast is still required.
For example, according to SqlTypeAssignmentRules, ST_MakePoint(Decimal, Decimal) also accepts operands with (Integer, Decimal) types, because Decimal is assignable from Integer.
@Test public void test1() { final String sql = "SELECT ST_MakePoint(1, 2.1)"; CalciteAssert.that() .with(CalciteAssert.Config.GEO) .query(sql) .returns("EXPR$0={\"x\":1,\"y\":2.1}\n"); }
We will get:
org.codehaus.commons.compiler.CompileException: Line 22, Column 124: No applicable constructor/method found for actual parameters "int, java.math.BigDecimal"; candidates are: "public static org.apache.calcite.runtime.GeoFunctions$Geom org.apache.calcite.runtime.GeoFunctions.ST_MakePoint(java.math.BigDecimal, java.math.BigDecimal, java.math.BigDecimal)", "public static org.apache.calcite.runtime.GeoFunctions$Geom org.apache.calcite.runtime.GeoFunctions.ST_MakePoint(java.math.BigDecimal, java.math.BigDecimal)" at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:12211) at org.codehaus.janino.UnitCompiler.findMostSpecificIInvocable(UnitCompiler.java:9263) at org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java:9123) at org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java:9025) at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5062) at org.codehaus.janino.UnitCompiler.access$9100(UnitCompiler.java:215)
Attachments
Issue Links
- blocks
-
CALCITE-3477 Geospatial function (ST_MakePoint) with integer parameter fails
- Closed
- links to