Skip to content

PHOENIX-6519 Make SchemaTool work with lower case table and column names - #1275

Merged
richardantal merged 1 commit into
apache:masterfrom
richardantal:PHOENIX-6519
Jul 29, 2021
Merged

PHOENIX-6519 Make SchemaTool work with lower case table and column names#1275
richardantal merged 1 commit into
apache:masterfrom
richardantal:PHOENIX-6519

Conversation

@richardantal

Copy link
Copy Markdown
Contributor

No description provided.

@stoty

Copy link
Copy Markdown
Contributor

💔 -1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 12sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
+1 💚@author0m 0sThe patch does not contain any @author tags.
-1 ❌test4tests0m 0sThe 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.
_ master Compile Tests _
+0 🆗mvndep5m 12sMaven dependency ordering for branch
+1 💚mvninstall20m 23smaster passed
+0hbaserecompile32m 34sHBase recompiled.
+1 💚compile1m 39smaster passed
+1 💚checkstyle0m 56smaster passed
+1 💚javadoc1m 13smaster passed
+0 🆗spotbugs3m 40sphoenix-core in master has 964 extant spotbugs warnings.
+0 🆗spotbugs0m 47sphoenix-tools in master has 5 extant spotbugs warnings.
_ Patch Compile Tests _
+0 🆗mvndep0m 12sMaven dependency ordering for patch
+1 💚mvninstall16m 59sthe patch passed
+0hbaserecompile24m 50sHBase recompiled.
+1 💚compile1m 36sthe patch passed
+1 💚javac1m 36sthe patch passed
-1 ❌checkstyle0m 44sphoenix-core: The patch generated 33 new + 712 unchanged - 0 fixed = 745 total (was 712)
-1 ❌checkstyle0m 16sphoenix-tools: The patch generated 15 new + 213 unchanged - 12 fixed = 228 total (was 225)
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚javadoc1m 6sthe patch passed
+1 💚spotbugs4m 25sthe patch passed
_ Other Tests _
+1 💚unit119m 10sphoenix-core in the patch passed.
-1 ❌unit3m 30sphoenix-tools in the patch failed.
+1 💚asflicense0m 24sThe patch does not generate ASF License warnings.
199m 48s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1275/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#1275
Optional Testsdupname asflicense javac javadoc unit spotbugs hbaserebuild hbaseanti checkstyle compile
unameLinux 015f7b580e53 4.15.0-147-generic #151-Ubuntu SMP Fri Jun 18 19:21:19 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev/phoenix-personality.sh
git revisionmaster / 6842c1d
Default JavaPrivate Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08
checkstylehttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1275/1/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt
checkstylehttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1275/1/artifact/yetus-general-check/output/diff-checkstyle-phoenix-tools.txt
unithttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1275/1/artifact/yetus-general-check/output/patch-unit-phoenix-tools.txt
Test Resultshttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1275/1/testReport/
Max. process+thread count11543 (vs. ulimit of 30000)
modulesC: phoenix-core phoenix-tools U: .
Console outputhttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1275/1/console
versionsgit=2.7.4 maven=3.3.9 spotbugs=4.1.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@stotystoty left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In general, you may want to go over the code, and make variable names more consistent.
i.e. add Quoted to quoted names, etc.

}

@Test
public void testCreateLocalIndexStatement() throws Exception {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems that you're also fixng some bugs WRT local indexes.
You should probablay note it at least in the commit message.

private String generateTableDDLString(String columnInfoString, String propertiesString,
String pSchemaName, String pTableName) {
String pTableFullName = SchemaUtil.getPTableFullNameWithQuotes(pSchemaName, pTableName);
String pTableFullName = SchemaUtil.getFullTableNameWithQuotes(pSchemaName, pTableName);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You may want to go over the code, and change the quoted variable names according to some common template, to improbe readability.

}

private static boolean quotesNeededForColumn(String name) {
if (!name.equals("_INDEX_ID") && "_".equals(String.valueOf(name.charAt(0)))) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need the special case for tables beginning with underscore ?
Also getting the first character as string would can probably done in a less circumpect way.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

If we want to create a table named _FOO we need quotes around that. The same applies for column names.
The difference is that when we create an index, _INDEX_ID column is added automatically and we do not want to have quotes around that. (But it should be possible to create a table called "_INDEX_ID" even if it an abnormal name.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation.
name.startsWith("_")
would be a far simpler check. (In the other methods as well.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Sure, I'll upload a new change soon.

Change-Id: I643ed8c3db1ec7ebd0a68b13412a22ff7249f037
}

public static String formatSchemaName(String name) {
if (quotesNeededForSchema(name)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does the leading _ issue not apply here ?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

It does, in quotesNeededForSchema we check for some extra schema specific stuff but I call the quotesNeededForTable there.

@stotystoty left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1 LGTM

@richardantal

Copy link
Copy Markdown
ContributorAuthor

Thank you @stoty for the reviews!

@richardantal
richardantal merged commit fa7e8c9 into apache:masterJul 29, 2021
@stoty

Copy link
Copy Markdown
Contributor

💔 -1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec5m 41sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
+1 💚@author0m 0sThe patch does not contain any @author tags.
-1 ❌test4tests0m 0sThe 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.
_ master Compile Tests _
+0 🆗mvndep5m 5sMaven dependency ordering for branch
+1 💚mvninstall19m 42smaster passed
+0hbaserecompile33m 45sHBase recompiled.
+1 💚compile1m 51smaster passed
+1 💚checkstyle1m 9smaster passed
+1 💚javadoc1m 26smaster passed
+0 🆗spotbugs4m 18sphoenix-core in master has 970 extant spotbugs warnings.
+0 🆗spotbugs0m 52sphoenix-tools in master has 3 extant spotbugs warnings.
_ Patch Compile Tests _
+0 🆗mvndep0m 13sMaven dependency ordering for patch
+1 💚mvninstall16m 34sthe patch passed
+0hbaserecompile23m 34sHBase recompiled.
+1 💚compile1m 46sthe patch passed
+1 💚javac1m 46sthe patch passed
-1 ❌checkstyle0m 46sphoenix-core: The patch generated 65 new + 909 unchanged - 27 fixed = 974 total (was 936)
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚javadoc1m 16sthe patch passed
+1 💚spotbugs4m 59sthe patch passed
_ Other Tests _
-1 ❌unit123m 16sphoenix-core in the patch failed.
-1 ❌unit3m 58sphoenix-tools in the patch failed.
+1 💚asflicense1m 24sThe patch does not generate ASF License warnings.
214m 11s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1275/2/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#1275
Optional Testsdupname asflicense javac javadoc unit spotbugs hbaserebuild hbaseanti checkstyle compile
unameLinux da3954fc0345 4.15.0-136-generic #140-Ubuntu SMP Thu Jan 28 05:20:47 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev/phoenix-personality.sh
git revisionmaster / d04b3d8
Default JavaPrivate Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08
checkstylehttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1275/2/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt
unithttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1275/2/artifact/yetus-general-check/output/patch-unit-phoenix-core.txt
unithttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1275/2/artifact/yetus-general-check/output/patch-unit-phoenix-tools.txt
Test Resultshttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1275/2/testReport/
Max. process+thread count13954 (vs. ulimit of 30000)
modulesC: phoenix-core phoenix-tools U: .
Console outputhttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1275/2/console
versionsgit=2.7.4 maven=3.3.9 spotbugs=4.1.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@richardantal@stoty