Re: [PR] [CALCITE-5950] Default column constraint is erroneously processed [calcite]

2023-10-08 Thread via GitHub


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

   @zstan LGTM.
   
   Hi @JiajunBernoulli @julianhyde ,do you have any other 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-unsubscr...@calcite.apache.org

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



Re: [PR] [CALCITE-5918] Add MAP function (enabled in Spark library) [calcite]

2023-10-08 Thread via GitHub


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

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


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

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

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



Re: [PR] [CALCITE-5950] Default column constraint is erroneously processed [calcite]

2023-10-08 Thread via GitHub


zstan commented on PR #3393:
URL: https://github.com/apache/calcite/pull/3393#issuecomment-1752363634

   @LakeShen thanks for review, i fix more of comments, probably it ready for 
merge ?


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

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

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



Re: [PR] Update powered_by.md [calcite]

2023-10-08 Thread via GitHub


kbeedkar commented on PR #3450:
URL: https://github.com/apache/calcite/pull/3450#issuecomment-1752311302

   Thanks. Will make a separate PR for updating the image.


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

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

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



Re: [PR] [CALCITE-6037] The function category of ARRAY/EXTRACT_VALUE/XML_TRANSFORM/EXTRACT_XML/EXISTSNODE is incorrect (Spark/MySQL/Oracle Library) [calcite]

2023-10-08 Thread via GitHub


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

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


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

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

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



Re: [PR] [CALCITE-6011] Add the planner rule that pushes the Filter past a Window [calcite]

2023-10-08 Thread via GitHub


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

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


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

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

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



Re: [PR] [CALCITE-6031] Add the planner rule that pushes the Filter past a Sample [calcite]

2023-10-08 Thread via GitHub


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

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


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

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

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



Re: [PR] [CALCITE-5918] Add MAP function (enabled in Spark library) [calcite]

2023-10-08 Thread via GitHub


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

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


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

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

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



Re: [PR] [CALCITE-5918] Add MAP function (enabled in Spark library) [calcite]

2023-10-08 Thread via GitHub


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

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


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

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

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



Re: [PR] [CALCITE-5918] Add MAP function (enabled in Spark library) [calcite]

2023-10-08 Thread via GitHub


chucheng92 commented on code in PR #3459:
URL: https://github.com/apache/calcite/pull/3459#discussion_r1349687321


##
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##
@@ -6604,11 +6605,44 @@ private static void checkIf(SqlOperatorFixture f) {
 // test operands not in same type family.
 f.checkFails("^map_concat(map[1, null], array[1])^",
 "Parameters must be of the same type", false);
+
+// 2. check with map function, map(k, v ...)

Review Comment:
   updated, but currently calcite not support 'cast(map() as map)', so I have added the case in IF block until we support it.



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

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

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



Re: [PR] [CALCITE-5918] Add MAP function (enabled in Spark library) [calcite]

2023-10-08 Thread via GitHub


chucheng92 commented on code in PR #3459:
URL: https://github.com/apache/calcite/pull/3459#discussion_r1349646120


##
core/src/main/codegen/templates/Parser.jj:
##
@@ -4886,14 +4886,21 @@ SqlNode MapConstructor() :
 {
  { s = span(); }
 (
-LOOKAHEAD(1)
-
-// by sub query "MAP (SELECT empno, deptno FROM emp)"
-e = LeafQueryOrExpr(ExprContext.ACCEPT_QUERY)
-
+(
+// empty map function call: "map()"
+LOOKAHEAD(2)
+  { args = SqlNodeList.EMPTY; }
+|
+args = ParenthesizedQueryOrCommaList(ExprContext.ACCEPT_ALL)
+)
 {
-return SqlStdOperatorTable.MAP_QUERY.createCall(
-s.end(this), e);
+if (args.size() == 1 && args.get(0).isA(SqlKind.QUERY)) {
+// MAP query constructor e.g. "MAP (SELECT empno, deptno FROM 
emps)"
+return SqlStdOperatorTable.MAP_QUERY.createCall(s.end(this), 
args.get(0));
+} else {
+// MAP function e.g. "MAP(1, 2)" equivalent to standard 
"MAP[1, 2]"
+return SqlLibraryOperators.MAP.createCall(s.end(this), 
args.getList());

Review Comment:
   I hope to retain the original parser logic here, because it will be detected 
later on OperandTypeChecker. And here is similar with spark's array handling 
and calcite array constructor. pls see: 
https://github.com/apache/calcite/pull/3141/files
   
   Another benefit is that we can use some more human-readable error messages 
in predefined CalciteResource.



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

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

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



Re: [PR] [CALCITE-5918] Add MAP function (enabled in Spark library) [calcite]

2023-10-08 Thread via GitHub


chucheng92 commented on code in PR #3459:
URL: https://github.com/apache/calcite/pull/3459#discussion_r1349646120


##
core/src/main/codegen/templates/Parser.jj:
##
@@ -4886,14 +4886,21 @@ SqlNode MapConstructor() :
 {
  { s = span(); }
 (
-LOOKAHEAD(1)
-
-// by sub query "MAP (SELECT empno, deptno FROM emp)"
-e = LeafQueryOrExpr(ExprContext.ACCEPT_QUERY)
-
+(
+// empty map function call: "map()"
+LOOKAHEAD(2)
+  { args = SqlNodeList.EMPTY; }
+|
+args = ParenthesizedQueryOrCommaList(ExprContext.ACCEPT_ALL)
+)
 {
-return SqlStdOperatorTable.MAP_QUERY.createCall(
-s.end(this), e);
+if (args.size() == 1 && args.get(0).isA(SqlKind.QUERY)) {
+// MAP query constructor e.g. "MAP (SELECT empno, deptno FROM 
emps)"
+return SqlStdOperatorTable.MAP_QUERY.createCall(s.end(this), 
args.get(0));
+} else {
+// MAP function e.g. "MAP(1, 2)" equivalent to standard 
"MAP[1, 2]"
+return SqlLibraryOperators.MAP.createCall(s.end(this), 
args.getList());

Review Comment:
   I hope to retain the original parser logic here, because it will be detected 
later on OperandTypeChecker. And here is similar with Array handling and 
calcite array constructor. pls see: 
https://github.com/apache/calcite/pull/3141/files
   
   Another benefit is that we can use some more human-readable error messages 
in predefined CalciteResource.



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

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

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



Re: [PR] [CALCITE-5918] Add MAP function (enabled in Spark library) [calcite]

2023-10-08 Thread via GitHub


chucheng92 commented on code in PR #3459:
URL: https://github.com/apache/calcite/pull/3459#discussion_r1349685796


##
site/_docs/reference.md:
##
@@ -2769,6 +2769,7 @@ BigQuery's type system uses confusingly different names 
for types and functions:
 | b | TO_HEX(binary) | Converts *binary* into 
a hexadecimal varchar
 | b | FROM_HEX(varchar)  | Converts a 
hexadecimal-encoded *varchar* into bytes
 | b o | LTRIM(string)| Returns *string* with 
all blanks removed from the start
+| s | MAP(key, value [, key, value]*)| Returns a map with the 
given key/value pairs

Review Comment:
   Fixed.



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

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

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



Re: [PR] [CALCITE-5918] Add MAP function (enabled in Spark library) [calcite]

2023-10-08 Thread via GitHub


chucheng92 commented on code in PR #3459:
URL: https://github.com/apache/calcite/pull/3459#discussion_r1349646490


##
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##
@@ -1077,6 +1079,38 @@ private static RelDataType 
arrayReturnType(SqlOperatorBinding opBinding) {
   SqlLibraryOperators::arrayReturnType,
   OperandTypes.SAME_VARIADIC);
 
+  private static RelDataType mapReturnType(SqlOperatorBinding opBinding) {
+Pair<@Nullable RelDataType, @Nullable RelDataType> type =
+getComponentTypes(
+opBinding.getTypeFactory(), opBinding.collectOperandTypes());
+return SqlTypeUtil.createMapType(
+opBinding.getTypeFactory(),
+requireNonNull(type.left, "inferred key type"),
+requireNonNull(type.right, "inferred value type"),
+false);
+  }
+
+  private static Pair<@Nullable RelDataType, @Nullable RelDataType> 
getComponentTypes(
+  RelDataTypeFactory typeFactory,
+  List argTypes) {
+// special case, allows empty map
+if (argTypes.size() == 0) {
+  return Pair.of(typeFactory.createUnknownType(), 
typeFactory.createUnknownType());

Review Comment:
   because Spark use VOID type when map is empty, the Spark VOID type are 
equivalent in some degree with calcite UNKNOWN.
   
   And it's similar with current spark ARRAY handling. pls see: 
https://github.com/apache/calcite/pull/3141/files



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

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

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



Re: [PR] [CALCITE-5918] Add MAP function (enabled in Spark library) [calcite]

2023-10-08 Thread via GitHub


chucheng92 commented on code in PR #3459:
URL: https://github.com/apache/calcite/pull/3459#discussion_r1349646490


##
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##
@@ -1077,6 +1079,38 @@ private static RelDataType 
arrayReturnType(SqlOperatorBinding opBinding) {
   SqlLibraryOperators::arrayReturnType,
   OperandTypes.SAME_VARIADIC);
 
+  private static RelDataType mapReturnType(SqlOperatorBinding opBinding) {
+Pair<@Nullable RelDataType, @Nullable RelDataType> type =
+getComponentTypes(
+opBinding.getTypeFactory(), opBinding.collectOperandTypes());
+return SqlTypeUtil.createMapType(
+opBinding.getTypeFactory(),
+requireNonNull(type.left, "inferred key type"),
+requireNonNull(type.right, "inferred value type"),
+false);
+  }
+
+  private static Pair<@Nullable RelDataType, @Nullable RelDataType> 
getComponentTypes(
+  RelDataTypeFactory typeFactory,
+  List argTypes) {
+// special case, allows empty map
+if (argTypes.size() == 0) {
+  return Pair.of(typeFactory.createUnknownType(), 
typeFactory.createUnknownType());

Review Comment:
   because Spark use a NullType class(VOID type) when map is empty, the Spark 
VOID type are equivalent in some degree with calcite UNKNOWN. 
   
   
https://github.com/apache/spark/blob/24b82dfd6cfb9a658af615446be5423695830dd9/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypeCreator.scala#L184C2-L184C2
   
   And it's similar with current spark ARRAY handling. pls see: 
https://github.com/apache/calcite/pull/3141/files



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

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

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



Re: [PR] [CALCITE-5918] Add MAP function (enabled in Spark library) [calcite]

2023-10-08 Thread via GitHub


chucheng92 commented on code in PR #3459:
URL: https://github.com/apache/calcite/pull/3459#discussion_r1349646120


##
core/src/main/codegen/templates/Parser.jj:
##
@@ -4886,14 +4886,21 @@ SqlNode MapConstructor() :
 {
  { s = span(); }
 (
-LOOKAHEAD(1)
-
-// by sub query "MAP (SELECT empno, deptno FROM emp)"
-e = LeafQueryOrExpr(ExprContext.ACCEPT_QUERY)
-
+(
+// empty map function call: "map()"
+LOOKAHEAD(2)
+  { args = SqlNodeList.EMPTY; }
+|
+args = ParenthesizedQueryOrCommaList(ExprContext.ACCEPT_ALL)
+)
 {
-return SqlStdOperatorTable.MAP_QUERY.createCall(
-s.end(this), e);
+if (args.size() == 1 && args.get(0).isA(SqlKind.QUERY)) {
+// MAP query constructor e.g. "MAP (SELECT empno, deptno FROM 
emps)"
+return SqlStdOperatorTable.MAP_QUERY.createCall(s.end(this), 
args.get(0));
+} else {
+// MAP function e.g. "MAP(1, 2)" equivalent to standard 
"MAP[1, 2]"
+return SqlLibraryOperators.MAP.createCall(s.end(this), 
args.getList());

Review Comment:
   I hope to retain the original parser logic here, because it will be detected 
later on OperandTypeChecker. And here is similar with Array handling. pls see: 
https://github.com/apache/calcite/pull/3141/files
   
   And even calcite MapValueConstructor keep this checking in 
OperandTypeChecker either.



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

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

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



Re: [PR] [CALCITE-5918] Add MAP function (enabled in Spark library) [calcite]

2023-10-08 Thread via GitHub


chucheng92 commented on code in PR #3459:
URL: https://github.com/apache/calcite/pull/3459#discussion_r1349646490


##
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##
@@ -1077,6 +1079,38 @@ private static RelDataType 
arrayReturnType(SqlOperatorBinding opBinding) {
   SqlLibraryOperators::arrayReturnType,
   OperandTypes.SAME_VARIADIC);
 
+  private static RelDataType mapReturnType(SqlOperatorBinding opBinding) {
+Pair<@Nullable RelDataType, @Nullable RelDataType> type =
+getComponentTypes(
+opBinding.getTypeFactory(), opBinding.collectOperandTypes());
+return SqlTypeUtil.createMapType(
+opBinding.getTypeFactory(),
+requireNonNull(type.left, "inferred key type"),
+requireNonNull(type.right, "inferred value type"),
+false);
+  }
+
+  private static Pair<@Nullable RelDataType, @Nullable RelDataType> 
getComponentTypes(
+  RelDataTypeFactory typeFactory,
+  List argTypes) {
+// special case, allows empty map
+if (argTypes.size() == 0) {
+  return Pair.of(typeFactory.createUnknownType(), 
typeFactory.createUnknownType());

Review Comment:
   because Spark use a VOID type when map is empty, the Spark VOID type are 
equivalent in some degree with calcite UNKNOWN.  
   
   And it's similar with current spark ARRAY handling. pls see: 
https://github.com/apache/calcite/pull/3141/files



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

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

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



Re: [PR] [CALCITE-5918] Add MAP function (enabled in Spark library) [calcite]

2023-10-08 Thread via GitHub


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

   @macroguo-ghy hi, thanks for reviewing. 
   Because we have implemented Spark's ARRAY function, their processing logic 
on parser and empty array/map is similar, if compare with 2 PRs to review may 
be more clearer.
   
   https://github.com/apache/calcite/pull/3141/files
   


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

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

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



Re: [PR] [CALCITE-5918] Add MAP function (enabled in Spark library) [calcite]

2023-10-08 Thread via GitHub


chucheng92 commented on code in PR #3459:
URL: https://github.com/apache/calcite/pull/3459#discussion_r1349646490


##
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##
@@ -1077,6 +1079,38 @@ private static RelDataType 
arrayReturnType(SqlOperatorBinding opBinding) {
   SqlLibraryOperators::arrayReturnType,
   OperandTypes.SAME_VARIADIC);
 
+  private static RelDataType mapReturnType(SqlOperatorBinding opBinding) {
+Pair<@Nullable RelDataType, @Nullable RelDataType> type =
+getComponentTypes(
+opBinding.getTypeFactory(), opBinding.collectOperandTypes());
+return SqlTypeUtil.createMapType(
+opBinding.getTypeFactory(),
+requireNonNull(type.left, "inferred key type"),
+requireNonNull(type.right, "inferred value type"),
+false);
+  }
+
+  private static Pair<@Nullable RelDataType, @Nullable RelDataType> 
getComponentTypes(
+  RelDataTypeFactory typeFactory,
+  List argTypes) {
+// special case, allows empty map
+if (argTypes.size() == 0) {
+  return Pair.of(typeFactory.createUnknownType(), 
typeFactory.createUnknownType());

Review Comment:
   because Spark use UNKNOWN type when it's empty, it's similar with current 
spark ARRAY handling. pls see: https://github.com/apache/calcite/pull/3141/files



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

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

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



Re: [PR] [CALCITE-5918] Add MAP function (enabled in Spark library) [calcite]

2023-10-08 Thread via GitHub


chucheng92 commented on code in PR #3459:
URL: https://github.com/apache/calcite/pull/3459#discussion_r1349646220


##
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##
@@ -6604,11 +6605,44 @@ private static void checkIf(SqlOperatorFixture f) {
 // test operands not in same type family.
 f.checkFails("^map_concat(map[1, null], array[1])^",
 "Parameters must be of the same type", false);
+
+// 2. check with map function, map(k, v ...)

Review Comment:
   yes, good point. I will fix it later.



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

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

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



Re: [PR] [CALCITE-5918] Add MAP function (enabled in Spark library) [calcite]

2023-10-08 Thread via GitHub


chucheng92 commented on code in PR #3459:
URL: https://github.com/apache/calcite/pull/3459#discussion_r1349646120


##
core/src/main/codegen/templates/Parser.jj:
##
@@ -4886,14 +4886,21 @@ SqlNode MapConstructor() :
 {
  { s = span(); }
 (
-LOOKAHEAD(1)
-
-// by sub query "MAP (SELECT empno, deptno FROM emp)"
-e = LeafQueryOrExpr(ExprContext.ACCEPT_QUERY)
-
+(
+// empty map function call: "map()"
+LOOKAHEAD(2)
+  { args = SqlNodeList.EMPTY; }
+|
+args = ParenthesizedQueryOrCommaList(ExprContext.ACCEPT_ALL)
+)
 {
-return SqlStdOperatorTable.MAP_QUERY.createCall(
-s.end(this), e);
+if (args.size() == 1 && args.get(0).isA(SqlKind.QUERY)) {
+// MAP query constructor e.g. "MAP (SELECT empno, deptno FROM 
emps)"
+return SqlStdOperatorTable.MAP_QUERY.createCall(s.end(this), 
args.get(0));
+} else {
+// MAP function e.g. "MAP(1, 2)" equivalent to standard 
"MAP[1, 2]"
+return SqlLibraryOperators.MAP.createCall(s.end(this), 
args.getList());

Review Comment:
   I hope to retain the original parser logic here, because it will be detected 
later on OperandTypeChecker. And here is similar with Array handling. pls see: 
https://github.com/apache/calcite/pull/3141/files



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

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

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



Re: [PR] [CALCITE-5918] Add MAP function (enabled in Spark library) [calcite]

2023-10-08 Thread via GitHub


chucheng92 commented on code in PR #3459:
URL: https://github.com/apache/calcite/pull/3459#discussion_r1349645838


##
site/_docs/reference.md:
##
@@ -2769,6 +2769,7 @@ BigQuery's type system uses confusingly different names 
for types and functions:
 | b | TO_HEX(binary) | Converts *binary* into 
a hexadecimal varchar
 | b | FROM_HEX(varchar)  | Converts a 
hexadecimal-encoded *varchar* into bytes
 | b o | LTRIM(string)| Returns *string* with 
all blanks removed from the start
+| s | MAP(key, value [, key, value]*)| Returns a map with the 
given key/value pairs

Review Comment:
   yes, good point. I will fix it later.



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

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

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



Re: [PR] [CALCITE-6022] Support "CREATE TABLE LIKE" DDL [calcite]

2023-10-08 Thread via GitHub


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

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


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

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

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



Re: [PR] [CALCITE-6022] Support "CREATE TABLE LIKE" DDL [calcite]

2023-10-08 Thread via GitHub


macroguo-ghy commented on code in PR #3442:
URL: https://github.com/apache/calcite/pull/3442#discussion_r1349640383


##
server/src/main/codegen/includes/parserImpls.ftl:
##
@@ -247,14 +247,73 @@ SqlCreate SqlCreateTable(Span s, boolean replace) :
 final SqlIdentifier id;
 SqlNodeList tableElementList = null;
 SqlNode query = null;
+
+SqlCreate createTableLike = null;
 }
 {
  ifNotExists = IfNotExistsOpt() id = CompoundIdentifier()
-[ tableElementList = TableElementList() ]
-[  query = OrderedQueryOrExpr(ExprContext.ACCEPT_QUERY) ]
+(
+ createTableLike = SqlCreateTableLike(s, replace, ifNotExists, 
id) {
+return createTableLike;
+}
+|
+[ tableElementList = TableElementList() ]
+[  query = OrderedQueryOrExpr(ExprContext.ACCEPT_QUERY) ]
+{
+return SqlDdlNodes.createTable(s.end(this), replace, ifNotExists, 
id, tableElementList, query);
+}
+)
+}
+
+SqlCreate SqlCreateTableLike(Span s, boolean replace, boolean ifNotExists, 
SqlIdentifier id) :

Review Comment:
   Fix this. Could you please review this PR again? @JiajunBernoulli 



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

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

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



Re: [PR] [CALCITE-6022] Support "CREATE TABLE LIKE" DDL [calcite]

2023-10-08 Thread via GitHub


macroguo-ghy commented on code in PR #3442:
URL: https://github.com/apache/calcite/pull/3442#discussion_r1349640383


##
server/src/main/codegen/includes/parserImpls.ftl:
##
@@ -247,14 +247,73 @@ SqlCreate SqlCreateTable(Span s, boolean replace) :
 final SqlIdentifier id;
 SqlNodeList tableElementList = null;
 SqlNode query = null;
+
+SqlCreate createTableLike = null;
 }
 {
  ifNotExists = IfNotExistsOpt() id = CompoundIdentifier()
-[ tableElementList = TableElementList() ]
-[  query = OrderedQueryOrExpr(ExprContext.ACCEPT_QUERY) ]
+(
+ createTableLike = SqlCreateTableLike(s, replace, ifNotExists, 
id) {
+return createTableLike;
+}
+|
+[ tableElementList = TableElementList() ]
+[  query = OrderedQueryOrExpr(ExprContext.ACCEPT_QUERY) ]
+{
+return SqlDdlNodes.createTable(s.end(this), replace, ifNotExists, 
id, tableElementList, query);
+}
+)
+}
+
+SqlCreate SqlCreateTableLike(Span s, boolean replace, boolean ifNotExists, 
SqlIdentifier id) :

Review Comment:
   Fix this. Could you please review this PR again?



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

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

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



Re: [PR] [CALCITE-5918] Add MAP function (enabled in Spark library) [calcite]

2023-10-08 Thread via GitHub


macroguo-ghy commented on code in PR #3459:
URL: https://github.com/apache/calcite/pull/3459#discussion_r1349635823


##
site/_docs/reference.md:
##
@@ -2769,6 +2769,7 @@ BigQuery's type system uses confusingly different names 
for types and functions:
 | b | TO_HEX(binary) | Converts *binary* into 
a hexadecimal varchar
 | b | FROM_HEX(varchar)  | Converts a 
hexadecimal-encoded *varchar* into bytes
 | b o | LTRIM(string)| Returns *string* with 
all blanks removed from the start
+| s | MAP(key, value [, key, value]*)| Returns a map with the 
given key/value pairs

Review Comment:
   Empty map is a legal functon. Please add `MAP()` to the documentation.



##
core/src/main/codegen/templates/Parser.jj:
##
@@ -4886,14 +4886,21 @@ SqlNode MapConstructor() :
 {
  { s = span(); }
 (
-LOOKAHEAD(1)
-
-// by sub query "MAP (SELECT empno, deptno FROM emp)"
-e = LeafQueryOrExpr(ExprContext.ACCEPT_QUERY)
-
+(
+// empty map function call: "map()"
+LOOKAHEAD(2)
+  { args = SqlNodeList.EMPTY; }
+|
+args = ParenthesizedQueryOrCommaList(ExprContext.ACCEPT_ALL)
+)
 {
-return SqlStdOperatorTable.MAP_QUERY.createCall(
-s.end(this), e);
+if (args.size() == 1 && args.get(0).isA(SqlKind.QUERY)) {
+// MAP query constructor e.g. "MAP (SELECT empno, deptno FROM 
emps)"
+return SqlStdOperatorTable.MAP_QUERY.createCall(s.end(this), 
args.get(0));
+} else {
+// MAP function e.g. "MAP(1, 2)" equivalent to standard 
"MAP[1, 2]"
+return SqlLibraryOperators.MAP.createCall(s.end(this), 
args.getList());

Review Comment:
   I think we can check if the size of args is an even number.



##
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##
@@ -1077,6 +1079,38 @@ private static RelDataType 
arrayReturnType(SqlOperatorBinding opBinding) {
   SqlLibraryOperators::arrayReturnType,
   OperandTypes.SAME_VARIADIC);
 
+  private static RelDataType mapReturnType(SqlOperatorBinding opBinding) {
+Pair<@Nullable RelDataType, @Nullable RelDataType> type =
+getComponentTypes(
+opBinding.getTypeFactory(), opBinding.collectOperandTypes());
+return SqlTypeUtil.createMapType(
+opBinding.getTypeFactory(),
+requireNonNull(type.left, "inferred key type"),
+requireNonNull(type.right, "inferred value type"),
+false);
+  }
+
+  private static Pair<@Nullable RelDataType, @Nullable RelDataType> 
getComponentTypes(
+  RelDataTypeFactory typeFactory,
+  List argTypes) {
+// special case, allows empty map
+if (argTypes.size() == 0) {
+  return Pair.of(typeFactory.createUnknownType(), 
typeFactory.createUnknownType());

Review Comment:
   There is a subtle difference between `unknown` and `any`, can you please 
explain why `unknown` is used?



##
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##
@@ -6604,11 +6605,44 @@ private static void checkIf(SqlOperatorFixture f) {
 // test operands not in same type family.
 f.checkFails("^map_concat(map[1, null], array[1])^",
 "Parameters must be of the same type", false);
+
+// 2. check with map function, map(k, v ...)

Review Comment:
   Can you please add some tests with `map()`, like `map_concat(map('foo', 1), 
map())`, `map_keys(map())` or `cast(map() as MAP)`.
   Because the type of `map()` is `MAP`, I am not sure if 
unknown component type will cause an error.



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

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

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



Re: [PR] [CALCITE-6022] Support "CREATE TABLE LIKE" DDL [calcite]

2023-10-08 Thread via GitHub


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

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


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

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

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



Re: [PR] [CALCITE-6037] The function category of ARRAY/EXTRACT_VALUE/XML_TRANSFORM/EXTRACT/EXISTSNODE is incorrect [calcite]

2023-10-08 Thread via GitHub


chucheng92 commented on code in PR #3458:
URL: https://github.com/apache/calcite/pull/3458#discussion_r1349538846


##
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##
@@ -532,26 +532,30 @@ static RelDataType deriveTypeSplit(SqlOperatorBinding 
operatorBinding,
   public static final SqlFunction EXTRACT_VALUE =
   SqlBasicFunction.create("EXTRACTVALUE",
   ReturnTypes.VARCHAR_2000.andThen(SqlTypeTransforms.FORCE_NULLABLE),
-  OperandTypes.STRING_STRING);
+  OperandTypes.STRING_STRING,

Review Comment:
   @LakeShen I get your point. Usually we classify functions according to the 
operands (in some cases, they can also be determined according to the return 
value type).
   
   more details pls see: ANSI sql function category: 
https://www.oreilly.com/library/view/sql-in-a/9780596155322/ch04s04.html. 
   
   The string function category can return string & numeric values. And this 
function only can divide into String category.
   
   Generally speaking, these functions(in this PR ) process XML text and 
conform to the definition of String category rather than Numeric.



##
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##
@@ -532,26 +532,30 @@ static RelDataType deriveTypeSplit(SqlOperatorBinding 
operatorBinding,
   public static final SqlFunction EXTRACT_VALUE =
   SqlBasicFunction.create("EXTRACTVALUE",
   ReturnTypes.VARCHAR_2000.andThen(SqlTypeTransforms.FORCE_NULLABLE),
-  OperandTypes.STRING_STRING);
+  OperandTypes.STRING_STRING,

Review Comment:
   @LakeShen I get your point. Usually we classify functions according to the 
operands (in some cases, they can also be determined according to the return 
value type).
   
   more details pls see: ANSI sql function category: 
https://www.oreilly.com/library/view/sql-in-a/9780596155322/ch04s04.html. 
   
   The string function category can return string & numeric values. And this 
function only can divide into String category.
   
   Generally speaking, these functions(in this PR) process XML text and conform 
to the definition of String category rather than Numeric.



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

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

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