[GitHub] [calcite] sonarcloud[bot] commented on pull request #3399: [CALCITE-5962] Support parse Spark-style syntax LEFT ANTI JOIN in Babel parser

2023-09-07 Thread via GitHub


sonarcloud[bot] commented on PR #3399:
URL: https://github.com/apache/calcite/pull/3399#issuecomment-1711039946

   Kudos, SonarCloud Quality Gate passed!  [![Quality Gate 
passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png
 'Quality Gate 
passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3399)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3399=false=BUG)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3399=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3399=false=BUG)
  
   
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png
 
'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite=3399=false=VULNERABILITY)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3399=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3399=false=VULNERABILITY)
  
   [![Security 
Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png
 'Security 
Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3399=false=SECURITY_HOTSPOT)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3399=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3399=false=SECURITY_HOTSPOT)
  
   [![Code 
Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png
 'Code 
Smell')](https://sonarcloud.io/project/issues?id=apache_calcite=3399=false=CODE_SMELL)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3399=false=CODE_SMELL)
 [6 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3399=false=CODE_SMELL)
   
   
[![84.6%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png
 
'84.6%')](https://sonarcloud.io/component_measures?id=apache_calcite=3399=new_coverage=list)
 [84.6% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3399=new_coverage=list)
  
   
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png
 
'0.0%')](https://sonarcloud.io/component_measures?id=apache_calcite=3399=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3399=new_duplicated_lines_density=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [calcite] JiajunBernoulli commented on pull request #3324: [CALCITE-5862] Incorrect semantics of ARRAY function(Spark library) when elements have Numeric and Character types

2023-09-07 Thread via GitHub


JiajunBernoulli commented on PR #3324:
URL: https://github.com/apache/calcite/pull/3324#issuecomment-1710979357

   The commit message should contain some info like `java. lang. 
NullPointerException: referred array element type`.
   
   It can be easily found by other users.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [calcite] JiajunBernoulli commented on pull request #3324: [CALCITE-5862] Incorrect semantics of ARRAY function(Spark library) when elements have Numeric and Character types

2023-09-07 Thread via GitHub


JiajunBernoulli commented on PR #3324:
URL: https://github.com/apache/calcite/pull/3324#issuecomment-1710977744

   @chucheng92 , Compared to NPE, the is indeed an improvement.
   
   LGTM, remember to squash your commits before merging.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [calcite] JiajunBernoulli merged pull request #3382: [CALCITE-5944] Add metadata for Sample

2023-09-07 Thread via GitHub


JiajunBernoulli merged PR #3382:
URL: https://github.com/apache/calcite/pull/3382


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[calcite] branch main updated: [CALCITE-5944] Add metadata for Sample

2023-09-07 Thread jiajunxie
This is an automated email from the ASF dual-hosted git repository.

jiajunxie pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/main by this push:
 new 64268b9dd7 [CALCITE-5944] Add metadata for Sample
64268b9dd7 is described below

commit 64268b9dd70bcdc15a3421ab120b8e5ecba17339
Author: xiejiajun 
AuthorDate: Sun Aug 20 17:30:58 2023 +0800

[CALCITE-5944] Add metadata for Sample

- RelMdAllPredicates
- RelMdColumnOrigins
- RelMdExpressionLineage
- RelMdMaxRowCount
- RelMdMinRowCount
- RelMdPredicates
- RelMdRowCount
---
 .../calcite/rel/metadata/RelMdAllPredicates.java   |  9 
 .../calcite/rel/metadata/RelMdColumnOrigins.java   |  6 +++
 .../rel/metadata/RelMdExpressionLineage.java   |  9 
 .../calcite/rel/metadata/RelMdMaxRowCount.java |  5 ++
 .../calcite/rel/metadata/RelMdMinRowCount.java |  5 ++
 .../calcite/rel/metadata/RelMdPredicates.java  |  8 
 .../apache/calcite/rel/metadata/RelMdRowCount.java |  7 +++
 .../org/apache/calcite/test/RelMetadataTest.java   | 56 ++
 .../GeneratedMetadata_AllPredicatesHandler.java|  2 +
 .../GeneratedMetadata_ColumnOriginHandler.java |  2 +
 ...GeneratedMetadata_ExpressionLineageHandler.java |  2 +
 .../GeneratedMetadata_MaxRowCountHandler.java  |  2 +
 .../GeneratedMetadata_MinRowCountHandler.java  |  2 +
 .../GeneratedMetadata_PredicatesHandler.java   |  2 +
 .../janino/GeneratedMetadata_RowCountHandler.java  |  2 +
 15 files changed, 119 insertions(+)

diff --git 
a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdAllPredicates.java 
b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdAllPredicates.java
index a062ab6502..d86a61fad8 100644
--- a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdAllPredicates.java
+++ b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdAllPredicates.java
@@ -27,6 +27,7 @@ import org.apache.calcite.rel.core.Exchange;
 import org.apache.calcite.rel.core.Filter;
 import org.apache.calcite.rel.core.Join;
 import org.apache.calcite.rel.core.Project;
+import org.apache.calcite.rel.core.Sample;
 import org.apache.calcite.rel.core.SetOp;
 import org.apache.calcite.rel.core.Sort;
 import org.apache.calcite.rel.core.TableModify;
@@ -345,6 +346,14 @@ public class RelMdAllPredicates
 return newPreds;
   }
 
+  /**
+   * Extracts predicates for a Sample.
+   */
+  public @Nullable RelOptPredicateList getAllPredicates(Sample sample,
+  RelMetadataQuery mq) {
+return mq.getAllPredicates(sample.getInput());
+  }
+
   /**
* Extracts predicates for a Sort.
*/
diff --git 
a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdColumnOrigins.java 
b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdColumnOrigins.java
index dc30e6a20a..a6ed11c104 100644
--- a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdColumnOrigins.java
+++ b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdColumnOrigins.java
@@ -25,6 +25,7 @@ import org.apache.calcite.rel.core.Exchange;
 import org.apache.calcite.rel.core.Filter;
 import org.apache.calcite.rel.core.Join;
 import org.apache.calcite.rel.core.Project;
+import org.apache.calcite.rel.core.Sample;
 import org.apache.calcite.rel.core.SetOp;
 import org.apache.calcite.rel.core.Snapshot;
 import org.apache.calcite.rel.core.Sort;
@@ -195,6 +196,11 @@ public class RelMdColumnOrigins
 return mq.getColumnOrigins(rel.getInput(), iOutputColumn);
   }
 
+  public @Nullable Set getColumnOrigins(Sample rel,
+  RelMetadataQuery mq, int iOutputColumn) {
+return mq.getColumnOrigins(rel.getInput(), iOutputColumn);
+  }
+
   public @Nullable Set getColumnOrigins(Snapshot rel,
   RelMetadataQuery mq, int iOutputColumn) {
 return mq.getColumnOrigins(rel.getInput(), iOutputColumn);
diff --git 
a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdExpressionLineage.java
 
b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdExpressionLineage.java
index 1b3445..3025ee1d4a 100644
--- 
a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdExpressionLineage.java
+++ 
b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdExpressionLineage.java
@@ -26,6 +26,7 @@ import org.apache.calcite.rel.core.Filter;
 import org.apache.calcite.rel.core.Join;
 import org.apache.calcite.rel.core.JoinRelType;
 import org.apache.calcite.rel.core.Project;
+import org.apache.calcite.rel.core.Sample;
 import org.apache.calcite.rel.core.Snapshot;
 import org.apache.calcite.rel.core.Sort;
 import org.apache.calcite.rel.core.TableModify;
@@ -394,6 +395,14 @@ public class RelMdExpressionLineage
 return mq.getExpressionLineage(rel.getInput(), outputExpression);
   }
 
+  /**
+   * Expression lineage from Sample.
+   */
+  public @Nullable Set getExpressionLineage(Sample rel,
+  RelMetadataQuery mq, RexNode outputExpression) {
+return 

[GitHub] [calcite-avatica] mihaibudiu opened a new pull request, #226: [CALCITE-5981] TIMESTAMPDIFF function returns incorrect result

2023-09-07 Thread via GitHub


mihaibudiu opened a new pull request, #226:
URL: https://github.com/apache/calcite-avatica/pull/226

   I have cross-checked the implementation with the MySQL implementation:
   
https://github.com/mysql/mysql-server/blob/ea1efa9822d81044b726aab20c857d5e1b7e046a/sql/item_timefunc.cc
   The tests are all adapted from MySQL, where they look like: 
"timestampdiff(month, ...)"
   
https://github.com/mysql/mysql-server/blob/ea1efa9822d81044b726aab20c857d5e1b7e046a/mysql-test/r/func_time.result#L1130
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[calcite] branch main updated: [CALCITE-5935] Add CODE_POINTS_TO_BYTES function (enabled in BigQuery library)

2023-09-07 Thread tanner
This is an automated email from the ASF dual-hosted git repository.

tanner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/main by this push:
 new 4e6c403842 [CALCITE-5935] Add CODE_POINTS_TO_BYTES function (enabled 
in BigQuery library)
4e6c403842 is described below

commit 4e6c403842bebc519b1a1ededc9c2311059d7cb2
Author: macroguo 
AuthorDate: Tue Aug 22 17:59:02 2023 +0800

[CALCITE-5935] Add CODE_POINTS_TO_BYTES function (enabled in BigQuery 
library)
---
 babel/src/test/resources/sql/big-query.iq  | 58 ++
 .../calcite/adapter/enumerable/RexImpTable.java|  3 ++
 .../apache/calcite/runtime/CalciteResource.java|  3 ++
 .../org/apache/calcite/runtime/SqlFunctions.java   | 22 
 .../calcite/sql/fun/SqlLibraryOperators.java   |  7 +++
 .../org/apache/calcite/sql/type/OperandTypes.java  | 32 
 .../org/apache/calcite/util/BuiltInMethod.java |  1 +
 .../calcite/runtime/CalciteResource.properties |  1 +
 site/_docs/reference.md|  1 +
 .../org/apache/calcite/test/SqlOperatorTest.java   | 31 
 10 files changed, 159 insertions(+)

diff --git a/babel/src/test/resources/sql/big-query.iq 
b/babel/src/test/resources/sql/big-query.iq
index d50969b81a..2479eb3663 100755
--- a/babel/src/test/resources/sql/big-query.iq
+++ b/babel/src/test/resources/sql/big-query.iq
@@ -1971,6 +1971,64 @@ SELECT CONTAINS_SUBSTR('{"lunch":"soup"}', "lunch", 
json_scope=>"JSON_KEYS_AND_V
 
 !ok
 
+#
+# CODE_POINTS_TO_BYTES(array)
+#
+# Takes an array of extended ASCII code points as ARRAY
+# and returns BYTES.
+#
+SELECT CODE_POINTS_TO_BYTES(array[65, 66, 67, 68]) as result;
++--+
+| result   |
++--+
+| 41424344 |
++--+
+(1 row)
+
+!ok
+
+SELECT CODE_POINTS_TO_BYTES(array[255, 254, 65, 64]) as result;
++--+
+| result   |
++--+
+| fffe4140 |
++--+
+(1 row)
+
+!ok
+
+SELECT CODE_POINTS_TO_BYTES(null) as result;
+++
+| result |
+++
+||
+++
+(1 row)
+
+!ok
+
+SELECT CODE_POINTS_TO_BYTES(array[65, null]) as result;
+++
+| result |
+++
+||
+++
+(1 row)
+
+!ok
+
+SELECT CODE_POINTS_TO_BYTES('abc') as result;
+Cannot apply 'CODE_POINTS_TO_BYTES' to arguments of type 
'CODE_POINTS_TO_BYTES()'. Supported form(s): 
CODE_POINTS_TO_BYTES()
+!error
+
+SELECT CODE_POINTS_TO_BYTES(array[-1]) as result;
+Input arguments of CODE_POINTS_TO_BYTES out of range: -1
+!error
+
+SELECT CODE_POINTS_TO_BYTES(array[2147483648, 1]);
+Input arguments of CODE_POINTS_TO_BYTES out of range: 2147483648
+!error
+
 #
 # DATE
 #
diff --git 
a/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java 
b/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
index 91a7aed9b0..03d7a07c0f 100644
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
+++ b/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
@@ -150,6 +150,7 @@ import static 
org.apache.calcite.sql.fun.SqlLibraryOperators.BOOL_OR;
 import static org.apache.calcite.sql.fun.SqlLibraryOperators.CEIL_BIG_QUERY;
 import static org.apache.calcite.sql.fun.SqlLibraryOperators.CHAR;
 import static org.apache.calcite.sql.fun.SqlLibraryOperators.CHR;
+import static 
org.apache.calcite.sql.fun.SqlLibraryOperators.CODE_POINTS_TO_BYTES;
 import static org.apache.calcite.sql.fun.SqlLibraryOperators.COMPRESS;
 import static org.apache.calcite.sql.fun.SqlLibraryOperators.CONCAT2;
 import static org.apache.calcite.sql.fun.SqlLibraryOperators.CONCAT_FUNCTION;
@@ -564,6 +565,8 @@ public class RexImpTable {
   defineMethod(ASCII, BuiltInMethod.ASCII.method, NullPolicy.STRICT);
   defineMethod(CHAR, BuiltInMethod.CHAR_FROM_ASCII.method,
   NullPolicy.SEMI_STRICT);
+  defineMethod(CODE_POINTS_TO_BYTES, 
BuiltInMethod.CODE_POINTS_TO_BYTES.method,
+  NullPolicy.STRICT);
   defineMethod(REPEAT, BuiltInMethod.REPEAT.method, NullPolicy.STRICT);
   defineMethod(SPACE, BuiltInMethod.SPACE.method, NullPolicy.STRICT);
   defineMethod(STRCMP, BuiltInMethod.STRCMP.method, NullPolicy.STRICT);
diff --git a/core/src/main/java/org/apache/calcite/runtime/CalciteResource.java 
b/core/src/main/java/org/apache/calcite/runtime/CalciteResource.java
index 230f2ea0ca..832e3715d4 100644
--- a/core/src/main/java/org/apache/calcite/runtime/CalciteResource.java
+++ b/core/src/main/java/org/apache/calcite/runtime/CalciteResource.java
@@ -298,6 +298,9 @@ public interface CalciteResource {
   @BaseMessage("Date literal ''{0}'' out of range")
   ExInst dateLiteralOutOfRange(String a0);
 
+  @BaseMessage("Input arguments of CODE_POINTS_TO_BYTES out of range: 
{0,number,#}")
+  ExInst 

[GitHub] [calcite] tanclary merged pull request #3389: [CALCITE-5935] Add CODE_POINTS_TO_BYTES function (enabled in BigQuery…

2023-09-07 Thread via GitHub


tanclary merged PR #3389:
URL: https://github.com/apache/calcite/pull/3389


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [calcite] sonarcloud[bot] commented on pull request #3408: [CALCITE-5978] Add REGEXP_INSTR function (enabled in BigQuery library)

2023-09-07 Thread via GitHub


sonarcloud[bot] commented on PR #3408:
URL: https://github.com/apache/calcite/pull/3408#issuecomment-1710648063

   Kudos, SonarCloud Quality Gate passed!  [![Quality Gate 
passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png
 'Quality Gate 
passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3408)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=BUG)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=BUG)
  
   
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png
 
'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=VULNERABILITY)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=VULNERABILITY)
  
   [![Security 
Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png
 'Security 
Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3408=false=SECURITY_HOTSPOT)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3408=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3408=false=SECURITY_HOTSPOT)
  
   [![Code 
Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png
 'Code 
Smell')](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=CODE_SMELL)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=CODE_SMELL)
 [4 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=CODE_SMELL)
   
   
[![99.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png
 
'99.0%')](https://sonarcloud.io/component_measures?id=apache_calcite=3408=new_coverage=list)
 [99.0% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3408=new_coverage=list)
  
   
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png
 
'0.0%')](https://sonarcloud.io/component_measures?id=apache_calcite=3408=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3408=new_duplicated_lines_density=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [calcite] sonarcloud[bot] commented on pull request #3408: [CALCITE-5978] Add REGEXP_INSTR function (enabled in BigQuery library)

2023-09-07 Thread via GitHub


sonarcloud[bot] commented on PR #3408:
URL: https://github.com/apache/calcite/pull/3408#issuecomment-1710619899

   Kudos, SonarCloud Quality Gate passed!  [![Quality Gate 
passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png
 'Quality Gate 
passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3408)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=BUG)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=BUG)
  
   
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png
 
'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=VULNERABILITY)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=VULNERABILITY)
  
   [![Security 
Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png
 'Security 
Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3408=false=SECURITY_HOTSPOT)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3408=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3408=false=SECURITY_HOTSPOT)
  
   [![Code 
Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png
 'Code 
Smell')](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=CODE_SMELL)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=CODE_SMELL)
 [4 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3408=false=CODE_SMELL)
   
   
[![98.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png
 
'98.0%')](https://sonarcloud.io/component_measures?id=apache_calcite=3408=new_coverage=list)
 [98.0% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3408=new_coverage=list)
  
   
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png
 
'0.0%')](https://sonarcloud.io/component_measures?id=apache_calcite=3408=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3408=new_duplicated_lines_density=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [calcite] tanclary commented on a diff in pull request #3408: [CALCITE-5978] Add REGEXP_INSTR function (enabled in BigQuery library)

2023-09-07 Thread via GitHub


tanclary commented on code in PR #3408:
URL: https://github.com/apache/calcite/pull/3408#discussion_r1318980163


##
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##
@@ -404,16 +404,39 @@ private Pattern validateRegexPattern(String regex, String 
methodName) {
   }
 }
 
-/** Helper for multiple capturing group regex check in REGEXP_EXTRACT fns. 
*/
+/** Helper for multiple capturing group regex check in REGEXP_* fns. */
 private void checkMultipleCapturingGroupsInRegex(Matcher matcher, String 
methodName) {
   if (matcher.groupCount() > 1) {
 throw RESOURCE.multipleCapturingGroupsForRegexpExtract(
 Integer.toString(matcher.groupCount()), methodName).ex();
   }
 }
 
+/** Helper for checking values of position and occurrence arguments in 
REGEXP_* fns.
+ *  Regex Fns not using occurrencePosition param pass a default value as 0.
+ *  Throws an exception or returns true in case of failed value checks. */
+private boolean checkPosOccurrenceParamValues(int position,
+int occurrence, int occurrencePosition, String value, String 
methodName) {
+  if (position <= 0) {
+throw 
RESOURCE.invalidIntegerInputForRegexpFunctions(Integer.toString(position),
+"position", methodName).ex();
+  }
+  if (occurrence <= 0) {
+throw 
RESOURCE.invalidIntegerInputForRegexpFunctions(Integer.toString(occurrence),
+"occurrence", methodName).ex();
+  }
+  if (occurrencePosition < 0 || occurrencePosition > 1) {

Review Comment:
   nit: would it be better to change this to != 0 && != 1? I feel like that 
makes it more clear that the only options are 0 or 1. Maybe I am just bad at 
reading math comparisons though. This isn't a big enough comment to worry about 
if I don't leave others.



##
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##
@@ -488,13 +502,74 @@ public List regexpExtractAll(String value, String 
regex) {
   ImmutableList.Builder matches = ImmutableList.builder();
   while (matcher.find()) {
 String match = matcher.group(matcher.groupCount());
-if (match != null && !match.isEmpty()) {
+if (match != null) {
   matches.add(match);
 }
   }
   return matches.build();
 }
 
+/** SQL {@code REGEXP_INSTR(value, regexp)} function.
+ *  Returns 0 if there is no match or regex is empty. Returns an exception 
if regex is invalid.

Review Comment:
   based on other javadocs in sqlfunctions I think this should only be one 
space.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [calcite] sonarcloud[bot] commented on pull request #3324: [CALCITE-5862] Incorrect semantics of ARRAY function(Spark library) when elements have Numeric and Character types

2023-09-07 Thread via GitHub


sonarcloud[bot] commented on PR #3324:
URL: https://github.com/apache/calcite/pull/3324#issuecomment-1710555631

   Kudos, SonarCloud Quality Gate passed!  [![Quality Gate 
passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png
 'Quality Gate 
passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3324)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3324=false=BUG)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3324=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3324=false=BUG)
  
   
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png
 
'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite=3324=false=VULNERABILITY)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3324=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3324=false=VULNERABILITY)
  
   [![Security 
Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png
 'Security 
Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3324=false=SECURITY_HOTSPOT)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3324=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3324=false=SECURITY_HOTSPOT)
  
   [![Code 
Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png
 'Code 
Smell')](https://sonarcloud.io/project/issues?id=apache_calcite=3324=false=CODE_SMELL)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3324=false=CODE_SMELL)
 [0 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3324=false=CODE_SMELL)
   
   
[![93.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png
 
'93.0%')](https://sonarcloud.io/component_measures?id=apache_calcite=3324=new_coverage=list)
 [93.0% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3324=new_coverage=list)
  
   
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png
 
'0.0%')](https://sonarcloud.io/component_measures?id=apache_calcite=3324=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3324=new_duplicated_lines_density=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [calcite] tanclary commented on pull request #3324: [CALCITE-5862] Incorrect semantics of ARRAY function(Spark library) when elements have Numeric and Character types

2023-09-07 Thread via GitHub


tanclary commented on PR #3324:
URL: https://github.com/apache/calcite/pull/3324#issuecomment-1710553211

   @chucheng92 Yes I think this looks good but I will wait for @JiajunBernoulli 
to approve/give + 1 because they also had some comments if I remember correctly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [calcite] chucheng92 commented on pull request #3324: [CALCITE-5862] Incorrect semantics of ARRAY function(Spark library) when elements have Numeric and Character types

2023-09-07 Thread via GitHub


chucheng92 commented on PR #3324:
URL: https://github.com/apache/calcite/pull/3324#issuecomment-1710540034

   hi, @tanclary It’s been a long time since this PR was created, could we 
continue on this PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [calcite] sonarcloud[bot] commented on pull request #3326: CALCITE-5860 Set scale when casting Decimal

2023-09-07 Thread via GitHub


sonarcloud[bot] commented on PR #3326:
URL: https://github.com/apache/calcite/pull/3326#issuecomment-1710503904

   Kudos, SonarCloud Quality Gate passed!  [![Quality Gate 
passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png
 'Quality Gate 
passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3326)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3326=false=BUG)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3326=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3326=false=BUG)
  
   
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png
 
'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite=3326=false=VULNERABILITY)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3326=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3326=false=VULNERABILITY)
  
   [![Security 
Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png
 'Security 
Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3326=false=SECURITY_HOTSPOT)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3326=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3326=false=SECURITY_HOTSPOT)
  
   [![Code 
Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png
 'Code 
Smell')](https://sonarcloud.io/project/issues?id=apache_calcite=3326=false=CODE_SMELL)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3326=false=CODE_SMELL)
 [3 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3326=false=CODE_SMELL)
   
   
[![90.7%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png
 
'90.7%')](https://sonarcloud.io/component_measures?id=apache_calcite=3326=new_coverage=list)
 [90.7% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3326=new_coverage=list)
  
   
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png
 
'0.0%')](https://sonarcloud.io/component_measures?id=apache_calcite=3326=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3326=new_duplicated_lines_density=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [calcite] sonarcloud[bot] commented on pull request #3410: [CALCITE-5971] Add the RelRule to rewrite the bernoulli sample as Filter

2023-09-07 Thread via GitHub


sonarcloud[bot] commented on PR #3410:
URL: https://github.com/apache/calcite/pull/3410#issuecomment-1710094291

   Kudos, SonarCloud Quality Gate passed!  [![Quality Gate 
passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png
 'Quality Gate 
passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3410)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=BUG)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=BUG)
  
   
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png
 
'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=VULNERABILITY)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=VULNERABILITY)
  
   [![Security 
Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png
 'Security 
Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3410=false=SECURITY_HOTSPOT)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3410=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3410=false=SECURITY_HOTSPOT)
  
   [![Code 
Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png
 'Code 
Smell')](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=CODE_SMELL)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=CODE_SMELL)
 [0 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=CODE_SMELL)
   
   
[![100.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/100-16px.png
 
'100.0%')](https://sonarcloud.io/component_measures?id=apache_calcite=3410=new_coverage=list)
 [100.0% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3410=new_coverage=list)
  
   
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png
 
'0.0%')](https://sonarcloud.io/component_measures?id=apache_calcite=3410=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3410=new_duplicated_lines_density=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [calcite] sonarcloud[bot] commented on pull request #3410: [CALCITE-5971] Add the RelRule to rewrite the bernoulli sample as Filter

2023-09-07 Thread via GitHub


sonarcloud[bot] commented on PR #3410:
URL: https://github.com/apache/calcite/pull/3410#issuecomment-1710094213

   Kudos, SonarCloud Quality Gate passed!  [![Quality Gate 
passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png
 'Quality Gate 
passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3410)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=BUG)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=BUG)
  
   
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png
 
'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=VULNERABILITY)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=VULNERABILITY)
  
   [![Security 
Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png
 'Security 
Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3410=false=SECURITY_HOTSPOT)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3410=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3410=false=SECURITY_HOTSPOT)
  
   [![Code 
Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png
 'Code 
Smell')](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=CODE_SMELL)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=CODE_SMELL)
 [0 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3410=false=CODE_SMELL)
   
   
[![100.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/100-16px.png
 
'100.0%')](https://sonarcloud.io/component_measures?id=apache_calcite=3410=new_coverage=list)
 [100.0% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3410=new_coverage=list)
  
   
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png
 
'0.0%')](https://sonarcloud.io/component_measures?id=apache_calcite=3410=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3410=new_duplicated_lines_density=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [calcite] chucheng92 commented on pull request #3405: [CALCITE-5961] Type inference of ARRAY_COMPACT is incorrect

2023-09-07 Thread via GitHub


chucheng92 commented on PR #3405:
URL: https://github.com/apache/calcite/pull/3405#issuecomment-1710071252

   hi, @NobiGo. If there are no new reviewers to give a comment. Would you help 
to merge this? thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [calcite] rubenada commented on pull request #3311: [CALCITE-5732] EnumerableHashJoin and EnumerableMergeJoin on composite key return rows matching condition 'null = null'

2023-09-07 Thread via GitHub


rubenada commented on PR #3311:
URL: https://github.com/apache/calcite/pull/3311#issuecomment-1710023196

   Thanks for the review @libenchao .
   I'll merge the PR in 24h if no further comments appear.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [calcite] LakeShen commented on a diff in pull request #3404: [CALCITE-5968] Provide an interface for RexExecutable to decouple janino runtime binding

2023-09-07 Thread via GitHub


LakeShen commented on code in PR #3404:
URL: https://github.com/apache/calcite/pull/3404#discussion_r1318408293


##
core/src/test/java/org/apache/calcite/rex/RexExecutorTest.java:
##
@@ -378,4 +383,140 @@ public void run() {
   interface Action {
 void check(RexBuilder rexBuilder, RexExecutorImpl executor);
   }
+
+  /**
+   * ArrayList-based DataContext to check Rex execution.
+   */
+  public static class TestDataContext extends SingleValueDataContext {
+private TestDataContext(Object[] values) {
+  super("inputRecord", values);
+}
+  }
+
+  /**
+   * Context that holds a value for a particular context name.
+   */
+  static class SingleValueDataContext implements DataContext {
+private final String name;
+private final Object value;
+
+SingleValueDataContext(String name, Object value) {
+  this.name = name;
+  this.value = value;
+}
+
+public SchemaPlus getRootSchema() {
+  throw new RuntimeException("Unsupported");
+}
+
+public JavaTypeFactory getTypeFactory() {
+  throw new RuntimeException("Unsupported");
+}
+
+public QueryProvider getQueryProvider() {
+  throw new RuntimeException("Unsupported");
+}
+
+public Object get(String name) {
+  if (this.name.equals(name)) {
+return value;
+  } else {
+throw new RuntimeException("Wrong DataContext access");
+  }
+}
+  }
+
+  /**
+   * User defined executable.
+   */
+  static class UserExecutable implements RexExecutable {
+final RexBuilder rexBuilder;
+final List exps;
+DataContext dataContext;
+UserExecutable(final RexBuilder rexBuilder, final List exps) {
+  assert exps != null && exps.size() == 1;
+  this.rexBuilder = rexBuilder;
+  this.exps = exps;
+}
+@Override public void reduce(RexBuilder rexBuilder, List 
constExps,
+List reducedValues) {
+  Object[] values;
+  try {
+values = execute();
+assert values.length == constExps.size();
+final List valueList = Arrays.asList(values);
+for (Pair value : Pair.zip(constExps, valueList)) {
+  reducedValues.add(
+  rexBuilder.makeLiteral(value.right, value.left.getType(), true));
+}
+  } catch (RuntimeException e) {
+// One or more of the expressions failed.
+// Don't reduce any of the expressions.
+reducedValues.addAll(constExps);
+  }
+}
+@Override public void setDataContext(DataContext dataContext) {
+  this.dataContext = dataContext;
+}
+@Override public Object[] execute() {
+  final RexNode exp = exps.get(0);
+  assert exp instanceof RexCall;
+  RexCall call = (RexCall) exp;
+  // NOTE: this isn't a correct substring function implementation, only 
for testing
+  if (!call.op.getName().equals("SUBSTRING")) {
+throw new RuntimeException("not supported");
+  }
+  assert call.getOperands().get(0) instanceof RexInputRef;
+  assert call.getOperands().get(1) instanceof RexLiteral;
+  String str = (String) ((Object[]) dataContext.get("inputRecord"))[0];
+  Integer startIndex = ((RexLiteral) 
call.getOperands().get(1)).getValueAs(Integer.class);
+  Object[] values = new Object[1];
+  values[0] = str.substring(startIndex - 1);
+  return values;
+}
+  }
+  /**
+   * User defined executor.
+   */
+  static class UserExecutor implements RexExecutor {
+@Override public void reduce(RexBuilder rexBuilder, List 
constExps,
+List reducedValues) {
+  this.getExecutable(rexBuilder, constExps, null).reduce(rexBuilder, 
constExps, reducedValues);
+}
+@Override public RexExecutable getExecutable(RexBuilder rexBuilder, 
List exps,
+RelDataType rowType) {
+  return new UserExecutable(rexBuilder, exps);
+}
+  }
+  @Test public void userExecutorTest() throws Exception {
+check((rexBuilder, executor) -> {
+  Object[] values = new Object[1];
+  final DataContext testContext = new TestDataContext(values);
+  final RelDataTypeFactory typeFactory = rexBuilder.getTypeFactory();
+  final RelDataType varchar =
+  typeFactory.createSqlType(SqlTypeName.VARCHAR);
+  final RelDataType integer =
+  typeFactory.createSqlType(SqlTypeName.INTEGER);
+  // Calcite is internally creating the input ref via a RexRangeRef
+  // which eventually leads to a RexInputRef. So we are good.
+  final RexInputRef input = rexBuilder.makeInputRef(varchar, 0);
+  final RexNode lengthArg = rexBuilder.makeLiteral(3, integer, true);
+  final RexNode substr =
+  rexBuilder.makeCall(SqlStdOperatorTable.SUBSTRING, input,
+  lengthArg);
+  ImmutableList constExps = ImmutableList.of(substr);
+  final RelDataType rowType = typeFactory.builder()
+  .add("someStr", varchar)
+  .build();
+  RexExecutor useExecutor = new UserExecutor();
+  final RexExecutable exec =

Review 

[GitHub] [calcite] LakeShen commented on pull request #3406: [CALCITE-5974] Fix bug when es index mapping set dynamic_templates without properties

2023-09-07 Thread via GitHub


LakeShen commented on PR #3406:
URL: https://github.com/apache/calcite/pull/3406#issuecomment-1709895369

   Hi @zoov-w ,don't begin with fix to the title of a JIRA, should describe the 
problem behavior.
   
   BTW, you could rebase the latest code of main branch,the commits and files 
changed will be back to normal.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [calcite] macroguo-ghy commented on pull request #3389: [CALCITE-5935] Add CODE_POINTS_TO_BYTES function (enabled in BigQuery…

2023-09-07 Thread via GitHub


macroguo-ghy commented on PR #3389:
URL: https://github.com/apache/calcite/pull/3389#issuecomment-1709734955

   I have rebased and squashed it. @tanclary 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [calcite] sonarcloud[bot] commented on pull request #3404: [CALCITE-5968] Provide an interface for RexExecutable to decouple janino runtime binding

2023-09-07 Thread via GitHub


sonarcloud[bot] commented on PR #3404:
URL: https://github.com/apache/calcite/pull/3404#issuecomment-1709544266

   Kudos, SonarCloud Quality Gate passed!  [![Quality Gate 
passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png
 'Quality Gate 
passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3404)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3404=false=BUG)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3404=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3404=false=BUG)
  
   
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png
 
'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite=3404=false=VULNERABILITY)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3404=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3404=false=VULNERABILITY)
  
   [![Security 
Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png
 'Security 
Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3404=false=SECURITY_HOTSPOT)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3404=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3404=false=SECURITY_HOTSPOT)
  
   [![Code 
Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png
 'Code 
Smell')](https://sonarcloud.io/project/issues?id=apache_calcite=3404=false=CODE_SMELL)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_calcite=3404=false=CODE_SMELL)
 [3 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3404=false=CODE_SMELL)
   
   
[![83.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png
 
'83.0%')](https://sonarcloud.io/component_measures?id=apache_calcite=3404=new_coverage=list)
 [83.0% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3404=new_coverage=list)
  
   
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png
 
'0.0%')](https://sonarcloud.io/component_measures?id=apache_calcite=3404=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3404=new_duplicated_lines_density=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org