[SPARK-30019][SQL] Add the owner property to v2 table#27249
[SPARK-30019][SQL] Add the owner property to v2 table#27249yaooqinn wants to merge 17 commits intoapache:masterfrom yaooqinn:SPARK-30019
Conversation
...e/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
Outdated
Show resolved
Hide resolved
|
Test build #116892 has finished for PR 27249 at commit
|
|
Test build #116898 has finished for PR 27249 at commit
|
|
Test build #116914 has finished for PR 27249 at commit
|
|
Test build #116929 has finished for PR 27249 at commit
|
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
Outdated
Show resolved
Hide resolved
|
shall we also print owner name/type in DESC TABLE like DESC NAMESPACE? |
The |
|
I mean, we should follow |
|
LGTM |
|
Test build #116940 has finished for PR 27249 at commit
|
|
Test build #116959 has finished for PR 27249 at commit
|
|
Test build #116958 has finished for PR 27249 at commit
|
|
retest this please |
|
Test build #116986 has finished for PR 27249 at commit
|
|
Test build #116991 has finished for PR 27249 at commit
|
|
retest this please |
|
Test build #116996 has finished for PR 27249 at commit
|
|
Test build #116999 has finished for PR 27249 at commit
|
| owner | ||
| </td> | ||
| <td> | ||
| no |
There was a problem hiding this comment.
it's reserved for both table and namespace, or do I miss something?
There was a problem hiding this comment.
nvm, we can update when revert ALTER NAMESPACE SET OWNER.
| case (PROP_LOCATION, _) => false | ||
| case (PROP_OWNER, _) if !legacyOn => | ||
| throw new ParseException(s"$PROP_OWNER is a reserved table property , please use" + | ||
| " ALTER TABLE ... SET OWNER ... to specify it.", ctx) |
There was a problem hiding this comment.
it can't be changed after table is created.
| import org.apache.spark.sql.catalyst.plans.DescribeTableSchema | ||
| import org.apache.spark.sql.catalyst.plans.logical._ | ||
| import org.apache.spark.sql.catalyst.util.{escapeSingleQuotedString, quoteIdentifier, CaseInsensitiveMap} | ||
| import org.apache.spark.sql.connector.catalog.TableCatalog |
|
|
||
| import org.apache.spark.sql.catalyst.TableIdentifier | ||
| import org.apache.spark.sql.catalyst.catalog.CatalogTable | ||
| import org.apache.spark.sql.connector.catalog.TableCatalog |
| import org.apache.spark.sql.catalyst.expressions.Expression | ||
| import org.apache.spark.sql.catalyst.parser.{CatalystSqlParser, ParseException} | ||
| import org.apache.spark.sql.connector.catalog.SupportsNamespaces._ | ||
| import org.apache.spark.sql.connector.catalog.TableCatalog |
|
can we add some tests to make sure CREATE/ALTER TABLE fails if setting Also let's update the PR title. Now we are just adding an owner property to v2 table. |
We have a general test for reserved ones
OK |
|
Test build #117109 has finished for PR 27249 at commit
|
|
Test build #117106 has finished for PR 27249 at commit
|
| } else { | ||
| catalog.getTableMetadata(tableIdent).properties | ||
| } | ||
| props -- TableCatalog.RESERVED_PROPERTIES.asScala |
| assert(sql(s"DESCRIBE TABLE EXTENDED spark_30019").where("col_name='Owner'") | ||
| .collect().head.getString(1) === Utils.getCurrentUserName()) | ||
| val e2 = intercept[ParseException]( | ||
| sql(s"CREATE TABLE spark_30019_2 WITH TBLPROPERTIES('owner'='spark_30019')")) |
There was a problem hiding this comment.
do we need it? I think we already have CREATE/REPLACE/ALTER TABLE tests for reserved properties.
There was a problem hiding this comment.
you mean this whole test or this line?
|
LGTM except a few minor comments |
|
Test build #117100 has finished for PR 27249 at commit
|
|
Test build #117120 has finished for PR 27249 at commit
|
|
Test build #117127 has finished for PR 27249 at commit
|
|
thanks, merging to master! |
What changes were proposed in this pull request?
Add
ownerproperty to v2 table, it is reversed byTableCatalog, indicates the table's owner.Why are the changes needed?
enhance ownership management of catalog API
Does this PR introduce any user-facing change?
yes, add 1 reserved property -
owner, and it is not allowed to use in OPTIONS/TBLPROPERTIES anymore, only if legacy onHow was this patch tested?
add uts