【问题标题】:Hive describe extended table return jsonHive 描述扩展表返回 json
【发布时间】:2016-12-07 18:52:01
【问题描述】:

有没有办法在 Hive 中运行“描述扩展表”并以JSONXML 或一些易于解析的格式返回结果?或者Java中是否存在可以解析这种格式的现有解析?

表(表名:test3,dbName:testdatabase,所有者:johnsmith,createTime:1481135997,lastAccessTime:0,retention:0,sd:StorageDescriptor(cols:[FieldSchema(名称:a,类型:字符串,注释:“” a,m)],位置:hdfs://testcluster/apps/hive/warehouse/testdatabase/test3,输入格式:org.apache.hadoop.hive.ql.io.orc.OrcInputFormat,输出格式: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:[], 参数:{}, 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)

【问题讨论】:

标签: sql hive


【解决方案1】:

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

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

【讨论】:

  • 不起作用,"错误:处理语句时出错:无法在运行时修改 hive.ddl.output.format。它不在允许在运行时修改的参数列表中( state=42000,code=1)"
  • 哪个蜂巢版本? hive config source code 可以找到这个配置,也许你的 Hive 服务器在运行时不能改变一些参数,你可以检查你的 Hive 配置这个设置:set hive.conf.restricted.list;hive config details
  • 嗨,Saboloh,感谢提供线索!我正在使用 Hive v1.2...很难更改公司集群...我的本地 hive.conf.restricted.listhive.security.authenticator.manager, hive.security.authorization.manager , hive.security.metastore.authorization.manager, hive.security.metastore.authenticator.manager, hive.users.in.admin.role,hive.server2.xsrf.filter.enabled, hive.security.authorization.enabled我>
【解决方案2】:

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

【讨论】:

  • 不是结构化数据,对程序员、数据过滤器等不友好。需要 JSON 或 XML,就像在任何其他好的 SGDB(如 PostgreSQL 或 Oracle)中一样。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-11-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-04-07
相关资源
最近更新 更多