CREATE TABLE parqtab
AS
SELECT col2, FROM txtfiletable
AS PARQUET;
这样我们可以创建它,但根据扩展属性,这不是 PARQUET 表。
Detailed Table Information Table(tableName:parqtab, dbName:dbtest, owner:cloudera, createTime:1606338549, lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:col2, type:string, comment:null)], location:hdfs://quickstart.cloudera:8020/user/hive/warehouse/dbtest.db/parqtab, inputFormat:org.apache.hadoop.mapred.TextInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat, compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, parameters:{serialization.format=1}), bucketCols:[], sortCols:[], parameters:{}, skewedInfo:SkewedInfo(skewedColNames:[], skewedColValues:[], skewedColValueLocationMaps:{}), storedAsSubDirectories:false), partitionKeys:[], parameters:{numFiles=1, transient_lastDdlTime=1606338550, COLUMN_STATS_ACCURATE=true, totalSize=68, numRows=3, rawDataSize=65}, viewOriginalText:null, viewExpandedText:null, tableType:MANAGED_TABLE)
观察:
inputFormat:org.apache.hadoop.mapred.TextInputFormat,
outputFormat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat, compressed:false,
我直接创建了一个拼花桌。
create table parqtab2(id int) stored as parquet;
详细信息在这里。
Detailed Table Information Table(tableName:parqtab2, dbName:dbtest, owner:cloudera, createTime:1606338696, lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:id, type:int, comment:null)], location:hdfs://quickstart.cloudera:8020/user/hive/warehouse/dbtest.db/parqtab2, inputFormat:org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat, compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe, parameters:{serialization.format=1}), bucketCols:[], sortCols:[], parameters:{}, skewedInfo:SkewedInfo(skewedColNames:[], skewedColValues:[], skewedColValueLocationMaps:{}), storedAsSubDirectories:false), partitionKeys:[], parameters:{transient_lastDdlTime=1606338696}, viewOriginalText:null, viewExpandedText:null, tableType:MANAGED_TABLE)
从扩展属性观察:
inputFormat:org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat,
outputFormat:org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat