有什么方法可以在 Hive 中运行“描述扩展表”并以 JSON
、XML
或一些易于解析的格式返回结果?或者 Java
中是否存在可以解析此类格式的现有解析器?
Table(tableName:test3, dbName:testdatabase, owner:johnsmith, createTime:1481135997, lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:a, type:string, comment:""a,m)], location: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, parameters:{serialization.format=1}), bucketCols:[], sortCols:[], parameters:{}, skewedInfo:SkewedInfo(skewedColNames:[], skewedColValues:[], skewedColValueLocationMaps:{}), storedAsSubDirectories:false), partitionKeys:[], parameters:{totalSize=0, numRows=0, rawDataSize=0, COLUMN_STATS_ACCURATE={"BASIC_STATS":"true"}, numFiles=0, transient_lastDdlTime=1481135997}, viewOriginalText:null, viewExpandedText:null, tableType:MANAGED_TABLE)
最佳答案
也许你可以使用hive.ddl.output.format
格式化输出
set hive.ddl.output.format=json;
desc extended table;
关于sql - Hive描述扩展表返回json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41025134/