[jira] [Commented] (CALCITE-3477) Decimal type should not be assigned from other types

2019-12-04 Thread Julian Hyde (Jira)


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

Julian Hyde commented on CALCITE-3477:
--

Please fix the summary of this Jira case. I don't agree that "Decimal type 
should not be assigned from other types" and I don't think the SQL standard 
agrees with it either.

> Decimal type should not be assigned from other types
> 
>
> Key: CALCITE-3477
> URL: https://issues.apache.org/jira/browse/CALCITE-3477
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: Kirils Mensikovs
>Assignee: Feng Zhu
>Priority: Major
>  Labels: geospatial, pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)


[jira] [Commented] (CALCITE-3477) Decimal type should not be assigned from other types

2019-11-21 Thread Danny Chen (Jira)


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

Danny Chen commented on CALCITE-3477:
-

Thanks [~donnyzone], i still think it is very about how each engine implements 
it for the DECIMAL assigned to other numeric data types. I didn‘ find any 
evidence that a decimal cannot assign to other numeric types, so i'm inclined 
to solve this problem in the query execution.

In Apache Flink, we did allow the decimal to int when we generate the code, it 
is not that hacky, because only the decimals need to handle specifically.

> Decimal type should not be assigned from other types
> 
>
> Key: CALCITE-3477
> URL: https://issues.apache.org/jira/browse/CALCITE-3477
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: Kirils Mensikovs
>Assignee: Feng Zhu
>Priority: Major
>  Labels: geospatial, pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)


[jira] [Commented] (CALCITE-3477) Decimal type should not be assigned from other types

2019-11-20 Thread Feng Zhu (Jira)


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

Feng Zhu commented on CALCITE-3477:
---

If we fix in the runtime, we need to check parameter types again and add Cast 
in codegen, resulting an inconsistency with RexNode.

> Decimal type should not be assigned from other types
> 
>
> Key: CALCITE-3477
> URL: https://issues.apache.org/jira/browse/CALCITE-3477
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: Kirils Mensikovs
>Assignee: Feng Zhu
>Priority: Major
>  Labels: geospatial, pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)


[jira] [Commented] (CALCITE-3477) Decimal type should not be assigned from other types

2019-11-20 Thread Feng Zhu (Jira)


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

Feng Zhu commented on CALCITE-3477:
---

[~danny0405] Yes, the cast beheavior is expected in validation and it works 
well for other type pairs.

For example (String->BigDecimal): *ST_MakePoint('1.0', '1.1')* will be 
transformed as *ST_MakePoint(cast('1.0' as Decimal), cast('1.1' as Decimal))*

But Decimal type is an exceptional case. because *SqlTypeAssignmentRules* think 
Decimal can be directly assigned from _int/long/..._ types without adding any 
cast operations.

Consequently, {{ST_MAKEPOINT(1.0, 1) {color:#FF}fails to{color} become 
}}{{ST_MAKEPOINT(1.0, cast(1 as Decimal))}}{{}}

> Decimal type should not be assigned from other types
> 
>
> Key: CALCITE-3477
> URL: https://issues.apache.org/jira/browse/CALCITE-3477
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: Kirils Mensikovs
>Assignee: Feng Zhu
>Priority: Major
>  Labels: geospatial, pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)


[jira] [Commented] (CALCITE-3477) Decimal type should not be assigned from other types

2019-11-19 Thread Danny Chen (Jira)


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

Danny Chen commented on CALCITE-3477:
-

{quote}parameter type cast happens in validation phase

Do you mean the implicit type coercion wrapped the arguments with Casts ? This 
is an expected behavior, what we need to fix is the code generation where the 
Cast node(with DECIMAL type) was assigned to other data type.

> Decimal type should not be assigned from other types
> 
>
> Key: CALCITE-3477
> URL: https://issues.apache.org/jira/browse/CALCITE-3477
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: Kirils Mensikovs
>Assignee: Feng Zhu
>Priority: Major
>  Labels: geospatial, pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)


[jira] [Commented] (CALCITE-3477) Decimal type should not be assigned from other types

2019-11-18 Thread Feng Zhu (Jira)


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

Feng Zhu commented on CALCITE-3477:
---

[~danny0405] Unfortunately, parameter type cast happens in validation phase.  I 
do not have good idea on how to cope with it in runtime. Because it will result 
duplicate logic.

> Decimal type should not be assigned from other types
> 
>
> Key: CALCITE-3477
> URL: https://issues.apache.org/jira/browse/CALCITE-3477
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: Kirils Mensikovs
>Assignee: Feng Zhu
>Priority: Major
>  Labels: geospatial, pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)


[jira] [Commented] (CALCITE-3477) Decimal type should not be assigned from other types

2019-11-18 Thread Danny Chen (Jira)


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

Danny Chen commented on CALCITE-3477:
-

Can we just fix the code generation ?

> Decimal type should not be assigned from other types
> 
>
> Key: CALCITE-3477
> URL: https://issues.apache.org/jira/browse/CALCITE-3477
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: Kirils Mensikovs
>Assignee: Feng Zhu
>Priority: Major
>  Labels: geospatial, pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)


[jira] [Commented] (CALCITE-3477) Decimal type should not be assigned from other types

2019-11-17 Thread Feng Zhu (Jira)


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

Feng Zhu commented on CALCITE-3477:
---

Hi [~julianhyde], [~amaliujia], thanks for your feedback. 

Well, I agree that decimal type can be *logically* assigned/cast to other types 
or from other types.

I also think it is reasonable for the rules in *SqlTypeAssignmentRules,* which 
collects type pairs that we do not need to do anything for casting.

However, in Java's implementation, we still need to do some work (e.g., 
_BigDecimal.valueOf(...)_, new _BigDeciaml(...)_) for the Decimal type 
explicitly.

Therefore, current PR removes these rules to trigger the type cast.

Any good idea to make up this gap?

 

> Decimal type should not be assigned from other types
> 
>
> Key: CALCITE-3477
> URL: https://issues.apache.org/jira/browse/CALCITE-3477
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: Kirils Mensikovs
>Assignee: Feng Zhu
>Priority: Major
>  Labels: geospatial, pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)


[jira] [Commented] (CALCITE-3477) Decimal type should not be assigned from other types

2019-11-15 Thread Rui Wang (Jira)


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

Rui Wang commented on CALCITE-3477:
---

at least based on the implicit type cast design, these types are allowed to 
cast to decimal. See: 
https://docs.google.com/document/d/1g2RUnLXyp_LjUlO-wbblKuP5hqEu3a_2Mt2k4dh6RwU/edit

> Decimal type should not be assigned from other types
> 
>
> Key: CALCITE-3477
> URL: https://issues.apache.org/jira/browse/CALCITE-3477
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: Kirils Mensikovs
>Assignee: Feng Zhu
>Priority: Major
>  Labels: geospatial, pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)


[jira] [Commented] (CALCITE-3477) Decimal type should not be assigned from other types

2019-11-14 Thread Julian Hyde (Jira)


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

Julian Hyde commented on CALCITE-3477:
--

What does the SQL standard say? Is it illegal to assign say {{DECIMAL(4, 0)}} 
to {{INTEGER}}? I suspect not.

> Decimal type should not be assigned from other types
> 
>
> Key: CALCITE-3477
> URL: https://issues.apache.org/jira/browse/CALCITE-3477
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: Kirils Mensikovs
>Assignee: Feng Zhu
>Priority: Major
>  Labels: geospatial, pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)