You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "tanclary (via GitHub)" <gi...@apache.org> on 2023/04/12 19:16:25 UTC

[GitHub] [calcite] tanclary opened a new pull request, #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

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

   This is a draft PR containing the base implementation for BigQuery's `CONTAINS_SUBSTR` function. This version only supports expressions of type `STRING` for the first argument while BigQuery accepts expressions of many different types ([doc link](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#contains_substr)).
   
   I will be working on adding more commits to expand this operator's functionality. Any comments, questions, or suggestions in the meantime are appreciated as always.


-- 
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-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1613981903

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


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

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

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Add CONTAINS_SUBSTR function (enabled in BigQuery library)

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1678218590

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=3147)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [![B](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/B-16px.png 'B')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [12 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL)
   
   [![94.8%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png '94.8%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_coverage&view=list) [94.8% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_coverage&view=list)  
   [![14.6%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/20-16px.png '14.6%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list) [14.6% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list)
   
   


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

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

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1624201858

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=3147)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=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&pullRequest=3147&resolved=false&types=BUG) [1 Bug](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [4 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL)
   
   [![95.6%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png '95.6%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_coverage&view=list) [95.6% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_coverage&view=list)  
   [![12.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/20-16px.png '12.0%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list) [12.0% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list)
   
   


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

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

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1640488189

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


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

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

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1614063838

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=3147)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=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&pullRequest=3147&resolved=false&types=BUG) [3 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [4 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL)
   
   [![95.1%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png '95.1%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_coverage&view=list) [95.1% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_coverage&view=list)  
   [![13.1%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/20-16px.png '13.1%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list) [13.1% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list)
   
   


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

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

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1624358430

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


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

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

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


[GitHub] [calcite] tanclary commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "tanclary (via GitHub)" <gi...@apache.org>.
tanclary commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1625884550

   > Is the new function class `SqlContainsSubstrFunction` necessary?
   > 
   > Thanks for adding javadoc in SqlFunctions. For future reference, `{@code ... }` is slightly preferred over `<code> ... </code>` because it handles some HTML escaping. (Of course you can't use it if you actually want HTML markup e.g. `<b>`and `<br>`.)
   > 
   > I'd rename `enum JsonScopeValue` to `enum JsonScope`. Every class holds values.
   > 
   > Make `normalize` private.
   I think right now the class is not fully necessary, but I think there are other `CONTAINS` functions (such as `REGEXP_CONTAINS`) that could make having its own dedicated class useful in the future. Additionally, there is currently an exception that gets thrown from `validateColumnListParams` if we just use `SqlBasicFunction.create` instead. The `#deriveType` override avoids this. Let me know what you think.
   
   Good to know about the comments.
   
   I amended to address your 3rd and 4th points.


-- 
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-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] tanclary commented on pull request #3147: [CALCITE-5644] Add CONTAINS_SUBSTR function (enabled in BigQuery library)

Posted by "tanclary (via GitHub)" <gi...@apache.org>.
tanclary commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1678195861

   @julianhyde I removed the class I added in favor of `SqlBasicFunction.create()` as you suggested, I also removed the method and its lone usage. Let me know what you think.


-- 
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-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Add CONTAINS_SUBSTR function (enabled in BigQuery library)

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1686795717

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


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

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

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Add CONTAINS_SUBSTR function (enabled in BigQuery library)

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1686804547

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


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

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

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


[GitHub] [calcite] julianhyde commented on a diff in pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "julianhyde (via GitHub)" <gi...@apache.org>.
julianhyde commented on code in PR #3147:
URL: https://github.com/apache/calcite/pull/3147#discussion_r1253447643


##########
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##########
@@ -765,6 +765,11 @@ static RelDataType deriveTypeSplit(SqlOperatorBinding operatorBinding,
           ReturnTypes.INTEGER_NULLABLE, OperandTypes.DATE,
           SqlFunctionCategory.TIMEDATE);
 
+  /** The "CONTAINS_SUBSTR(expression, search_value_literal[, json_scope => json_scope_value])"

Review Comment:
   as i said elsewhere 'performs' is a zero-information word.
   
   need to escape '=>' for HTML.



##########
core/src/main/java/org/apache/calcite/sql/SqlKind.java:
##########
@@ -839,6 +839,8 @@ public enum SqlKind {
    * TABLE(udx(CURSOR(SELECT ...), x, y, z))</code>. */
   CURSOR,
 
+  CONTAINS_SUBSTR,

Review Comment:
   need javadoc comment



##########
core/src/main/java/org/apache/calcite/sql/fun/SqlContainsSubstrFunction.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.sql.fun;
+
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.sql.SqlCall;
+import org.apache.calcite.sql.SqlFunction;
+import org.apache.calcite.sql.SqlFunctionCategory;
+import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.SqlNode;
+import org.apache.calcite.sql.type.OperandTypes;
+import org.apache.calcite.sql.type.ReturnTypes;
+import org.apache.calcite.sql.validate.SqlValidator;
+import org.apache.calcite.sql.validate.SqlValidatorScope;
+
+/** The "CONTAINS_SUBSTR(expression, search_value_literal[, json_scope => json_scope_value])"
+ * function; performs a search to see if a value exists as a substring in an expression. */
+public class SqlContainsSubstrFunction extends SqlFunction {
+  public SqlContainsSubstrFunction() {
+    super("CONTAINS_SUBSTR", SqlKind.CONTAINS_SUBSTR, ReturnTypes.BOOLEAN_NULLABLE,
+        null, OperandTypes.ANY_STRING_OPTIONAL_STRING,
+        SqlFunctionCategory.STRING);
+  }
+
+  @Override public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, 

Review Comment:
   indentation for `SqlCall call` line looks off.



##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -562,6 +564,91 @@ public static List<ByteString> split(ByteString s, ByteString delimiter) {
     }
   }
 
+  public static @Nullable Boolean containsSubstr(@Nullable Object @Nullable [] s0, String s1) {
+    // If s0 has null arguments, it should return TRUE if substring is found, otherwise NULL
+    boolean nullFlag = false;
+    if (s0 == null) {
+      return false;
+    }
+    for (Object obj : s0) {
+      if (obj == null) {
+        nullFlag = true;
+      } else if (obj instanceof Object[]) {
+        return containsSubstr((Object[]) obj, s1);
+      } else if (obj instanceof ArrayList) {
+        return containsSubstr((List) obj, s1);
+      } else if (normalize(obj.toString()).contains(normalize(s1))) {
+        return true;
+      }
+    }
+    return nullFlag ? null : false;
+  }
+
+  public static @Nullable Boolean containsSubstr(List s0, String s1) {
+    // If s0 has null arguments, it should return TRUE if substring is found, otherwise NULL
+    boolean nullFlag = false;
+    for (Object item : s0) {
+      if (item == null) {
+        nullFlag = true;
+      }
+      if (item != null && containsSubstr(item, s1)) {
+        return true;
+      }
+    }
+    return nullFlag ? null : false;
+  }
+
+  public static @Nullable Boolean containsSubstr(String s0, String s1, String s2) {
+    // The third argument specifies the json_scope, either keys, values, or both
+    LinkedHashMap<String, String> map = (LinkedHashMap) JsonFunctions.dejsonize(s0);
+    Set<String> keys = map.keySet();
+    Collection<String> values = map.values();
+    if (s2.equals("JSON_KEYS")) {

Review Comment:
   should `s2` be an `enum` rather than a `String`?



##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -562,6 +564,91 @@ public static List<ByteString> split(ByteString s, ByteString delimiter) {
     }
   }
 
+  public static @Nullable Boolean containsSubstr(@Nullable Object @Nullable [] s0, String s1) {
+    // If s0 has null arguments, it should return TRUE if substring is found, otherwise NULL
+    boolean nullFlag = false;
+    if (s0 == null) {
+      return false;
+    }
+    for (Object obj : s0) {
+      if (obj == null) {
+        nullFlag = true;
+      } else if (obj instanceof Object[]) {
+        return containsSubstr((Object[]) obj, s1);
+      } else if (obj instanceof ArrayList) {
+        return containsSubstr((List) obj, s1);
+      } else if (normalize(obj.toString()).contains(normalize(s1))) {
+        return true;
+      }
+    }
+    return nullFlag ? null : false;
+  }
+
+  public static @Nullable Boolean containsSubstr(List s0, String s1) {
+    // If s0 has null arguments, it should return TRUE if substring is found, otherwise NULL
+    boolean nullFlag = false;
+    for (Object item : s0) {
+      if (item == null) {
+        nullFlag = true;
+      }
+      if (item != null && containsSubstr(item, s1)) {
+        return true;
+      }
+    }
+    return nullFlag ? null : false;
+  }
+
+  public static @Nullable Boolean containsSubstr(String s0, String s1, String s2) {
+    // The third argument specifies the json_scope, either keys, values, or both
+    LinkedHashMap<String, String> map = (LinkedHashMap) JsonFunctions.dejsonize(s0);
+    Set<String> keys = map.keySet();
+    Collection<String> values = map.values();
+    if (s2.equals("JSON_KEYS")) {
+      return keys.contains(s1);
+    } else if (s2.equals("JSON_VALUES")) {
+      return values.contains(s1);
+    } else if (s2.equals("JSON_KEYS_AND_VALUES")) {
+      return keys.contains(s1) || values.contains(s1);
+    } else {
+      throw new IllegalArgumentException("json_scope argument must be one of: \"JSON_KEYS\", "
+          + "\"JSON_VALUES\", \"JSON_KEYS_AND_VALUES\".");
+    }
+  }
+
+  /** SQL {@code CONTAINS_SUBSTR(string, string)} function. */

Review Comment:
   Use more descriptive names for arguments. Make the arguments in the javadoc comment (`string`) and Java parameters (`s0`, `s1`) consistent.



##########
core/src/main/java/org/apache/calcite/sql/fun/SqlContainsSubstrFunction.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.sql.fun;
+
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.sql.SqlCall;
+import org.apache.calcite.sql.SqlFunction;
+import org.apache.calcite.sql.SqlFunctionCategory;
+import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.SqlNode;
+import org.apache.calcite.sql.type.OperandTypes;
+import org.apache.calcite.sql.type.ReturnTypes;
+import org.apache.calcite.sql.validate.SqlValidator;
+import org.apache.calcite.sql.validate.SqlValidatorScope;
+
+/** The "CONTAINS_SUBSTR(expression, search_value_literal[, json_scope => json_scope_value])"
+ * function; performs a search to see if a value exists as a substring in an expression. */
+public class SqlContainsSubstrFunction extends SqlFunction {

Review Comment:
   Do we need a class for this? Would `SqlBasicFunction.create` suffice? If not, what's missing?



##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -562,6 +564,91 @@ public static List<ByteString> split(ByteString s, ByteString delimiter) {
     }
   }
 
+  public static @Nullable Boolean containsSubstr(@Nullable Object @Nullable [] s0, String s1) {
+    // If s0 has null arguments, it should return TRUE if substring is found, otherwise NULL
+    boolean nullFlag = false;
+    if (s0 == null) {
+      return false;
+    }
+    for (Object obj : s0) {
+      if (obj == null) {
+        nullFlag = true;
+      } else if (obj instanceof Object[]) {
+        return containsSubstr((Object[]) obj, s1);
+      } else if (obj instanceof ArrayList) {
+        return containsSubstr((List) obj, s1);
+      } else if (normalize(obj.toString()).contains(normalize(s1))) {
+        return true;
+      }
+    }
+    return nullFlag ? null : false;
+  }
+
+  public static @Nullable Boolean containsSubstr(List s0, String s1) {
+    // If s0 has null arguments, it should return TRUE if substring is found, otherwise NULL
+    boolean nullFlag = false;
+    for (Object item : s0) {
+      if (item == null) {
+        nullFlag = true;
+      }
+      if (item != null && containsSubstr(item, s1)) {
+        return true;
+      }
+    }
+    return nullFlag ? null : false;
+  }
+
+  public static @Nullable Boolean containsSubstr(String s0, String s1, String s2) {
+    // The third argument specifies the json_scope, either keys, values, or both

Review Comment:
   Rather than adding comments, just rename `s2` to `jsonScope`



##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -562,6 +564,91 @@ public static List<ByteString> split(ByteString s, ByteString delimiter) {
     }
   }
 
+  public static @Nullable Boolean containsSubstr(@Nullable Object @Nullable [] s0, String s1) {

Review Comment:
   Each of these methods needs a simple javadoc comment. Without such comments, it's quite difficult to map from java types to the SQL types.



##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -562,6 +564,91 @@ public static List<ByteString> split(ByteString s, ByteString delimiter) {
     }
   }
 
+  public static @Nullable Boolean containsSubstr(@Nullable Object @Nullable [] s0, String s1) {
+    // If s0 has null arguments, it should return TRUE if substring is found, otherwise NULL
+    boolean nullFlag = false;
+    if (s0 == null) {
+      return false;
+    }
+    for (Object obj : s0) {
+      if (obj == null) {
+        nullFlag = true;
+      } else if (obj instanceof Object[]) {
+        return containsSubstr((Object[]) obj, s1);
+      } else if (obj instanceof ArrayList) {
+        return containsSubstr((List) obj, s1);
+      } else if (normalize(obj.toString()).contains(normalize(s1))) {
+        return true;
+      }
+    }
+    return nullFlag ? null : false;
+  }
+
+  public static @Nullable Boolean containsSubstr(List s0, String s1) {
+    // If s0 has null arguments, it should return TRUE if substring is found, otherwise NULL
+    boolean nullFlag = false;
+    for (Object item : s0) {
+      if (item == null) {
+        nullFlag = true;
+      }
+      if (item != null && containsSubstr(item, s1)) {
+        return true;
+      }
+    }
+    return nullFlag ? null : false;
+  }
+
+  public static @Nullable Boolean containsSubstr(String s0, String s1, String s2) {
+    // The third argument specifies the json_scope, either keys, values, or both
+    LinkedHashMap<String, String> map = (LinkedHashMap) JsonFunctions.dejsonize(s0);
+    Set<String> keys = map.keySet();
+    Collection<String> values = map.values();
+    if (s2.equals("JSON_KEYS")) {
+      return keys.contains(s1);
+    } else if (s2.equals("JSON_VALUES")) {
+      return values.contains(s1);
+    } else if (s2.equals("JSON_KEYS_AND_VALUES")) {
+      return keys.contains(s1) || values.contains(s1);
+    } else {
+      throw new IllegalArgumentException("json_scope argument must be one of: \"JSON_KEYS\", "
+          + "\"JSON_VALUES\", \"JSON_KEYS_AND_VALUES\".");
+    }
+  }
+
+  /** SQL {@code CONTAINS_SUBSTR(string, string)} function. */
+  public static Boolean containsSubstr(@Nullable Object s0, String s1) {

Review Comment:
   Do all these methods need to return `Boolean` rather than `boolean`?
   
   Remember that Calcite's code generator will short-circuit the call based on the function's strong-ness. For normal functions, if any arguments are null, it will not call the function, and the result is SQL NULL (or UNKNOWN). In such cases, you should not handle nulls. `Integer` arguments can be `int`, `Boolean` return can be `boolean`, etc.



##########
site/_docs/reference.md:
##########
@@ -2685,6 +2687,7 @@ BigQuery's type system uses confusingly different names for types and functions:
 | m p | CONCAT_WS(separator, str1 [, string ]*)      | Concatenates one or more strings, returns null only when separator is null, otherwise treats null arguments as empty strings
 | q | CONCAT_WS(separator, str1, str2 [, string ]*)  | Concatenates two or more strings, requires at least 3 arguments (up to 254), treats null arguments as empty strings
 | m | COMPRESS(string)                               | Compresses a string using zlib compression and returns the result as a binary string
+| b | CONTAINS_SUBSTR(expression, string [ , json_scope=>json_scope_value]) | Performs a normalized, case-insensitive search to see if a value exists as a substring in an expression. Can also search JSON data within an optionally-specified scope. Returns TRUE if the string is found and FALSE if it is not.

Review Comment:
   need to escape `=>`?
   
   spaces around `[` and `]`
   
   trailing period
   
   replace 'a value' with '*string*'
   
   'Performs' is a zero-information word. 'Returns whether...'.
   
   Remove the 'Returns TRUE ...' sentence. It is covered by previous description. Also it implies (wrongly?) that the function can never return UNKNOWN.



-- 
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-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1613964748

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=3147)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=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&pullRequest=3147&resolved=false&types=BUG) [3 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [4 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL)
   
   [![95.1%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png '95.1%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_coverage&view=list) [95.1% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_coverage&view=list)  
   [![13.1%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/20-16px.png '13.1%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list) [13.1% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list)
   
   


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

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

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1613964506

   Please retry analysis of this Pull-Request directly on [SonarCloud](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147).


-- 
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-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1613956650

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=3147)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=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&pullRequest=3147&resolved=false&types=BUG) [3 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [4 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=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&pullRequest=3147&metric=new_coverage&view=list) [95.2% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_coverage&view=list)  
   [![12.8%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/20-16px.png '12.8%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list) [12.8% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list)
   
   


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

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

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1613963583

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=3147)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=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&pullRequest=3147&resolved=false&types=BUG) [3 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [4 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL)
   
   [![95.1%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png '95.1%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_coverage&view=list) [95.1% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_coverage&view=list)  
   [![13.1%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/20-16px.png '13.1%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list) [13.1% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list)
   
   


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

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

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Add CONTAINS_SUBSTR function (enabled in BigQuery library)

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1686817731

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


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

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

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


[GitHub] [calcite] tanclary commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "tanclary (via GitHub)" <gi...@apache.org>.
tanclary commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1624173994

   @julianhyde I added a commit that I think addresses most of your comments. Thanks for the thorough review, i think the PR is in much better shape now. Of course let me know if you have more suggestions.


-- 
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-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] julianhyde commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "julianhyde (via GitHub)" <gi...@apache.org>.
julianhyde commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1624482681

   Is the new function class `SqlContainsSubstrFunction` necessary?
   
   Thanks for adding javadoc in SqlFunctions. For future reference, `{@code ... }` is slightly preferred over `<code> ... </code>` because it handles some HTML escaping. (Of course you can't use it if you actually want HTML markup e.g. `<b>`and `<br>`.)
   
   I'd rename `enum JsonScopeValue` to `enum JsonScope`. Every class holds values.
   
   Make `normalize` private.


-- 
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-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] tanclary commented on a diff in pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "tanclary (via GitHub)" <gi...@apache.org>.
tanclary commented on code in PR #3147:
URL: https://github.com/apache/calcite/pull/3147#discussion_r1254813751


##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -562,6 +564,91 @@ public static List<ByteString> split(ByteString s, ByteString delimiter) {
     }
   }
 
+  public static @Nullable Boolean containsSubstr(@Nullable Object @Nullable [] s0, String s1) {
+    // If s0 has null arguments, it should return TRUE if substring is found, otherwise NULL
+    boolean nullFlag = false;
+    if (s0 == null) {
+      return false;
+    }
+    for (Object obj : s0) {
+      if (obj == null) {
+        nullFlag = true;
+      } else if (obj instanceof Object[]) {
+        return containsSubstr((Object[]) obj, s1);
+      } else if (obj instanceof ArrayList) {
+        return containsSubstr((List) obj, s1);
+      } else if (normalize(obj.toString()).contains(normalize(s1))) {
+        return true;
+      }
+    }
+    return nullFlag ? null : false;
+  }
+
+  public static @Nullable Boolean containsSubstr(List s0, String s1) {
+    // If s0 has null arguments, it should return TRUE if substring is found, otherwise NULL
+    boolean nullFlag = false;
+    for (Object item : s0) {
+      if (item == null) {
+        nullFlag = true;
+      }
+      if (item != null && containsSubstr(item, s1)) {
+        return true;
+      }
+    }
+    return nullFlag ? null : false;
+  }
+
+  public static @Nullable Boolean containsSubstr(String s0, String s1, String s2) {
+    // The third argument specifies the json_scope, either keys, values, or both
+    LinkedHashMap<String, String> map = (LinkedHashMap) JsonFunctions.dejsonize(s0);
+    Set<String> keys = map.keySet();
+    Collection<String> values = map.values();
+    if (s2.equals("JSON_KEYS")) {
+      return keys.contains(s1);
+    } else if (s2.equals("JSON_VALUES")) {
+      return values.contains(s1);
+    } else if (s2.equals("JSON_KEYS_AND_VALUES")) {
+      return keys.contains(s1) || values.contains(s1);
+    } else {
+      throw new IllegalArgumentException("json_scope argument must be one of: \"JSON_KEYS\", "
+          + "\"JSON_VALUES\", \"JSON_KEYS_AND_VALUES\".");
+    }
+  }
+
+  /** SQL {@code CONTAINS_SUBSTR(string, string)} function. */
+  public static Boolean containsSubstr(@Nullable Object s0, String s1) {

Review Comment:
   I left some as `Boolean` because there are cases where the method should return `NULL` even if none of the parameters are `NULL`. For example if the argument is ROW(1, null, 3) and the substr is '2', it should return `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-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] tanclary commented on a diff in pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "tanclary (via GitHub)" <gi...@apache.org>.
tanclary commented on code in PR #3147:
URL: https://github.com/apache/calcite/pull/3147#discussion_r1254761699


##########
core/src/main/java/org/apache/calcite/sql/fun/SqlContainsSubstrFunction.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.sql.fun;
+
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.sql.SqlCall;
+import org.apache.calcite.sql.SqlFunction;
+import org.apache.calcite.sql.SqlFunctionCategory;
+import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.SqlNode;
+import org.apache.calcite.sql.type.OperandTypes;
+import org.apache.calcite.sql.type.ReturnTypes;
+import org.apache.calcite.sql.validate.SqlValidator;
+import org.apache.calcite.sql.validate.SqlValidatorScope;
+
+/** The "CONTAINS_SUBSTR(expression, search_value_literal[, json_scope => json_scope_value])"
+ * function; performs a search to see if a value exists as a substring in an expression. */
+public class SqlContainsSubstrFunction extends SqlFunction {

Review Comment:
   Right now if you use `SqlBasicFunction.create`, an `UnsupportedOperationException` gets thrown from`validateColumnListParams` [here](https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L6363). The `deriveType` override avoids this. What do you think?



-- 
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-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] tanclary commented on a diff in pull request #3147: [CALCITE-5644] Add CONTAINS_SUBSTR function (enabled in BigQuery library)

Posted by "tanclary (via GitHub)" <gi...@apache.org>.
tanclary commented on code in PR #3147:
URL: https://github.com/apache/calcite/pull/3147#discussion_r1286109761


##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -562,6 +564,91 @@ public static List<ByteString> split(ByteString s, ByteString delimiter) {
     }
   }
 
+  public static @Nullable Boolean containsSubstr(@Nullable Object @Nullable [] s0, String s1) {
+    // If s0 has null arguments, it should return TRUE if substring is found, otherwise NULL
+    boolean nullFlag = false;
+    if (s0 == null) {
+      return false;
+    }
+    for (Object obj : s0) {
+      if (obj == null) {
+        nullFlag = true;
+      } else if (obj instanceof Object[]) {
+        return containsSubstr((Object[]) obj, s1);
+      } else if (obj instanceof ArrayList) {
+        return containsSubstr((List) obj, s1);
+      } else if (normalize(obj.toString()).contains(normalize(s1))) {
+        return true;
+      }
+    }
+    return nullFlag ? null : false;
+  }
+
+  public static @Nullable Boolean containsSubstr(List s0, String s1) {
+    // If s0 has null arguments, it should return TRUE if substring is found, otherwise NULL
+    boolean nullFlag = false;
+    for (Object item : s0) {
+      if (item == null) {
+        nullFlag = true;
+      }
+      if (item != null && containsSubstr(item, s1)) {
+        return true;
+      }
+    }
+    return nullFlag ? null : false;
+  }
+
+  public static @Nullable Boolean containsSubstr(String s0, String s1, String s2) {
+    // The third argument specifies the json_scope, either keys, values, or both
+    LinkedHashMap<String, String> map = (LinkedHashMap) JsonFunctions.dejsonize(s0);
+    Set<String> keys = map.keySet();
+    Collection<String> values = map.values();
+    if (s2.equals("JSON_KEYS")) {

Review Comment:
   Done



##########
core/src/main/java/org/apache/calcite/sql/SqlKind.java:
##########
@@ -839,6 +839,8 @@ public enum SqlKind {
    * TABLE(udx(CURSOR(SELECT ...), x, y, z))</code>. */
   CURSOR,
 
+  CONTAINS_SUBSTR,

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-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] tanclary merged pull request #3147: [CALCITE-5644] Add CONTAINS_SUBSTR function (enabled in BigQuery library)

Posted by "tanclary (via GitHub)" <gi...@apache.org>.
tanclary merged PR #3147:
URL: https://github.com/apache/calcite/pull/3147


-- 
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-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1613966411

   Please retry analysis of this Pull-Request directly on [SonarCloud](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147).


-- 
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-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1613963810

   Please retry analysis of this Pull-Request directly on [SonarCloud](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147).


-- 
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-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1613969634

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=3147)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=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&pullRequest=3147&resolved=false&types=BUG) [3 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [4 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL)
   
   [![95.1%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png '95.1%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_coverage&view=list) [95.1% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_coverage&view=list)  
   [![13.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/20-16px.png '13.0%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list) [13.0% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list)
   
   


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

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

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1622163551

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


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

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

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Add CONTAINS_SUBSTR function (enabled in BigQuery library)

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1686861026

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


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

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

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1625927852

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


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

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

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1624377232

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


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

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

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1613967001

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=3147)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=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&pullRequest=3147&resolved=false&types=BUG) [3 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [4 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL)
   
   [![95.1%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png '95.1%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_coverage&view=list) [95.1% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_coverage&view=list)  
   [![13.1%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/20-16px.png '13.1%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list) [13.1% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list)
   
   


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

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

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1607946984

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=3147)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=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&pullRequest=3147&metric=new_coverage&view=list) [100.0% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_coverage&view=list)  
   [![2.3%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '2.3%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list) [2.3% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list)
   
   


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

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

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


[GitHub] [calcite] sonarcloud[bot] commented on pull request #3147: [CALCITE-5644] Implement BigQuery CONTAINS_SUBSTR

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3147:
URL: https://github.com/apache/calcite/pull/3147#issuecomment-1608464335

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=3147)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3147&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=CODE_SMELL) [6 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3147&resolved=false&types=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&pullRequest=3147&metric=new_coverage&view=list) [100.0% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_coverage&view=list)  
   [![12.6%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/20-16px.png '12.6%')](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list) [12.6% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3147&metric=new_duplicated_lines_density&view=list)
   
   


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

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

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


[GitHub] [calcite] tanclary commented on a diff in pull request #3147: [CALCITE-5644] Add CONTAINS_SUBSTR function (enabled in BigQuery library)

Posted by "tanclary (via GitHub)" <gi...@apache.org>.
tanclary commented on code in PR #3147:
URL: https://github.com/apache/calcite/pull/3147#discussion_r1286109962


##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -562,6 +564,91 @@ public static List<ByteString> split(ByteString s, ByteString delimiter) {
     }
   }
 
+  public static @Nullable Boolean containsSubstr(@Nullable Object @Nullable [] s0, String s1) {
+    // If s0 has null arguments, it should return TRUE if substring is found, otherwise NULL
+    boolean nullFlag = false;
+    if (s0 == null) {
+      return false;
+    }
+    for (Object obj : s0) {
+      if (obj == null) {
+        nullFlag = true;
+      } else if (obj instanceof Object[]) {
+        return containsSubstr((Object[]) obj, s1);
+      } else if (obj instanceof ArrayList) {
+        return containsSubstr((List) obj, s1);
+      } else if (normalize(obj.toString()).contains(normalize(s1))) {
+        return true;
+      }
+    }
+    return nullFlag ? null : false;
+  }
+
+  public static @Nullable Boolean containsSubstr(List s0, String s1) {
+    // If s0 has null arguments, it should return TRUE if substring is found, otherwise NULL
+    boolean nullFlag = false;
+    for (Object item : s0) {
+      if (item == null) {
+        nullFlag = true;
+      }
+      if (item != null && containsSubstr(item, s1)) {
+        return true;
+      }
+    }
+    return nullFlag ? null : false;
+  }
+
+  public static @Nullable Boolean containsSubstr(String s0, String s1, String s2) {
+    // The third argument specifies the json_scope, either keys, values, or both

Review Comment:
   Done



##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -562,6 +564,91 @@ public static List<ByteString> split(ByteString s, ByteString delimiter) {
     }
   }
 
+  public static @Nullable Boolean containsSubstr(@Nullable Object @Nullable [] s0, String s1) {
+    // If s0 has null arguments, it should return TRUE if substring is found, otherwise NULL
+    boolean nullFlag = false;
+    if (s0 == null) {
+      return false;
+    }
+    for (Object obj : s0) {
+      if (obj == null) {
+        nullFlag = true;
+      } else if (obj instanceof Object[]) {
+        return containsSubstr((Object[]) obj, s1);
+      } else if (obj instanceof ArrayList) {
+        return containsSubstr((List) obj, s1);
+      } else if (normalize(obj.toString()).contains(normalize(s1))) {
+        return true;
+      }
+    }
+    return nullFlag ? null : false;
+  }
+
+  public static @Nullable Boolean containsSubstr(List s0, String s1) {
+    // If s0 has null arguments, it should return TRUE if substring is found, otherwise NULL
+    boolean nullFlag = false;
+    for (Object item : s0) {
+      if (item == null) {
+        nullFlag = true;
+      }
+      if (item != null && containsSubstr(item, s1)) {
+        return true;
+      }
+    }
+    return nullFlag ? null : false;
+  }
+
+  public static @Nullable Boolean containsSubstr(String s0, String s1, String s2) {
+    // The third argument specifies the json_scope, either keys, values, or both
+    LinkedHashMap<String, String> map = (LinkedHashMap) JsonFunctions.dejsonize(s0);
+    Set<String> keys = map.keySet();
+    Collection<String> values = map.values();
+    if (s2.equals("JSON_KEYS")) {
+      return keys.contains(s1);
+    } else if (s2.equals("JSON_VALUES")) {
+      return values.contains(s1);
+    } else if (s2.equals("JSON_KEYS_AND_VALUES")) {
+      return keys.contains(s1) || values.contains(s1);
+    } else {
+      throw new IllegalArgumentException("json_scope argument must be one of: \"JSON_KEYS\", "
+          + "\"JSON_VALUES\", \"JSON_KEYS_AND_VALUES\".");
+    }
+  }
+
+  /** SQL {@code CONTAINS_SUBSTR(string, string)} function. */

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-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] julianhyde commented on a diff in pull request #3147: [CALCITE-5644] Add CONTAINS_SUBSTR function (enabled in BigQuery library)

Posted by "julianhyde (via GitHub)" <gi...@apache.org>.
julianhyde commented on code in PR #3147:
URL: https://github.com/apache/calcite/pull/3147#discussion_r1287715037


##########
core/src/main/java/org/apache/calcite/sql/fun/SqlContainsSubstrFunction.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.sql.fun;
+
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.sql.SqlCall;
+import org.apache.calcite.sql.SqlFunction;
+import org.apache.calcite.sql.SqlFunctionCategory;
+import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.SqlNode;
+import org.apache.calcite.sql.type.OperandTypes;
+import org.apache.calcite.sql.type.ReturnTypes;
+import org.apache.calcite.sql.validate.SqlValidator;
+import org.apache.calcite.sql.validate.SqlValidatorScope;
+
+/** The "CONTAINS_SUBSTR(expression, search_value_literal[, json_scope => json_scope_value])"
+ * function; performs a search to see if a value exists as a substring in an expression. */
+public class SqlContainsSubstrFunction extends SqlFunction {

Review Comment:
   `validateColumnListParams` seems to always throw. It also seems vestigial. If you remove the one call to it, do any tests break? I suspect not.
   
   So perhaps the method and calls can be removed. If you do that, can you switch to using `SqlBasicFunction.create`?
   



-- 
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-unsubscribe@calcite.apache.org

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