You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2021/07/22 12:17:24 UTC
[GitHub] [phoenix] richardantal opened a new pull request #1271: PHOENIX-6518 Implement SHOW CREATE STATEMENT SQL command
richardantal opened a new pull request #1271:
URL: https://github.com/apache/phoenix/pull/1271
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] richardantal commented on a change in pull request #1271: PHOENIX-6518 Implement SHOW CREATE STATEMENT SQL command
Posted by GitBox <gi...@apache.org>.
richardantal commented on a change in pull request #1271:
URL: https://github.com/apache/phoenix/pull/1271#discussion_r678081138
##########
File path: phoenix-core/src/main/antlr3/PhoenixSQL.g
##########
@@ -496,6 +498,11 @@ show_node returns [ShowStatement ret]
| SHOW SCHEMAS (LIKE pattern=string_literal)? { $ret = factory.showSchemasStatement(pattern); }
;
+// Parse a describe statement. SHOW CREATE STATEMENT tablename ...
+show_create_statement_node returns [ShowCreateStatement ret]
+ : SHOW CREATE STATEMENT tablename=from_table_name { $ret = factory.showCreateStatement(tablename); }
Review comment:
This from_table_name can be actually a view or index table as well.
https://github.com/apache/phoenix/blob/9b76bd51c86faea117d963b8fc033dbfef647d47/phoenix-core/src/main/antlr3/PhoenixSQL.g#L1129
It is already working for views and for indexes as well. I added some tests to be sure.
Istvan was in the favour of naming this SHOW CREATE STATEMENT as it works for views and indexes as well.
In case we chose to rename it to SHOW CREATE TABLE, should it work for views and indexes as well or Do you think those should be separate commands?
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] richardantal merged pull request #1271: PHOENIX-6518 Implement SHOW CREATE TABLE SQL command
Posted by GitBox <gi...@apache.org>.
richardantal merged pull request #1271:
URL: https://github.com/apache/phoenix/pull/1271
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] stoty commented on pull request #1271: PHOENIX-6518 Implement SHOW CREATE STATEMENT SQL command
Posted by GitBox <gi...@apache.org>.
stoty commented on pull request #1271:
URL: https://github.com/apache/phoenix/pull/1271#issuecomment-885146182
:broken_heart: **-1 overall**
| Vote | Subsystem | Runtime | Comment |
|:----:|----------:|--------:|:--------|
| +0 :ok: | reexec | 0m 28s | Docker mode activated. |
||| _ Prechecks _ |
| +1 :green_heart: | dupname | 0m 0s | No case conflicting files found. |
| +1 :green_heart: | hbaseanti | 0m 0s | Patch does not have any anti-patterns. |
| +1 :green_heart: | @author | 0m 0s | The patch does not contain any @author tags. |
| +1 :green_heart: | test4tests | 0m 0s | The patch appears to include 1 new or modified test files. |
||| _ master Compile Tests _ |
| +0 :ok: | mvndep | 5m 9s | Maven dependency ordering for branch |
| +1 :green_heart: | mvninstall | 17m 19s | master passed |
| +0 | hbaserecompile | 30m 16s | HBase recompiled. |
| +1 :green_heart: | compile | 1m 32s | master passed |
| +1 :green_heart: | checkstyle | 2m 3s | master passed |
| +1 :green_heart: | javadoc | 1m 12s | master passed |
| +0 :ok: | spotbugs | 3m 6s | phoenix-core in master has 964 extant spotbugs warnings. |
| +0 :ok: | spotbugs | 0m 44s | phoenix-tools in master has 5 extant spotbugs warnings. |
| -0 :warning: | patch | 0m 59s | Used diff version of patch file. Binary files and potentially other changes not applied. Please rebase and squash commits if necessary. |
||| _ Patch Compile Tests _ |
| +0 :ok: | mvndep | 0m 11s | Maven dependency ordering for patch |
| +1 :green_heart: | mvninstall | 13m 43s | the patch passed |
| +0 | hbaserecompile | 20m 41s | HBase recompiled. |
| +1 :green_heart: | compile | 1m 33s | the patch passed |
| +1 :green_heart: | javac | 1m 33s | the patch passed |
| -1 :x: | checkstyle | 1m 49s | phoenix-core: The patch generated 428 new + 2618 unchanged - 20 fixed = 3046 total (was 2638) |
| +1 :green_heart: | checkstyle | 0m 16s | phoenix-tools: The patch generated 0 new + 60 unchanged - 361 fixed = 60 total (was 421) |
| +1 :green_heart: | whitespace | 0m 0s | The patch has no whitespace issues. |
| +1 :green_heart: | xml | 0m 2s | The patch has no ill-formed XML file. |
| +1 :green_heart: | javadoc | 1m 10s | the patch passed |
| -1 :x: | spotbugs | 3m 22s | phoenix-core generated 6 new + 964 unchanged - 0 fixed = 970 total (was 964) |
| +1 :green_heart: | spotbugs | 0m 54s | phoenix-tools generated 0 new + 3 unchanged - 2 fixed = 3 total (was 5) |
||| _ Other Tests _ |
| -1 :x: | unit | 113m 11s | phoenix-core in the patch failed. |
| -1 :x: | unit | 3m 36s | phoenix-tools in the patch failed. |
| +1 :green_heart: | asflicense | 1m 22s | The patch does not generate ASF License warnings. |
| | | 191m 3s | |
| Reason | Tests |
|-------:|:------|
| FindBugs | module:phoenix-core |
| | Found reliance on default encoding in org.apache.phoenix.schematool.SchemaSynthesisProcessor.getQueriesFromFile(String):in org.apache.phoenix.schematool.SchemaSynthesisProcessor.getQueriesFromFile(String): new java.io.FileReader(File) At SchemaSynthesisProcessor.java:[line 211] |
| | Null passed for non-null parameter of new org.apache.phoenix.parse.SQLParser(String) in org.apache.phoenix.schematool.SchemaSynthesisProcessor.synthesize(String, String) Method invoked at SchemaSynthesisProcessor.java:of new org.apache.phoenix.parse.SQLParser(String) in org.apache.phoenix.schematool.SchemaSynthesisProcessor.synthesize(String, String) Method invoked at SchemaSynthesisProcessor.java:[line 80] |
| | Null passed for non-null parameter of new org.apache.phoenix.parse.SQLParser(String) in org.apache.phoenix.schematool.SchemaSynthesisProcessor.synthesize(String, String) Method invoked at SchemaSynthesisProcessor.java:of new org.apache.phoenix.parse.SQLParser(String) in org.apache.phoenix.schematool.SchemaSynthesisProcessor.synthesize(String, String) Method invoked at SchemaSynthesisProcessor.java:[line 81] |
| | org.apache.phoenix.schematool.SchemaSynthesisProcessor.getQueriesFromFile(String) may fail to close stream At SchemaSynthesisProcessor.java:stream At SchemaSynthesisProcessor.java:[line 211] |
| | Invocation of toString on Throwable.getStackTrace() in org.apache.phoenix.util.QueryUtil.getShowCreateStatementStmt(PhoenixConnection, String, TableName) At QueryUtil.java:in org.apache.phoenix.util.QueryUtil.getShowCreateStatementStmt(PhoenixConnection, String, TableName) At QueryUtil.java:[line 788] |
| | org.apache.phoenix.util.QueryUtil.getShowCreateStatementStmt(PhoenixConnection, String, TableName) may fail to clean up java.sql.Statement on checked exception Obligation to clean up resource created at QueryUtil.java:to clean up java.sql.Statement on checked exception Obligation to clean up resource created at QueryUtil.java:[line 794] is not discharged |
| Failed junit tests | phoenix.end2end.PermissionNSEnabledWithCustomAccessControllerIT |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/2/artifact/yetus-general-check/output/Dockerfile |
| GITHUB PR | https://github.com/apache/phoenix/pull/1271 |
| Optional Tests | dupname asflicense javac javadoc unit spotbugs hbaserebuild hbaseanti checkstyle compile xml |
| uname | Linux c9b4b2252172 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | dev/phoenix-personality.sh |
| git revision | master / 6842c1d |
| Default Java | Private Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08 |
| checkstyle | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/2/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt |
| spotbugs | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/2/artifact/yetus-general-check/output/new-spotbugs-phoenix-core.html |
| unit | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/2/artifact/yetus-general-check/output/patch-unit-phoenix-core.txt |
| unit | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/2/artifact/yetus-general-check/output/patch-unit-phoenix-tools.txt |
| Test Results | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/2/testReport/ |
| Max. process+thread count | 15739 (vs. ulimit of 30000) |
| modules | C: phoenix-core phoenix-tools U: . |
| Console output | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/2/console |
| versions | git=2.7.4 maven=3.3.9 spotbugs=4.1.3 |
| Powered by | Apache Yetus 0.12.0 https://yetus.apache.org |
This message was automatically generated.
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] richardantal commented on a change in pull request #1271: PHOENIX-6518 Implement SHOW CREATE STATEMENT SQL command
Posted by GitBox <gi...@apache.org>.
richardantal commented on a change in pull request #1271:
URL: https://github.com/apache/phoenix/pull/1271#discussion_r674947200
##########
File path: phoenix-core/src/main/java/org/apache/phoenix/parse/ShowCreateTablesStatement.java
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.phoenix.parse;
+
+import org.apache.phoenix.compile.ColumnResolver;
+import org.apache.phoenix.thirdparty.com.google.common.base.Preconditions;
+import org.apache.phoenix.util.SchemaUtil;
+
+import java.util.Objects;
+
+/**
+ * ParseNode implementation for DESCRIBE tablename.
+ */
+public class ShowCreateTablesStatement extends ShowCreateStatement {
+
+ private TableName tableName;
+
+ public ShowCreateTablesStatement(TableName tn) {
+ tableName = tn;
+ }
+
+ public TableName getTableName() {
+ return tableName;
+ }
+
+ public void toSQL(ColumnResolver resolver, StringBuilder buf) {
+ Preconditions.checkNotNull(buf);
+ buf.append("SHOW CREATE STATEMENT ");
+
+ if(tableName.getSchemaName() != null) {
+ if (tableName.isSchemaNameCaseSensitive()) {
+ buf.append("\"");
+ }
+ buf.append(tableName.getSchemaName());
+ if (tableName.isSchemaNameCaseSensitive()) {
+ buf.append("\"");
+ }
+ buf.append(".");
+ }
+
+ if (tableName.isTableNameCaseSensitive()) {
+ buf.append("\"");
+ }
+ buf.append(tableName.getTableName());
+ if (tableName.isTableNameCaseSensitive()) {
+ buf.append("\"");
+ }
Review comment:
I updated this to use the SchemaUtil.getEscapedTableName, its not exactly the same but works.
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] stoty commented on pull request #1271: PHOENIX-6518 Implement SHOW CREATE STATEMENT SQL command
Posted by GitBox <gi...@apache.org>.
stoty commented on pull request #1271:
URL: https://github.com/apache/phoenix/pull/1271#issuecomment-885003758
:broken_heart: **-1 overall**
| Vote | Subsystem | Runtime | Comment |
|:----:|----------:|--------:|:--------|
| +0 :ok: | reexec | 0m 28s | Docker mode activated. |
||| _ Prechecks _ |
| +1 :green_heart: | dupname | 0m 1s | No case conflicting files found. |
| +1 :green_heart: | hbaseanti | 0m 0s | Patch does not have any anti-patterns. |
| +1 :green_heart: | @author | 0m 0s | The patch does not contain any @author tags. |
| +1 :green_heart: | test4tests | 0m 0s | The patch appears to include 1 new or modified test files. |
||| _ master Compile Tests _ |
| +0 :ok: | mvndep | 5m 21s | Maven dependency ordering for branch |
| +1 :green_heart: | mvninstall | 17m 39s | master passed |
| +0 | hbaserecompile | 29m 52s | HBase recompiled. |
| +1 :green_heart: | compile | 1m 35s | master passed |
| +1 :green_heart: | checkstyle | 2m 3s | master passed |
| +1 :green_heart: | javadoc | 1m 9s | master passed |
| +0 :ok: | spotbugs | 3m 3s | phoenix-core in master has 964 extant spotbugs warnings. |
| +0 :ok: | spotbugs | 0m 43s | phoenix-tools in master has 5 extant spotbugs warnings. |
||| _ Patch Compile Tests _ |
| +0 :ok: | mvndep | 0m 11s | Maven dependency ordering for patch |
| +1 :green_heart: | mvninstall | 13m 38s | the patch passed |
| +0 | hbaserecompile | 19m 59s | HBase recompiled. |
| +1 :green_heart: | compile | 1m 34s | the patch passed |
| +1 :green_heart: | javac | 1m 34s | the patch passed |
| -1 :x: | checkstyle | 1m 49s | phoenix-core: The patch generated 428 new + 2618 unchanged - 20 fixed = 3046 total (was 2638) |
| +1 :green_heart: | checkstyle | 0m 16s | phoenix-tools: The patch generated 0 new + 60 unchanged - 361 fixed = 60 total (was 421) |
| +1 :green_heart: | whitespace | 0m 0s | The patch has no whitespace issues. |
| +1 :green_heart: | xml | 0m 1s | The patch has no ill-formed XML file. |
| +1 :green_heart: | javadoc | 1m 9s | the patch passed |
| -1 :x: | spotbugs | 3m 19s | phoenix-core generated 6 new + 964 unchanged - 0 fixed = 970 total (was 964) |
| +1 :green_heart: | spotbugs | 0m 54s | phoenix-tools generated 0 new + 3 unchanged - 2 fixed = 3 total (was 5) |
||| _ Other Tests _ |
| -1 :x: | unit | 111m 54s | phoenix-core in the patch failed. |
| -1 :x: | unit | 3m 41s | phoenix-tools in the patch failed. |
| +1 :green_heart: | asflicense | 1m 24s | The patch does not generate ASF License warnings. |
| | | 188m 43s | |
| Reason | Tests |
|-------:|:------|
| FindBugs | module:phoenix-core |
| | Found reliance on default encoding in org.apache.phoenix.schematool.SchemaSynthesisProcessor.getQueriesFromFile(String):in org.apache.phoenix.schematool.SchemaSynthesisProcessor.getQueriesFromFile(String): new java.io.FileReader(File) At SchemaSynthesisProcessor.java:[line 211] |
| | Null passed for non-null parameter of new org.apache.phoenix.parse.SQLParser(String) in org.apache.phoenix.schematool.SchemaSynthesisProcessor.synthesize(String, String) Method invoked at SchemaSynthesisProcessor.java:of new org.apache.phoenix.parse.SQLParser(String) in org.apache.phoenix.schematool.SchemaSynthesisProcessor.synthesize(String, String) Method invoked at SchemaSynthesisProcessor.java:[line 80] |
| | Null passed for non-null parameter of new org.apache.phoenix.parse.SQLParser(String) in org.apache.phoenix.schematool.SchemaSynthesisProcessor.synthesize(String, String) Method invoked at SchemaSynthesisProcessor.java:of new org.apache.phoenix.parse.SQLParser(String) in org.apache.phoenix.schematool.SchemaSynthesisProcessor.synthesize(String, String) Method invoked at SchemaSynthesisProcessor.java:[line 81] |
| | org.apache.phoenix.schematool.SchemaSynthesisProcessor.getQueriesFromFile(String) may fail to close stream At SchemaSynthesisProcessor.java:stream At SchemaSynthesisProcessor.java:[line 211] |
| | Invocation of toString on Throwable.getStackTrace() in org.apache.phoenix.util.QueryUtil.getShowCreateStatementStmt(PhoenixConnection, String, TableName) At QueryUtil.java:in org.apache.phoenix.util.QueryUtil.getShowCreateStatementStmt(PhoenixConnection, String, TableName) At QueryUtil.java:[line 788] |
| | org.apache.phoenix.util.QueryUtil.getShowCreateStatementStmt(PhoenixConnection, String, TableName) may fail to clean up java.sql.Statement on checked exception Obligation to clean up resource created at QueryUtil.java:to clean up java.sql.Statement on checked exception Obligation to clean up resource created at QueryUtil.java:[line 804] is not discharged |
| Failed junit tests | phoenix.end2end.BackwardCompatibilityIT |
| | phoenix.schema.SchemaToolExtractionIT |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/1/artifact/yetus-general-check/output/Dockerfile |
| GITHUB PR | https://github.com/apache/phoenix/pull/1271 |
| Optional Tests | dupname asflicense javac javadoc unit spotbugs hbaserebuild hbaseanti checkstyle compile xml |
| uname | Linux 36dc51b6ef0f 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | dev/phoenix-personality.sh |
| git revision | master / 6842c1d |
| Default Java | Private Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08 |
| checkstyle | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/1/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt |
| spotbugs | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/1/artifact/yetus-general-check/output/new-spotbugs-phoenix-core.html |
| unit | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/1/artifact/yetus-general-check/output/patch-unit-phoenix-core.txt |
| unit | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/1/artifact/yetus-general-check/output/patch-unit-phoenix-tools.txt |
| Test Results | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/1/testReport/ |
| Max. process+thread count | 14695 (vs. ulimit of 30000) |
| modules | C: phoenix-core phoenix-tools U: . |
| Console output | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/1/console |
| versions | git=2.7.4 maven=3.3.9 spotbugs=4.1.3 |
| Powered by | Apache Yetus 0.12.0 https://yetus.apache.org |
This message was automatically generated.
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] stoty commented on pull request #1271: PHOENIX-6518 Implement SHOW CREATE STATEMENT SQL command
Posted by GitBox <gi...@apache.org>.
stoty commented on pull request #1271:
URL: https://github.com/apache/phoenix/pull/1271#issuecomment-888237844
:broken_heart: **-1 overall**
| Vote | Subsystem | Runtime | Comment |
|:----:|----------:|--------:|:--------|
| +0 :ok: | reexec | 0m 58s | Docker mode activated. |
||| _ Prechecks _ |
| +1 :green_heart: | dupname | 0m 0s | No case conflicting files found. |
| +1 :green_heart: | hbaseanti | 0m 0s | Patch does not have any anti-patterns. |
| +1 :green_heart: | @author | 0m 0s | The patch does not contain any @author tags. |
| +1 :green_heart: | test4tests | 0m 0s | The patch appears to include 1 new or modified test files. |
||| _ master Compile Tests _ |
| +0 :ok: | mvndep | 4m 58s | Maven dependency ordering for branch |
| +1 :green_heart: | mvninstall | 21m 55s | master passed |
| +0 | hbaserecompile | 35m 21s | HBase recompiled. |
| +1 :green_heart: | compile | 1m 56s | master passed |
| +1 :green_heart: | checkstyle | 1m 50s | master passed |
| +1 :green_heart: | javadoc | 1m 20s | master passed |
| +0 :ok: | spotbugs | 3m 56s | phoenix-core in master has 964 extant spotbugs warnings. |
| +0 :ok: | spotbugs | 0m 50s | phoenix-tools in master has 5 extant spotbugs warnings. |
| -0 :warning: | patch | 1m 7s | Used diff version of patch file. Binary files and potentially other changes not applied. Please rebase and squash commits if necessary. |
||| _ Patch Compile Tests _ |
| +0 :ok: | mvndep | 0m 14s | Maven dependency ordering for patch |
| +1 :green_heart: | mvninstall | 17m 27s | the patch passed |
| +0 | hbaserecompile | 24m 17s | HBase recompiled. |
| +1 :green_heart: | compile | 1m 38s | the patch passed |
| +1 :green_heart: | javac | 1m 38s | the patch passed |
| -1 :x: | checkstyle | 1m 34s | phoenix-core: The patch generated 408 new + 2638 unchanged - 0 fixed = 3046 total (was 2638) |
| -1 :x: | checkstyle | 0m 16s | phoenix-tools: The patch generated 3 new + 57 unchanged - 364 fixed = 60 total (was 421) |
| +1 :green_heart: | whitespace | 0m 0s | The patch has no whitespace issues. |
| +1 :green_heart: | xml | 0m 1s | The patch has no ill-formed XML file. |
| +1 :green_heart: | javadoc | 1m 9s | the patch passed |
| -1 :x: | spotbugs | 3m 23s | phoenix-core generated 6 new + 964 unchanged - 0 fixed = 970 total (was 964) |
| +1 :green_heart: | spotbugs | 0m 52s | phoenix-tools generated 0 new + 3 unchanged - 2 fixed = 3 total (was 5) |
||| _ Other Tests _ |
| +1 :green_heart: | unit | 116m 53s | phoenix-core in the patch passed. |
| -1 :x: | unit | 3m 23s | phoenix-tools in the patch failed. |
| +1 :green_heart: | asflicense | 0m 28s | The patch does not generate ASF License warnings. |
| | | 202m 12s | |
| Reason | Tests |
|-------:|:------|
| FindBugs | module:phoenix-core |
| | Found reliance on default encoding in org.apache.phoenix.schematool.SchemaSynthesisProcessor.getQueriesFromFile(String):in org.apache.phoenix.schematool.SchemaSynthesisProcessor.getQueriesFromFile(String): new java.io.FileReader(File) At SchemaSynthesisProcessor.java:[line 211] |
| | Null passed for non-null parameter of new org.apache.phoenix.parse.SQLParser(String) in org.apache.phoenix.schematool.SchemaSynthesisProcessor.synthesize(String, String) Method invoked at SchemaSynthesisProcessor.java:of new org.apache.phoenix.parse.SQLParser(String) in org.apache.phoenix.schematool.SchemaSynthesisProcessor.synthesize(String, String) Method invoked at SchemaSynthesisProcessor.java:[line 80] |
| | Null passed for non-null parameter of new org.apache.phoenix.parse.SQLParser(String) in org.apache.phoenix.schematool.SchemaSynthesisProcessor.synthesize(String, String) Method invoked at SchemaSynthesisProcessor.java:of new org.apache.phoenix.parse.SQLParser(String) in org.apache.phoenix.schematool.SchemaSynthesisProcessor.synthesize(String, String) Method invoked at SchemaSynthesisProcessor.java:[line 81] |
| | org.apache.phoenix.schematool.SchemaSynthesisProcessor.getQueriesFromFile(String) may fail to close stream At SchemaSynthesisProcessor.java:stream At SchemaSynthesisProcessor.java:[line 211] |
| | Invocation of toString on Throwable.getStackTrace() in org.apache.phoenix.util.QueryUtil.getShowCreateStatementStmt(PhoenixConnection, String, TableName) At QueryUtil.java:in org.apache.phoenix.util.QueryUtil.getShowCreateStatementStmt(PhoenixConnection, String, TableName) At QueryUtil.java:[line 788] |
| | org.apache.phoenix.util.QueryUtil.getShowCreateStatementStmt(PhoenixConnection, String, TableName) may fail to clean up java.sql.Statement on checked exception Obligation to clean up resource created at QueryUtil.java:to clean up java.sql.Statement on checked exception Obligation to clean up resource created at QueryUtil.java:[line 794] is not discharged |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/3/artifact/yetus-general-check/output/Dockerfile |
| GITHUB PR | https://github.com/apache/phoenix/pull/1271 |
| Optional Tests | dupname asflicense javac javadoc unit spotbugs hbaserebuild hbaseanti checkstyle compile xml |
| uname | Linux 4a5cb0890046 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | dev/phoenix-personality.sh |
| git revision | master / 9b76bd5 |
| Default Java | Private Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08 |
| checkstyle | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/3/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt |
| checkstyle | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/3/artifact/yetus-general-check/output/diff-checkstyle-phoenix-tools.txt |
| spotbugs | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/3/artifact/yetus-general-check/output/new-spotbugs-phoenix-core.html |
| unit | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/3/artifact/yetus-general-check/output/patch-unit-phoenix-tools.txt |
| Test Results | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/3/testReport/ |
| Max. process+thread count | 14392 (vs. ulimit of 30000) |
| modules | C: phoenix-core phoenix-tools U: . |
| Console output | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/3/console |
| versions | git=2.7.4 maven=3.3.9 spotbugs=4.1.3 |
| Powered by | Apache Yetus 0.12.0 https://yetus.apache.org |
This message was automatically generated.
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] chrajeshbabu commented on a change in pull request #1271: PHOENIX-6518 Implement SHOW CREATE STATEMENT SQL command
Posted by GitBox <gi...@apache.org>.
chrajeshbabu commented on a change in pull request #1271:
URL: https://github.com/apache/phoenix/pull/1271#discussion_r677984039
##########
File path: phoenix-core/src/main/antlr3/PhoenixSQL.g
##########
@@ -496,6 +498,11 @@ show_node returns [ShowStatement ret]
| SHOW SCHEMAS (LIKE pattern=string_literal)? { $ret = factory.showSchemasStatement(pattern); }
;
+// Parse a describe statement. SHOW CREATE STATEMENT tablename ...
+show_create_statement_node returns [ShowCreateStatement ret]
+ : SHOW CREATE STATEMENT tablename=from_table_name { $ret = factory.showCreateStatement(tablename); }
Review comment:
Can we make it "SHOW CREATE TABLE" than "SHOW CREATE STATEMENT" to adhere to other databases like mysql.
https://dev.mysql.com/doc/refman/8.0/en/show-create-table.html
https://docs.databricks.com/sql/language-manual/sql-ref-syntax-aux-show-create-table.html
https://prestodb.io/docs/current/sql/show-create-table.html
##########
File path: phoenix-core/src/main/antlr3/PhoenixSQL.g
##########
@@ -496,6 +498,11 @@ show_node returns [ShowStatement ret]
| SHOW SCHEMAS (LIKE pattern=string_literal)? { $ret = factory.showSchemasStatement(pattern); }
;
+// Parse a describe statement. SHOW CREATE STATEMENT tablename ...
+show_create_statement_node returns [ShowCreateStatement ret]
+ : SHOW CREATE STATEMENT tablename=from_table_name { $ret = factory.showCreateStatement(tablename); }
Review comment:
Would be better to support to get the statements for index as well as views also. May be another JIRA.
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] stoty commented on pull request #1271: PHOENIX-6518 Implement SHOW CREATE STATEMENT SQL command
Posted by GitBox <gi...@apache.org>.
stoty commented on pull request #1271:
URL: https://github.com/apache/phoenix/pull/1271#issuecomment-888410346
:broken_heart: **-1 overall**
| Vote | Subsystem | Runtime | Comment |
|:----:|----------:|--------:|:--------|
| +0 :ok: | reexec | 1m 32s | Docker mode activated. |
||| _ Prechecks _ |
| +1 :green_heart: | dupname | 0m 0s | No case conflicting files found. |
| +1 :green_heart: | hbaseanti | 0m 0s | Patch does not have any anti-patterns. |
| +1 :green_heart: | @author | 0m 0s | The patch does not contain any @author tags. |
| +1 :green_heart: | test4tests | 0m 0s | The patch appears to include 1 new or modified test files. |
||| _ master Compile Tests _ |
| +0 :ok: | mvndep | 4m 54s | Maven dependency ordering for branch |
| +1 :green_heart: | mvninstall | 19m 4s | master passed |
| +0 | hbaserecompile | 32m 4s | HBase recompiled. |
| +1 :green_heart: | compile | 1m 44s | master passed |
| +1 :green_heart: | checkstyle | 2m 4s | master passed |
| +1 :green_heart: | javadoc | 1m 12s | master passed |
| +0 :ok: | spotbugs | 3m 23s | phoenix-core in master has 964 extant spotbugs warnings. |
| +0 :ok: | spotbugs | 0m 47s | phoenix-tools in master has 5 extant spotbugs warnings. |
| -0 :warning: | patch | 1m 3s | Used diff version of patch file. Binary files and potentially other changes not applied. Please rebase and squash commits if necessary. |
||| _ Patch Compile Tests _ |
| +0 :ok: | mvndep | 0m 13s | Maven dependency ordering for patch |
| +1 :green_heart: | mvninstall | 15m 10s | the patch passed |
| +0 | hbaserecompile | 21m 52s | HBase recompiled. |
| +1 :green_heart: | compile | 1m 41s | the patch passed |
| +1 :green_heart: | javac | 1m 41s | the patch passed |
| -1 :x: | checkstyle | 1m 49s | phoenix-core: The patch generated 427 new + 2618 unchanged - 20 fixed = 3045 total (was 2638) |
| -1 :x: | checkstyle | 0m 18s | phoenix-tools: The patch generated 3 new + 57 unchanged - 364 fixed = 60 total (was 421) |
| +1 :green_heart: | whitespace | 0m 0s | The patch has no whitespace issues. |
| +1 :green_heart: | xml | 0m 2s | The patch has no ill-formed XML file. |
| +1 :green_heart: | javadoc | 1m 11s | the patch passed |
| -1 :x: | spotbugs | 3m 32s | phoenix-core generated 6 new + 964 unchanged - 0 fixed = 970 total (was 964) |
| +1 :green_heart: | spotbugs | 0m 56s | phoenix-tools generated 0 new + 3 unchanged - 2 fixed = 3 total (was 5) |
||| _ Other Tests _ |
| -1 :x: | unit | 115m 14s | phoenix-core in the patch failed. |
| -1 :x: | unit | 3m 49s | phoenix-tools in the patch failed. |
| +1 :green_heart: | asflicense | 1m 20s | The patch does not generate ASF License warnings. |
| | | 198m 27s | |
| Reason | Tests |
|-------:|:------|
| FindBugs | module:phoenix-core |
| | Found reliance on default encoding in org.apache.phoenix.schematool.SchemaSynthesisProcessor.getQueriesFromFile(String):in org.apache.phoenix.schematool.SchemaSynthesisProcessor.getQueriesFromFile(String): new java.io.FileReader(File) At SchemaSynthesisProcessor.java:[line 211] |
| | Null passed for non-null parameter of new org.apache.phoenix.parse.SQLParser(String) in org.apache.phoenix.schematool.SchemaSynthesisProcessor.synthesize(String, String) Method invoked at SchemaSynthesisProcessor.java:of new org.apache.phoenix.parse.SQLParser(String) in org.apache.phoenix.schematool.SchemaSynthesisProcessor.synthesize(String, String) Method invoked at SchemaSynthesisProcessor.java:[line 80] |
| | Null passed for non-null parameter of new org.apache.phoenix.parse.SQLParser(String) in org.apache.phoenix.schematool.SchemaSynthesisProcessor.synthesize(String, String) Method invoked at SchemaSynthesisProcessor.java:of new org.apache.phoenix.parse.SQLParser(String) in org.apache.phoenix.schematool.SchemaSynthesisProcessor.synthesize(String, String) Method invoked at SchemaSynthesisProcessor.java:[line 81] |
| | org.apache.phoenix.schematool.SchemaSynthesisProcessor.getQueriesFromFile(String) may fail to close stream At SchemaSynthesisProcessor.java:stream At SchemaSynthesisProcessor.java:[line 211] |
| | Invocation of toString on Throwable.getStackTrace() in org.apache.phoenix.util.QueryUtil.getShowCreateTableStmt(PhoenixConnection, String, TableName) At QueryUtil.java:in org.apache.phoenix.util.QueryUtil.getShowCreateTableStmt(PhoenixConnection, String, TableName) At QueryUtil.java:[line 788] |
| | org.apache.phoenix.util.QueryUtil.getShowCreateTableStmt(PhoenixConnection, String, TableName) may fail to clean up java.sql.Statement on checked exception Obligation to clean up resource created at QueryUtil.java:to clean up java.sql.Statement on checked exception Obligation to clean up resource created at QueryUtil.java:[line 794] is not discharged |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/4/artifact/yetus-general-check/output/Dockerfile |
| GITHUB PR | https://github.com/apache/phoenix/pull/1271 |
| Optional Tests | dupname asflicense javac javadoc unit spotbugs hbaserebuild hbaseanti checkstyle compile xml |
| uname | Linux 85ac32b8f57d 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | dev/phoenix-personality.sh |
| git revision | master / 9b76bd5 |
| Default Java | Private Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08 |
| checkstyle | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/4/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt |
| checkstyle | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/4/artifact/yetus-general-check/output/diff-checkstyle-phoenix-tools.txt |
| spotbugs | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/4/artifact/yetus-general-check/output/new-spotbugs-phoenix-core.html |
| unit | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/4/artifact/yetus-general-check/output/patch-unit-phoenix-core.txt |
| unit | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/4/artifact/yetus-general-check/output/patch-unit-phoenix-tools.txt |
| Test Results | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/4/testReport/ |
| Max. process+thread count | 10509 (vs. ulimit of 30000) |
| modules | C: phoenix-core phoenix-tools U: . |
| Console output | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1271/4/console |
| versions | git=2.7.4 maven=3.3.9 spotbugs=4.1.3 |
| Powered by | Apache Yetus 0.12.0 https://yetus.apache.org |
This message was automatically generated.
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] richardantal commented on a change in pull request #1271: PHOENIX-6518 Implement SHOW CREATE STATEMENT SQL command
Posted by GitBox <gi...@apache.org>.
richardantal commented on a change in pull request #1271:
URL: https://github.com/apache/phoenix/pull/1271#discussion_r674751278
##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/ShowCreateStatementIT.java
##########
@@ -0,0 +1,79 @@
+/*
+ * 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.phoenix.end2end;
+
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.util.Properties;
+
+import static org.junit.Assert.assertTrue;
+
+public class ShowCreateStatementIT extends ParallelStatsDisabledIT {
+ @Test
+ public void testDescribebasic() throws Exception {
+ Properties props = new Properties();
+ Connection conn = DriverManager.getConnection(getUrl(), props);
+ String tableName = generateUniqueName();
+ String ddl = "CREATE TABLE " + tableName + "(K VARCHAR NOT NULL PRIMARY KEY, INT INTEGER)";
+ conn.createStatement().execute(ddl);
+
+ ResultSet rs = conn.createStatement().executeQuery("SHOW CREATE STATEMENT " + tableName );
+ assertTrue(rs.next());
+ System.out.println(ddl);
+ System.out.println(rs.getString(1));
+ assertTrue(rs.getString(1).contains(ddl));
+ }
+
+ @Ignore
Review comment:
https://issues.apache.org/jira/browse/PHOENIX-6519
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] richardantal commented on a change in pull request #1271: PHOENIX-6518 Implement SHOW CREATE STATEMENT SQL command
Posted by GitBox <gi...@apache.org>.
richardantal commented on a change in pull request #1271:
URL: https://github.com/apache/phoenix/pull/1271#discussion_r678182557
##########
File path: phoenix-tools/src/it/java/org/apache/phoenix/schema/SchemaToolSynthesisIT.java
##########
@@ -23,8 +23,8 @@
import java.io.File;
import java.net.URL;
-import static org.apache.phoenix.schema.SchemaSynthesisProcessor.ENTITY_NAME_IN_BASE_AND_ALTER_DDL_DON_T_MATCH;
-import static org.apache.phoenix.schema.SchemaSynthesisProcessor.UNSUPPORTED_DDL_EXCEPTION;
+import static org.apache.phoenix.schematool.SchemaSynthesisProcessor.ENTITY_NAME_IN_BASE_AND_ALTER_DDL_DON_T_MATCH;
Review comment:
In this package there are the files I moved from phoenix-tools module.
It has the SchemaSynthesis functionality as well not only the schema extraction.
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] stoty commented on a change in pull request #1271: PHOENIX-6518 Implement SHOW CREATE STATEMENT SQL command
Posted by GitBox <gi...@apache.org>.
stoty commented on a change in pull request #1271:
URL: https://github.com/apache/phoenix/pull/1271#discussion_r674825398
##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/ShowCreateStatementIT.java
##########
@@ -0,0 +1,79 @@
+/*
+ * 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.phoenix.end2end;
+
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.util.Properties;
+
+import static org.junit.Assert.assertTrue;
+
+public class ShowCreateStatementIT extends ParallelStatsDisabledIT {
+ @Test
+ public void testDescribebasic() throws Exception {
Review comment:
not describe
##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/ShowCreateStatementIT.java
##########
@@ -0,0 +1,79 @@
+/*
+ * 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.phoenix.end2end;
+
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.util.Properties;
+
+import static org.junit.Assert.assertTrue;
+
+public class ShowCreateStatementIT extends ParallelStatsDisabledIT {
+ @Test
+ public void testDescribebasic() throws Exception {
+ Properties props = new Properties();
+ Connection conn = DriverManager.getConnection(getUrl(), props);
+ String tableName = generateUniqueName();
+ String ddl = "CREATE TABLE " + tableName + "(K VARCHAR NOT NULL PRIMARY KEY, INT INTEGER)";
+ conn.createStatement().execute(ddl);
+
+ ResultSet rs = conn.createStatement().executeQuery("SHOW CREATE STATEMENT " + tableName );
+ assertTrue(rs.next());
+ System.out.println(ddl);
+ System.out.println(rs.getString(1));
+ assertTrue(rs.getString(1).contains(ddl));
+ }
+
+ @Ignore
+ @Test
+ public void testDescribeLowerCase() throws Exception {
+ Properties props = new Properties();
+ Connection conn = DriverManager.getConnection(getUrl(), props);
+ String tableName = "lowercasetbl1";
+ String ddl = "CREATE TABLE \"" + tableName + "\"(K VARCHAR NOT NULL PRIMARY KEY, INT INTEGER)";
+ conn.createStatement().execute(ddl);
+
+ ResultSet rs = conn.createStatement().executeQuery("SHOW CREATE STATEMENT \"" + tableName + "\"");
+ assertTrue(rs.next());
+ System.out.println(ddl);
+ System.out.println(rs.getString(1));
+ assertTrue(rs.getString(1).contains(ddl));
+ }
+
+ @Test
+ public void testDescribeUpperCase() throws Exception {
+ Properties props = new Properties();
+ Connection conn = DriverManager.getConnection(getUrl(), props);
+ String tableName = generateUniqueName();
+ String schemaName = generateUniqueName();
+ String tableFullName = SchemaUtil.getQualifiedTableName(schemaName, tableName);
+ String ddl = "CREATE TABLE " + tableFullName + "(K VARCHAR NOT NULL PRIMARY KEY, INT INTEGER)";
+ conn.createStatement().execute(ddl);
+
+ ResultSet rs = conn.createStatement().executeQuery("SHOW CREATE STATEMENT " + tableFullName + "");
+ assertTrue(rs.next());
+ System.out.println(ddl);
Review comment:
debug printlns
##########
File path: phoenix-core/src/main/java/org/apache/phoenix/parse/ShowCreateTablesStatement.java
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.phoenix.parse;
+
+import org.apache.phoenix.compile.ColumnResolver;
+import org.apache.phoenix.thirdparty.com.google.common.base.Preconditions;
+import org.apache.phoenix.util.SchemaUtil;
+
+import java.util.Objects;
+
+/**
+ * ParseNode implementation for DESCRIBE tablename.
+ */
+public class ShowCreateTablesStatement extends ShowCreateStatement {
+
+ private TableName tableName;
+
+ public ShowCreateTablesStatement(TableName tn) {
+ tableName = tn;
+ }
+
+ public TableName getTableName() {
+ return tableName;
+ }
+
+ public void toSQL(ColumnResolver resolver, StringBuilder buf) {
+ Preconditions.checkNotNull(buf);
+ buf.append("SHOW CREATE STATEMENT ");
+
+ if(tableName.getSchemaName() != null) {
+ if (tableName.isSchemaNameCaseSensitive()) {
+ buf.append("\"");
+ }
+ buf.append(tableName.getSchemaName());
+ if (tableName.isSchemaNameCaseSensitive()) {
+ buf.append("\"");
+ }
+ buf.append(".");
+ }
+
+ if (tableName.isTableNameCaseSensitive()) {
+ buf.append("\"");
+ }
+ buf.append(tableName.getTableName());
+ if (tableName.isTableNameCaseSensitive()) {
+ buf.append("\"");
+ }
Review comment:
Pretty sure we have a helper function already for this.
##########
File path: phoenix-tools/src/it/java/org/apache/phoenix/schema/SchemaToolSynthesisIT.java
##########
@@ -23,8 +23,8 @@
import java.io.File;
import java.net.URL;
-import static org.apache.phoenix.schema.SchemaSynthesisProcessor.ENTITY_NAME_IN_BASE_AND_ALTER_DDL_DON_T_MATCH;
-import static org.apache.phoenix.schema.SchemaSynthesisProcessor.UNSUPPORTED_DDL_EXCEPTION;
+import static org.apache.phoenix.schematool.SchemaSynthesisProcessor.ENTITY_NAME_IN_BASE_AND_ALTER_DDL_DON_T_MATCH;
Review comment:
Not sure about the "schematool" package name.
Perhaps "schemaextract" or "sema.generate" or similar would be more descriptive.
##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/ShowCreateStatementIT.java
##########
@@ -0,0 +1,79 @@
+/*
+ * 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.phoenix.end2end;
+
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.util.Properties;
+
+import static org.junit.Assert.assertTrue;
+
+public class ShowCreateStatementIT extends ParallelStatsDisabledIT {
+ @Test
+ public void testDescribebasic() throws Exception {
+ Properties props = new Properties();
+ Connection conn = DriverManager.getConnection(getUrl(), props);
+ String tableName = generateUniqueName();
+ String ddl = "CREATE TABLE " + tableName + "(K VARCHAR NOT NULL PRIMARY KEY, INT INTEGER)";
+ conn.createStatement().execute(ddl);
+
+ ResultSet rs = conn.createStatement().executeQuery("SHOW CREATE STATEMENT " + tableName );
+ assertTrue(rs.next());
+ System.out.println(ddl);
+ System.out.println(rs.getString(1));
+ assertTrue(rs.getString(1).contains(ddl));
+ }
+
+ @Ignore
+ @Test
+ public void testDescribeLowerCase() throws Exception {
+ Properties props = new Properties();
+ Connection conn = DriverManager.getConnection(getUrl(), props);
+ String tableName = "lowercasetbl1";
+ String ddl = "CREATE TABLE \"" + tableName + "\"(K VARCHAR NOT NULL PRIMARY KEY, INT INTEGER)";
+ conn.createStatement().execute(ddl);
+
+ ResultSet rs = conn.createStatement().executeQuery("SHOW CREATE STATEMENT \"" + tableName + "\"");
+ assertTrue(rs.next());
+ System.out.println(ddl);
Review comment:
do not commit printlns
##########
File path: phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
##########
@@ -1302,6 +1304,22 @@ public QueryPlan compilePlan(final PhoenixStatement stmt, Sequence.ValueOp seqAc
}
}
+ private static class ExecutableShowCreateTablesStatement extends ShowCreateTablesStatement
Review comment:
class names don't match the command name
##########
File path: phoenix-core/src/main/java/org/apache/phoenix/parse/ShowCreateTablesStatement.java
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.phoenix.parse;
+
+import org.apache.phoenix.compile.ColumnResolver;
+import org.apache.phoenix.thirdparty.com.google.common.base.Preconditions;
+import org.apache.phoenix.util.SchemaUtil;
+
+import java.util.Objects;
+
+/**
+ * ParseNode implementation for DESCRIBE tablename.
Review comment:
does not match command
##########
File path: phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
##########
@@ -769,6 +772,42 @@ public static PreparedStatement getTablesStmt(PhoenixConnection connection, Stri
return stmt;
}
+ /**
+ * Util that generates a PreparedStatement against syscat to get the table listing in a given schema.
+ */
+ public static PreparedStatement getShowCreateStatementStmt(PhoenixConnection connection, String catalog, TableName tn) throws SQLException {
+
+ String output;
+ SchemaProcessor processor = new SchemaExtractionProcessor(null,
+ connection.unwrap(PhoenixConnection.class).getQueryServices().getConfiguration(),
+ tn.getSchemaName() == null ? null : "\"" + tn.getSchemaName()+ "\"",
+ "\"" + tn.getTableName() + "\"");
+ try {
+ output = processor.process();
+ } catch (Exception e) {
+ LOGGER.error(e.getStackTrace().toString());
+ throw new SQLException(e.getMessage());
+ }
+
+ String stmtType;
Review comment:
Not sure we need to adjust the column name.
"CREATE STATEMENT" is probably enough.
##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/ShowCreateStatementIT.java
##########
@@ -0,0 +1,79 @@
+/*
+ * 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.phoenix.end2end;
+
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.util.Properties;
+
+import static org.junit.Assert.assertTrue;
+
+public class ShowCreateStatementIT extends ParallelStatsDisabledIT {
+ @Test
+ public void testDescribebasic() throws Exception {
+ Properties props = new Properties();
+ Connection conn = DriverManager.getConnection(getUrl(), props);
+ String tableName = generateUniqueName();
+ String ddl = "CREATE TABLE " + tableName + "(K VARCHAR NOT NULL PRIMARY KEY, INT INTEGER)";
+ conn.createStatement().execute(ddl);
+
+ ResultSet rs = conn.createStatement().executeQuery("SHOW CREATE STATEMENT " + tableName );
+ assertTrue(rs.next());
+ System.out.println(ddl);
Review comment:
remove debug printlns
##########
File path: phoenix-core/src/main/java/org/apache/phoenix/parse/ShowCreateStatement.java
##########
@@ -0,0 +1,38 @@
+/*
+ * 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.phoenix.parse;
+
+import org.apache.phoenix.jdbc.PhoenixStatement;
+
+/**
+ * Parent class for all SHOW statements. SHOW SCHEMAS, SHOW TABLES etc.
Review comment:
Comment doesn't seem to be true
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] stoty commented on pull request #1271: PHOENIX-6518 Implement SHOW CREATE STATEMENT SQL command
Posted by GitBox <gi...@apache.org>.
stoty commented on pull request #1271:
URL: https://github.com/apache/phoenix/pull/1271#issuecomment-888912290
Don't forget to change the statement name in the ticket and commit message as well.
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] chrajeshbabu commented on a change in pull request #1271: PHOENIX-6518 Implement SHOW CREATE STATEMENT SQL command
Posted by GitBox <gi...@apache.org>.
chrajeshbabu commented on a change in pull request #1271:
URL: https://github.com/apache/phoenix/pull/1271#discussion_r678097208
##########
File path: phoenix-core/src/main/antlr3/PhoenixSQL.g
##########
@@ -496,6 +498,11 @@ show_node returns [ShowStatement ret]
| SHOW SCHEMAS (LIKE pattern=string_literal)? { $ret = factory.showSchemasStatement(pattern); }
;
+// Parse a describe statement. SHOW CREATE STATEMENT tablename ...
+show_create_statement_node returns [ShowCreateStatement ret]
+ : SHOW CREATE STATEMENT tablename=from_table_name { $ret = factory.showCreateStatement(tablename); }
Review comment:
bq.In case we chose to rename it to SHOW CREATE TABLE, should it work for views and indexes as well or Do you think those should be separate commands?
Same should work for table,index and views as well instead of separate commands.
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] richardantal commented on a change in pull request #1271: PHOENIX-6518 Implement SHOW CREATE STATEMENT SQL command
Posted by GitBox <gi...@apache.org>.
richardantal commented on a change in pull request #1271:
URL: https://github.com/apache/phoenix/pull/1271#discussion_r674751772
##########
File path: phoenix-tools/src/it/java/org/apache/phoenix/schema/SchemaToolExtractionIT.java
##########
@@ -67,6 +68,20 @@ public void testCreateTableStatement() throws Exception {
Assert.assertEquals(createTableStmt, result.toUpperCase());
}
+// @Ignore
Review comment:
Created https://issues.apache.org/jira/browse/PHOENIX-6519 for this
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org