如何从现有的配置单元表中读取分区键

时间:2014-10-20 13:43:43

标签: linux shell hive hiveql

我正在尝试从源配置单元表中读取数据到目标配置单元表,这是我创建的部分内容     使用源数据库表模式的目标配置单元数据库中的表,我没有问题     所以我想动态读取分区键并将它们插入到load语句中     以便将数据导入目标表。

我想知道是否有人可以帮助我从现有的表模式中读取分区键?

这是示例表模式...

     hive> describe extended pageviews;
     OK
     eventtime               string
     userid                  string
     page                    string
     dt                      string
     applicationtype         string

# Partition Information
# col_name              data_type               comment

dt                      string
applicationtype         string

Detailed Table Information      
Table(tableName:pageviews, dbName:default, owner:root, createTime:1413687270, lastAccessTime:0, retention:0, 
sd:StorageDescriptor(cols:[FieldSchema(name:eventtime, type:string, comment:null), 
FieldSchema(name:userid, type:string, comment:null), 
FieldSchema(name:page, type:string, comment:null), FieldSchema(name:dt, type:string,  comment:null),
FieldSchema(name:applicationtype, type:string, comment:null)], location:hdfs://sandbox.hortonworks.com:8020/apps/hive/warehouse/pageviews,
 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:[FieldSchema(name:dt, type:string, comment:null),  
FieldSchema(name:applicationtype, type:string, comment:null)],
 parameters:{transient_lastDdlTime=1413687270}, viewOriginalText:null,
   viewExpandedText:null, tableType:MANAGED_TABLE)

Time taken: 0.903 seconds, Fetched: 13 row(s)

0 个答案:

没有答案