apache / gravitino

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
https://gravitino.apache.org
Apache License 2.0
1.09k stars 343 forks source link

[Bug report] Missing comment of the struct field when creating table #4874

Open LauraXia123 opened 2 months ago

LauraXia123 commented 2 months ago

Version

main branch

Describe what's wrong

curl 'http://0.0.0.0:3002/api/metalakes/metalake_demo/catalogs/catalog_hive/schemas/sales/tables' \
  -H 'Accept: application/vnd.gravitino.v1+json' \
  -H 'Accept-Language: zh-CN,zh;q=0.9' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: application/json;charset=UTF-8' \
  -H 'Origin: http://0.0.0.0:3002' \
  -H 'Pragma: no-cache' \
  -H 'Referer: http://0.0.0.0:3002/catalogs/catalog_hive/sales?catalogType=relational' \
  --data-raw '{"name":"table7","comment":"","columns":[{"name":"structComment","type":{"type":"struct","fields":[{"name":"field","type":"binary","nullable":true,"comment":"xxx1111"}]},"nullable":true,"comment":""}],"properties":{}}' \
  --insecure

get the response { "code": 0, "table": { "name": "table7", "comment": "", "columns": [ { "name": "structcomment", "type": { "type": "struct", "fields": [ { "name": "field", "type": "binary", "nullable": true } ] }, "comment": "", "nullable": true, "autoIncrement": false } ], "properties": { "input-format": "org.apache.hadoop.mapred.TextInputFormat", "transient_lastDdlTime": "1725612072", "output-format": "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat", "location": "hdfs://hive:9000/user/hive/warehouse/sales.db/table7", "table-type": "MANAGED_TABLE", "serde-lib": "org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe", "serde-name": "table7" }, "audit": { "creator": "anonymous", "createTime": "2024-09-06T08:41:12.419Z" }, "distribution": { "strategy": "none", "number": 0, "funcArgs": [] }, "sortOrders": [], "partitioning": [], "indexes": [] } }

Missing the comment of the struct field [{"name":"field","type":"binary","nullable":true,"comment":"xxx1111"}]

Error message and/or stacktrace

N/A

How to reproduce

  1. create a table by curl above
  2. get the response

Additional context

No response

LauraXia123 commented 2 months ago

@mchades Would you help to have a check?

tyoushinya commented 4 weeks ago

@LauraXia123 For source code I saw the field comment is not supported for hive struct column. Maybe this is the reason why comment of the struct field was missing.

截屏2024-10-24 10 47 32