[jira] [Updated] (CALCITE-6077) Add FACTORIAL function (enabled in Hive and Spark libraries)

2023-10-27 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot updated CALCITE-6077:

Labels: pull-request-available  (was: )

> Add FACTORIAL function (enabled in Hive and Spark libraries)
> 
>
> Key: CALCITE-6077
> URL: https://issues.apache.org/jira/browse/CALCITE-6077
> Project: Calcite
>  Issue Type: New Feature
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Runkang He
>Assignee: Runkang He
>Priority: Major
>  Labels: pull-request-available
>
> Add FACTORIAL function (enabled in Hive and Spark libraries)
> FACTORIAL(expr): Returns the factorial of expr. expr is [0..20]. Otherwise, 
> returns NULL.
> For example:
> {code:sql}
> SELECT factorial(5); 
> >120
> {code}
> See more at 
> [Hive|https://cwiki.apache.org/confluence/display/hive/languagemanual+udf#LanguageManualUDF-MathematicalFunctions]
>  and 
> [Spark|https://spark.apache.org/docs/latest/api/sql/index.html#factorial] doc.



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


[jira] [Updated] (CALCITE-6077) Add FACTORIAL function (enabled in Hive and Spark libraries)

2023-10-27 Thread Runkang He (Jira)


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

Runkang He updated CALCITE-6077:

Description: 
Add FACTORIAL function (enabled in Hive and Spark libraries)
FACTORIAL(expr): Returns the factorial of expr. expr is [0..20]. Otherwise, 
returns NULL.
For example:
{code:sql}
SELECT factorial(5); 
>120
{code}
See more at 
[Hive|https://cwiki.apache.org/confluence/display/hive/languagemanual+udf#LanguageManualUDF-MathematicalFunctions]
 and [Spark|https://spark.apache.org/docs/latest/api/sql/index.html#factorial] 
doc.

  was:
Add FACTORIAL functions (enabled in Hive and Spark library)
FACTORIAL(expr): Returns the factorial of expr. expr is [0..20]. Otherwise, 
returns NULL.
For example:

{code:sql}
SELECT factorial(5); 
>120
{code}

See more at 
[Hive|https://cwiki.apache.org/confluence/display/hive/languagemanual+udf#LanguageManualUDF-MathematicalFunctions]
 and [Spark|https://spark.apache.org/docs/latest/api/sql/index.html#factorial] 
doc.


> Add FACTORIAL function (enabled in Hive and Spark libraries)
> 
>
> Key: CALCITE-6077
> URL: https://issues.apache.org/jira/browse/CALCITE-6077
> Project: Calcite
>  Issue Type: New Feature
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Runkang He
>Assignee: Runkang He
>Priority: Major
>
> Add FACTORIAL function (enabled in Hive and Spark libraries)
> FACTORIAL(expr): Returns the factorial of expr. expr is [0..20]. Otherwise, 
> returns NULL.
> For example:
> {code:sql}
> SELECT factorial(5); 
> >120
> {code}
> See more at 
> [Hive|https://cwiki.apache.org/confluence/display/hive/languagemanual+udf#LanguageManualUDF-MathematicalFunctions]
>  and 
> [Spark|https://spark.apache.org/docs/latest/api/sql/index.html#factorial] doc.



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


[jira] [Updated] (CALCITE-6077) Add FACTORIAL function (enabled in Hive and Spark libraries)

2023-10-27 Thread Runkang He (Jira)


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

Runkang He updated CALCITE-6077:

Summary: Add FACTORIAL function (enabled in Hive and Spark libraries)  
(was: Add FACTORIAL functions (enabled in Hive and Spark library))

> Add FACTORIAL function (enabled in Hive and Spark libraries)
> 
>
> Key: CALCITE-6077
> URL: https://issues.apache.org/jira/browse/CALCITE-6077
> Project: Calcite
>  Issue Type: New Feature
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Runkang He
>Assignee: Runkang He
>Priority: Major
>
> Add FACTORIAL functions (enabled in Hive and Spark library)
> FACTORIAL(expr): Returns the factorial of expr. expr is [0..20]. Otherwise, 
> returns NULL.
> For example:
> {code:sql}
> SELECT factorial(5); 
> >120
> {code}
> See more at 
> [Hive|https://cwiki.apache.org/confluence/display/hive/languagemanual+udf#LanguageManualUDF-MathematicalFunctions]
>  and 
> [Spark|https://spark.apache.org/docs/latest/api/sql/index.html#factorial] doc.



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


[jira] [Updated] (CALCITE-6066) Add HYPOT function (enabled in Spark library)

2023-10-27 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot updated CALCITE-6066:

Labels: pull-request-available  (was: )

> Add HYPOT function (enabled in Spark library)
> -
>
> Key: CALCITE-6066
> URL: https://issues.apache.org/jira/browse/CALCITE-6066
> Project: Calcite
>  Issue Type: New Feature
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Runkang He
>Assignee: Runkang He
>Priority: Major
>  Labels: pull-request-available
>
> Add HYPOT function (enabled in Spark library)
> HYPOT: returns sqrt(x^2+ y^2) without intermediate overflow or underflow. For 
> example:
> {code:sql}
> SELECT hypot(3, 4);
> > 5.0
> {code}
> See more at [Spark 
> |https://spark.apache.org/docs/latest/api/sql/index.html#hypot]doc.
> Note that I have checked there is no function with the same name in 
> MySQL/PostgreSQL/Hive/Oracle.



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


[jira] [Updated] (CALCITE-129) Support recursive WITH queries

2023-10-27 Thread Julian Hyde (Jira)


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

Julian Hyde updated CALCITE-129:

Description: 
Building on CALCITE-128, enable the {{RECURSIVE}} keyword.

This feature allows relations to be computed iteratively. Whereas CALCITE-128 
was mainly a parser/validator change, this feature requires significant changes 
to the planner and runtime.

{noformat}
 Imported from GitHub 
Url: https://github.com/julianhyde/optiq/issues/129
Created by: [julianhyde|https://github.com/julianhyde]
Labels: enhancement, 
Created at: Tue Feb 11 20:29:35 CET 2014
State: open
{noformat}


  was:
Building on https://github.com/julianhyde/optiq/issues/128, enable the 
RECURSIVE keyword.

This feature allows relations to be computed iteratively. Whereas 
([#128|https://github.com/JulianHyde/optiq/issues/128] | 
[FLINK-128|https://issues.apache.org/jira/browse/OPTIQ-128]) was mainly a 
parser/validator change, this feature requires significant changes to the 
planner and runtime.

 Imported from GitHub 
Url: https://github.com/julianhyde/optiq/issues/129
Created by: [julianhyde|https://github.com/julianhyde]
Labels: enhancement, 
Created at: Tue Feb 11 20:29:35 CET 2014
State: open



> Support recursive WITH queries
> --
>
> Key: CALCITE-129
> URL: https://issues.apache.org/jira/browse/CALCITE-129
> Project: Calcite
>  Issue Type: Improvement
>Reporter: GitHub Import
>Assignee: Hanumath Rao Maduri
>Priority: Major
>  Labels: github-import, pull-request-available
> Fix For: 1.36.0
>
>
> Building on CALCITE-128, enable the {{RECURSIVE}} keyword.
> This feature allows relations to be computed iteratively. Whereas CALCITE-128 
> was mainly a parser/validator change, this feature requires significant 
> changes to the planner and runtime.
> {noformat}
>  Imported from GitHub 
> Url: https://github.com/julianhyde/optiq/issues/129
> Created by: [julianhyde|https://github.com/julianhyde]
> Labels: enhancement, 
> Created at: Tue Feb 11 20:29:35 CET 2014
> State: open
> {noformat}



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


[jira] [Updated] (CALCITE-6066) Add HYPOT function (enabled in Spark library)

2023-10-27 Thread Runkang He (Jira)


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

Runkang He updated CALCITE-6066:

Description: 
Add HYPOT function (enabled in Spark library)
HYPOT: returns sqrt(x^2+ y^2) without intermediate overflow or underflow. For 
example:
{code:sql}
SELECT hypot(3, 4);
> 5.0
{code}
See more at [Spark 
|https://spark.apache.org/docs/latest/api/sql/index.html#hypot]doc.
Note that I have checked there is no function with the same name in 
MySQL/PostgreSQL/Hive/Oracle.

  was:
Add HYPOT function (enabled in Spark library)
HYPOT: returns sqrt(x(2 )+ y(2)) without intermediate overflow or underflow. 
For example:
{code:sql}
SELECT hypot(3, 4);
> 5.0
{code}
See more at [Spark 
|https://spark.apache.org/docs/latest/api/sql/index.html#hypot]doc.
Note that I have checked there is no function with the same name in 
MySQL/PostgreSQL/Hive/Oracle.


> Add HYPOT function (enabled in Spark library)
> -
>
> Key: CALCITE-6066
> URL: https://issues.apache.org/jira/browse/CALCITE-6066
> Project: Calcite
>  Issue Type: New Feature
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Runkang He
>Assignee: Runkang He
>Priority: Major
>
> Add HYPOT function (enabled in Spark library)
> HYPOT: returns sqrt(x^2+ y^2) without intermediate overflow or underflow. For 
> example:
> {code:sql}
> SELECT hypot(3, 4);
> > 5.0
> {code}
> See more at [Spark 
> |https://spark.apache.org/docs/latest/api/sql/index.html#hypot]doc.
> Note that I have checked there is no function with the same name in 
> MySQL/PostgreSQL/Hive/Oracle.



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


[jira] [Updated] (CALCITE-6066) Add HYPOT function (enabled in Spark library)

2023-10-27 Thread Runkang He (Jira)


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

Runkang He updated CALCITE-6066:

Description: 
Add HYPOT function (enabled in Spark library)
HYPOT: returns sqrt(x(2 )+ y(2)) without intermediate overflow or underflow. 
For example:
{code:sql}
SELECT hypot(3, 4);
> 5.0
{code}
See more at [Spark 
|https://spark.apache.org/docs/latest/api/sql/index.html#hypot]doc.
Note that I have checked there is no function with the same name in 
MySQL/PostgreSQL/Hive/Oracle.

  was:
Add HYPOT function (enabled in Spark library)
HYPOT: calculates the hypotenuse of a right-angle triangle. For example:
{code:sql}
SELECT hypot(3, 4);
> 5.0
{code}
See more at [Spark 
|https://spark.apache.org/docs/latest/api/sql/index.html#hypot]doc.
Note that I have checked there is no function with the same name in 
MySQL/PostgreSQL/Hive/Oracle.


> Add HYPOT function (enabled in Spark library)
> -
>
> Key: CALCITE-6066
> URL: https://issues.apache.org/jira/browse/CALCITE-6066
> Project: Calcite
>  Issue Type: New Feature
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Runkang He
>Assignee: Runkang He
>Priority: Major
>
> Add HYPOT function (enabled in Spark library)
> HYPOT: returns sqrt(x(2 )+ y(2)) without intermediate overflow or underflow. 
> For example:
> {code:sql}
> SELECT hypot(3, 4);
> > 5.0
> {code}
> See more at [Spark 
> |https://spark.apache.org/docs/latest/api/sql/index.html#hypot]doc.
> Note that I have checked there is no function with the same name in 
> MySQL/PostgreSQL/Hive/Oracle.



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


[jira] [Commented] (CALCITE-6066) Add HYPOT function (enabled in Spark library)

2023-10-27 Thread Runkang He (Jira)


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

Runkang He commented on CALCITE-6066:
-

I have removed the support for Oracle from title after I checked there is such 
function in Oracle 
[documentation|https://docs.oracle.com/cd/B28928_01/server.103/b28925/sqfunc.htm],
 and test fails in Oracle Live SQL Platform.

> Add HYPOT function (enabled in Spark library)
> -
>
> Key: CALCITE-6066
> URL: https://issues.apache.org/jira/browse/CALCITE-6066
> Project: Calcite
>  Issue Type: New Feature
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Runkang He
>Assignee: Runkang He
>Priority: Major
>
> Add HYPOT function (enabled in Spark library)
> HYPOT: calculates the hypotenuse of a right-angle triangle. For example:
> {code:sql}
> SELECT hypot(3, 4);
> > 5.0
> {code}
> See more at [Spark 
> |https://spark.apache.org/docs/latest/api/sql/index.html#hypot]doc.
> Note that I have checked there is no function with the same name in 
> MySQL/PostgreSQL/Hive/Oracle.



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


[jira] [Updated] (CALCITE-6066) Add HYPOT function (enabled in Spark library)

2023-10-27 Thread Runkang He (Jira)


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

Runkang He updated CALCITE-6066:

Description: 
Add HYPOT function (enabled in Spark library)
HYPOT: calculates the hypotenuse of a right-angle triangle. For example:
{code:sql}
SELECT hypot(3, 4);
> 5.0
{code}
See more at [Spark 
|https://spark.apache.org/docs/latest/api/sql/index.html#hypot]doc.
Note that I have checked there is no function with the same name in 
MySQL/PostgreSQL/Hive/Oracle.

  was:
Add HYPOT function (enabled in Spark and Oracle libraries)
HYPOT: calculates the hypotenuse of a right-angle triangle. For example:
{code:sql}
SELECT hypot(3, 4);
> 5.0
{code}
See more at 
[Spark|https://spark.apache.org/docs/latest/api/sql/index.html#hypot] and 
[Oracle|https://docs.oracle.com/en/middleware/fusion-middleware/osa/19.1/using/applying-functions-create-new-column.html#GUID-A6F5689E-6C6D-4FA4-B152-5A5287555C95]
 doc.
Note that I have checked there is no function with the same name in 
MySQL/PostgreSQL/Hive.


> Add HYPOT function (enabled in Spark library)
> -
>
> Key: CALCITE-6066
> URL: https://issues.apache.org/jira/browse/CALCITE-6066
> Project: Calcite
>  Issue Type: New Feature
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Runkang He
>Assignee: Runkang He
>Priority: Major
>
> Add HYPOT function (enabled in Spark library)
> HYPOT: calculates the hypotenuse of a right-angle triangle. For example:
> {code:sql}
> SELECT hypot(3, 4);
> > 5.0
> {code}
> See more at [Spark 
> |https://spark.apache.org/docs/latest/api/sql/index.html#hypot]doc.
> Note that I have checked there is no function with the same name in 
> MySQL/PostgreSQL/Hive/Oracle.



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


[jira] [Comment Edited] (CALCITE-6024) A more efficient implementation of SqlOperatorTable, backed by an immutable multi-map keyed by upper-case operator name

2023-10-27 Thread Julian Hyde (Jira)


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

Julian Hyde edited comment on CALCITE-6024 at 10/28/23 12:12 AM:
-

Fixed in 
[7b9660f1|https://github.com/apache/calcite/commit/7b9660f150e66c544ce8df47015978b39f40e7e4].
 (Thanks for the review, [~libenchao]!)


was (Author: julianhyde):
Fixed in 
[7b9660f1|https://github.com/apache/calcite/commit/7b9660f150e66c544ce8df47015978b39f40e7e4].

> A more efficient implementation of SqlOperatorTable, backed by an immutable 
> multi-map keyed by upper-case operator name
> ---
>
> Key: CALCITE-6024
> URL: https://issues.apache.org/jira/browse/CALCITE-6024
> Project: Calcite
>  Issue Type: Improvement
>Reporter: Julian Hyde
>Assignee: Julian Hyde
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.36.0
>
>
> {{ListSqlOperatorTable}} is inefficient if it contains a large number of 
> operators. It currently examines the operators one by one. 
> {{ReflectiveSqlOperatorTable}} (and its subclass, {{SqlStdOperatorTable}}) 
> builds a map of operators by name (actually two maps, one case-sensitive and 
> one case-insensitive).
> {{ListSqlOperatorTable}} should do the same, at least in its immutable form.



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


[jira] [Updated] (CALCITE-6066) Add HYPOT function (enabled in Spark library)

2023-10-27 Thread Runkang He (Jira)


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

Runkang He updated CALCITE-6066:

Summary: Add HYPOT function (enabled in Spark library)  (was: Add HYPOT 
function (enabled in Spark and Oracle libraries))

> Add HYPOT function (enabled in Spark library)
> -
>
> Key: CALCITE-6066
> URL: https://issues.apache.org/jira/browse/CALCITE-6066
> Project: Calcite
>  Issue Type: New Feature
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Runkang He
>Assignee: Runkang He
>Priority: Major
>
> Add HYPOT function (enabled in Spark and Oracle libraries)
> HYPOT: calculates the hypotenuse of a right-angle triangle. For example:
> {code:sql}
> SELECT hypot(3, 4);
> > 5.0
> {code}
> See more at 
> [Spark|https://spark.apache.org/docs/latest/api/sql/index.html#hypot] and 
> [Oracle|https://docs.oracle.com/en/middleware/fusion-middleware/osa/19.1/using/applying-functions-create-new-column.html#GUID-A6F5689E-6C6D-4FA4-B152-5A5287555C95]
>  doc.
> Note that I have checked there is no function with the same name in 
> MySQL/PostgreSQL/Hive.



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


[jira] [Resolved] (CALCITE-6024) A more efficient implementation of SqlOperatorTable, backed by an immutable multi-map keyed by upper-case operator name

2023-10-27 Thread Julian Hyde (Jira)


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

Julian Hyde resolved CALCITE-6024.
--
Resolution: Fixed

Fixed in 
[7b9660f1|https://github.com/apache/calcite/commit/7b9660f150e66c544ce8df47015978b39f40e7e4].

> A more efficient implementation of SqlOperatorTable, backed by an immutable 
> multi-map keyed by upper-case operator name
> ---
>
> Key: CALCITE-6024
> URL: https://issues.apache.org/jira/browse/CALCITE-6024
> Project: Calcite
>  Issue Type: Improvement
>Reporter: Julian Hyde
>Assignee: Julian Hyde
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.36.0
>
>
> {{ListSqlOperatorTable}} is inefficient if it contains a large number of 
> operators. It currently examines the operators one by one. 
> {{ReflectiveSqlOperatorTable}} (and its subclass, {{SqlStdOperatorTable}}) 
> builds a map of operators by name (actually two maps, one case-sensitive and 
> one case-insensitive).
> {{ListSqlOperatorTable}} should do the same, at least in its immutable form.



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


[jira] [Updated] (CALCITE-6024) A more efficient implementation of SqlOperatorTable, backed by an immutable multi-map keyed by upper-case operator name

2023-10-27 Thread Julian Hyde (Jira)


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

Julian Hyde updated CALCITE-6024:
-
Summary: A more efficient implementation of SqlOperatorTable, backed by an 
immutable multi-map keyed by upper-case operator name  (was: 
ListSqlOperatorTable is inefficient)

> A more efficient implementation of SqlOperatorTable, backed by an immutable 
> multi-map keyed by upper-case operator name
> ---
>
> Key: CALCITE-6024
> URL: https://issues.apache.org/jira/browse/CALCITE-6024
> Project: Calcite
>  Issue Type: Improvement
>Reporter: Julian Hyde
>Assignee: Julian Hyde
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.36.0
>
>
> {{ListSqlOperatorTable}} is inefficient if it contains a large number of 
> operators. It currently examines the operators one by one. 
> {{ReflectiveSqlOperatorTable}} (and its subclass, {{SqlStdOperatorTable}}) 
> builds a map of operators by name (actually two maps, one case-sensitive and 
> one case-insensitive).
> {{ListSqlOperatorTable}} should do the same, at least in its immutable form.



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


[jira] [Resolved] (CALCITE-5918) Add MAP function (enabled in Spark library)

2023-10-27 Thread Tanner Clary (Jira)


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

Tanner Clary resolved CALCITE-5918.
---
Resolution: Fixed

Merged via 
[b11f179|https://github.com/apache/calcite/commit/b11f179cbabd6c306a1300b40f1b8e0c8d11fda4],
 thanks for the fix, [~taoran]!

> Add MAP function (enabled in Spark library)
> ---
>
> Key: CALCITE-5918
> URL: https://issues.apache.org/jira/browse/CALCITE-5918
> Project: Calcite
>  Issue Type: New Feature
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Guillaume Massé
>Assignee: Ran Tao
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.36.0
>
>
> Apache Spark map constructor is different than the standard SQL:
> [https://spark.apache.org/docs/3.4.0/api/sql/index.html#map]
>  
> {code:java}
> SELECT map(1.0, '2', 3.0, '4');
> // {1.0:"2",3.0:"4"} {code}
>  
> related PR that can help implement this: 
> https://github.com/apache/calcite/pull/3141



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


[jira] [Comment Edited] (CALCITE-6041) MAP sub-query gives NullPointerException

2023-10-27 Thread Ran Tao (Jira)


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

Ran Tao edited comment on CALCITE-6041 at 10/27/23 2:14 PM:


thanks Julian for explanations. I will fix array-with-orderby above in 
follow-up ticket.


was (Author: lemonjing):
thanks Julian for explanations. I will fix some questions above in follow-up 
ticket.

> MAP sub-query gives NullPointerException
> 
>
> Key: CALCITE-6041
> URL: https://issues.apache.org/jira/browse/CALCITE-6041
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Ran Tao
>Assignee: Ran Tao
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.36.0
>
>
> calcite support array/map/multiset query constructor, but if we run map query 
> such as:
> {code:java}
> select map(select 1, 2)
> select map(select empno, deptno from emps); {code}
> It will cause exception:
> {noformat}
> java.sql.SQLException: Error while executing SQL "select map(select 1, 2)": 
> Unable to implement EnumerableNestedLoopJoin(condition=[true], 
> joinType=[semi]): rowcount = 1.0, cumulative cost = \{13.0 rows, 3.0 cpu, 0.0 
> io}, id = 72
>   EnumerableCollect(field=[x]): rowcount = 1.0, cumulative cost = \{2.0 rows, 
> 2.0 cpu, 0.0 io}, id = 69
>     EnumerableValues(tuples=[[\\{ 1, 2 }]]): rowcount = 1.0, cumulative cost 
> = \{1.0 rows, 1.0 cpu, 0.0 io}, id = 38
>   EnumerableValues(tuples=[[\\{ 0 }]]): rowcount = 1.0, cumulative cost = 
> \{1.0 rows, 1.0 cpu, 0.0 io}, id = 35
>     at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
>     at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
>     at 
> org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:164)
>     at 
> org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:228)
>     at 
> org.apache.calcite.test.SqlOperatorTest$TesterImpl.check(SqlOperatorTest.java:13107)
>     at 
> org.apache.calcite.sql.test.SqlOperatorFixture.check(SqlOperatorFixture.java:439)
>     at 
> org.apache.calcite.sql.test.SqlOperatorFixture.check(SqlOperatorFixture.java:415)
>     at 
> org.apache.calcite.sql.test.SqlOperatorFixture.check(SqlOperatorFixture.java:420)
>     at 
> org.apache.calcite.test.SqlOperatorTest.testMapQueryConstructor(SqlOperatorTest.java:10235)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:498)
>     at 
> org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
>     at 
> org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
>     at 
> org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
>     at 
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
>     at 
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
>     at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
>     at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
>     at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
>     at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
>     at 
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
>     at 
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>     at 
> 

[jira] [Comment Edited] (CALCITE-6041) MAP sub-query gives NullPointerException

2023-10-27 Thread Ran Tao (Jira)


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

Ran Tao edited comment on CALCITE-6041 at 10/27/23 2:12 PM:


hi [~julianhyde] Sorry to pin you. Since you have helped to review the RP and +1
could you help to merge this?   then we can add it in up-coming 1.36.


was (Author: lemonjing):
hi [~julianhyde] Sorry to pin you. Since you have helped to review the RP and +1
could you help to merge this?   then we can add it in up-coming 1.36.

> MAP sub-query gives NullPointerException
> 
>
> Key: CALCITE-6041
> URL: https://issues.apache.org/jira/browse/CALCITE-6041
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Ran Tao
>Assignee: Ran Tao
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.36.0
>
>
> calcite support array/map/multiset query constructor, but if we run map query 
> such as:
> {code:java}
> select map(select 1, 2)
> select map(select empno, deptno from emps); {code}
> It will cause exception:
> {noformat}
> java.sql.SQLException: Error while executing SQL "select map(select 1, 2)": 
> Unable to implement EnumerableNestedLoopJoin(condition=[true], 
> joinType=[semi]): rowcount = 1.0, cumulative cost = \{13.0 rows, 3.0 cpu, 0.0 
> io}, id = 72
>   EnumerableCollect(field=[x]): rowcount = 1.0, cumulative cost = \{2.0 rows, 
> 2.0 cpu, 0.0 io}, id = 69
>     EnumerableValues(tuples=[[\\{ 1, 2 }]]): rowcount = 1.0, cumulative cost 
> = \{1.0 rows, 1.0 cpu, 0.0 io}, id = 38
>   EnumerableValues(tuples=[[\\{ 0 }]]): rowcount = 1.0, cumulative cost = 
> \{1.0 rows, 1.0 cpu, 0.0 io}, id = 35
>     at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
>     at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
>     at 
> org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:164)
>     at 
> org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:228)
>     at 
> org.apache.calcite.test.SqlOperatorTest$TesterImpl.check(SqlOperatorTest.java:13107)
>     at 
> org.apache.calcite.sql.test.SqlOperatorFixture.check(SqlOperatorFixture.java:439)
>     at 
> org.apache.calcite.sql.test.SqlOperatorFixture.check(SqlOperatorFixture.java:415)
>     at 
> org.apache.calcite.sql.test.SqlOperatorFixture.check(SqlOperatorFixture.java:420)
>     at 
> org.apache.calcite.test.SqlOperatorTest.testMapQueryConstructor(SqlOperatorTest.java:10235)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:498)
>     at 
> org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
>     at 
> org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
>     at 
> org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
>     at 
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
>     at 
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
>     at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
>     at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
>     at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
>     at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
>     at 
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
>     at 
> 

[jira] (CALCITE-6041) MAP sub-query gives NullPointerException

2023-10-27 Thread Ran Tao (Jira)


[ https://issues.apache.org/jira/browse/CALCITE-6041 ]


Ran Tao deleted comment on CALCITE-6041:
--

was (Author: lemonjing):
The follow-up ticket is 
[CALCITE-6063|https://issues.apache.org/jira/browse/CALCITE-6063]

> MAP sub-query gives NullPointerException
> 
>
> Key: CALCITE-6041
> URL: https://issues.apache.org/jira/browse/CALCITE-6041
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Ran Tao
>Assignee: Ran Tao
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.36.0
>
>
> calcite support array/map/multiset query constructor, but if we run map query 
> such as:
> {code:java}
> select map(select 1, 2)
> select map(select empno, deptno from emps); {code}
> It will cause exception:
> {noformat}
> java.sql.SQLException: Error while executing SQL "select map(select 1, 2)": 
> Unable to implement EnumerableNestedLoopJoin(condition=[true], 
> joinType=[semi]): rowcount = 1.0, cumulative cost = \{13.0 rows, 3.0 cpu, 0.0 
> io}, id = 72
>   EnumerableCollect(field=[x]): rowcount = 1.0, cumulative cost = \{2.0 rows, 
> 2.0 cpu, 0.0 io}, id = 69
>     EnumerableValues(tuples=[[\\{ 1, 2 }]]): rowcount = 1.0, cumulative cost 
> = \{1.0 rows, 1.0 cpu, 0.0 io}, id = 38
>   EnumerableValues(tuples=[[\\{ 0 }]]): rowcount = 1.0, cumulative cost = 
> \{1.0 rows, 1.0 cpu, 0.0 io}, id = 35
>     at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
>     at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
>     at 
> org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:164)
>     at 
> org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:228)
>     at 
> org.apache.calcite.test.SqlOperatorTest$TesterImpl.check(SqlOperatorTest.java:13107)
>     at 
> org.apache.calcite.sql.test.SqlOperatorFixture.check(SqlOperatorFixture.java:439)
>     at 
> org.apache.calcite.sql.test.SqlOperatorFixture.check(SqlOperatorFixture.java:415)
>     at 
> org.apache.calcite.sql.test.SqlOperatorFixture.check(SqlOperatorFixture.java:420)
>     at 
> org.apache.calcite.test.SqlOperatorTest.testMapQueryConstructor(SqlOperatorTest.java:10235)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:498)
>     at 
> org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
>     at 
> org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
>     at 
> org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
>     at 
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
>     at 
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
>     at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
>     at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
>     at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
>     at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
>     at 
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
>     at 
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>     at 
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
>     at 
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)
>     at 
> 

[jira] [Commented] (CALCITE-6041) MAP sub-query gives NullPointerException

2023-10-27 Thread Ran Tao (Jira)


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

Ran Tao commented on CALCITE-6041:
--

hi [~julianhyde] Sorry to pin you. Since you have helped to review the RP and +1
could you help to merge this?   then we can add it in up-coming 1.36.

> MAP sub-query gives NullPointerException
> 
>
> Key: CALCITE-6041
> URL: https://issues.apache.org/jira/browse/CALCITE-6041
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Ran Tao
>Assignee: Ran Tao
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.36.0
>
>
> calcite support array/map/multiset query constructor, but if we run map query 
> such as:
> {code:java}
> select map(select 1, 2)
> select map(select empno, deptno from emps); {code}
> It will cause exception:
> {noformat}
> java.sql.SQLException: Error while executing SQL "select map(select 1, 2)": 
> Unable to implement EnumerableNestedLoopJoin(condition=[true], 
> joinType=[semi]): rowcount = 1.0, cumulative cost = \{13.0 rows, 3.0 cpu, 0.0 
> io}, id = 72
>   EnumerableCollect(field=[x]): rowcount = 1.0, cumulative cost = \{2.0 rows, 
> 2.0 cpu, 0.0 io}, id = 69
>     EnumerableValues(tuples=[[\\{ 1, 2 }]]): rowcount = 1.0, cumulative cost 
> = \{1.0 rows, 1.0 cpu, 0.0 io}, id = 38
>   EnumerableValues(tuples=[[\\{ 0 }]]): rowcount = 1.0, cumulative cost = 
> \{1.0 rows, 1.0 cpu, 0.0 io}, id = 35
>     at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
>     at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
>     at 
> org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:164)
>     at 
> org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:228)
>     at 
> org.apache.calcite.test.SqlOperatorTest$TesterImpl.check(SqlOperatorTest.java:13107)
>     at 
> org.apache.calcite.sql.test.SqlOperatorFixture.check(SqlOperatorFixture.java:439)
>     at 
> org.apache.calcite.sql.test.SqlOperatorFixture.check(SqlOperatorFixture.java:415)
>     at 
> org.apache.calcite.sql.test.SqlOperatorFixture.check(SqlOperatorFixture.java:420)
>     at 
> org.apache.calcite.test.SqlOperatorTest.testMapQueryConstructor(SqlOperatorTest.java:10235)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:498)
>     at 
> org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
>     at 
> org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
>     at 
> org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
>     at 
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
>     at 
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
>     at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
>     at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
>     at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
>     at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
>     at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
>     at 
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
>     at 
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>     at 
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
>     at 
> 

[jira] [Commented] (CALCITE-5860) Decimal type conversion missing scale

2023-10-27 Thread Stamatis Zampetakis (Jira)


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

Stamatis Zampetakis commented on CALCITE-5860:
--

I removed the fixVersion for now. When someone starts working on it again we 
can decide in which version to put it.

> Decimal type conversion missing scale
> -
>
> Key: CALCITE-5860
> URL: https://issues.apache.org/jira/browse/CALCITE-5860
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.34.0
>Reporter: Guoliang Sun
>Assignee: pengfei.zhan
>Priority: Major
>  Labels: pull-request-available
>
> Take the following SQL as an example
> {code:sql}
> SELECT CAST(((2.0) / SQRT(3.0)) AS DECIMAL(18, 0)) * SQRT(3.0) {code}
> The result of the SQL calculation should be {*}SQRT(3.0){*}.However, the 
> actual result is {*}2.0{*}, which is not meet expectations.
>  
> The following is the code generated by Janino
> {code:java}
> public Object[] apply(Object root0) {
>   final java.math.BigDecimal literal_value = new java.math.BigDecimal(
>     "2.0");
>   final java.math.BigDecimal literal_value0 = new java.math.BigDecimal(
>     "3.0");
>   final java.math.BigDecimal literal_value1 = new java.math.BigDecimal(
>     "0.5");
>   final double method_name_call_value = 
> org.apache.calcite.runtime.SqlFunctions.power(literal_value0, literal_value1);
>   final java.math.BigDecimal cast_value = new java.math.BigDecimal(
>     literal_value.doubleValue() / method_name_call_value);
>   return new Object[] {
>       cast_value == null ? 0.0D : cast_value.doubleValue() * 
> method_name_call_value};
> } {code}
> We can see *((2.0) / SQRT(3.0)) AS DECIMAL(18, 0)* lost the scale.



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


[jira] [Updated] (CALCITE-5860) Decimal type conversion missing scale

2023-10-27 Thread Stamatis Zampetakis (Jira)


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

Stamatis Zampetakis updated CALCITE-5860:
-
Fix Version/s: (was: 1.36.0)

> Decimal type conversion missing scale
> -
>
> Key: CALCITE-5860
> URL: https://issues.apache.org/jira/browse/CALCITE-5860
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.34.0
>Reporter: Guoliang Sun
>Assignee: pengfei.zhan
>Priority: Major
>  Labels: pull-request-available
>
> Take the following SQL as an example
> {code:sql}
> SELECT CAST(((2.0) / SQRT(3.0)) AS DECIMAL(18, 0)) * SQRT(3.0) {code}
> The result of the SQL calculation should be {*}SQRT(3.0){*}.However, the 
> actual result is {*}2.0{*}, which is not meet expectations.
>  
> The following is the code generated by Janino
> {code:java}
> public Object[] apply(Object root0) {
>   final java.math.BigDecimal literal_value = new java.math.BigDecimal(
>     "2.0");
>   final java.math.BigDecimal literal_value0 = new java.math.BigDecimal(
>     "3.0");
>   final java.math.BigDecimal literal_value1 = new java.math.BigDecimal(
>     "0.5");
>   final double method_name_call_value = 
> org.apache.calcite.runtime.SqlFunctions.power(literal_value0, literal_value1);
>   final java.math.BigDecimal cast_value = new java.math.BigDecimal(
>     literal_value.doubleValue() / method_name_call_value);
>   return new Object[] {
>       cast_value == null ? 0.0D : cast_value.doubleValue() * 
> method_name_call_value};
> } {code}
> We can see *((2.0) / SQRT(3.0)) AS DECIMAL(18, 0)* lost the scale.



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


[jira] [Resolved] (CALCITE-5825) Add URL_ENCODE and URL_DECODE function (enabled in Spark library)

2023-10-27 Thread Jiajun Xie (Jira)


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

Jiajun Xie resolved CALCITE-5825.
-
Resolution: Fixed

> Add URL_ENCODE and URL_DECODE function (enabled in Spark library)
> -
>
> Key: CALCITE-5825
> URL: https://issues.apache.org/jira/browse/CALCITE-5825
> Project: Calcite
>  Issue Type: New Feature
>  Components: core
>Affects Versions: 1.34.0, 1.35.0
>Reporter: Runkang He
>Assignee: Runkang He
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.36.0
>
>
> Add URL_ENCODE and URL_DECODE function (enabled in Spark library):
>  * URL_ENCODE(str) - Translates a string into 
> 'application/x-www-form-urlencoded' format using a specific encoding scheme. 
> See more details in 
> [Spark|https://spark.apache.org/docs/latest/api/sql/index.html#url_encode] 
> doc.
>  * URL_DECODE(str) - Decodes a {{str}} in 'application/x-www-form-urlencoded' 
> format using a specific encoding scheme. See more details in 
> [Spark|https://spark.apache.org/docs/latest/api/sql/index.html#url_decode] 
> doc.



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


[jira] [Commented] (CALCITE-5825) Add URL_ENCODE and URL_DECODE function (enabled in Spark library)

2023-10-27 Thread Jiajun Xie (Jira)


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

Jiajun Xie commented on CALCITE-5825:
-

Fixed in 
[ad2e843|https://github.com/apache/calcite/commit/ad2e843c5d9b3bec001d22e680ebe6b5de4e2078].

 

Thanks for the PR.[~Runking] 

Thanks for your review [~shenlang] , [~mbudiu] .

> Add URL_ENCODE and URL_DECODE function (enabled in Spark library)
> -
>
> Key: CALCITE-5825
> URL: https://issues.apache.org/jira/browse/CALCITE-5825
> Project: Calcite
>  Issue Type: New Feature
>  Components: core
>Affects Versions: 1.34.0, 1.35.0
>Reporter: Runkang He
>Assignee: Runkang He
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.36.0
>
>
> Add URL_ENCODE and URL_DECODE function (enabled in Spark library):
>  * URL_ENCODE(str) - Translates a string into 
> 'application/x-www-form-urlencoded' format using a specific encoding scheme. 
> See more details in 
> [Spark|https://spark.apache.org/docs/latest/api/sql/index.html#url_encode] 
> doc.
>  * URL_DECODE(str) - Decodes a {{str}} in 'application/x-www-form-urlencoded' 
> format using a specific encoding scheme. See more details in 
> [Spark|https://spark.apache.org/docs/latest/api/sql/index.html#url_decode] 
> doc.



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


[jira] [Resolved] (CALCITE-6011) Add the planner rule that pushes the Filter past a Window

2023-10-27 Thread Stamatis Zampetakis (Jira)


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

Stamatis Zampetakis resolved CALCITE-6011.
--
Resolution: Fixed

Fixed in 
[bdafeec27c529d0089434a4d8b0fc7a1e49efcd1|https://github.com/apache/calcite/commit/bdafeec27c529d0089434a4d8b0fc7a1e49efcd1].
 Thanks for the PR [~shenlang]!

> Add the planner rule that pushes the Filter past a Window
> -
>
> Key: CALCITE-6011
> URL: https://issues.apache.org/jira/browse/CALCITE-6011
> Project: Calcite
>  Issue Type: New Feature
>  Components: core
>Reporter: LakeShen
>Assignee: LakeShen
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.36.0
>
>
> The Filter condition could be pushed past the Window when condition used 
> columns is window partition columns.
> For example:
> {code:java}
> SELECT 
>   * 
> FROM 
>   (
>     SELECT 
>       custkey, 
>       orderkey, 
>       rank() OVER (
>         PARTITION BY custkey 
>         ORDER BY 
>           orderdate ASC
>       ) 
>     FROM 
>       orders
>   ) 
> WHERE 
>   custkey = 0 
>   AND orderkey > 0 {code}
> The plan tree:
> {code:java}
> LogicalProject(custkey=[0], orderkey=[$1], EXPR$2=[$2])
>   LogicalFilter(condition=[AND(=($0, 0), >($1, 0))])
>     LogicalProject(custkey=[$1], orderkey=[$0], EXPR$2=[$3])
>       LogicalWindow(window#0=[window(partition {1} order by [2] aggs 
> [RANK()])])
>         LogicalProject(ORDERKEY=[$0], CUSTKEY=[$1], ORDERDATE=[$4])
>           LogicalTableScan(table=[[tpch, ORDERS]]) {code}
> Because the window partition columns is custkey,so the condition `custkey = 0 
> ` could be pushed down the LogicalWindow.
> After that,the plan is :
> {code:java}
>  
> LogicalProject(custkey=[0], orderkey=[$1], EXPR$2=[$2])
>   LogicalFilter(condition=[>($1, 0)])
>     LogicalProject(custkey=[$1], orderkey=[$0], EXPR$2=[$3])
>       LogicalWindow(window#0=[window(partition {1} order by [2] aggs 
> [RANK()])])
>         LogicalFilter(condition=[=($1, 0)])
>           LogicalProject(ORDERKEY=[$0], CUSTKEY=[$1], ORDERDATE=[$4])
>             LogicalTableScan(table=[[tpch, ORDERS]]) 
>  {code}
>  
>  
>  



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


[jira] [Comment Edited] (CALCITE-6075) Site: Cloning source code from GitHub using git protocol fails

2023-10-27 Thread Jira


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

蔡灿材 edited comment on CALCITE-6075 at 10/27/23 9:44 AM:


I think so too . I also don't think we need to do something for the


was (Author: JIRAUSER302115):
I think so too

>  Site: Cloning source code from GitHub using git protocol fails
> ---
>
> Key: CALCITE-6075
> URL: https://issues.apache.org/jira/browse/CALCITE-6075
> Project: Calcite
>  Issue Type: Improvement
>  Components: site
>Affects Versions: 1.35.0
>Reporter: 蔡灿材
>Assignee: 蔡灿材
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.36.0
>
> Attachments: 2023-10-26 16-28-15屏幕截图.png
>
>
> git clone git://github.com/apache/calcite.git does not have this writing 
> method. It should be [https://github.com/apache/calcite.git] or 
> g...@github.com:apache/calcite.git
> GitHub removed the unecrypted git protocol a while ago:
> [https://github.blog/changelog/2022-03-15-removed-unencrypted-git-protocol-and-certain-ssh-keys/]
>  



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


[jira] [Commented] (CALCITE-6075) Site: Cloning source code from GitHub using git protocol fails

2023-10-27 Thread Jira


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

蔡灿材 commented on CALCITE-6075:
--

I think so too

>  Site: Cloning source code from GitHub using git protocol fails
> ---
>
> Key: CALCITE-6075
> URL: https://issues.apache.org/jira/browse/CALCITE-6075
> Project: Calcite
>  Issue Type: Improvement
>  Components: site
>Affects Versions: 1.35.0
>Reporter: 蔡灿材
>Assignee: 蔡灿材
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.36.0
>
> Attachments: 2023-10-26 16-28-15屏幕截图.png
>
>
> git clone git://github.com/apache/calcite.git does not have this writing 
> method. It should be [https://github.com/apache/calcite.git] or 
> g...@github.com:apache/calcite.git
> GitHub removed the unecrypted git protocol a while ago:
> [https://github.blog/changelog/2022-03-15-removed-unencrypted-git-protocol-and-certain-ssh-keys/]
>  



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


[jira] [Commented] (CALCITE-6075) Site: Cloning source code from GitHub using git protocol fails

2023-10-27 Thread Stamatis Zampetakis (Jira)


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

Stamatis Zampetakis commented on CALCITE-6075:
--

Merged addendum for howto.md in 
[ef82a6cc6bc565f6dc596c1d2aca7221fd6cdc49|https://github.com/apache/calcite/commit/ef82a6cc6bc565f6dc596c1d2aca7221fd6cdc49].
 Thanks for the follow-up [~caicancai].

I don't think we need to do something for the references of "git:" in 
build.gradle.kts since they refer to protocols used by gitbox (not github).

>  Site: Cloning source code from GitHub using git protocol fails
> ---
>
> Key: CALCITE-6075
> URL: https://issues.apache.org/jira/browse/CALCITE-6075
> Project: Calcite
>  Issue Type: Improvement
>  Components: site
>Affects Versions: 1.35.0
>Reporter: 蔡灿材
>Assignee: 蔡灿材
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.36.0
>
> Attachments: 2023-10-26 16-28-15屏幕截图.png
>
>
> git clone git://github.com/apache/calcite.git does not have this writing 
> method. It should be [https://github.com/apache/calcite.git] or 
> g...@github.com:apache/calcite.git
> GitHub removed the unecrypted git protocol a while ago:
> [https://github.blog/changelog/2022-03-15-removed-unencrypted-git-protocol-and-certain-ssh-keys/]
>  



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


[jira] [Comment Edited] (CALCITE-6075) Site: Cloning source code from GitHub using git protocol fails

2023-10-27 Thread Stamatis Zampetakis (Jira)


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

Stamatis Zampetakis edited comment on CALCITE-6075 at 10/27/23 9:18 AM:


Fixed in 
[https://github.com/apache/calcite/commit/8821eaf94b08dd5c55074b900201da7c386c1635].
 Thanks [~caicancai] for the contribution and [~taoran]  for the review!


was (Author: zabetak):
Fixed in 
[https://github.com/apache/calcite/commit/8821eaf94b08dd5c55074b900201da7c386c1635.]
 Thanks [~caicancai] for the contribution and [~taoran]  for the review!

>  Site: Cloning source code from GitHub using git protocol fails
> ---
>
> Key: CALCITE-6075
> URL: https://issues.apache.org/jira/browse/CALCITE-6075
> Project: Calcite
>  Issue Type: Improvement
>  Components: site
>Affects Versions: 1.35.0
>Reporter: 蔡灿材
>Assignee: 蔡灿材
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.36.0
>
> Attachments: 2023-10-26 16-28-15屏幕截图.png
>
>
> git clone git://github.com/apache/calcite.git does not have this writing 
> method. It should be [https://github.com/apache/calcite.git] or 
> g...@github.com:apache/calcite.git
> GitHub removed the unecrypted git protocol a while ago:
> [https://github.blog/changelog/2022-03-15-removed-unencrypted-git-protocol-and-certain-ssh-keys/]
>  



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


[jira] [Resolved] (CALCITE-5949) RexExecutable should return unchanged original expressions when it fails

2023-10-27 Thread Ruben Q L (Jira)


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

Ruben Q L resolved CALCITE-5949.

Resolution: Fixed

Fixed in 
[{{417a1b5}}|https://github.com/apache/calcite/commit/417a1b53ec9fd6bd449601036535bdb323229059]

Thanks [~cbrisson] for the patch!

> RexExecutable should return unchanged original expressions when it fails
> 
>
> Key: CALCITE-5949
> URL: https://issues.apache.org/jira/browse/CALCITE-5949
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.35.0
>Reporter: Claude Brisson
>Assignee: Ruben Q L
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.36.0
>
>
> While reducing, when encountering an invalid expression in the list of 
> constant expressions, RexExecutor is meant to return all initial expressions 
> unchanged.
> It fails to do so, because already handled correct expressions have already 
> been added to the returned list, which can be greater than the input list.
> For instance, when given the list \{ LN(2), LN(-2) }, the RexExecutor will 
> output a list of length 3.



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