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

[SPARK-29680][SQL][Followup] Replace qualifiedName with multipartIdentifier #26419

Closed
wants to merge 4 commits into from

Conversation

viirya
Copy link
Member

@viirya viirya commented Nov 7, 2019

What changes were proposed in this pull request?

Replace qualifiedName with multipartIdentifier in parser rules of DDL commands.

Why are the changes needed?

There are identifiers in some DDL rules we use qualifiedName. We should use multipartIdentifier because it can capture wrong identifiers such as test-table, test-col.

Does this PR introduce any user-facing change?

Yes. Wrong identifiers such as test-table, will be captured now after this change.

How was this patch tested?

Unit tests.

@viirya
Copy link
Member Author

viirya commented Nov 7, 2019

actually I am not sure if this should keep as followup or should create another JIRA ticket. @cloud-fan

@SparkQA
Copy link

SparkQA commented Nov 7, 2019

Test build #113360 has finished for PR 26419 at commit 5b99355.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds no public classes.

@viirya viirya changed the title [SPARK-29680][SQL][Followup] Replace qualifiedName with multipartIdentifier [WIP][SPARK-29680][SQL][Followup] Replace qualifiedName with multipartIdentifier Nov 7, 2019
@viirya viirya changed the title [WIP][SPARK-29680][SQL][Followup] Replace qualifiedName with multipartIdentifier [SPARK-29680][SQL][Followup] Replace qualifiedName with multipartIdentifier Nov 7, 2019
@@ -136,20 +136,22 @@ statement
| ALTER TABLE multipartIdentifier
ADD (COLUMN | COLUMNS)
'(' columns=qualifiedColTypeWithPositionList ')' #addTableColumns
| ALTER TABLE table=multipartIdentifier
RENAME COLUMN
from=multipartIdentifier TO to=multipartIdentifier #renameTableColumn
Copy link
Contributor

Choose a reason for hiding this comment

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

to should be a single identifer. We can only rename a column or a field, but not a field chain.

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, then it should be errorCapturingIdentifier.

@@ -802,7 +808,7 @@ intervalUnit
;

colPosition
: FIRST | AFTER qualifiedName
Copy link
Contributor

Choose a reason for hiding this comment

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

can we remove the definition of qualifiedName if it's used nowhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

in current change i just replaced qualifiedName for DDL commands.

there are still few places using qualifiedName. Need to address them see if we can replace them too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can a function be named as test-func without quote?

There are rules CRATE (OR REPLACE)? TEMPORARY? FUNCTION... and DROP TEMPORARY? FUNCTION that use qualifiedName.

Copy link
Contributor

@cloud-fan cloud-fan Nov 8, 2019

Choose a reason for hiding this comment

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

qualifiedName can't match a-b. I take another look, qualifiedName is still needed in places where - is a legal following, e.g. select a - b, we must use qualifiedName to match column name.

For function name in CREATE FUNCTION, we can use multipartIdentifier

Copy link
Member Author

Choose a reason for hiding this comment

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

If we use multipartIdentifier in CREATE FUNCTION, meaning function name is multipartIdentifier. Will it be a problem for parsing SELECT a-test_func(...) ...?

In this case, a-test will be parsed by multipartIdentifier and an exception will be thrown to ask adding quote for it.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can only use multipartIdentifier when define the function, e.g. CREATE FUNCTION ..., not when calling the function.

@SparkQA
Copy link

SparkQA commented Nov 7, 2019

Test build #113362 has finished for PR 26419 at commit c8fd004.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 7, 2019

Test build #113397 has finished for PR 26419 at commit baf3e31.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

"""
|CREATE TABLE IF NOT EXISTS tab
|USING test-provider
|COMMENT 'This is the staging page view table'
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we don't have to specify COMMENT, LOCATION, etc to test provider name.

@SparkQA
Copy link

SparkQA commented Nov 8, 2019

Test build #113442 has finished for PR 26419 at commit 50f4579.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 8, 2019

Test build #113465 has finished for PR 26419 at commit 092236c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@viirya
Copy link
Member Author

viirya commented Nov 8, 2019

Thanks. Merging to master.

@viirya viirya closed this in 70987d8 Nov 8, 2019
@viirya viirya deleted the SPARK-29680-followup2 branch December 27, 2023 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants