Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHOENIX-6271: Effective DDL generated by SchemaExtractionTool should … #1212

Merged
merged 1 commit into from Apr 29, 2021

Conversation

swaroopak
Copy link
Contributor

…maintain the order of PK and other columns

@stoty
Copy link
Contributor

stoty commented Apr 27, 2021

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 55s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ 4.x Compile Tests _
+0 🆗 mvndep 5m 28s Maven dependency ordering for branch
+1 💚 mvninstall 11m 11s 4.x passed
+1 💚 compile 1m 48s 4.x passed
+1 💚 checkstyle 0m 58s 4.x passed
+1 💚 javadoc 1m 12s 4.x passed
+0 🆗 spotbugs 3m 57s phoenix-core in 4.x has 946 extant spotbugs warnings.
+0 🆗 spotbugs 0m 50s phoenix-tools in 4.x has 3 extant spotbugs warnings.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 14s Maven dependency ordering for patch
+1 💚 mvninstall 7m 16s the patch passed
+1 💚 compile 1m 54s the patch passed
+1 💚 javac 1m 54s the patch passed
-1 ❌ checkstyle 0m 45s phoenix-core: The patch generated 2 new + 719 unchanged - 3 fixed = 721 total (was 722)
-1 ❌ checkstyle 0m 16s phoenix-tools: The patch generated 11 new + 215 unchanged - 8 fixed = 226 total (was 223)
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 javadoc 1m 7s the patch passed
+1 💚 spotbugs 5m 31s the patch passed
_ Other Tests _
+1 💚 unit 241m 55s phoenix-core in the patch passed.
+1 💚 unit 4m 10s phoenix-tools in the patch passed.
+1 💚 asflicense 0m 20s The patch does not generate ASF License warnings.
292m 15s
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-1212/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #1212
JIRA Issue PHOENIX-6271
Optional Tests dupname asflicense javac javadoc unit spotbugs hbaseanti checkstyle compile
uname Linux c6050475172b 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 4.x / c3f166e
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-1212/1/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-1212/1/artifact/yetus-general-check/output/diff-checkstyle-phoenix-tools.txt
Test Results https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1212/1/testReport/
Max. process+thread count 4725 (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-1212/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.

Copy link
Contributor

@gokceni gokceni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some nits

@@ -1275,15 +1275,21 @@ public static String getPTableFullNameWithQuotes(String pSchemaName, String pTab
pTableName = "\""+pTableName+"\"";
}
if(tableNameNeedsQuotes || schemaNameNeedsQuotes) {
pTableFullName = pSchemaName + "." + pTableName;
if (pSchemaName != null && !pSchemaName.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Strings.isNullOrEmpty

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also do you need to think about namespaceenabled? I am guessing no

return pTableFullName;
}

private static boolean isQuotesNeeded(String name) {
// first char numeric or non-underscore
if(!Character.isAlphabetic(name.charAt(0)) && name.charAt(0)!='_') {
if (name == null || name.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Strings.isNullOrEmpty

Copy link
Contributor

@gjacoby126 gjacoby126 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm misunderstanding what you're trying to do in this patch, but the results for indexes look incorrect to me. The effective DDL of an index shouldn't contain the PK suffix inherited from the base table or parent view. (I can see it being useful to include such a thing in a SQL comment or something, but not the CREATE INDEX statement itself)

if (effectivePK.isEmpty()) {
effectivePK = indexPkSet;
// This is added because of PHOENIX-2340
if (dataPTable.isMultiTenant() && indexPKName.contains(dataPKName.get(0))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we have a String tenantId = dataPKName.get(0); line and use that in the checks? I worry that if we ever implement PHOENIX-5248 that the current logic here will be too subtle for the implementer to realize that it needs to be changed if we can't depend on first column == tenantId.

…maintain the order of PK and other columns
@stoty
Copy link
Contributor

stoty commented Apr 29, 2021

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 4s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ 4.x Compile Tests _
+0 🆗 mvndep 5m 7s Maven dependency ordering for branch
+1 💚 mvninstall 9m 19s 4.x passed
+1 💚 compile 1m 32s 4.x passed
+1 💚 checkstyle 1m 2s 4.x passed
+1 💚 javadoc 1m 0s 4.x passed
+0 🆗 spotbugs 3m 0s phoenix-core in 4.x has 946 extant spotbugs warnings.
+0 🆗 spotbugs 0m 45s phoenix-tools in 4.x has 3 extant spotbugs warnings.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 17s Maven dependency ordering for patch
+1 💚 mvninstall 6m 2s the patch passed
+1 💚 compile 1m 32s the patch passed
+1 💚 javac 1m 32s the patch passed
-1 ❌ checkstyle 0m 45s phoenix-core: The patch generated 2 new + 719 unchanged - 3 fixed = 721 total (was 722)
-1 ❌ checkstyle 0m 15s phoenix-tools: The patch generated 34 new + 192 unchanged - 31 fixed = 226 total (was 223)
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 javadoc 0m 57s the patch passed
+1 💚 spotbugs 4m 5s the patch passed
_ Other Tests _
+1 💚 unit 211m 55s phoenix-core in the patch passed.
+1 💚 unit 4m 18s phoenix-tools in the patch passed.
+1 💚 asflicense 0m 18s The patch does not generate ASF License warnings.
254m 27s
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-1212/2/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #1212
JIRA Issue PHOENIX-6271
Optional Tests dupname asflicense javac javadoc unit spotbugs hbaseanti checkstyle compile
uname Linux 0820657ae601 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 4.x / c3f166e
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-1212/2/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-1212/2/artifact/yetus-general-check/output/diff-checkstyle-phoenix-tools.txt
Test Results https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1212/2/testReport/
Max. process+thread count 5094 (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-1212/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.

Copy link
Contributor

@gjacoby126 gjacoby126 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, thanks for the patch and adding the extra test assertions, @swaroopak

@@ -47,6 +47,7 @@

import javax.annotation.Nullable;

import com.google.common.base.Strings;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember that you'll have to use the shaded version when you port to master.

@swaroopak
Copy link
Contributor Author

Thank you for the review @gjacoby126 @gokceni

@swaroopak swaroopak merged commit 8d8be95 into apache:4.x Apr 29, 2021
swaroopak added a commit that referenced this pull request May 21, 2021
…maintain the order of PK and other columns (#1212)

Co-authored-by: Swaroopa Kadam <s.kadam@apache.org>
stoty pushed a commit to stoty/phoenix that referenced this pull request Jun 18, 2021
…maintain the order of PK and other columns (apache#1212)

Co-authored-by: Swaroopa Kadam <s.kadam@apache.org>
asfgit pushed a commit that referenced this pull request Jun 18, 2021
…maintain the order of PK and other columns (#1212)

Co-authored-by: Swaroopa Kadam <s.kadam@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants