[SPARK-44698][SQL] Create table like other table should also copy tab…#42374
Closed
zhuqi-lucas wants to merge 1 commit intoapache:masterfrom
Closed
[SPARK-44698][SQL] Create table like other table should also copy tab…#42374zhuqi-lucas wants to merge 1 commit intoapache:masterfrom
zhuqi-lucas wants to merge 1 commit intoapache:masterfrom
Conversation
Contributor
Author
|
Sorry i misunderstand, the create table like don't need to copy data actually! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…le stats.
What changes were proposed in this pull request?
Jira:
SPARK-44698
Create table like other table should also copy table stats, now the stats is missing from the source table to the target table, for example:
For example:
describe table extended tbl;
col0 int
col1 int
col2 int
col3 int
Detailed Table Information
Catalog spark_catalog
Database default
Table tbl
Owner zhuqi
Created Time Mon Aug 07 14:02:30 CST 2023
Last Access UNKNOWN
Created By Spark 4.0.0-SNAPSHOT
Type MANAGED
Provider hive
Table Properties [transient_lastDdlTime=1691388473]
Statistics 30 bytes
Location file:/Users/zhuqi/spark/spark/spark-warehouse/tbl
Serde Library org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
InputFormat org.apache.hadoop.mapred.TextInputFormat
OutputFormat org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
Storage Properties [serialization.format=1]
Partition Provider Catalog
Time taken: 0.032 seconds, Fetched 23 row(s)
create table tbl2 like tbl;
23/08/07 14:14:07 WARN HiveMetaStore: Location: file:/Users/zhuqi/spark/spark/spark-warehouse/tbl2 specified for non-external table:tbl2
Time taken: 0.098 seconds
spark-sql (default)> describe table extended tbl2;
col0 int
col1 int
col2 int
col3 int
Detailed Table Information
Catalog spark_catalog
Database default
Table tbl2
Owner zhuqi
Created Time Mon Aug 07 14:14:07 CST 2023
Last Access UNKNOWN
Created By Spark 4.0.0-SNAPSHOT
Type MANAGED
Provider hive
Table Properties [transient_lastDdlTime=1691388847]
Location file:/Users/zhuqi/spark/spark/spark-warehouse/tbl2
Serde Library org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
InputFormat org.apache.hadoop.mapred.TextInputFormat
OutputFormat org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
Storage Properties [serialization.format=1]
Partition Provider Catalog
Time taken: 0.03 seconds, Fetched 22 row(s)
The table stats are missing.
Why are the changes needed?
Does this PR introduce any user-facing change?
No
How was this patch tested?
I create a unit test in code to confirm it.