-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-37878][SQL][FOLLOWUP] V1Table should always carry the "location" property #36498
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
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 |
|---|---|---|
|
|
@@ -42,7 +42,7 @@ import org.apache.spark.sql.catalyst.plans.logical._ | |
| import org.apache.spark.sql.catalyst.trees.CurrentOrigin | ||
| import org.apache.spark.sql.catalyst.util.{CharVarcharUtils, DateTimeUtils, IntervalUtils, ResolveDefaultColumns} | ||
| import org.apache.spark.sql.catalyst.util.DateTimeUtils.{convertSpecialDate, convertSpecialTimestamp, convertSpecialTimestampNTZ, getZoneId, stringToDate, stringToTimestamp, stringToTimestampWithoutTimeZone} | ||
| import org.apache.spark.sql.connector.catalog.{SupportsNamespaces, TableCatalog} | ||
| import org.apache.spark.sql.connector.catalog.{CatalogV2Util, SupportsNamespaces, TableCatalog} | ||
| import org.apache.spark.sql.connector.catalog.TableChange.ColumnPosition | ||
| import org.apache.spark.sql.connector.expressions.{ApplyTransform, BucketTransform, DaysTransform, Expression => V2Expression, FieldReference, HoursTransform, IdentityTransform, LiteralValue, MonthsTransform, Transform, YearsTransform} | ||
| import org.apache.spark.sql.errors.QueryParsingErrors | ||
|
|
@@ -3288,7 +3288,15 @@ class AstBuilder extends SqlBaseParserBaseVisitor[AnyRef] with SQLConfHelper wit | |
| throw QueryParsingErrors.cannotCleanReservedTablePropertyError( | ||
| PROP_EXTERNAL, ctx, "please use CREATE EXTERNAL TABLE") | ||
| case (PROP_EXTERNAL, _) => false | ||
| case _ => true | ||
| // It's safe to set whatever table comment, so we don't make it a reserved table property. | ||
| case (PROP_COMMENT, _) => true | ||
| case (k, _) => | ||
|
Contributor
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. I think it is duplicate with case before. Just leave code you added is simple and clear.
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. We need the code above to throw errors with a better error message, which gives suggestions like
Contributor
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. That's where I got confused too. If we want to keep the code above to issue a better error message, why not adding something in parallel such as
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. We may add more reserved properties in the future that the suggestion can only be
Contributor
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. Got it. Thanks for the explanation. |
||
| val isReserved = CatalogV2Util.TABLE_RESERVED_PROPERTIES.contains(k) | ||
| if (!legacyOn && isReserved) { | ||
| throw QueryParsingErrors.cannotCleanReservedTablePropertyError( | ||
| k, ctx, "please remove it from the TBLPROPERTIES list.") | ||
| } | ||
| !isReserved | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
nit :
actually, we can add a reserved property named
PROP_TABLE_TYPE, because type includeEXTERNALMANAGEDVIEWthat also can control the different behaviors whenTYPE == MANAGED. AndPROP_TABLE_TYPEsounds more generic, may be we can add more type in future.Uh oh!
There was an error while loading. Please reload this page.
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.
I don't think we will use
TableCatalogto support views. I'm adding this new property as I think this is the most precise way. People can create EXTERNAL table without location, or create MANAGED TABLE with location. What we care in SHOW CREATE TABLE is if the location is generated by the catalog or not, instead of the table type.