[GitHub] [calcite] sonarcloud[bot] commented on pull request #3397: [CALCITE-5836] Implement Rel2Sql for MERGE
sonarcloud[bot] commented on PR #3397: URL: https://github.com/apache/calcite/pull/3397#issuecomment-1709406924 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=3397) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3397=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=3397=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3397=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=3397=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=3397=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3397=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=3397=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=3397=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3397=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=3397=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=3397=false=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3397=false=CODE_SMELL) [![97.8%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png '97.8%')](https://sonarcloud.io/component_measures?id=apache_calcite=3397=new_coverage=list) [97.8% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3397=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=3397=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3397=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 #3389: [CALCITE-5935] Add CODE_POINTS_TO_BYTES function (enabled in BigQuery…
sonarcloud[bot] commented on PR #3389: URL: https://github.com/apache/calcite/pull/3389#issuecomment-1709382851 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=3389) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3389=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=3389=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3389=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=3389=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=3389=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3389=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=3389=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=3389=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3389=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=3389=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=3389=false=CODE_SMELL) [4 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3389=false=CODE_SMELL) [![98.5%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png '98.5%')](https://sonarcloud.io/component_measures?id=apache_calcite=3389=new_coverage=list) [98.5% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3389=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=3389=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3389=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 #3382: [CALCITE-5944] Add metadata for Sample
sonarcloud[bot] commented on PR #3382: URL: https://github.com/apache/calcite/pull/3382#issuecomment-1709365534 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=3382) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3382=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=3382=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3382=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=3382=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=3382=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3382=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=3382=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=3382=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3382=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=3382=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=3382=false=CODE_SMELL) [1 Code Smell](https://sonarcloud.io/project/issues?id=apache_calcite=3382=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=3382=new_coverage=list) [100.0% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3382=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=3382=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3382=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 #3382: [CALCITE-5944] Add metadata for Sample
JiajunBernoulli commented on PR #3382: URL: https://github.com/apache/calcite/pull/3382#issuecomment-1709363747 Rename `inputRowCount` and rebase `main`. @rubenada Thank you~ -- 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 commented on pull request #3389: [CALCITE-5935] Add CODE_POINTS_TO_BYTES function (enabled in BigQuery…
herunkang2018 commented on PR #3389: URL: https://github.com/apache/calcite/pull/3389#issuecomment-1709299782 @macroguo-ghy LGTM. Remind that there are some duplicated commits compare to main branch, would you like to rebase from the main branch to fix 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 #3408: [CALCITE-5978] Add REGEXP_INSTR function (enabled in BigQuery library)
sonarcloud[bot] commented on PR #3408: URL: https://github.com/apache/calcite/pull/3408#issuecomment-1708895825 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] Anthrino commented on a diff in pull request #3408: [CALCITE-5978] Add REGEXP_INSTR function (enabled in BigQuery library)
Anthrino commented on code in PR #3408: URL: https://github.com/apache/calcite/pull/3408#discussion_r1317647557 ## 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. + * Uses position=1, occurrence=1, occurrencePosition=0 as default values if not specified. */ +public Integer regexpInstr(String value, String regex) { Review Comment: Yes I assumed that too, thanks will update 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] Anthrino commented on a diff in pull request #3408: [CALCITE-5978] Add REGEXP_INSTR function (enabled in BigQuery library)
Anthrino commented on code in PR #3408: URL: https://github.com/apache/calcite/pull/3408#discussion_r1317644833 ## 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) { +throw RESOURCE.invalidIntegerInputForRegexpFunctions(Integer.toString(occurrencePosition), +"occurrence_position", methodName).ex(); + } + if (position > value.length()) { +return true; + } + return false; +} + /** SQL {@code REGEXP_CONTAINS(value, regexp)} function. - * Throws a runtime exception for invalid regular expressions.*/ + * Throws a runtime exception for invalid regular expressions. */ Review Comment: yes just to align spaecs in this line with the ones above ## 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) { +throw RESOURCE.invalidIntegerInputForRegexpFunctions(Integer.toString(occurrencePosition), +"occurrence_position", methodName).ex(); + } + if (position > value.length()) { +return true; + } + return false; +} + /** SQL {@code REGEXP_CONTAINS(value, regexp)} function. - * Throws a runtime exception for invalid regular expressions.*/ + * Throws a runtime exception for invalid regular expressions. */ Review Comment: yes just to align spaces in this line with the ones above -- 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] Anthrino commented on a diff in pull request #3408: [CALCITE-5978] Add REGEXP_INSTR function (enabled in BigQuery library)
Anthrino commented on code in PR #3408: URL: https://github.com/apache/calcite/pull/3408#discussion_r1317644833 ## 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) { +throw RESOURCE.invalidIntegerInputForRegexpFunctions(Integer.toString(occurrencePosition), +"occurrence_position", methodName).ex(); + } + if (position > value.length()) { +return true; + } + return false; +} + /** SQL {@code REGEXP_CONTAINS(value, regexp)} function. - * Throws a runtime exception for invalid regular expressions.*/ + * Throws a runtime exception for invalid regular expressions. */ Review Comment: yes just to align this line with the ones above -- 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] Anthrino commented on a diff in pull request #3408: [CALCITE-5978] Add REGEXP_INSTR function (enabled in BigQuery library)
Anthrino commented on code in PR #3408: URL: https://github.com/apache/calcite/pull/3408#discussion_r1317644115 ## 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) { +throw RESOURCE.invalidIntegerInputForRegexpFunctions(Integer.toString(occurrencePosition), +"occurrence_position", methodName).ex(); + } + if (position > value.length()) { Review Comment: kept it this way since thats the failing condition, can be inverted too is that to make it more intuitive with return values true/false or for some other reason? -- 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] Anthrino commented on a diff in pull request #3408: [CALCITE-5978] Add REGEXP_INSTR function (enabled in BigQuery library)
Anthrino commented on code in PR #3408: URL: https://github.com/apache/calcite/pull/3408#discussion_r1317637600 ## 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. + * Uses position=1, occurrence=1, occurrencePosition=0 as default values if not specified. */ +public Integer regexpInstr(String value, String regex) { + return regexpInstr(value, regex, 1, 1, 0); +} + +/** SQL {@code REGEXP_INSTR(value, regexp, position)} function. + * Returns 0 if there is no match, regex is empty, or if position is beyond range. + * Returns an exception if regex or position is invalid. + * Uses occurrence=1, occurrencePosition=0 as default value when not specified. */ +public Integer regexpInstr(String value, String regex, int position) { + return regexpInstr(value, regex, position, 1, 0); +} + +/** SQL {@code REGEXP_INSTR(value, regexp, position, occurrence)} function. + * Returns NULL if there is no match, regex is empty, or if position or occurrence Review Comment: My bad missed on correcting this instance, should be aligned with the others thanks for catching 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] tanclary commented on a diff in pull request #3408: [CALCITE-5978] Add REGEXP_INSTR function (enabled in BigQuery library)
tanclary commented on code in PR #3408: URL: https://github.com/apache/calcite/pull/3408#discussion_r1317629669 ## 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. + * Uses position=1, occurrence=1, occurrencePosition=0 as default values if not specified. */ +public Integer regexpInstr(String value, String regex) { Review Comment: should we use `int` in favor of `Integer`? It seems that's what used in most other cases. ## 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. + * Uses position=1, occurrence=1, occurrencePosition=0 as default values if not specified. */ +public Integer regexpInstr(String value, String regex) { + return regexpInstr(value, regex, 1, 1, 0); +} + +/** SQL {@code REGEXP_INSTR(value, regexp, position)} function. + * Returns 0 if there is no match, regex is empty, or if position is beyond range. + * Returns an exception if regex or position is invalid. + * Uses occurrence=1, occurrencePosition=0 as default value when not specified. */ +public Integer regexpInstr(String value, String regex, int position) { + return regexpInstr(value, regex, position, 1, 0); +} + +/** SQL {@code REGEXP_INSTR(value, regexp, position, occurrence)} function. + * Returns NULL if there is no match, regex is empty, or if position or occurrence Review Comment: Is it correct that this one should return null if there is no match while others return 0? Just checking ## 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) { +throw RESOURCE.invalidIntegerInputForRegexpFunctions(Integer.toString(occurrencePosition), +"occurrence_position", methodName).ex(); + } + if (position > value.length()) { +return true; + } + return false; +} + /** SQL {@code REGEXP_CONTAINS(value, regexp)} function. - * Throws a runtime exception for invalid regular expressions.*/ + * Throws a runtime exception for invalid regular expressions. */ Review Comment: Did you mean to add this? ## 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
[GitHub] [calcite] sonarcloud[bot] commented on pull request #3408: [CALCITE-5978] Add REGEXP_INSTR function (enabled in BigQuery library)
sonarcloud[bot] commented on PR #3408: URL: https://github.com/apache/calcite/pull/3408#issuecomment-1708795300 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) [![97.9%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png '97.9%')](https://sonarcloud.io/component_measures?id=apache_calcite=3408=new_coverage=list) [97.9% 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 pull request #3389: [CALCITE-5935] Add CODE_POINTS_TO_BYTES function (enabled in BigQuery…
tanclary commented on PR #3389: URL: https://github.com/apache/calcite/pull/3389#issuecomment-1708722386 @macroguo-ghy yes, would you mind rebasing/squashing down to a final commit? Sorry for any inconvenience and delay in review I have been a bit busy. -- 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 #3396: [CALCITE-5940] Add the Rules to optimize Limit
sonarcloud[bot] commented on PR #3396: URL: https://github.com/apache/calcite/pull/3396#issuecomment-1708610510 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=3396) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3396=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=3396=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3396=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=3396=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=3396=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3396=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=3396=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=3396=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3396=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=3396=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=3396=false=CODE_SMELL) [1 Code Smell](https://sonarcloud.io/project/issues?id=apache_calcite=3396=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=3396=new_coverage=list) [83.0% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3396=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=3396=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3396=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 #3367: [CALCITE-5889] Add the RelRule that converts Minus into UNION ALL..GROUP BY...WHERE
sonarcloud[bot] commented on PR #3367: URL: https://github.com/apache/calcite/pull/3367#issuecomment-1708586323 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=3367) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3367=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=3367=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3367=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=3367=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=3367=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3367=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=3367=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=3367=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3367=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=3367=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=3367=false=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3367=false=CODE_SMELL) [![93.4%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png '93.4%')](https://sonarcloud.io/component_measures?id=apache_calcite=3367=new_coverage=list) [93.4% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3367=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=3367=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3367=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 #3395: [CALCITE-5948] Explicit casting should be made if the type of an element in ARRAY/MAP not equals with the derived component type
sonarcloud[bot] commented on PR #3395: URL: https://github.com/apache/calcite/pull/3395#issuecomment-1708446685 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=3395) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3395=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=3395=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3395=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=3395=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=3395=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3395=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=3395=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=3395=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3395=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=3395=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=3395=false=CODE_SMELL) [16 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3395=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=3395=new_coverage=list) [100.0% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3395=new_coverage=list) [![5.8%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/10-16px.png '5.8%')](https://sonarcloud.io/component_measures?id=apache_calcite=3395=new_duplicated_lines_density=list) [5.8% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3395=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 #3405: [CALCITE-5961] Type inference of ARRAY_COMPACT is incorrect
sonarcloud[bot] commented on PR #3405: URL: https://github.com/apache/calcite/pull/3405#issuecomment-1708293514 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=3405) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3405=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=3405=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3405=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=3405=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=3405=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3405=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=3405=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=3405=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3405=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=3405=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=3405=false=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3405=false=CODE_SMELL) [![94.1%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png '94.1%')](https://sonarcloud.io/component_measures?id=apache_calcite=3405=new_coverage=list) [94.1% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3405=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=3405=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3405=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 #3409: [CALCITE-5980] QuidemTests are not effectively executed on Windows
sonarcloud[bot] commented on PR #3409: URL: https://github.com/apache/calcite/pull/3409#issuecomment-1708135546 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=3409) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3409=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=3409=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3409=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=3409=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=3409=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3409=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=3409=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=3409=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3409=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=3409=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=3409=false=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3409=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=3409=new_coverage=list) [100.0% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3409=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=3409=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3409=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] rubenada opened a new pull request, #3409: [CALCITE-5980] QuidemTests are not effectively executed on Windows
rubenada opened a new pull request, #3409: URL: https://github.com/apache/calcite/pull/3409 See details in CALCITE-5980 -- 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 merged pull request #3403: [CALCITE-5967] UnsupportedOperationException while implementing a call that requires a special collator
rubenada merged PR #3403: URL: https://github.com/apache/calcite/pull/3403 -- 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-5967] UnsupportedOperationException while implementing a call that requires a special collator
This is an automated email from the ASF dual-hosted git repository. rubenql 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 164ff0a27e [CALCITE-5967] UnsupportedOperationException while implementing a call that requires a special collator 164ff0a27e is described below commit 164ff0a27e243850d294908dc5cff90760d0a35a Author: rubenada AuthorDate: Tue Aug 29 17:49:20 2023 +0100 [CALCITE-5967] UnsupportedOperationException while implementing a call that requires a special collator --- .../calcite/adapter/enumerable/RexImpTable.java| 6 -- .../enumerable/EnumerableStringComparisonTest.java | 23 ++ 2 files changed, 27 insertions(+), 2 deletions(-) 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 93203afe3c..91a7aed9b0 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 @@ -44,6 +44,7 @@ import org.apache.calcite.rex.RexInputRef; import org.apache.calcite.rex.RexLiteral; import org.apache.calcite.rex.RexNode; import org.apache.calcite.rex.RexPatternFieldRef; +import org.apache.calcite.runtime.FlatLists; import org.apache.calcite.runtime.SqlFunctions; import org.apache.calcite.schema.FunctionContext; import org.apache.calcite.schema.ImplementableAggFunction; @@ -2865,7 +2866,7 @@ public class RexImpTable { @Override Expression implementSafe( final RexToLixTranslator translator, final RexCall call, -final List argValueList) { +List argValueList) { // neither nullable: // return x OP y // x nullable @@ -2892,7 +2893,8 @@ public class RexImpTable { final Expression fieldComparator = generateCollatorExpression(relDataType0.getCollation()); if (fieldComparator != null) { -argValueList.add(fieldComparator); +// We need to add the comparator, the argValueList might be non-mutable, so create a new one +argValueList = FlatLists.append(argValueList, fieldComparator); } final Primitive primitive = Primitive.ofBoxOr(type0); diff --git a/core/src/test/java/org/apache/calcite/test/enumerable/EnumerableStringComparisonTest.java b/core/src/test/java/org/apache/calcite/test/enumerable/EnumerableStringComparisonTest.java index fd12311b49..d7f40b4dc5 100644 --- a/core/src/test/java/org/apache/calcite/test/enumerable/EnumerableStringComparisonTest.java +++ b/core/src/test/java/org/apache/calcite/test/enumerable/EnumerableStringComparisonTest.java @@ -137,6 +137,29 @@ class EnumerableStringComparisonTest { "name=presales"); } + /** Test case for + * https://issues.apache.org/jira/browse/CALCITE-5967;>[CALCITE-5967] + * UnsupportedOperationException while implementing a call that requires a special collator. + */ + @Test void testFilterStringSpecialCollation() { +tester() +.withRel(builder -> builder +.values( +createRecordVarcharSpecialCollation(builder), +"Legal", "presales", "hr", "Administration", "MARKETING") +// Filter on a field with special collation: +// a special comparator needs to be used inside the eq operation +.filter( +builder.equals( +builder.field(1, 0, "name"), +builder.literal("MARKETING"))) +.build()) +.explainHookMatches("" ++ "EnumerableCalc(expr#0=[{inputs}], expr#1=['MARKETING'], expr#2=[=($t0, $t1)], name=[$t0], $condition=[$t2])\n" ++ " EnumerableValues(tuples=[[{ 'Legal' }, { 'presales' }, { 'hr' }, { 'Administration' }, { 'MARKETING' }]])\n") +.returnsUnordered("name=MARKETING"); + } + @Test void testMergeJoinOnStringSpecialCollation() { tester() .withHook(Hook.PLANNER, (Consumer) planner -> {
[calcite] branch main updated: [CALCITE-5952] SemiJoinJoinTransposeRule should check if JoinType supports pushing predicates into its inputs
This is an automated email from the ASF dual-hosted git repository. rubenql 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 d667123585 [CALCITE-5952] SemiJoinJoinTransposeRule should check if JoinType supports pushing predicates into its inputs d667123585 is described below commit d667123585bf518edd6a9bf93e23c1785fe03376 Author: Leonid Chistov AuthorDate: Mon Sep 4 18:33:56 2023 +0300 [CALCITE-5952] SemiJoinJoinTransposeRule should check if JoinType supports pushing predicates into its inputs --- .../rel/rules/SemiJoinJoinTransposeRule.java | 12 +++ .../calcite/runtime/RelOptRulesRuntimeTest.java| 97 ++ .../org/apache/calcite/test/RelOptRulesTest.java | 92 .../org/apache/calcite/test/RelOptRulesTest.xml| 62 ++ 4 files changed, 263 insertions(+) diff --git a/core/src/main/java/org/apache/calcite/rel/rules/SemiJoinJoinTransposeRule.java b/core/src/main/java/org/apache/calcite/rel/rules/SemiJoinJoinTransposeRule.java index d314b2819a..f523209893 100644 --- a/core/src/main/java/org/apache/calcite/rel/rules/SemiJoinJoinTransposeRule.java +++ b/core/src/main/java/org/apache/calcite/rel/rules/SemiJoinJoinTransposeRule.java @@ -114,6 +114,18 @@ public class SemiJoinJoinTransposeRule return; } +// join type needs to allow pushing predicate (represented as semi-join in our case) +// to the corresponding input +if (nKeysFromX > 0) { + if (!join.getJoinType().canPushLeftFromAbove()) { +return; + } +} else { + if (!join.getJoinType().canPushRightFromAbove()) { +return; + } +} + // need to convert the semi-join condition and possibly the keys final RexNode newSemiJoinFilter; int[] adjustments = new int[nTotalFields]; diff --git a/core/src/test/java/org/apache/calcite/runtime/RelOptRulesRuntimeTest.java b/core/src/test/java/org/apache/calcite/runtime/RelOptRulesRuntimeTest.java new file mode 100644 index 00..7faa2385eb --- /dev/null +++ b/core/src/test/java/org/apache/calcite/runtime/RelOptRulesRuntimeTest.java @@ -0,0 +1,97 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.calcite.runtime; + +import org.apache.calcite.adapter.java.ReflectiveSchema; +import org.apache.calcite.config.CalciteConnectionProperty; +import org.apache.calcite.config.Lex; +import org.apache.calcite.plan.RelOptPlanner; +import org.apache.calcite.rel.core.JoinRelType; +import org.apache.calcite.rel.rules.CoreRules; +import org.apache.calcite.test.CalciteAssert; +import org.apache.calcite.test.schemata.hr.HrSchema; + +import org.junit.jupiter.api.Test; + +import java.util.function.Consumer; + +/** + * Unit tests for rules in {@code org.apache.calcite.rel} and subpackages. + */ +public class RelOptRulesRuntimeTest { + + /** Test case for + * https://issues.apache.org/jira/browse/CALCITE-5952;>[CALCITE-5952] + * SemiJoinJoinTransposeRule should check if JoinType supports pushing predicates + * into its inputs. */ + @Test void semiJoinLeftJoinTransposeTest() { +tester(true, new HrSchema()) +.withRel( +builder -> builder.scan("s", "depts") +.scan("s", "emps") +.join(JoinRelType.LEFT, +builder.equals( +builder.field(2, 0, "deptno"), +builder.field(2, 1, "deptno")) +) +.scan("s", "dependents") +.semiJoin( +builder.equals( +builder.field(2, 0, "empid"), +builder.field(2, 1, "empid"))) +.build() +) +.withHook(Hook.PLANNER, (Consumer) planner -> +planner.addRule(CoreRules.SEMI_JOIN_JOIN_TRANSPOSE) +) +.returnsUnordered(); + } + + /** Test case for + * https://issues.apache.org/jira/browse/CALCITE-5952;>[CALCITE-5952] + * SemiJoinJoinTransposeRule should check if JoinType supports pushing predicates + * into its inputs. */ + @Test void semiJoinRightJoinTransposeTest() { +
[GitHub] [calcite] rubenada merged pull request #3407: [CALCITE-5952] SemiJoinJoinTransposeRule should check if JoinType supports pushing predicates into its inputs
rubenada merged PR #3407: URL: https://github.com/apache/calcite/pull/3407 -- 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 #3403: [CALCITE-5967] UnsupportedOperationException while implementing a call that requires a special collator
sonarcloud[bot] commented on PR #3403: URL: https://github.com/apache/calcite/pull/3403#issuecomment-1707873463 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=3403) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3403=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=3403=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3403=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=3403=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=3403=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3403=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=3403=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=3403=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3403=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=3403=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=3403=false=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3403=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=3403=new_coverage=list) [100.0% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3403=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=3403=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3403=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] LeonidChistov commented on pull request #3407: [CALCITE-5952] SemiJoinJoinTransposeRule should check if JoinType supports pushing predicates into its inputs
LeonidChistov commented on PR #3407: URL: https://github.com/apache/calcite/pull/3407#issuecomment-1707868065 @rubenada Done. -- 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 #3407: [CALCITE-5952] SemiJoinJoinTransposeRule should check if JoinType supports pushing predicates into its inputs
sonarcloud[bot] commented on PR #3407: URL: https://github.com/apache/calcite/pull/3407#issuecomment-1707860662 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=3407) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3407=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=3407=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3407=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=3407=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=3407=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3407=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=3407=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=3407=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3407=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=3407=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=3407=false=CODE_SMELL) [1 Code Smell](https://sonarcloud.io/project/issues?id=apache_calcite=3407=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=3407=new_coverage=list) [100.0% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3407=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=3407=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3407=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 #3311: [CALCITE-5732] EnumerableHashJoin and EnumerableMergeJoin on composite key return rows matching condition 'null = null'
sonarcloud[bot] commented on PR #3311: URL: https://github.com/apache/calcite/pull/3311#issuecomment-1707832963 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=3311) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3311=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=3311=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3311=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=3311=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=3311=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3311=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=3311=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=3311=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3311=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=3311=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=3311=false=CODE_SMELL) [13 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3311=false=CODE_SMELL) [![86.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '86.0%')](https://sonarcloud.io/component_measures?id=apache_calcite=3311=new_coverage=list) [86.0% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3311=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=3311=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3311=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 #3403: [CALCITE-5967] UnsupportedOperationException while implementing a call that requires a special collator
sonarcloud[bot] commented on PR #3403: URL: https://github.com/apache/calcite/pull/3403#issuecomment-1707826919 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=3403) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3403=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=3403=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3403=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=3403=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=3403=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3403=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=3403=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=3403=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3403=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=3403=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=3403=false=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3403=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=3403=new_coverage=list) [100.0% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3403=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=3403=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3403=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] rubenada commented on a diff in pull request #3311: [CALCITE-5732] EnumerableHashJoin and EnumerableMergeJoin on composite key return rows matching condition 'null = null'
rubenada commented on code in PR #3311: URL: https://github.com/apache/calcite/pull/3311#discussion_r1316837374 ## linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java: ## @@ -4495,6 +4492,27 @@ private boolean advanceRight(TInner right, TKey rightKey) { } } + public static int compareNullsLastForMergeJoin(@Nullable Comparable v0, @Nullable Comparable v1) { +return compareNullsLastForMergeJoin(v0, v1, null); + } + + public static int compareNullsLastForMergeJoin(@Nullable Comparable v0, @Nullable Comparable v1, + @Nullable Comparator comparator) { +// Special code for mergeJoin algorithm: in case of two null values, they must not be +// considered as equal (otherwise the join would return incorrect results); instead, consider +// the first (left) value as "bigger", to advance on the right value and continue with the +// algorithm +if (v0 == null && v1 == null) { + return 1; Review Comment: Done -- 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 merged pull request #3359: [CALCITE-5905] Documentation for CREATE TYPE is incorrect
libenchao merged PR #3359: URL: https://github.com/apache/calcite/pull/3359 -- 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-5905] Documentation for CREATE TYPE is incorrect
This is an automated email from the ASF dual-hosted git repository. libenchao 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 b57f2d2cb0 [CALCITE-5905] Documentation for CREATE TYPE is incorrect b57f2d2cb0 is described below commit b57f2d2cb0fa1227ce17e4be872982c05f260249 Author: Mihai Budiu AuthorDate: Tue Sep 5 22:01:38 2023 -0700 [CALCITE-5905] Documentation for CREATE TYPE is incorrect Signed-off-by: Mihai Budiu --- .../java/org/apache/calcite/test/ServerTest.java | 52 ++ site/_docs/reference.md| 34 +++--- .../apache/calcite/test/schemata/hr/HrSchema.java | 4 +- 3 files changed, 71 insertions(+), 19 deletions(-) diff --git a/server/src/test/java/org/apache/calcite/test/ServerTest.java b/server/src/test/java/org/apache/calcite/test/ServerTest.java index cc5fb2a4f7..3c9180970c 100644 --- a/server/src/test/java/org/apache/calcite/test/ServerTest.java +++ b/server/src/test/java/org/apache/calcite/test/ServerTest.java @@ -39,6 +39,7 @@ import org.apache.calcite.sql.ddl.SqlTruncateTable; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import java.math.BigDecimal; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; @@ -144,6 +145,57 @@ class ServerTest { } } + /** Test case for + * https://issues.apache.org/jira/browse/CALCITE-5905;>[CALCITE-5905] + * Documentation for CREATE TYPE is incorrect. */ + @Test void testCreateTypeDocumentationExample() throws SQLException { +try (Connection c = connect(); + Statement s = c.createStatement()) { + boolean b = s.execute("CREATE TYPE address_typ AS (\n" + + " street VARCHAR(30),\n" + + " cityVARCHAR(20),\n" + + " state CHAR(2),\n" + + " postal_code VARCHAR(6))"); + assertThat(b, is(false)); + b = s.execute("CREATE TYPE employee_typ AS (\n" + + " employee_id DECIMAL(6),\n" + + " first_nameVARCHAR(20),\n" + + " last_name VARCHAR(25),\n" + + " email VARCHAR(25),\n" + + " phone_number VARCHAR(20),\n" + + " hire_date DATE,\n" + + " job_idVARCHAR(10),\n" + + " salaryDECIMAL(8,2),\n" + + " commission_pctDECIMAL(2,2),\n" + + " manager_idDECIMAL(6),\n" + + " department_id DECIMAL(4),\n" + + " address address_typ)\n"); + assertThat(b, is(false)); + try (ResultSet r = + s.executeQuery("SELECT employee_typ(315, 'Francis', 'Logan', 'FLOGAN',\n" + + "'555.777.', DATE '2004-05-01', 'SA_MAN', 11000, .15, 101, 110,\n" + + " address_typ('376 Mission', 'San Francisco', 'CA', '94222'))")) { +assertThat(r.next(), is(true)); +Struct obj = r.getObject(1, Struct.class); +Object[] data = obj.getAttributes(); +assertThat(data[0], is(315)); +assertThat(data[1], is("Francis")); +assertThat(data[2], is("Logan")); +assertThat(data[3], is("FLOGAN")); +assertThat(data[4], is("555.777.")); +assertThat(data[5], is(java.sql.Date.valueOf("2004-05-01"))); +assertThat(data[6], is("SA_MAN")); +assertThat(data[7], is(11000)); +assertThat(data[8], is(new BigDecimal(".15"))); +assertThat(data[9], is(101)); +assertThat(data[10], is(110)); +Struct address = (Struct) data[11]; +assertArrayEquals(address.getAttributes(), +new Object[] { "376 Mission", "San Francisco", "CA", "94222" }); + } +} + } + @Test void testCreateType() throws Exception { try (Connection c = connect(); Statement s = c.createStatement()) { diff --git a/site/_docs/reference.md b/site/_docs/reference.md index 6cc2f03aa5..ccb79bc1f4 100644 --- a/site/_docs/reference.md +++ b/site/_docs/reference.md @@ -3503,24 +3503,24 @@ instantiated. Each object can hold different values. For example, we can declare types `address_typ` and `employee_typ`: {% highlight sql %} -CREATE TYPE address_typ AS OBJECT ( - street VARCHAR2(30), - cityVARCHAR2(20), +CREATE TYPE address_typ AS ( + street VARCHAR(30), + cityVARCHAR(20), state CHAR(2), - postal_code VARCHAR2(6)); - -CREATE TYPE employee_typ AS OBJECT ( - employee_id NUMBER(6), - first_nameVARCHAR2(20), - last_name VARCHAR2(25), - email VARCHAR2(25), - phone_number VARCHAR2(20), + postal_code VARCHAR(6)); + +CREATE TYPE employee_typ AS ( + employee_id DECIMAL(6), + first_nameVARCHAR(20), + last_name VARCHAR(25), +