描述表-GET ddl/database /:db/table /:table

Description

描述一个 HCatalog 表。通常返回一个简单的列列表(使用“ desc table”),但是扩展格式将显示更多信息(使用“ show table extended like”)。

URL

http:// * www.myserver.com * /templeton/v1/ddl/database/ *:db * /table/ *:table *

http:// * www.myserver.com * /templeton/v1/ddl/database/ *:db * /table/ *:table * ?format=extended

Parameters

NameDescriptionRequired?Default
:db数据库名称RequiredNone
:table表名RequiredNone
format设置“ format=extended”以查看其他信息(使用“显示表扩展为”)OptionalNot extended

standard parameters也受支持。

Results

NameDescription
columns列名称和类型的列表
database数据库名称
table表名
分区 (仅扩展)如果表已分区,则为 True
位置 (仅扩展)桌子的位置
outputFormat (仅扩展)Output format
所有者 (仅扩展)所有者的用户名
partitionColumns (仅扩展)分区列列表
inputFormat (仅扩展)Input format

Example

Curl 命令(简单)

% curl -s 'http://localhost:50111/templeton/v1/ddl/database/default/table/my_table?user.name=ctdean'

JSON 输出(简单)

{
 "columns": [
   {
     "name": "id",
     "type": "bigint"
   },
   {
     "name": "user",
     "comment": "The user name",
     "type": "string"
   },
   {
     "name": "my_p",
     "type": "string"
   },
   {
     "name": "my_q",
     "type": "string"
   }
 ],
 "database": "default",
 "table": "my_table"
}

Curl 命令(扩展)

% curl -s 'http://localhost:50111/templeton/v1/ddl/database/default/table/test_table?user.name=ctdean&format=extended'

JSON 输出(扩展)

{
  "partitioned": true,
  "location": "hdfs://ip-10-77-6-151.ec2.internal:8020/apps/hive/warehouse/test_table",
  "outputFormat": "org.apache.hadoop.hive.ql.io.RCFileOutputFormat",
  "columns": [
    {
      "name": "id",
      "type": "bigint"
    },
    {
      "name": "price",
      "comment": "The unit price",
      "type": "float"
    }
  ],
  "owner": "ctdean",
  "partitionColumns": [
    {
      "name": "country",
      "type": "string"
    }
  ],
  "inputFormat": "org.apache.hadoop.hive.ql.io.RCFileInputFormat",
  "database": "default",
  "table": "test_table"
}

JSON 输出(错误)

{
  "error": "Table xtest_table does not exist",
  "errorCode": 404,
  "database": "default",
  "table": "xtest_table"
}

Navigation Links

上一个:GET ddl/database/:db/table下一个:PUT ddl/database/:db/table/:table

一般:DDL ResourcesWebHCat ReferenceWebHCat ManualHCatalog ManualHive Wiki 主页Hive 项目 site