Re: [PR] [CALCITE-6239] Add a postgis dialect that supports ST functions [calcite]
YiwenWu commented on code in PR #3668: URL: https://github.com/apache/calcite/pull/3668#discussion_r1476931157 ## core/src/main/java/org/apache/calcite/sql/dialect/PostgisSqlDialect.java: ## @@ -0,0 +1,51 @@ +/* + * 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.dialect; + +import org.apache.calcite.avatica.util.Casing; +import org.apache.calcite.sql.SqlCall; +import org.apache.calcite.sql.SqlDialect; +import org.apache.calcite.sql.SqlWriter; +import org.apache.calcite.util.RelToSqlConverterUtil; + +/** + * A SqlDialect implementation for the PostgreSQL database. + */ +public class PostgisSqlDialect extends PostgresqlSqlDialect { + + public static final SqlDialect.Context DEFAULT_CONTEXT = SqlDialect.EMPTY_CONTEXT + .withDatabaseProduct(DatabaseProduct.POSTGIS) + .withIdentifierQuoteString("\"") + .withUnquotedCasing(Casing.TO_LOWER) + .withDataTypeSystem(POSTGRESQL_TYPE_SYSTEM); + + public static final SqlDialect DEFAULT = new PostgisSqlDialect(DEFAULT_CONTEXT); + + /** Creates a PostgresqlSqlDialect. */ + public PostgisSqlDialect(Context context) { +super(context); + } + + @Override public void unparseCall(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { Review Comment: Since PostGIS is an extension of PostgreSQL, Can these changes be processed directly in PostgresqlSqlDialect? ## core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java: ## @@ -7876,6 +7878,26 @@ private void checkLiteral2(String expression, String expected) { .withSpark().ok(sparkExpected); } + /** + * Test case for ST_SRID function. + * All the spatial functions where the arguments are the same type should behave similarly. + */ + @Test void testPostgisStSrid() { +String query = "select st_srid(\"point\") FROM \"points\""; +String expectedPostgis = "SELECT \"ST_SRID\"(\"point\")\nFROM \"GEO\".\"points\""; Review Comment: Some UT tests failed -- 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-6219 - Always Filter validation [calcite]
sonarcloud[bot] commented on PR #3662: URL: https://github.com/apache/calcite/pull/3662#issuecomment-1924914603 ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3662) **Quality Gate passed** The SonarCloud Quality Gate passed, but some issues were introduced. [5 New issues](https://sonarcloud.io/project/issues?id=apache_calcite=3662=false=true) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3662=false=true) [90.1% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3662=new_coverage=list) [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3662=new_duplicated_lines_density=list) [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_calcite=3662) -- 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-6219 - Always Filter validation [calcite]
sonarcloud[bot] commented on PR #3662: URL: https://github.com/apache/calcite/pull/3662#issuecomment-1924905900 ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3662) **Quality Gate passed** The SonarCloud Quality Gate passed, but some issues were introduced. [5 New issues](https://sonarcloud.io/project/issues?id=apache_calcite=3662=false=true) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3662=false=true) [90.6% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3662=new_coverage=list) [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3662=new_duplicated_lines_density=list) [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_calcite=3662) -- 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-6224] Add LOG2 function (enabled in Mysql, Spark library) [calcite]
caicancai commented on PR #3648: URL: https://github.com/apache/calcite/pull/3648#issuecomment-1924901070 I will fix 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-6219 - Always Filter validation [calcite]
sonarcloud[bot] commented on PR #3662: URL: https://github.com/apache/calcite/pull/3662#issuecomment-1924887816 ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3662) **Quality Gate passed** The SonarCloud Quality Gate passed, but some issues were introduced. [5 New issues](https://sonarcloud.io/project/issues?id=apache_calcite=3662=false=true) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3662=false=true) [90.6% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3662=new_coverage=list) [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3662=new_duplicated_lines_density=list) [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_calcite=3662) -- 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-6219 - Always Filter validation [calcite]
sonarcloud[bot] commented on PR #3662: URL: https://github.com/apache/calcite/pull/3662#issuecomment-1924877784 ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3662) **Quality Gate passed** The SonarCloud Quality Gate passed, but some issues were introduced. [6 New issues](https://sonarcloud.io/project/issues?id=apache_calcite=3662=false=true) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3662=false=true) [90.7% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3662=new_coverage=list) [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3662=new_duplicated_lines_density=list) [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_calcite=3662) -- 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
[PR] [CALCITE-6239] Add a postgis dialect that supports ST functions [calcite]
bchapuis opened a new pull request, #3668: URL: https://github.com/apache/calcite/pull/3668 (no comment) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add a postgis dialect that supports ST functions [calcite]
bchapuis closed pull request #3667: Add a postgis dialect that supports ST functions URL: https://github.com/apache/calcite/pull/3667 -- 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
[PR] Add a postgis dialect that supports ST functions [calcite]
bchapuis opened a new pull request, #3667: URL: https://github.com/apache/calcite/pull/3667 (no comment) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [CALCITE-5647] RelMdPopulationSize should use mq.getRowCount(rel) instead of rel.estimateRowCount(mq) [calcite]
sonarcloud[bot] commented on PR #3632: URL: https://github.com/apache/calcite/pull/3632#issuecomment-1924835521 ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3632) **Quality Gate passed** Kudos, no new issues were introduced! [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite=3632=false=true) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3632=false=true) [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3632=new_coverage=list) [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3632=new_duplicated_lines_density=list) [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_calcite=3632) -- 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-5647] RelMdPopulationSize should use mq.getRowCount(rel) instead of rel.estimateRowCount(mq) [calcite]
jduo commented on PR #3632: URL: https://github.com/apache/calcite/pull/3632#issuecomment-1924809312 > @jduo, usually the commit message is the same as Jira subject (more info here: https://calcite.apache.org/develop/#contributing). > > What if we use (for both Jira and commit) something that describes in-between the problem and the change, i.e. `[CALCITE-5647] RelMdPopulationSize should use mq.getRowCount(rel) instead of rel.estimateRowCount(mq)` ? Sounds good. I've updated the name of the PR and the commit message. However I cannot seem to edit the JIRA title (perhaps because I'm not the original reporter of the issue). -- 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-2067] RexLiteral cannot represent accurately floating point values, including NaN, Infinity [calcite]
sonarcloud[bot] commented on PR #3663: URL: https://github.com/apache/calcite/pull/3663#issuecomment-1924646186 ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3663) **Quality Gate passed** The SonarCloud Quality Gate passed, but some issues were introduced. [3 New issues](https://sonarcloud.io/project/issues?id=apache_calcite=3663=false=true) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3663=false=true) [70.6% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3663=new_coverage=list) [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3663=new_duplicated_lines_density=list) [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_calcite=3663) -- 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-2067] RexLiteral cannot represent accurately floating point values, including NaN, Infinity [calcite]
mihaibudiu commented on PR #3663: URL: https://github.com/apache/calcite/pull/3663#issuecomment-1924584002 @rubenada I have added a commented-out breaking change for the next release. Thank you for the reminder. -- 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-6032] Multilevel correlated query is failing in RelDecorrela… [calcite]
HanumathRao commented on PR #3640: URL: https://github.com/apache/calcite/pull/3640#issuecomment-1924399074 > @HanumathRao I'll try to take a look as soon as I have a bit of time. In the meanwhile, could you please check if your patch also fixes the cases mentioned in [CALCITE-5390](https://issues.apache.org/jira/browse/CALCITE-5390) ? (also NPE related to decorrelation). If it doesn't, no problem, I'd like just to confirm if [CALCITE-6032](https://issues.apache.org/jira/browse/CALCITE-6032) and [CALCITE-5390](https://issues.apache.org/jira/browse/CALCITE-5390) are / aren't due to same root cause. Thanks @rubenada for the reply. I tried out the query in CALCITE-5390 (https://issues.apache.org/jira/browse/CALCITE-5390) and they are not the same root cause. I can take a look at it later (post this JIRA merge), if no one is working on it. thanks -- 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-6032] Multilevel correlated query is failing in RelDecorrela… [calcite]
rubenada commented on PR #3640: URL: https://github.com/apache/calcite/pull/3640#issuecomment-1924192157 @HanumathRao I'll try to take a look as soon as I have a bit of time. In the meanwhile, could you please check if your patch also fixes the cases mentioned in CALCITE-5390 ? (also NPE related to decorrelation). If it doesn't, no problem, I'd like just to confirm if CALCITE-6032 and CALCITE-5390 are / aren't due to same root cause. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
(calcite) branch main updated: [CALCITE-6234] Add tests on SqlOperatorTest for to_char function
This is an automated email from the ASF dual-hosted git repository. rubenql pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/calcite.git The following commit(s) were added to refs/heads/main by this push: new 2aabf210dc [CALCITE-6234] Add tests on SqlOperatorTest for to_char function 2aabf210dc is described below commit 2aabf210dc1918c6ca20e63b39661ff445535eb8 Author: caicancai <2356672...@qq.com> AuthorDate: Tue Jan 30 23:25:44 2024 +0800 [CALCITE-6234] Add tests on SqlOperatorTest for to_char function --- .../org/apache/calcite/test/SqlOperatorTest.java | 27 ++ 1 file changed, 27 insertions(+) diff --git a/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java b/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java index a8b8d876e5..d4ee5b75f6 100644 --- a/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java +++ b/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java @@ -4423,6 +4423,33 @@ public class SqlOperatorTest { f.checkString("to_char(timestamp '2022-06-03 12:15:48.678', '-MM-DD HH24:MI:SS.MS TZ')", "2022-06-03 12:15:48.678", "VARCHAR(2000) NOT NULL"); +f.checkString("to_char(timestamp '2022-06-03 12:15:48.678', 'Day')", +"Friday", +"VARCHAR(2000) NOT NULL"); +f.checkString("to_char(timestamp '2022-06-03 12:15:48.678', 'CC')", +"21", +"VARCHAR(2000) NOT NULL"); +f.checkString("to_char(timestamp '2022-06-03 13:15:48.678', 'HH12')", +"01", +"VARCHAR(2000) NOT NULL"); +f.checkString("to_char(timestamp '2022-06-03 13:15:48.678', 'HH24')", +"13", +"VARCHAR(2000) NOT NULL"); +f.checkString("to_char(timestamp '2022-06-03 13:15:48.678', 'MI')", +"15", +"VARCHAR(2000) NOT NULL"); +f.checkString("to_char(timestamp '2022-06-03 13:15:48.678', 'MS')", +"678", +"VARCHAR(2000) NOT NULL"); +f.checkString("to_char(timestamp '2022-06-03 13:15:48.678', 'Q')", +"2", +"VARCHAR(2000) NOT NULL"); +f.checkString("to_char(timestamp '2022-06-03 13:15:48.678', 'IW')", +"23", +"VARCHAR(2000) NOT NULL"); +f.checkNull("to_char(timestamp '2022-06-03 12:15:48.678', NULL)"); +f.checkNull("to_char(cast(NULL as timestamp), NULL)"); +f.checkNull("to_char(cast(NULL as timestamp), 'Day')"); } @Test void testFromBase64() {
Re: [PR] [CALCITE-6234] Add tests on SqlOperatorTest for to_char function [calcite]
rubenada merged PR #3659: URL: https://github.com/apache/calcite/pull/3659 -- 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-6032] Multilevel correlated query is failing in RelDecorrela… [calcite]
HanumathRao commented on PR #3640: URL: https://github.com/apache/calcite/pull/3640#issuecomment-1924164888 @mihaibudiu, Please let me know if you have any further questions or clarifications on these changes. @libenchao and @rubenada, a friendly reminder to review the PR changes. -- 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-6214] Remove DISTINCT in aggregate function if field is unique [calcite]
sonarcloud[bot] commented on PR #3641: URL: https://github.com/apache/calcite/pull/3641#issuecomment-1923833598 ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3641) **Quality Gate passed** Kudos, no new issues were introduced! [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite=3641=false=true) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3641=false=true) [96.3% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3641=new_coverage=list) [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3641=new_duplicated_lines_density=list) [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_calcite=3641) -- 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-6236] EnumerableBatchNestedLoopJoin::estimateRowCount returns wrong value [calcite]
sonarcloud[bot] commented on PR #3665: URL: https://github.com/apache/calcite/pull/3665#issuecomment-1923710826 ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3665) **Quality Gate passed** The SonarCloud Quality Gate passed, but some issues were introduced. [2 New issues](https://sonarcloud.io/project/issues?id=apache_calcite=3665=false=true) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3665=false=true) [88.2% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3665=new_coverage=list) [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3665=new_duplicated_lines_density=list) [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_calcite=3665) -- 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-6236] EnumerableBatchNestedLoopJoin::estimateRowCount returns wrong value [calcite]
sonarcloud[bot] commented on PR #3665: URL: https://github.com/apache/calcite/pull/3665#issuecomment-1923647839 ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3665) **Quality Gate passed** The SonarCloud Quality Gate passed, but some issues were introduced. [2 New issues](https://sonarcloud.io/project/issues?id=apache_calcite=3665=false=true) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3665=false=true) [89.5% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3665=new_coverage=list) [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3665=new_duplicated_lines_density=list) [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_calcite=3665) -- 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-6236] EnumerableBatchNestedLoopJoin::estimateRowCount returns wrong value [calcite]
sonarcloud[bot] commented on PR #3665: URL: https://github.com/apache/calcite/pull/3665#issuecomment-1923627869 ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3665) **Quality Gate passed** The SonarCloud Quality Gate passed, but some issues were introduced. [2 New issues](https://sonarcloud.io/project/issues?id=apache_calcite=3665=false=true) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3665=false=true) [94.4% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3665=new_coverage=list) [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3665=new_duplicated_lines_density=list) [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_calcite=3665) -- 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
[PR] [CALCITE-2040] Create adapter for Apache Arrow [calcite]
macroguo-ghy opened a new pull request, #3666: URL: https://github.com/apache/calcite/pull/3666 (no comment) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [CALCITE-2067] RexLiteral cannot represent accurately floating point values, including NaN, Infinity [calcite]
rubenada commented on PR #3663: URL: https://github.com/apache/calcite/pull/3663#issuecomment-1923545735 bq. This is a breaking change in some respect [...] Just a minor reminder: before the final merge, @mihaibudiu , I think it'd be necessary to include the corresponding comment about this on `history.md` in the "breaking changes" section for the next release 1.37 (so that we don't forget to mention it when preparing the next release). -- 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-6236] EnumerableBatchNestedLoopJoin uses wrong row count for cost calculation [calcite]
sonarcloud[bot] commented on PR #3661: URL: https://github.com/apache/calcite/pull/3661#issuecomment-1923460518 ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3661) **Quality Gate passed** Kudos, no new issues were introduced! [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite=3661=false=true) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3661=false=true) [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3661=new_coverage=list) [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3661=new_duplicated_lines_density=list) [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_calcite=3661) -- 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-6224] Add LOG2 function (enabled in Mysql, Spark library) [calcite]
caicancai commented on PR #3648: URL: https://github.com/apache/calcite/pull/3648#issuecomment-1923453271 @mihaibudiu @tanclary https://issues.apache.org/jira/browse/CALCITE-6237 -- 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-6236] EnumerableBatchNestedLoopJoin::estimateRowCount returns wrong value [calcite]
sonarcloud[bot] commented on PR #3665: URL: https://github.com/apache/calcite/pull/3665#issuecomment-1923450389 ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3665) **Quality Gate passed** The SonarCloud Quality Gate passed, but some issues were introduced. [2 New issues](https://sonarcloud.io/project/issues?id=apache_calcite=3665=false=true) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3665=false=true) [93.8% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3665=new_coverage=list) [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3665=new_duplicated_lines_density=list) [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_calcite=3665) -- 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-6224] Add LOG2 function (enabled in Mysql, Spark library) [calcite]
sonarcloud[bot] commented on PR #3648: URL: https://github.com/apache/calcite/pull/3648#issuecomment-1923439078 ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3648) **Quality Gate passed** The SonarCloud Quality Gate passed, but some issues were introduced. [1 New issue](https://sonarcloud.io/project/issues?id=apache_calcite=3648=false=true) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3648=false=true) [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3648=new_coverage=list) [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3648=new_duplicated_lines_density=list) [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_calcite=3648) -- 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-6224] Add LOG2 function (enabled in Mysql, Spark library) [calcite]
caicancai commented on code in PR #3648: URL: https://github.com/apache/calcite/pull/3648#discussion_r1475796619 ## testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java: ## @@ -6188,6 +6188,67 @@ void checkRegexpExtract(SqlOperatorFixture f0, FunctionAlias functionAlias) { f.checkNull("log(10, cast(null as real))"); } + /** Test case for + * https://issues.apache.org/jira/browse/CALCITE-6224;>[CALCITE-6224] + * Add LOG@ function (enabled in MYSQL, Spark library). */ + @Test void testLog2Func() { +final SqlOperatorFixture f0 = fixture(); +final Consumer consumer = f -> { + f.setFor(SqlLibraryOperators.LOG2); + f.checkScalarApprox("log2(2)", "DOUBLE NOT NULL", + isWithin(1.0, 0.01)); + f.checkScalarApprox("log2(4)", "DOUBLE NOT NULL", + isWithin(2.0, 0.01)); + f.checkScalarApprox("log2(65536)", "DOUBLE NOT NULL", + isWithin(16.0, 0.01)); + f.checkScalarApprox("log2(-2)", "DOUBLE NOT NULL", + "NaN"); + f.checkScalarApprox("log2(2/3)", "DOUBLE NOT NULL", + "-Infinity"); + f.checkScalarApprox("log2(2.2)", "DOUBLE NOT NULL", + "1.1375035237499351"); + f.checkScalarApprox("log2(0.5)", "DOUBLE NOT NULL", + "-1.0"); + f.checkScalarApprox("log2(3)", "DOUBLE NOT NULL", + isWithin(1.5849625007211563, 0.01)); + f.checkNull("log2(cast(null as real))"); +}; +f0.forEachLibrary(list(SqlLibrary.MYSQL, SqlLibrary.SPARK), consumer); + } + + /** Test case for + * https://issues.apache.org/jira/browse/CALCITE-6232;>[CALCITE-6232] + * Using fractions in LOG function does not return correct results. */ + @Test void testLogFuncByConvert() { +// The fractional conversion of the Log function is reserved only for integer bits +final SqlOperatorFixture f0 = Fixtures.forOperators(true); +f0.setFor(SqlLibraryOperators.LOG, VmName.EXPAND); +final SqlOperatorFixture f = f0.withLibrary(SqlLibrary.BIG_QUERY); +f.checkScalarApprox("log(2/3, 2)", "DOUBLE NOT NULL", Review Comment: done. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [CALCITE-6234] Add tests on SqlOperatorTest for to_char function [calcite]
sonarcloud[bot] commented on PR #3659: URL: https://github.com/apache/calcite/pull/3659#issuecomment-1923432146 ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite=3659) **Quality Gate passed** Kudos, no new issues were introduced! [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite=3659=false=true) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3659=false=true) [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3659=new_coverage=list) [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite=3659=new_duplicated_lines_density=list) [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_calcite=3659) -- 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-6224] Add LOG2 function (enabled in Mysql, Spark library) [calcite]
caicancai commented on code in PR #3648: URL: https://github.com/apache/calcite/pull/3648#discussion_r1475796414 ## testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java: ## @@ -6188,6 +6188,65 @@ void checkRegexpExtract(SqlOperatorFixture f0, FunctionAlias functionAlias) { f.checkNull("log(10, cast(null as real))"); } + /** Test case for + * https://issues.apache.org/jira/browse/CALCITE-6224;>[CALCITE-6224] + * Add LOG@ function (enabled in MYSQL, Spark library). */ + @Test void testLog2Func() { +final SqlOperatorFixture f0 = fixture(); +final Consumer consumer = f -> { + f.setFor(SqlLibraryOperators.LOG2); + f.checkScalarApprox("log2(2)", "DOUBLE NOT NULL", + isWithin(1.0, 0.01)); + f.checkScalarApprox("log2(4)", "DOUBLE NOT NULL", + isWithin(2.0, 0.01)); + f.checkScalarApprox("log2(65536)", "DOUBLE NOT NULL", + isWithin(16.0, 0.01)); + f.checkScalarApprox("log2(-2)", "DOUBLE NOT NULL", + "NaN"); + f.checkScalarApprox("log2(2/3)", "DOUBLE NOT NULL", + "-Infinity"); + f.checkScalarApprox("log2(2.2)", "DOUBLE NOT NULL", + "1.1375035237499351"); + f.checkScalarApprox("log2(0.5)", "DOUBLE NOT NULL", + "-1.0"); + f.checkScalarApprox("log2(3)", "DOUBLE NOT NULL", + isWithin(1.5849625007211563, 0.01)); + f.checkNull("log2(cast(null as real))"); +}; +f0.forEachLibrary(list(SqlLibrary.MYSQL, SqlLibrary.SPARK), consumer); + } + + /** Test case for + * https://issues.apache.org/jira/browse/CALCITE-6232;>[CALCITE-6232] + * Using fractions in LOG function does not return correct results. */ + @Test void testLogFuncByConvert() { +// The fractional conversion of the Log function is reserved only for integer bits +final SqlOperatorFixture f0 = Fixtures.forOperators(true); +f0.setFor(SqlLibraryOperators.LOG, VmName.EXPAND); +final SqlOperatorFixture f = f0.withLibrary(SqlLibrary.BIG_QUERY); +f.checkScalarApprox("log(2/3, 2)", "DOUBLE NOT NULL", + "-Infinity"); +f.checkScalarApprox("log(0,2)", "DOUBLE NOT NULL", + "-Infinity"); +f.checkScalarApprox("log(1,2)", "DOUBLE NOT NULL", +"0.0"); +f.checkScalarApprox("log(4/3,2)", "DOUBLE NOT NULL", +"0.0"); +f.checkScalarApprox("log(5/3,2)", "DOUBLE NOT NULL", +"0.0"); +f.checkScalarApprox("log(2/3, 10)", "DOUBLE NOT NULL", + "-Infinity"); +f.checkScalarApprox("log(0,10)", "DOUBLE NOT NULL", + "-Infinity"); +f.checkScalarApprox("log(1,10)", "DOUBLE NOT NULL", +"0.0"); +f.checkScalarApprox("log(4/3,10)", "DOUBLE NOT NULL", Review Comment: The result looks correct, it's only different when it comes to fractions ## testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java: ## @@ -6188,6 +6188,67 @@ void checkRegexpExtract(SqlOperatorFixture f0, FunctionAlias functionAlias) { f.checkNull("log(10, cast(null as real))"); } + /** Test case for + * https://issues.apache.org/jira/browse/CALCITE-6224;>[CALCITE-6224] + * Add LOG@ function (enabled in MYSQL, Spark library). */ + @Test void testLog2Func() { +final SqlOperatorFixture f0 = fixture(); +final Consumer consumer = f -> { + f.setFor(SqlLibraryOperators.LOG2); + f.checkScalarApprox("log2(2)", "DOUBLE NOT NULL", + isWithin(1.0, 0.01)); + f.checkScalarApprox("log2(4)", "DOUBLE NOT NULL", + isWithin(2.0, 0.01)); + f.checkScalarApprox("log2(65536)", "DOUBLE NOT NULL", + isWithin(16.0, 0.01)); + f.checkScalarApprox("log2(-2)", "DOUBLE NOT NULL", + "NaN"); + f.checkScalarApprox("log2(2/3)", "DOUBLE NOT NULL", + "-Infinity"); + f.checkScalarApprox("log2(2.2)", "DOUBLE NOT NULL", + "1.1375035237499351"); + f.checkScalarApprox("log2(0.5)", "DOUBLE NOT NULL", + "-1.0"); + f.checkScalarApprox("log2(3)", "DOUBLE NOT NULL", + isWithin(1.5849625007211563, 0.01)); + f.checkNull("log2(cast(null as real))"); +}; +f0.forEachLibrary(list(SqlLibrary.MYSQL, SqlLibrary.SPARK), consumer); + } + + /** Test case for + * https://issues.apache.org/jira/browse/CALCITE-6232;>[CALCITE-6232] + * Using fractions in LOG function does not return correct results. */ + @Test void testLogFuncByConvert() { +// The fractional conversion of the Log function is reserved only for integer bits +final SqlOperatorFixture f0 = Fixtures.forOperators(true); +f0.setFor(SqlLibraryOperators.LOG, VmName.EXPAND); +final SqlOperatorFixture f = f0.withLibrary(SqlLibrary.BIG_QUERY); +f.checkScalarApprox("log(2/3, 2)", "DOUBLE NOT NULL", Review Comment: done. The result looks correct, it's only different when it comes to fractions -- This is an automated message from the Apache Git Service. To respond to the message, please log
[PR] [CALCITE-6236] EnumerableBatchNestedLoopJoin::estimateRowCount returns wrong value [calcite]
kramerul opened a new pull request, #3665: URL: https://github.com/apache/calcite/pull/3665 This is another approach to fix [CALCITE-6236] using the selectivity of the filter which is inserted on the right side. -- 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-6234] Add tests on SqlOperatorTest for to_char function [calcite]
caicancai commented on PR #3659: URL: https://github.com/apache/calcite/pull/3659#issuecomment-1923388488 > @caicancai could you please also amend the commit message to have the same? done. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [CALCITE-6234] Add tests on SqlOperatorTest for to_char function [calcite]
rubenada commented on PR #3659: URL: https://github.com/apache/calcite/pull/3659#issuecomment-1923372029 @caicancai could you please also amend the commit message to have the same? -- 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-5647] Use mq.getRowCount(rel) instead of rel.estimateRowCount(mq) [calcite]
rubenada commented on PR #3632: URL: https://github.com/apache/calcite/pull/3632#issuecomment-1923356817 @jduo, usually the commit message is the same as Jira subject (more info here: https://calcite.apache.org/develop/#contributing). What if we use (for both Jira and commit) something that describes in-between the problem and the change, i.e. `[CALCITE-5647] RelMdPopulationSize should use mq.getRowCount(rel) instead of rel.estimateRowCount(mq)` ? -- 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-6221] JDBC adapter generates invalid query when the same table is joined multiple times [calcite]
kramerul commented on code in PR #3664: URL: https://github.com/apache/calcite/pull/3664#discussion_r1475710267 ## core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java: ## @@ -437,11 +437,43 @@ public Result visit(Filter e) { final Result x = visitInput(e, 0, Clause.WHERE); parseCorrelTable(e, x); final Builder builder = x.builder(e); + if (input instanceof Join) { +final Context context = x.qualifiedContext(); +final ImmutableList.Builder selectList = ImmutableList.builder(); +// Fieldnames are unique since they are created by SqlValidatorUtil.deriveJoinRowType() +final List uniqueFieldNames = input.getRowType().getFieldNames(); +boolean selectListRequired = false; +for (int i = 0; i < context.fieldCount; i++) { + final SqlNode field = context.field(i); + final String fieldName = uniqueFieldNames.get(i); + if (fieldWasRenamedByJoinDueToNameClash(field, fieldName)) { +selectListRequired = true; + } + selectList.add( + SqlStdOperatorTable.AS.createCall(POS, field, + new SqlIdentifier(fieldName, POS))); +} +if (selectListRequired) { + builder.setSelect(new SqlNodeList(selectList.build(), POS)); +} + } builder.setWhere(builder.context.toSql(null, e.getCondition())); return builder.result(); } } + private static boolean fieldWasRenamedByJoinDueToNameClash(SqlNode field, String fieldName) { +if (!(field instanceof SqlIdentifier)) { Review Comment: I changed it accordingly. -- 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