[ 
https://issues.apache.org/jira/browse/CALCITE-3477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kirils Mensikovs updated CALCITE-3477:
--------------------------------------
    Description: 
Geospatial function with integer parameter fails. The expected behavior is to 
cast automatically all number values to BigDecimal.

{{Example: 'select  ST_MAKEPOINT(1.0, 1)'}}

Return:
{code:java}
Error: Error while executing SQL "select  ST_MAKEPOINT(1.0, 1)": Error while 
compiling generated Java code:
public org.apache.calcite.linq4j.Enumerable bind(final 
org.apache.calcite.DataContext root) {
  final org.apache.calcite.linq4j.Enumerable _inputEnumerable = 
org.apache.calcite.linq4j.Linq4j.asEnumerable(new Integer[] {
    0});
  return new org.apache.calcite.linq4j.AbstractEnumerable(){
      public org.apache.calcite.linq4j.Enumerator enumerator() {
        return new org.apache.calcite.linq4j.Enumerator(){
            public final org.apache.calcite.linq4j.Enumerator inputEnumerator = 
_inputEnumerable.enumerator();
            public void reset() {
              inputEnumerator.reset();
            }


            public boolean moveNext() {
              return inputEnumerator.moveNext();
            }


            public void close() {
              inputEnumerator.close();
            }


            public Object current() {
              final java.math.BigDecimal v = 
$L4J$C$new_java_math_BigDecimal_1_0_;
              return org.apache.calcite.runtime.GeoFunctions.ST_MakePoint(v, 1);
            }


            static final java.math.BigDecimal 
$L4J$C$new_java_math_BigDecimal_1_0_ = new java.math.BigDecimal(
              "1.0");
          };
      }


    };
}




public Class getElementType() {
  return org.apache.calcite.runtime.GeoFunctions.Geom.class;
} (state=,code=0)
{code}
 

  was:
Geospatial function with integer parameter fails. The expected behavior is to 
cast automatically all number values to BigDecimal.

{{Example: select  ST_MAKEPOINT(1.0, 1)}}

Return:
{{ Error: Error while executing SQL "select  ST_MAKEPOINT(1.0, 1)": Error while 
compiling generated Java code:}}{{public org.apache.calcite.linq4j.Enumerable 
bind(final org.apache.calcite.DataContext root) {}}{{  final 
org.apache.calcite.linq4j.Enumerable _inputEnumerable = 
org.apache.calcite.linq4j.Linq4j.asEnumerable(new Integer[]}}{{{     
0}}}{{);}}{{  return new org.apache.calcite.linq4j.AbstractEnumerable(){}}{{    
  public org.apache.calcite.linq4j.Enumerator enumerator() {}}{{        return 
new org.apache.calcite.linq4j.Enumerator(){}}{{            public final 
org.apache.calcite.linq4j.Enumerator inputEnumerator = 
_inputEnumerable.enumerator();}}{{            public void reset()}}{{{          
     inputEnumerator.reset();             }}}{{ }}{{            public boolean 
moveNext()}}{{{               return inputEnumerator.moveNext();             
}}}{{ }}{{            public void close()}}{{{               
inputEnumerator.close();             }}}{{ }}{{            public Object 
current()}}{{{               final java.math.BigDecimal v = 
$L4J$C$new_java_math_BigDecimal_1_0_;               return 
org.apache.calcite.runtime.GeoFunctions.ST_MakePoint(v, 1);             }}}{{ 
}}{{            static final java.math.BigDecimal 
$L4J$C$new_java_math_BigDecimal_1_0_ = new java.math.BigDecimal(}}{{            
  "1.0");}}{{          };}}{{      }}}{{ }}{{    };}}{{}}}{{ }}{{ }}{{public 
Class getElementType()}}{{{   return 
org.apache.calcite.runtime.GeoFunctions.Geom.class; }}}{{(state=,code=0)}}

 


> Geofunction do not support int type as input
> --------------------------------------------
>
>                 Key: CALCITE-3477
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3477
>             Project: Calcite
>          Issue Type: Bug
>          Components: spatial
>            Reporter: Kirils Mensikovs
>            Priority: Minor
>              Labels: geospatial
>
> Geospatial function with integer parameter fails. The expected behavior is to 
> cast automatically all number values to BigDecimal.
> {{Example: 'select  ST_MAKEPOINT(1.0, 1)'}}
> Return:
> {code:java}
> Error: Error while executing SQL "select  ST_MAKEPOINT(1.0, 1)": Error while 
> compiling generated Java code:
> public org.apache.calcite.linq4j.Enumerable bind(final 
> org.apache.calcite.DataContext root) {
>   final org.apache.calcite.linq4j.Enumerable _inputEnumerable = 
> org.apache.calcite.linq4j.Linq4j.asEnumerable(new Integer[] {
>     0});
>   return new org.apache.calcite.linq4j.AbstractEnumerable(){
>       public org.apache.calcite.linq4j.Enumerator enumerator() {
>         return new org.apache.calcite.linq4j.Enumerator(){
>             public final org.apache.calcite.linq4j.Enumerator inputEnumerator 
> = _inputEnumerable.enumerator();
>             public void reset() {
>               inputEnumerator.reset();
>             }
>             public boolean moveNext() {
>               return inputEnumerator.moveNext();
>             }
>             public void close() {
>               inputEnumerator.close();
>             }
>             public Object current() {
>               final java.math.BigDecimal v = 
> $L4J$C$new_java_math_BigDecimal_1_0_;
>               return org.apache.calcite.runtime.GeoFunctions.ST_MakePoint(v, 
> 1);
>             }
>             static final java.math.BigDecimal 
> $L4J$C$new_java_math_BigDecimal_1_0_ = new java.math.BigDecimal(
>               "1.0");
>           };
>       }
>     };
> }
> public Class getElementType() {
>   return org.apache.calcite.runtime.GeoFunctions.Geom.class;
> } (state=,code=0)
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to