Re: [PR] [CALCITE-6022] Support "CREATE TABLE LIKE" DDL [calcite]
JiajunBernoulli merged PR #3442: URL: https://github.com/apache/calcite/pull/3442 -- 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-6022] Support "CREATE TABLE ... LIKE" DDL in server module
This is an automated email from the ASF dual-hosted git repository. jiajunxie 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 23b7931c3e [CALCITE-6022] Support "CREATE TABLE ... LIKE" DDL in server module 23b7931c3e is described below commit 23b7931c3e516bdb6cfedda956213f7fe06c6b24 Author: macroguo AuthorDate: Tue Sep 26 14:07:23 2023 +0800 [CALCITE-6022] Support "CREATE TABLE ... LIKE" DDL in server module --- .../main/java/org/apache/calcite/sql/SqlKind.java | 6 +- .../apache/calcite/sql/ddl/SqlCreateTableLike.java | 121 .../org/apache/calcite/sql/ddl/SqlDdlNodes.java| 8 ++ server/src/main/codegen/config.fmpp| 1 + server/src/main/codegen/includes/parserImpls.ftl | 67 - .../apache/calcite/server/ServerDdlExecutor.java | 99 + .../org/apache/calcite/test/ServerParserTest.java | 30 .../java/org/apache/calcite/test/ServerTest.java | 160 + server/src/test/resources/sql/table.iq | 137 ++ site/_docs/reference.md| 8 ++ 10 files changed, 632 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/apache/calcite/sql/SqlKind.java b/core/src/main/java/org/apache/calcite/sql/SqlKind.java index b2b5556c5e..7688cae915 100644 --- a/core/src/main/java/org/apache/calcite/sql/SqlKind.java +++ b/core/src/main/java/org/apache/calcite/sql/SqlKind.java @@ -1161,6 +1161,9 @@ public enum SqlKind { /** {@code CREATE TABLE} DDL statement. */ CREATE_TABLE, + /** {@code CREATE TABLE LIKE} DDL statement. */ + CREATE_TABLE_LIKE, + /** {@code ALTER TABLE} DDL statement. */ ALTER_TABLE, @@ -1281,7 +1284,8 @@ public enum SqlKind { public static final EnumSet DDL = EnumSet.of(COMMIT, ROLLBACK, ALTER_SESSION, CREATE_SCHEMA, CREATE_FOREIGN_SCHEMA, DROP_SCHEMA, - CREATE_TABLE, ALTER_TABLE, DROP_TABLE, TRUNCATE_TABLE, + CREATE_TABLE, CREATE_TABLE_LIKE, + ALTER_TABLE, DROP_TABLE, TRUNCATE_TABLE, CREATE_FUNCTION, DROP_FUNCTION, CREATE_VIEW, ALTER_VIEW, DROP_VIEW, CREATE_MATERIALIZED_VIEW, ALTER_MATERIALIZED_VIEW, diff --git a/core/src/main/java/org/apache/calcite/sql/ddl/SqlCreateTableLike.java b/core/src/main/java/org/apache/calcite/sql/ddl/SqlCreateTableLike.java new file mode 100644 index 00..c291de2fe3 --- /dev/null +++ b/core/src/main/java/org/apache/calcite/sql/ddl/SqlCreateTableLike.java @@ -0,0 +1,121 @@ +/* + * 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.ddl; + +import org.apache.calcite.sql.SqlCreate; +import org.apache.calcite.sql.SqlIdentifier; +import org.apache.calcite.sql.SqlKind; +import org.apache.calcite.sql.SqlLiteral; +import org.apache.calcite.sql.SqlNode; +import org.apache.calcite.sql.SqlNodeList; +import org.apache.calcite.sql.SqlOperator; +import org.apache.calcite.sql.SqlSpecialOperator; +import org.apache.calcite.sql.SqlWriter; +import org.apache.calcite.sql.Symbolizable; +import org.apache.calcite.sql.parser.SqlParserPos; +import org.apache.calcite.util.ImmutableNullableList; + +import com.google.common.base.Preconditions; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * Parse tree for {@code CREATE TABLE LIKE} statement. + */ +public class SqlCreateTableLike extends SqlCreate { + private static final SqlOperator OPERATOR = + new SqlSpecialOperator("CREATE TABLE LIKE", SqlKind.CREATE_TABLE_LIKE); + + /** + * The LikeOption specify which additional properties of the original table to copy. + */ + public enum LikeOption implements Symbolizable { +ALL, +DEFAULTS, +GENERATED + } + + public final SqlIdentifier name; + public final SqlIdentifier sourceTable; + public final SqlNodeList includingOptions; + public final SqlNodeList excludingOptions; + + + public SqlCreateTableLike(SqlParserPos pos, boolean replace, boolean ifNotExists, + SqlIdentifier name, SqlIdentifier sourceTable, + SqlNodeList includingOptions,
Re: [PR] [CALCITE-6035] Unparse 'WITHIN GROUP' for BigQuery dialect to match BigQuery documentation [calcite]
olivrlee commented on code in PR #3466: URL: https://github.com/apache/calcite/pull/3466#discussion_r1364743179 ## core/src/main/java/org/apache/calcite/sql/dialect/BigQuerySqlDialect.java: ## @@ -292,6 +295,17 @@ private static void unparseItem(SqlWriter writer, SqlCall call, int leftPrec) { writer.endList(frame); } + private static void unparseWithinGroup(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { +assert call.operandCount() == 2; +call.operand(0).unparse(writer, 0, 0); +writer.keyword("OVER"); Review Comment: Julian had a comment [here](https://issues.apache.org/jira/browse/CALCITE-6039) about how we should approach the followup tickets I think it won't work out of the box, there are things to figure out We would still be parsing it as `within_group` in the parser, but want it to be handled differently in the validator. questions to then consider: would we still use a SqlWithinGroupOperator? If yes, then that would be unparsed into "OVER" correctly. If not, this may have to change -- 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-6035] Unparse 'WITHIN GROUP' for BigQuery dialect to match BigQuery documentation [calcite]
sonarcloud[bot] commented on PR #3466: URL: https://github.com/apache/calcite/pull/3466#issuecomment-1769686191 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=3466) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3466=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=3466=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3466=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=3466=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=3466=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3466=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=3466=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=3466=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3466=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=3466=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=3466=false=CODE_SMELL) [1 Code Smell](https://sonarcloud.io/project/issues?id=apache_calcite=3466=false=CODE_SMELL) [![92.3%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png '92.3%')](https://sonarcloud.io/component_measures?id=apache_calcite=3466=new_coverage=list) [92.3% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3466=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=3466=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3466=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-6035] Unparse 'WITHIN GROUP' for BigQuery dialect to match BigQuery documentation [calcite]
tanclary commented on code in PR #3466: URL: https://github.com/apache/calcite/pull/3466#discussion_r1364694015 ## core/src/main/java/org/apache/calcite/sql/dialect/BigQuerySqlDialect.java: ## @@ -292,6 +295,17 @@ private static void unparseItem(SqlWriter writer, SqlCall call, int leftPrec) { writer.endList(frame); } + private static void unparseWithinGroup(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { +assert call.operandCount() == 2; +call.operand(0).unparse(writer, 0, 0); +writer.keyword("OVER"); Review Comment: Ohhh ok. So if Calcite ended up supporting the `partition by` case (your `input_2` from that comment), do you know if this would break? -- 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-6052] SqlImplementor writes REAL, FLOAT, and DOUBLE literals as DECIMAL literals [calcite]
sonarcloud[bot] commented on PR #3472: URL: https://github.com/apache/calcite/pull/3472#issuecomment-1769580991 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=3472) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3472=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=3472=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3472=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=3472=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=3472=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3472=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=3472=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=3472=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3472=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=3472=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=3472=false=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3472=false=CODE_SMELL) [![83.3%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '83.3%')](https://sonarcloud.io/component_measures?id=apache_calcite=3472=new_coverage=list) [83.3% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3472=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=3472=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3472=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-6035] Unparse 'WITHIN GROUP' for BigQuery dialect to match BigQuery documentation [calcite]
olivrlee commented on code in PR #3466: URL: https://github.com/apache/calcite/pull/3466#discussion_r1364690539 ## core/src/main/java/org/apache/calcite/sql/dialect/BigQuerySqlDialect.java: ## @@ -292,6 +295,17 @@ private static void unparseItem(SqlWriter writer, SqlCall call, int leftPrec) { writer.endList(frame); } + private static void unparseWithinGroup(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { +assert call.operandCount() == 2; +call.operand(0).unparse(writer, 0, 0); +writer.keyword("OVER"); Review Comment: So I detailed in this [comment](https://issues.apache.org/jira/browse/CALCITE-5955?focusedCommentId=17772373=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17772373) how Calcite currently only supports `select percentile_cont(0.5) within group (order by X)` so I want to say that for what is supported at this moment, it is sufficient -- 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-6041] MAP sub-query gives NullPointerException [calcite]
julianhyde commented on code in PR #3475: URL: https://github.com/apache/calcite/pull/3475#discussion_r1364098384 ## core/src/test/resources/sql/sub-query.iq: ## @@ -3685,4 +3685,15 @@ FROM dept d1; !ok +# [CALCITE-6041] MAP sub-query gives NullPointerException +SELECT map(SELECT empno, deptno from emp where deptno < 20); Review Comment: test may be nondeterministic. if Calcite allows an `order by` in the subquery I think you should add it also add tests where the map contains 1 row and 0 rows -- 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-6041] MAP sub-query gives NullPointerException [calcite]
sonarcloud[bot] commented on PR #3475: URL: https://github.com/apache/calcite/pull/3475#issuecomment-1768132133 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=3475) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3475=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=3475=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3475=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=3475=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=3475=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3475=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=3475=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=3475=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3475=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=3475=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=3475=false=CODE_SMELL) [3 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3475=false=CODE_SMELL) [![66.7%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '66.7%')](https://sonarcloud.io/component_measures?id=apache_calcite=3475=new_coverage=list) [66.7% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3475=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=3475=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3475=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]
sonarcloud[bot] commented on PR #3439: URL: https://github.com/apache/calcite/pull/3439#issuecomment-1768047584 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) [1 Code Smell](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-5860 Set scale when casting Decimal [calcite]
zabetak commented on PR #3326: URL: https://github.com/apache/calcite/pull/3326#issuecomment-1767960287 @pfzhan Now that CALCITE-5923 is committed you can revert https://github.com/apache/calcite/pull/3326/commits/c976ef4ff24966418553807b9e576a0d3c433cd7 and continue the work as usual. Ping me again once you address the test failures. 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
[calcite] branch main updated: [CALCITE-5923] SqlOperatorTest using safeParameters are not using overridable fixture
This is an automated email from the ASF dual-hosted git repository. zabetak 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 f996bc9993 [CALCITE-5923] SqlOperatorTest using safeParameters are not using overridable fixture f996bc9993 is described below commit f996bc9993546019d0fd475b2daa99ac8b1b9259 Author: Runkang He AuthorDate: Sun Aug 13 18:06:37 2023 +0800 [CALCITE-5923] SqlOperatorTest using safeParameters are not using overridable fixture SqlOperatorTest cases using the safeParameters method to generate parameterized inputs are not using the overridable fixture from the subclasses. Due to this the customized behavior introduced by subclasses of SqlOperatorTest is not taken into account by these tests. This violates the design principle of the SqlOperatorTest class which explicitly states that subclasses are meant to override the method and basically decreases code coverage since subclasses will not have any effect on the affected tests. 1. Remove static modifier from safeParameters to allow the use of overridable fixture() method. 2. Add TestInstance.Lifecycle.PER_CLASS annotation to allow @MethodSource to be non-static (see junit-team/junit5#984). 3. Adapt expected results for test cases casting string to timestamps based on changes from CALCITE-5678 in Avatica. 4. Pickup avatica.version from project properties to run the appropriate tests while waiting for the Avatica upgrade. Close apache/calcite#3364 --- build.gradle.kts | 1 + .../org/apache/calcite/test/SqlOperatorTest.java | 52 -- .../java/org/apache/calcite/util/TestUtil.java | 2 + 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 9d4a6e8af9..f026c48583 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -820,6 +820,7 @@ allprojects { passProperty("user.language", "TR") passProperty("user.country", "tr") passProperty("user.timezone", "UTC") +passProperty("calcite.avatica.version", props.string("calcite.avatica.version")) val props = System.getProperties() for (e in props.propertyNames() as `java.util`.Enumeration) { if (e.startsWith("calcite.") || e.startsWith("avatica.")) { 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 746c330720..fd11a31f05 100644 --- a/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java +++ b/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java @@ -83,6 +83,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -197,6 +198,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; * null arguments or null results. * */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) @SuppressWarnings("MethodCanBeStatic") public class SqlOperatorTest { //~ Static fields/initializers - @@ -441,8 +443,9 @@ public class SqlOperatorTest { } /** Generates parameters to test both regular and safe cast. */ - static Stream safeParameters() { -SqlOperatorFixture f = SqlOperatorFixtureImpl.DEFAULT; + @SuppressWarnings("unused") + private Stream safeParameters() { +SqlOperatorFixture f = fixture(); SqlOperatorFixture f2 = SqlOperatorFixtures.safeCastWrapper(f.withLibrary(SqlLibrary.BIG_QUERY), "SAFE_CAST"); SqlOperatorFixture f3 = @@ -1238,8 +1241,6 @@ public class SqlOperatorTest { f.checkScalar("cast('1945-02-24 12:42:25' as TIMESTAMP)", "1945-02-24 12:42:25", "TIMESTAMP(0) NOT NULL"); -f.checkScalar("cast('1945-2-2 12:2:5' as TIMESTAMP)", -"1945-02-02 12:02:05", "TIMESTAMP(0) NOT NULL"); f.checkScalar("cast(' 1945-02-24 12:42:25 ' as TIMESTAMP)", "1945-02-24 12:42:25", "TIMESTAMP(0) NOT NULL"); f.checkScalar("cast('1945-02-24 12:42:25.34' as TIMESTAMP)", @@ -1253,15 +1254,40 @@ public class SqlOperatorTest { f.checkScalar("cast('1945-02-24 12:42:25.34' as TIMESTAMP(2))", "1945-02-24 12:42:25.34", "TIMESTAMP(2) NOT NULL"); } +// Remove the if condition and the else block once CALCITE-6053 is fixed +if (TestUtil.AVATICA_VERSION.startsWith("1.0.0-dev-main")) { + if (castType == CastType.CAST) { +f.checkFails("cast('1945-2-2 12:2:5' as
Re: [PR] [CALCITE-5923] Some test cases in SqlOperatorTest violates the test fixture's design principle [calcite]
zabetak closed pull request #3364: [CALCITE-5923] Some test cases in SqlOperatorTest violates the test fixture's design principle URL: https://github.com/apache/calcite/pull/3364 -- 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-6041] MAP sub-query gives NullPointerException [calcite]
sonarcloud[bot] commented on PR #3475: URL: https://github.com/apache/calcite/pull/3475#issuecomment-1767802684 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=3475) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_calcite=3475=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=3475=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_calcite=3475=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=3475=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=3475=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_calcite=3475=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=3475=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=3475=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite=3475=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=3475=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=3475=false=CODE_SMELL) [3 Code Smells](https://sonarcloud.io/project/issues?id=apache_calcite=3475=false=CODE_SMELL) [![66.7%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '66.7%')](https://sonarcloud.io/component_measures?id=apache_calcite=3475=new_coverage=list) [66.7% Coverage](https://sonarcloud.io/component_measures?id=apache_calcite=3475=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=3475=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_calcite=3475=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
[PR] [CALCITE-6041] MAP sub-query gives NullPointerException [calcite]
chucheng92 opened a new pull request, #3475: URL: https://github.com/apache/calcite/pull/3475 https://issues.apache.org/jira/browse/CALCITE-6041 -- 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