[GitHub] [calcite] sonarcloud[bot] commented on pull request #3196: [CALCITE-5691] IN sub-query inside FILTER clause throws IndexOutOfBoundsException

2023-05-10 Thread via GitHub


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

   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=3196)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3196=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=3196=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3196=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=3196=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=3196=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3196=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=3196=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=3196=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3196=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=3196=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=3196=false=CODE_SMELL)
 [0 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3196=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=3196=new_coverage=list)
 [100.0% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3196=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=3196=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3196=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] herunkang2018 opened a new pull request, #3196: [CALCITE-5691] IN sub-query inside FILTER clause throws IndexOutOfBoundsException

2023-05-10 Thread via GitHub


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

   (no comment)


-- 
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 #3194: [CALCITE-5695] Add MAP_KEYS, MAP_VALUES function (enabled in Spark li…

2023-05-10 Thread via GitHub


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

   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=3194)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3194=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=3194=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3194=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=3194=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=3194=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3194=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=3194=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=3194=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3194=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=3194=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=3194=false=CODE_SMELL)
 [6 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3194=false=CODE_SMELL)
   
   
[![95.5%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png
 
'95.5%')](https://sonarcloud.io/component_measures?id=apache_calcite=3194=new_coverage=list)
 [95.5% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3194=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=3194=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3194=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] liuyongvs commented on a diff in pull request #3194: [CALCITE-5695] Add MAP_KEYS, MAP_VALUES function (enabled in Spark li…

2023-05-10 Thread via GitHub


liuyongvs commented on code in PR #3194:
URL: https://github.com/apache/calcite/pull/3194#discussion_r1190558850


##
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##
@@ -5361,6 +5361,28 @@ private static void checkIf(SqlOperatorFixture f) {
 f.checkNull("array_length(null)");
   }
 
+  /** Tests {@code MAP_KEYS} function from Spark. */
+  @Test void testMapKeysFunc() {
+final SqlOperatorFixture f = fixture()
+.setFor(SqlLibraryOperators.MAP_KEYS)

Review Comment:
   added @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] liuyongvs commented on a diff in pull request #3194: [CALCITE-5695] Add MAP_KEYS, MAP_VALUES function (enabled in Spark li…

2023-05-10 Thread via GitHub


liuyongvs commented on code in PR #3194:
URL: https://github.com/apache/calcite/pull/3194#discussion_r1190558694


##
site/_docs/reference.md:
##
@@ -2723,6 +2723,8 @@ BigQuery's type system uses confusingly different names 
for types and functions:
 | m | TO_BASE64(string)  | Converts the *string* 
to base-64 encoded form and returns a encoded string
 | b m | FROM_BASE64(string)  | Returns the decoded 
result of a base-64 *string* as a string
 | b o | LTRIM(string)| Returns *string* with 
all blanks removed from the start
+| s | MAP_KEYS(map)  | Returns an unordered 
array containing the keys of the map.

Review Comment:
   fixed @julianhyde 



-- 
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 #3189: [CALCITE-5674] Cast expr to target type should respect nullable when …

2023-05-10 Thread via GitHub


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

   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=3189)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3189=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=3189=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3189=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=3189=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=3189=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3189=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=3189=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=3189=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3189=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=3189=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=3189=false=CODE_SMELL)
 [1 Code 
Smell](https://sonarcloud.io/project/issues?id=apache_calcite=3189=false=CODE_SMELL)
   
   
[![78.7%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png
 
'78.7%')](https://sonarcloud.io/component_measures?id=apache_calcite=3189=new_coverage=list)
 [78.7% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3189=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=3189=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3189=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-avatica] julianhyde closed pull request #218: CALCITE-5678 Validate incorrect datetime string representation

2023-05-10 Thread via GitHub


julianhyde closed pull request #218: CALCITE-5678 Validate incorrect datetime 
string representation
URL: https://github.com/apache/calcite-avatica/pull/218


-- 
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-avatica] branch main updated: [CALCITE-5678] Validate date, time and timestamp literals per ISO-8601

2023-05-10 Thread jhyde
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 05e07c151 [CALCITE-5678] Validate date, time and timestamp literals 
per ISO-8601
05e07c151 is described below

commit 05e07c151a47e5225b67084abb2e2b9fe161a30d
Author: zstan 
AuthorDate: Thu Apr 27 13:17:55 2023 +0300

[CALCITE-5678] Validate date, time and timestamp literals per ISO-8601

Close apache/calcite-avatica#218
---
 .../apache/calcite/avatica/util/DateTimeUtils.java |  99 +++-
 .../calcite/avatica/util/DateTimeUtilsTest.java| 102 -
 .../util/TimestampFromNumberAccessorTest.java  |   6 ++
 3 files changed, 202 insertions(+), 5 deletions(-)

diff --git 
a/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java 
b/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
index 144d024ce..3c988a140 100644
--- a/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
+++ b/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
@@ -30,6 +30,8 @@ import java.util.Calendar;
 import java.util.Date;
 import java.util.Locale;
 import java.util.TimeZone;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * Utility functions for datetime types: date, time, timestamp.
@@ -57,6 +59,14 @@ public class DateTimeUtils {
   public static final String TIMESTAMP_FORMAT_STRING =
   DATE_FORMAT_STRING + " " + TIME_FORMAT_STRING;
 
+  /** Regex for date, -MM-DD. */
+  private static final Pattern ISO_DATE_PATTERN =
+  Pattern.compile("^(\\d{4})-([0]\\d|1[0-2])-([0-2]\\d|3[01])$");
+
+  /** Regex for time, HH:MM:SS. */
+  private static final Pattern ISO_TIME_PATTERN =
+  Pattern.compile("^([0-2]\\d):[0-5]\\d:[0-5]\\d(\\.\\d*)*$");
+
   /** The GMT time zone.
*
* @deprecated Use {@link #UTC_ZONE} */
@@ -729,15 +739,100 @@ public class DateTimeUtils {
 return r;
   }
 
+  private static void validateDate(String s, String full) {
+Matcher matcher = ISO_DATE_PATTERN.matcher(s);
+if (matcher.find()) {
+  int year = Integer.parseInt(matcher.group(1));
+  int month = Integer.parseInt(matcher.group(2));
+  int day = Integer.parseInt(matcher.group(3));
+  if (day > daysInMonth(year, month)) {
+throw fieldOutOfRange("DAY", full);
+  }
+} else {
+  throw invalidType("DATE", full);
+}
+  }
+
+  /** Returns the number of days in a month in the proleptic Gregorian calendar
+   * used by ISO-8601.
+   *
+   * "Proleptic" means that we apply the calendar to dates before the
+   * Gregorian calendar was invented (in 1582). Thus, years 0 and 1200 are
+   * considered leap years, and 1500 is not. */
+  private static int daysInMonth(int year, int month) {
+switch (month) {
+case 9:
+case 4:
+case 6:
+case 11:
+// Thirty days hath September,
+// April, June, and November,
+  return 30;
+
+default:
+  // All the rest have thirty-one,
+  return 31;
+
+case 2:
+  // Except February, twenty-eight days clear,
+  // And twenty-nine in each leap year.
+  return isLeapYear(year) ? 29 : 28;
+}
+  }
+
+  /** Whether a year is considered a leap year in the proleptic Gregorian
+   * calendar. */
+  private static boolean isLeapYear(int year) {
+return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
+  }
+
+  private static void validateTime(String time, String full) {
+Matcher matcher = ISO_TIME_PATTERN.matcher(time);
+if (matcher.find()) {
+  int hour = Integer.parseInt(matcher.group(1));
+  if (hour > 23) {
+throw fieldOutOfRange("HOUR", full);
+  }
+} else {
+  throw invalidType("TIME", full);
+}
+  }
+
+  private static IllegalArgumentException fieldOutOfRange(String field,
+  String full) {
+return new IllegalArgumentException("Value of " + field
++ " field is out of range in '" + full + "'");
+  }
+
+  private static IllegalArgumentException invalidType(String type,
+  String full) {
+return new IllegalArgumentException("Invalid " + type + " value, '"
++ full + "'");
+  }
+
   public static long timestampStringToUnixDate(String s) {
+try {
+  return timestampStringToUnixDate0(s);
+} catch (NumberFormatException e) {
+  throw new IllegalArgumentException(e.getMessage());
+}
+  }
+
+  private static long timestampStringToUnixDate0(String s) {
 final long d;
 final long t;
 s = s.trim();
 int space = s.indexOf(' ');
 if (space >= 0) {
-  d = dateStringToUnixDate(s.substring(0, space));
-  t = timeStringToUnixDate(s, space + 1);
+  String datePart = s.substring(0, space);
+  validateDate(datePart, s);
+  d = dateStringToUnixDate(datePart);
+
+  String timePart = 

[GitHub] [calcite] julianhyde commented on a diff in pull request #3179: [CALCITE-5676] Set `DATA_TYPE` and `TYPE_NAME` metadata values for `MEASURE` types

2023-05-10 Thread via GitHub


julianhyde commented on code in PR #3179:
URL: https://github.com/apache/calcite/pull/3179#discussion_r1190362519


##
core/src/test/java/org/apache/calcite/test/JdbcFrontLinqBackTest.java:
##
@@ -343,12 +356,13 @@ private CalciteAssert.AssertThat mutable(
 .with(makePostProcessor(employees));
   }
 
-  static AbstractModifiableTable mutable(String tableName,

Review Comment:
   Rather than creating a weird implementation of type factory, could you not 
just override getRowType so that `sal` has a measure type?



-- 
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] julianhyde commented on a diff in pull request #3179: [CALCITE-5676] Set `DATA_TYPE` and `TYPE_NAME` metadata values for `MEASURE` types

2023-05-10 Thread via GitHub


julianhyde commented on code in PR #3179:
URL: https://github.com/apache/calcite/pull/3179#discussion_r1190359548


##
core/src/test/java/org/apache/calcite/test/JdbcFrontLinqBackTest.java:
##
@@ -343,12 +356,13 @@ private CalciteAssert.AssertThat mutable(
 .with(makePostProcessor(employees));
   }
 
-  static AbstractModifiableTable mutable(String tableName,

Review Comment:
   It doesn't seem right to pass a type factory into a table constructor. I 
know these are only mock tables for testing. But tables have a lifetime longer 
than a single statement, therefore longer than a type factory. That's why 
`getRowType` takes a type factory as an argument.



-- 
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] julianhyde commented on a diff in pull request #3179: [CALCITE-5676] Set `DATA_TYPE` and `TYPE_NAME` metadata values for `MEASURE` types

2023-05-10 Thread via GitHub


julianhyde commented on code in PR #3179:
URL: https://github.com/apache/calcite/pull/3179#discussion_r1190355718


##
core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java:
##
@@ -837,8 +837,16 @@ private static ColumnMetaData.AvaticaType 
avaticaType(JavaTypeFactory typeFactor
 : origins.get(origins.size() - 1 - offsetFromEnd);
   }
 
-  private static int getTypeOrdinal(RelDataType type) {
-return type.getSqlTypeName().getJdbcOrdinal();
+  public static int getTypeOrdinal(RelDataType type) {

Review Comment:
   As a public method, this needs javadoc.
   
   Formatting looks off.
   
   Also, I'd save a few lines by avoiding assigning to the variable, just 
`return` immediately.



-- 
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] julianhyde commented on a diff in pull request #3179: [CALCITE-5676] Set `DATA_TYPE` and `TYPE_NAME` metadata values for `MEASURE` types

2023-05-10 Thread via GitHub


julianhyde commented on code in PR #3179:
URL: https://github.com/apache/calcite/pull/3179#discussion_r1190355718


##
core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java:
##
@@ -837,8 +837,16 @@ private static ColumnMetaData.AvaticaType 
avaticaType(JavaTypeFactory typeFactor
 : origins.get(origins.size() - 1 - offsetFromEnd);
   }
 
-  private static int getTypeOrdinal(RelDataType type) {
-return type.getSqlTypeName().getJdbcOrdinal();
+  public static int getTypeOrdinal(RelDataType type) {

Review Comment:
   formatting looks off. Also, I'd save a few lines by avoiding assigning to 
the variable, just `return` immediately



-- 
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] julianhyde commented on a diff in pull request #3194: [CALCITE-5695] Add MAP_KEYS, MAP_VALUES function (enabled in Spark li…

2023-05-10 Thread via GitHub


julianhyde commented on code in PR #3194:
URL: https://github.com/apache/calcite/pull/3194#discussion_r1190352269


##
site/_docs/reference.md:
##
@@ -2723,6 +2723,8 @@ BigQuery's type system uses confusingly different names 
for types and functions:
 | m | TO_BASE64(string)  | Converts the *string* 
to base-64 encoded form and returns a encoded string
 | b m | FROM_BASE64(string)  | Returns the decoded 
result of a base-64 *string* as a string
 | b o | LTRIM(string)| Returns *string* with 
all blanks removed from the start
+| s | MAP_KEYS(map)  | Returns an unordered 
array containing the keys of the map.

Review Comment:
   remove '.'



-- 
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] allai5 closed pull request #3195: Alice/support join using compound identifiers

2023-05-10 Thread via GitHub


allai5 closed pull request #3195: Alice/support join using compound identifiers
URL: https://github.com/apache/calcite/pull/3195


-- 
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] allai5 opened a new pull request, #3195: Alice/support join using compound identifiers

2023-05-10 Thread via GitHub


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

   (no comment)


-- 
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] HanumathRao commented on a diff in pull request #3193: [CALCITE-5683] Two level nested correlated subquery throws an excepti…

2023-05-10 Thread via GitHub


HanumathRao commented on code in PR #3193:
URL: https://github.com/apache/calcite/pull/3193#discussion_r1190174369


##
core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java:
##
@@ -6823,6 +6824,65 @@ private void checkSemiJoinRuleOnAntiJoin(RelOptRule 
rule) {
 .checkUnchanged();
   }
 
+  /** Test case for CALCITE-5683 for two level nested decorrelate with 
standard program
+   * failing during the decorrelation phase. */
+  @Test void testTwoLevelDecorrelate() {

Review Comment:
   @libenchao Thanks for reviewing the PR. Yeah this test case is different in 
style because the issue is showing up only with standard program. Let me know 
if there is a better place(file) to add these test cases.



-- 
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 #3194: [CALCITE-5695] Add MAP_KEYS, MAP_VALUES function (enabled in Spark li…

2023-05-10 Thread via GitHub


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


##
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##
@@ -5361,6 +5361,28 @@ private static void checkIf(SqlOperatorFixture f) {
 f.checkNull("array_length(null)");
   }
 
+  /** Tests {@code MAP_KEYS} function from Spark. */
+  @Test void testMapKeysFunc() {
+final SqlOperatorFixture f = fixture()
+.setFor(SqlLibraryOperators.MAP_KEYS)

Review Comment:
   I think it could be good to write a test that fails if library is not set to 
Spark (you only want it to work for Spark).



-- 
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 #3189: [CALCITE-5674] Cast expr to target type should respect nullable when …

2023-05-10 Thread via GitHub


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

   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=3189)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3189=false=BUG)
 
[![C](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/C-16px.png
 
'C')](https://sonarcloud.io/project/issues?id=apache_calcite=3189=false=BUG)
 [5 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3189=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=3189=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=3189=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3189=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=3189=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=3189=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3189=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=3189=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=3189=false=CODE_SMELL)
 [0 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3189=false=CODE_SMELL)
   
   
[![78.7%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png
 
'78.7%')](https://sonarcloud.io/component_measures?id=apache_calcite=3189=new_coverage=list)
 [78.7% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3189=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=3189=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3189=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-avatica] stoty commented on pull request #217: CALCITE-5581: Client side LB implementation

2023-05-10 Thread via GitHub


stoty commented on PR #217:
URL: https://github.com/apache/calcite-avatica/pull/217#issuecomment-1542101644

   One more thing, @vaijosh .
   Please change the commit message to match the Avatica convention.
   i.e. use square brackets instead of colon.


-- 
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 #3189: [CALCITE-5674] Cast expr to target type should respect nullable when …

2023-05-10 Thread via GitHub


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

   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=3189)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3189=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=3189=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3189=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=3189=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=3189=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3189=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=3189=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=3189=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3189=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=3189=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=3189=false=CODE_SMELL)
 [0 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3189=false=CODE_SMELL)
   
   
[![78.7%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png
 
'78.7%')](https://sonarcloud.io/component_measures?id=apache_calcite=3189=new_coverage=list)
 [78.7% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3189=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=3189=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3189=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] liuyongvs commented on a diff in pull request #3194: [CALCITE-5695] Add MAP_KEYS, MAP_VALUES function (enabled in Spark li…

2023-05-10 Thread via GitHub


liuyongvs commented on code in PR #3194:
URL: https://github.com/apache/calcite/pull/3194#discussion_r1189758110


##
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##
@@ -3797,6 +3798,16 @@ public static List distinct(List list) {
 return new ArrayList<>(result);
   }
 
+  /** Support the MAP_KEYS function. */
+  public static List mapKeys(Map map) {
+return (List) map.keySet().stream().collect(Collectors.toList());

Review Comment:
   and why i doesn't add unit test map_keys(cast(null as map[keyType, 
valueType])) is because the calcite doesn't supported, which you can see here 
https://github.com/apache/calcite/pull/3189
   java.lang.RuntimeException: Error while parsing query: select 
cast(map['washington', 1, null, 44] as map[CHAR(10), INTEGER NOT NULL>] from 
(values (1))
at 
org.apache.calcite.sql.test.AbstractSqlTester.parseAndValidate(AbstractSqlTester.java:157)
at 
org.apache.calcite.sql.test.AbstractSqlTester.validateAndThen(AbstractSqlTester.java:248)
at 
org.apache.calcite.sql.test.AbstractSqlTester.checkColumnType(AbstractSqlTester.java:177)
at org.apache.calcite.test.SqlValidatorFixture.columnType(



-- 
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 #3193: [CALCITE-5683] Two level nested correlated subquery throws an excepti…

2023-05-10 Thread via GitHub


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


##
core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java:
##
@@ -6823,6 +6824,65 @@ private void checkSemiJoinRuleOnAntiJoin(RelOptRule 
rule) {
 .checkUnchanged();
   }
 
+  /** Test case for CALCITE-5683 for two level nested decorrelate with 
standard program
+   * failing during the decorrelation phase. */
+  @Test void testTwoLevelDecorrelate() {

Review Comment:
   The test style is different from existing ones, could you change it to be 
the same style with existing testings? 



-- 
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] liuyongvs commented on a diff in pull request #3194: [CALCITE-5695] Add MAP_KEYS, MAP_VALUES function (enabled in Spark li…

2023-05-10 Thread via GitHub


liuyongvs commented on code in PR #3194:
URL: https://github.com/apache/calcite/pull/3194#discussion_r1189754135


##
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##
@@ -3797,6 +3798,16 @@ public static List distinct(List list) {
 return new ArrayList<>(result);
   }
 
+  /** Support the MAP_KEYS function. */
+  public static List mapKeys(Map map) {
+return (List) map.keySet().stream().collect(Collectors.toList());

Review Comment:
   @zoudan not needs. the runtime will does it like other engine
   
   
![image](https://github.com/apache/calcite/assets/6316753/eab04a04-2f3f-42b2-a871-1a7ffa6afc28)
   



-- 
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] liuyongvs commented on a diff in pull request #3194: [CALCITE-5695] Add MAP_KEYS, MAP_VALUES function (enabled in Spark li…

2023-05-10 Thread via GitHub


liuyongvs commented on code in PR #3194:
URL: https://github.com/apache/calcite/pull/3194#discussion_r1189754135


##
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##
@@ -3797,6 +3798,16 @@ public static List distinct(List list) {
 return new ArrayList<>(result);
   }
 
+  /** Support the MAP_KEYS function. */
+  public static List mapKeys(Map map) {
+return (List) map.keySet().stream().collect(Collectors.toList());

Review Comment:
   @zoudan not needs. the runtime will does it like other engine
   ![Uploading image.png…]()
   



-- 
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 #3191: [CALCITE-5693] AssertionError with UNION using CTE

2023-05-10 Thread via GitHub


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


##
core/src/test/java/org/apache/calcite/test/JdbcAdapterTest.java:
##
@@ -135,6 +135,14 @@ class JdbcAdapterTest {
 + "WHERE \"product_id\" = 1");
   }
 
+  @Test void testFilterUnionIncludingWithPlan() {

Review Comment:
   Unfortunately `JdbcAdapterTest` is not the best place for this testing 
purpose, as I said above, I prefer to add tests in `SqlValidatorTest` instead 
of `JdbcAdapterTest`.



-- 
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 #3191: [CALCITE-5693] AssertionError with UNION using CTE

2023-05-10 Thread via GitHub


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


##
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##
@@ -4021,19 +4021,30 @@ private void validateModality(SqlNode query) {
   default:
 break;
   }
+} else if (query.getKind() == SqlKind.WITH) {
+  SqlWith with = (SqlWith) query;
+  for (SqlNode item : with.withList) {
+SqlNode operand = ((SqlWithItem) item).query;
+validateModality(operand, modality);
+  }
+  validateModality(with.body, modality);
 } else {
   assert query.isA(SqlKind.SET_QUERY);
   final SqlCall call = (SqlCall) query;
   for (SqlNode operand : call.getOperandList()) {
-if (deduceModality(operand) != modality) {
-  throw newValidationError(operand,
-  Static.RESOURCE.streamSetOpInconsistentInputs());
-}
-validateModality(operand);
+validateModality(operand, modality);
   }
 }
   }
 
+  private  void validateModality(SqlNode operand, SqlModality modality) {
+if (deduceModality(operand) != modality) {
+  throw newValidationError(operand,
+  Static.RESOURCE.streamSetOpInconsistentInputs());

Review Comment:
   I don't agree, you actually enlarged the scope of this code: it is only used 
for set query before, but now it also handles with query.



##
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##
@@ -4021,19 +4021,30 @@ private void validateModality(SqlNode query) {
   default:
 break;
   }
+} else if (query.getKind() == SqlKind.WITH) {

Review Comment:
   It's a nice-to-have, not a must-have request, I'm ok with this.



-- 
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 #3194: [CALCITE-5695] Add MAP_KEYS, MAP_VALUES function (enabled in Spark li…

2023-05-10 Thread via GitHub


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

   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=3194)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3194=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=3194=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3194=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=3194=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=3194=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3194=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=3194=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=3194=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3194=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=3194=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=3194=false=CODE_SMELL)
 [6 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3194=false=CODE_SMELL)
   
   
[![95.2%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png
 
'95.2%')](https://sonarcloud.io/component_measures?id=apache_calcite=3194=new_coverage=list)
 [95.2% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3194=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=3194=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3194=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 #3194: [CALCITE-5695] Add MAP_KEYS, MAP_VALUES function (enabled in Spark li…

2023-05-10 Thread via GitHub


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

   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=3194)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3194=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=3194=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3194=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=3194=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=3194=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3194=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=3194=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=3194=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3194=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=3194=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=3194=false=CODE_SMELL)
 [6 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3194=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=3194=new_coverage=list)
 [100.0% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3194=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=3194=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3194=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] zoudan commented on a diff in pull request #3194: [CALCITE-5695] Add MAP_KEYS, MAP_VALUES function (enabled in Spark li…

2023-05-10 Thread via GitHub


zoudan commented on code in PR #3194:
URL: https://github.com/apache/calcite/pull/3194#discussion_r1189631187


##
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##
@@ -3797,6 +3798,16 @@ public static List distinct(List list) {
 return new ArrayList<>(result);
   }
 
+  /** Support the MAP_KEYS function. */
+  public static List mapKeys(Map map) {
+return (List) map.keySet().stream().collect(Collectors.toList());

Review Comment:
Then we should handle null here? It seems a NPE Exception will be thrown?



-- 
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] liuyongvs commented on a diff in pull request #3194: [CALCITE-5695] Add MAP_KEYS, MAP_VALUES function (enabled in Spark li…

2023-05-10 Thread via GitHub


liuyongvs commented on code in PR #3194:
URL: https://github.com/apache/calcite/pull/3194#discussion_r1189605267


##
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##
@@ -3797,6 +3798,16 @@ public static List distinct(List list) {
 return new ArrayList<>(result);
   }
 
+  /** Support the MAP_KEYS function. */
+  public static List mapKeys(Map map) {
+return (List) map.keySet().stream().collect(Collectors.toList());

Review Comment:
   return null @zoudan 



-- 
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] zoudan commented on a diff in pull request #3194: [CALCITE-5695] Add MAP_KEYS, MAP_VALUES function (enabled in Spark li…

2023-05-10 Thread via GitHub


zoudan commented on code in PR #3194:
URL: https://github.com/apache/calcite/pull/3194#discussion_r1189565277


##
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##
@@ -3797,6 +3798,16 @@ public static List distinct(List list) {
 return new ArrayList<>(result);
   }
 
+  /** Support the MAP_KEYS function. */
+  public static List mapKeys(Map map) {
+return (List) map.keySet().stream().collect(Collectors.toList());

Review Comment:
   what is the expected result if the input map is null?



-- 
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 #3194: [CALCITE-5695] Add MAP_KEYS, MAP_VALUES function (enabled in Spark li…

2023-05-10 Thread via GitHub


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

   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=3194)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3194=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=3194=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3194=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=3194=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=3194=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3194=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=3194=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=3194=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3194=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=3194=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=3194=false=CODE_SMELL)
 [5 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3194=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=3194=new_coverage=list)
 [100.0% 
Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3194=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=3194=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3194=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] liuyongvs commented on pull request #3194: [CALCITE-5695] Add MAP_KEYS, MAP_VALUES function (enabled in Spark li…

2023-05-10 Thread via GitHub


liuyongvs commented on PR #3194:
URL: https://github.com/apache/calcite/pull/3194#issuecomment-1541451693

   hi @JiajunBernoulli could you also help review it?


-- 
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] liuyongvs opened a new pull request, #3194: [CALCITE-5695] Add MAP_KEYS, MAP_VALUES function (enabled in Spark li…

2023-05-10 Thread via GitHub


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

   MAP_KEYS - Returns an unordered array containing the keys of the map. If the 
map itself is null, the function will return null. 
   
   MAP_VALUES - Returns an unordered array containing the values of the map. If 
the map itself is null, the function will return null. 
   
   For more details
   https://spark.apache.org/docs/latest/sql-ref-functions-builtin.html


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