-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[SPARK-55024][SQL][FOLLOWUP] Delay namespace length check to v1 identifier creation #54247
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -698,12 +698,12 @@ class SparkSqlAstBuilder extends AstBuilder { | |
| } | ||
|
|
||
| withIdentClause(ctx.identifierReference(), Seq(qPlan), (ident, otherPlans) => { | ||
| val tableIdentifier = ident.asTableIdentifier | ||
| if (tableIdentifier.database.isDefined) { | ||
| if (ident.length > 1) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this case covered by some test? (its easy to understand though, so not blocking)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| // Temporary view names should NOT contain database prefix like "database.table" | ||
| throw QueryParsingErrors | ||
| .notAllowedToAddDBPrefixForTempViewError(tableIdentifier.nameParts, ctx) | ||
| .notAllowedToAddDBPrefixForTempViewError(ident, ctx) | ||
| } | ||
| val tableIdentifier = TableIdentifier(ident.head) | ||
|
|
||
| CreateViewCommand( | ||
| tableIdentifier, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1162,8 +1162,10 @@ class V2SessionCatalogNamespaceSuite extends V2SessionCatalogBaseSuite { | |
| val testIdent: IdentifierHelper = Identifier.of(Array("a", "b"), "c") | ||
| checkError( | ||
| exception = intercept[AnalysisException](testIdent.asTableIdentifier), | ||
| condition = "IDENTIFIER_TOO_MANY_NAME_PARTS", | ||
| parameters = Map("identifier" -> "`a`.`b`.`c`", "limit" -> "2") | ||
| condition = "REQUIRES_SINGLE_PART_NAMESPACE", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just opinion that previously having the identifier was a bit easier to debug. I wonder if we can extend the error message to have a version with identifier?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good point, working on it. |
||
| parameters = Map( | ||
| "sessionCatalog" -> "spark_catalog", | ||
| "identifier" -> "`a`.`b`.`c`") | ||
| ) | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious here, is it necessary to remove these if ns is not empty? I see that asTableIdentifierOpt still handles the empty ns case.
I assume in V1SessionCatalog case, the namespace is never empty, but just checking if its necessary to remove, in case some v2 connector is using the method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should never be empty, we have stricter check in other places before: https://github.com/apache/spark/pull/54247/changes#diff-415c3b78d7558933c759da01218075e011c45c4d0fb5ff3fe522f24d6e4b8e20L730