Hive描述扩展表返回json

时间:2016-12-07 18:52:01

标签: sql hive

有没有办法运行"描述扩展表"在Hive中并以pickleJSON或一些易于解析的格式返回结果?或者XML中是否存在可解析此类格式的现有解析?

  

表(tableName:test3,dbName:testdatabase,owner:johnsmith,createTime:1481135997,lastAccessTime:0,retention:0,sd:StorageDescriptor(cols:[FieldSchema(name:a,type:string,comment:&# 34;" a,m)],位置:hdfs:// testcluster / apps / hive / warehouse / testdatabase / test3,inputFormat:org.apache.hadoop.hive.ql.io.orc.OrcInputFormat,outputFormat: org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat,compressed:false,numBuckets:-1,serdeInfo:SerDeInfo(name:null,serializationLib:org.apache.hadoop.hive.ql.io.orc.OrcSerde ,参数:{serialization.format = 1}),bucketCols:[],sortCols:[],参数:{},skewedInfo:SkewedInfo(skewedColNames:[],skewedColValues:[],skewedColValueLocationMaps:{}),storedAsSubDirectories:false ),partitionKeys:[],参数:{totalSize = 0,numRows = 0,rawDataSize = 0,COLUMN_STATS_ACCURATE = {" BASIC_STATS":" true"},numFiles = 0,transient_lastDdlTime = 1481135997},viewOriginalText:null,viewExpandedText:null,tableType:MANAGED_TABLE)

2 个答案:

答案 0 :(得分:1)

DESCRIBE FORMATTED my_table;更友好 不是json或xml ..但比DESCRIBE EXTENDED my_table;

更具可读性

答案 1 :(得分:1)

也许您可以使用hive.ddl.output.format格式化输出

set hive.ddl.output.format=json;
desc extended table;