Hive 我们可以从现有的地板上创建拼花地板桌子吗?

Hive 我们可以从现有的地板上创建拼花地板桌子吗?,hive,parquet,Hive,Parquet,我有一张包含大量数据的表格。 我必须从中提取一些列并创建一个拼花地板表。 下面是我所做的- CREATE TABLE parqfiletable AS SELECT col2, col4, col8 FROM txtfiletable STORED AS PARQUET; 这是成功的,但是当我试图从拼花地板表检索数据时,它抛出了一个错误 此外,相同的CREATETABLE语句现在不起作用 我会用一种正常的方式来做,比如创建一个存储为parquet的表定义,然后从原始源加载数据。但在那个时候,上

我有一张包含大量数据的表格。 我必须从中提取一些列并创建一个拼花地板表。 下面是我所做的-

CREATE TABLE parqfiletable
AS
SELECT col2, col4, col8 FROM txtfiletable
STORED AS PARQUET;
这是成功的,但是当我试图从拼花地板表检索数据时,它抛出了一个错误

此外,相同的CREATETABLE语句现在不起作用

我会用一种正常的方式来做,比如创建一个存储为parquet的表定义,然后从原始源加载数据。但在那个时候,上面的方法立即起作用,并且创建了表

您能让我理解CREATETABLE语句的错误吗? 我们不能创建“创建为…”。。储存为拼花地板'

CREATE TABLE parqtab
AS
SELECT col2, FROM txtfiletable
AS 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

我为上述问题找到了正确的语法

从textfiletable中选择*创建存储为拼花的表拼花表