[GitHub] [calcite] xy2953396112 edited a comment on pull request #2369: [CALCITE-4533] Fix handling of REPLACE and IF NOT EXISTS keywords for CREATE TABLE/SCHEMA commands (Vladimir Ozerov)
xy2953396112 edited a comment on pull request #2369: URL: https://github.com/apache/calcite/pull/2369#issuecomment-797285619 please fix commits. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [calcite] xy2953396112 commented on pull request #2369: [CALCITE-4533] Fix handling of REPLACE and IF NOT EXISTS keywords for CREATE TABLE/SCHEMA commands (Vladimir Ozerov)
xy2953396112 commented on pull request #2369: URL: https://github.com/apache/calcite/pull/2369#issuecomment-797285619 squash commits? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [calcite] xy2953396112 commented on a change in pull request #2369: [CALCITE-4533] Fix handling of REPLACE and IF NOT EXISTS keywords for CREATE TABLE/SCHEMA commands (Vladimir Ozerov)
xy2953396112 commented on a change in pull request #2369: URL: https://github.com/apache/calcite/pull/2369#discussion_r592953187 ## File path: server/src/test/java/org/apache/calcite/test/ServerTest.java ## @@ -127,6 +127,16 @@ static Connection connect() throws SQLException { assertThat(r.getInt(1), is(1)); assertThat(r.next(), is(false)); } + + b = s.execute("create schema if not exists s"); + assertThat(b, is(false)); Review comment: Why not true? Schema not created successfully? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[calcite] branch master updated (75b9440 -> 39d477d)
This is an automated email from the ASF dual-hosted git repository. danny0405 pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/calcite.git. omit 75b9440 [CALCITE-4526] Fixup the unparse's output of SqlSnapshot when the table has alias (jibiyr) new 39d477d [CALCITE-4526] SqlSnapshot unparse lost the AS keyword when the table has alias (jibiyr) This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (75b9440) \ N -- N -- N refs/heads/master (39d477d) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: core/src/main/java/org/apache/calcite/sql/SqlSnapshot.java | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-)
[calcite] 01/01: [CALCITE-4526] SqlSnapshot unparse lost the AS keyword when the table has alias (jibiyr)
This is an automated email from the ASF dual-hosted git repository. danny0405 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/calcite.git commit 39d477d96b90eca05e5af1cec0f8ae0617226b5d Author: laughing.sheng AuthorDate: Wed Mar 10 16:46:14 2021 +0800 [CALCITE-4526] SqlSnapshot unparse lost the AS keyword when the table has alias (jibiyr) For SQL: table_name FOR SYSTEM_TIME AS OF time_point AS table_alias, when SqlSnapshot's table has alias(the AS operator), the unparse result is wrong: the alias is missing but the name reference is still hold by other expression. close apache/calcite#2366 --- .../main/java/org/apache/calcite/sql/SqlSnapshot.java | 17 - .../org/apache/calcite/sql/parser/SqlParserTest.java| 9 + 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/apache/calcite/sql/SqlSnapshot.java b/core/src/main/java/org/apache/calcite/sql/SqlSnapshot.java index 07ecce7..4ccf3d1 100644 --- a/core/src/main/java/org/apache/calcite/sql/SqlSnapshot.java +++ b/core/src/main/java/org/apache/calcite/sql/SqlSnapshot.java @@ -127,8 +127,23 @@ public class SqlSnapshot extends SqlCall { int leftPrec, int rightPrec) { final SqlSnapshot snapshot = (SqlSnapshot) call; + SqlNode tableRef = snapshot.tableRef; + + if (tableRef instanceof SqlBasicCall + && ((SqlBasicCall) tableRef).getOperator() instanceof SqlAsOperator) { +SqlBasicCall basicCall = (SqlBasicCall) tableRef; +basicCall.operand(0).unparse(writer, 0, 0); +writer.setNeedWhitespace(true); +writeForSystemTimeAsOf(writer, snapshot); +writer.keyword("AS"); +basicCall.operand(1).unparse(writer, 0, 0); + } else { +tableRef.unparse(writer, 0, 0); +writeForSystemTimeAsOf(writer, snapshot); + } +} - snapshot.tableRef.unparse(writer, 0, 0); +private static void writeForSystemTimeAsOf(SqlWriter writer, SqlSnapshot snapshot) { writer.keyword("FOR SYSTEM_TIME AS OF"); snapshot.period.unparse(writer, 0, 0); } diff --git a/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java b/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java index 1737908..8034698 100644 --- a/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java +++ b/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java @@ -7766,6 +7766,15 @@ public class SqlParserTest { SqlParserUtil.addCarets("abcdef", 1, 7, 1, 7)); } + @Test void testSnapshotForSystemTimeWithAlias() { +sql("SELECT * FROM orders LEFT JOIN products FOR SYSTEM_TIME AS OF " ++ "orders.proctime as products ON orders.product_id = products.pro_id") +.ok("SELECT *\n" ++ "FROM `ORDERS`\n" ++ "LEFT JOIN `PRODUCTS` FOR SYSTEM_TIME AS OF `ORDERS`.`PROCTIME` AS `PRODUCTS` ON (`ORDERS`" ++ ".`PRODUCT_ID` = `PRODUCTS`.`PRO_ID`)"); + } + @Test protected void testMetadata() { SqlAbstractParserImpl.Metadata metadata = getSqlParser("").getMetadata(); assertThat(metadata.isReservedFunctionName("ABS"), is(true));
[GitHub] [calcite] amaliujia commented on a change in pull request #2369: [CALCITE-4533] Fix handling of REPLACE and IF NOT EXISTS keywords for CREATE TABLE/SCHEMA commands (Vladimir Ozerov)
amaliujia commented on a change in pull request #2369: URL: https://github.com/apache/calcite/pull/2369#discussion_r592751131 ## File path: server/src/test/java/org/apache/calcite/test/ServerTest.java ## @@ -127,6 +127,16 @@ static Connection connect() throws SQLException { assertThat(r.getInt(1), is(1)); assertThat(r.next(), is(false)); } + + b = s.execute("create schema if not exists s"); + assertThat(b, is(false)); + x = s.executeUpdate("insert into s.t values 2"); + assertThat(x, is(1)); + + b = s.execute("create or replace schema s"); + assertThat(b, is(false)); Review comment: Should this be true as schema s can be replaced? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [calcite] devozerov opened a new pull request #2369: [CALCITE-4533] Fix handling of REPLACE and IF NOT EXISTS keywords for CREATE TABLE/SCHEMA commands (Vladimir Ozerov)
devozerov opened a new pull request #2369: URL: https://github.com/apache/calcite/pull/2369 See https://issues.apache.org/jira/browse/CALCITE-4533 for the details. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[calcite] branch master updated (e447ff8 -> 75b9440)
This is an automated email from the ASF dual-hosted git repository. danny0405 pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/calcite.git. from e447ff8 [CALCITE-2317] Support JDBC DatabaseMetaData.getFunctions (Malte Bellmann) add 75b9440 [CALCITE-4526] Fixup the unparse's output of SqlSnapshot when the table has alias (jibiyr) No new revisions were added by this update. Summary of changes: .../java/org/apache/calcite/sql/SqlSnapshot.java | 23 -- .../apache/calcite/sql/parser/SqlParserTest.java | 9 + 2 files changed, 30 insertions(+), 2 deletions(-)
[GitHub] [calcite] danny0405 closed pull request #2366: [CALCITE-4526] Fixup the unparse's output of SqlSnapshot,when tableRel is a SqlAsOperator (jibiyr)
danny0405 closed pull request #2366: URL: https://github.com/apache/calcite/pull/2366 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org