[GitHub] [calcite] libenchao commented on a diff in pull request #2974: [CALCITE-5209] ArrayIndexOutOfBoundsException during SqlToRelConverter for group-by on `case` having `in` expression predicates

2023-01-14 Thread GitBox


libenchao commented on code in PR #2974:
URL: https://github.com/apache/calcite/pull/2974#discussion_r1070491944


##
core/src/test/resources/sql/agg.iq:
##
@@ -3467,4 +3467,38 @@ order by ename, deptno;
 
 !ok
 
+# Test cases for [CALCITE-5209] ArrayIndexOutOfBoundsException during 
SqlToRelConverter for group-by on `case`
+# having `in` expression predicates exceeding SqlRelConverter.Config 
InSubQueryThreshold
+!use scott
+select
+case when deptno in (1, 2, 3, 4, 5) THEN 1 else 0 end
+from emp
+group by
+case when deptno in (1, 2, 3, 4, 5) THEN 1 else 0 end;
+
+++
+| EXPR$0 |
+++
+|  0 |
+++
+(1 row)
+
+!ok
+
+!set insubquerythreshold 5
+select
+case when deptno in (1, 2, 3, 4, 5) THEN 1 else 0 end

Review Comment:
   This looks better!



-- 
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] libenchao commented on a diff in pull request #2932: [CALCITE-5304] RelJson should support RexSubQuery

2023-01-14 Thread GitBox


libenchao commented on code in PR #2932:
URL: https://github.com/apache/calcite/pull/2932#discussion_r1070270379


##
core/src/main/java/org/apache/calcite/rel/externalize/RelJson.java:
##
@@ -122,10 +127,32 @@ public RelJson withInputTranslator(InputTranslator 
inputTranslator) {
 return new RelJson(jsonBuilder, inputTranslator);
   }
 
+  /** Returns a RelJson with a given RelJsonReader. */
+  @SuppressWarnings("initialization.invalid.field.write.initialized")
+  public RelJson withRelJsonReader(@UnknownInitialization RelJsonReader 
relJsonReader) {
+this.relJsonReader = relJsonReader;
+return this;
+  }
+
+  /** Returns a RelJson with a given RelJsonWriter. */
+  @SuppressWarnings("initialization.invalid.field.write.initialized")
+  public RelJson withRelJsonWriter(@UnknownInitialization RelJsonWriter 
relJsonWriter) {
+this.relJsonWriter = relJsonWriter;
+return this;
+  }
+
   private JsonBuilder jsonBuilder() {
 return requireNonNull(jsonBuilder, "jsonBuilder");
   }
 
+  private RelJsonWriter relJsonWriter() {
+return requireNonNull(relJsonWriter, "relJsonWriter");
+  }
+
+  private RelJsonReader relJsonReader() {

Review Comment:
   Because there is a `RelNode` in `RexSubQuery`, to serialize/deserialize a 
`RelNode`, we need to use `RelJsonWriter` and `RelJsonReader`.



-- 
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 #3030: [CALCITE-5479] Adjust handling of iFormalOperand in sequence and interval checkers.

2023-01-14 Thread GitBox


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

   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&pullRequest=3030)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3030&resolved=false&types=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&pullRequest=3030&resolved=false&types=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3030&resolved=false&types=BUG)
  
   
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png
 
'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3030&resolved=false&types=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&pullRequest=3030&resolved=false&types=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3030&resolved=false&types=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&pullRequest=3030&resolved=false&types=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&pullRequest=3030&resolved=false&types=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3030&resolved=false&types=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&pullRequest=3030&resolved=false&types=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&pullRequest=3030&resolved=false&types=CODE_SMELL)
 [1 Code 
Smell](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3030&resolved=false&types=CODE_SMELL)
   
   
[![70.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png
 
'70.0%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3030&metric=new_coverage&view=list)
 [70.0% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3030&metric=new_coverage&view=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&pullRequest=3030&metric=new_duplicated_lines_density&view=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3030&metric=new_duplicated_lines_density&view=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 #3029: [CALCITE-5478] Use highest input precision for datetimes in SqlTypeFactoryImpl.leastRestrictive.

2023-01-14 Thread GitBox


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

   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&pullRequest=3029)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3029&resolved=false&types=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&pullRequest=3029&resolved=false&types=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3029&resolved=false&types=BUG)
  
   
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png
 
'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3029&resolved=false&types=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&pullRequest=3029&resolved=false&types=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3029&resolved=false&types=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&pullRequest=3029&resolved=false&types=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&pullRequest=3029&resolved=false&types=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3029&resolved=false&types=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&pullRequest=3029&resolved=false&types=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&pullRequest=3029&resolved=false&types=CODE_SMELL)
 [0 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3029&resolved=false&types=CODE_SMELL)
   
   
[![92.9%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png
 
'92.9%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3029&metric=new_coverage&view=list)
 [92.9% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3029&metric=new_coverage&view=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&pullRequest=3029&metric=new_duplicated_lines_density&view=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3029&metric=new_duplicated_lines_density&view=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] gianm opened a new pull request, #3030: [CALCITE-5479] Adjust handling of iFormalOperand in sequence and interval checkers.

2023-01-14 Thread GitBox


gianm opened a new pull request, #3030:
URL: https://github.com/apache/calcite/pull/3030

   1) Revert change from 33f4ab40bbee26e06209061c35a422f2f1e05371 that sent 
nonzero formal operands to any checkers in a sequence that are not 
FamilyOperandTypeChecker.
   
   2) Adjust IntervalOperandTypeChecker to always expect iFormalOperand as zero.
   
   Based on my understanding of how `iFormalOperand` and sequence checkers are 
supposed to work, these two changes are both bug fixes.


-- 
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 #3028: [CALCITE-5477] Prefer Util.checkArgument over Preconditions.checkArgument

2023-01-14 Thread GitBox


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

   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&pullRequest=3028)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3028&resolved=false&types=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&pullRequest=3028&resolved=false&types=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3028&resolved=false&types=BUG)
  
   
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png
 
'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3028&resolved=false&types=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&pullRequest=3028&resolved=false&types=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3028&resolved=false&types=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&pullRequest=3028&resolved=false&types=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&pullRequest=3028&resolved=false&types=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3028&resolved=false&types=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&pullRequest=3028&resolved=false&types=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&pullRequest=3028&resolved=false&types=CODE_SMELL)
 [2 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3028&resolved=false&types=CODE_SMELL)
   
   
[![67.9%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png
 
'67.9%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3028&metric=new_coverage&view=list)
 [67.9% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3028&metric=new_coverage&view=list)
  
   
[![0.7%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png
 
'0.7%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3028&metric=new_duplicated_lines_density&view=list)
 [0.7% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3028&metric=new_duplicated_lines_density&view=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] gianm opened a new pull request, #3029: [CALCITE-5478] Use highest input precision for datetimes in SqlTypeFactoryImpl.leastRestrictive.

2023-01-14 Thread GitBox


gianm opened a new pull request, #3029:
URL: https://github.com/apache/calcite/pull/3029

   Some code exists to do this for other types, but not datetimes.


-- 
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