cloud-fan edited a comment on issue #26219: [SPARK-29563][SQL] CREATE TABLE LIKE should look up catalog/table like v2 commands URL: https://github.com/apache/spark/pull/26219#issuecomment-549723014 This command is tricky as it involves 2 tables: source and target. When we need to create the target table in the session catalog, shall we create a v1 or v2 table? For CREATE TABLE, the rule is simple: we check the provider and create v2 tables if it's a v2 provider. For this case, it's complicated as the source table may be a v2 table and doesn't have a provider. My proposal: if the source table doesn't have a provider, use the default provider (set by `spark.sql.sources.default`). Then follow CREATE TABLE and create v2 table if provider is v2. In summary: 1. resolve the source table first. 2. if target table needs to be created in a non-session catalog, use v2 CREATE TABLE LIKE 3. if target table needs to be created in the session catalog, check the provider of the source table or use the default provider. If it's a v2 provider, use v2 CREATE TABLE LIKE, otherwise use the v1 command. v2 CREATE TABLE LIKE implementation: get schema and table properties from the source table, and create the target table.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
