GitHub user gatorsmile opened a pull request:
https://github.com/apache/spark/pull/14727
[SPARK-17166] [SQL] Store Table Properties Specified in CTAS after
Conversion to Data Source Tables
## What changes were proposed in this pull request?
CTAS lost table properties after conversion to data source tables. For
example,
```SQL
CREATE TABLE t TBLPROPERTIES('prop1' = 'c', 'prop2' = 'd') AS SELECT 1 as
a, 1 as b
```
The output of `DESC FORMATTED t` does not have the related properties.
```
|Table Parameters: |
| |
| rawDataSize |-1
| |
| numFiles |1
| |
| transient_lastDdlTime |1471670983
| |
| totalSize |496
| |
| spark.sql.sources.provider|parquet
| |
| EXTERNAL |FALSE
| |
| COLUMN_STATS_ACCURATE |false
| |
| numRows |-1
| |
| |
| |
|# Storage Information |
| |
|SerDe Library:
|org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe
| |
|InputFormat:
|org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat
| |
|OutputFormat:
|org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat
| |
|Compressed: |No
| |
|Storage Desc Parameters: |
| |
| serialization.format |1
| |
| path
|file:/private/var/folders/4b/sgmfldk15js406vk7lw5llzw0000gn/T/warehouse-f3aa2927-6464-4a35-a715-1300dde6c614/t|
|
```
After the fix, the properties specified by users are stored as serde
properties, since the table properties are used for storing table schemas and
system generated properties.
```
|Table Parameters: |
| |
| rawDataSize |-1
| |
| numFiles |1
| |
| transient_lastDdlTime |1471672182
| |
| totalSize |496
| |
| spark.sql.sources.provider|parquet
| |
| EXTERNAL |FALSE
| |
| COLUMN_STATS_ACCURATE |false
| |
| numRows |-1
| |
| |
| |
|# Storage Information |
| |
|SerDe Library:
|org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe
| |
|InputFormat:
|org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat
| |
|OutputFormat:
|org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat
| |
|Compressed: |No
| |
|Storage Desc Parameters: |
| |
| prop2 |d
| |
| prop1 |c
| |
| serialization.format |1
| |
| path
|file:/private/var/folders/4b/sgmfldk15js406vk7lw5llzw0000gn/T/warehouse-78c38cea-02c9-40aa-9b20-9803686069ae/t|
|
+----------------------------+--------------------------------------------------------------------------------------------------------------+-------+
```
## How was this patch tested?
Added a test case.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/gatorsmile/spark tablePropertiesLoss
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/14727.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #14727
----
commit bffc412b4ce50ffc63da0f6b05d82f7dd52a97fd
Author: gatorsmile <[email protected]>
Date: 2016-08-20T05:40:52Z
fix.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
