StarRocks/starrocks

Support converting JSON to STRUCT

已關閉

#43,101 建立於 2024年3月25日

 (13 則留言) (2 個反應) (1 位負責人)Java (1,246 個分叉)batch import
good first issueno-issue-activitytype/feature-requestversion:3.2.9version:3.3.0version:3.4

倉庫指標

星標
 (5,717 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Feature request

Is your feature request related to a problem? Please describe.

STRUCT type is more performant that JSON in terms of query, but which use the fixed schema and annoying to construct.

If it's possible to convert JSON to STRUCT directly, like to_struct(JSON), it can be much easier to use.

Describe the solution you'd like

  1. Use a function to convert JSON to STRUCT:
    • Example: select to_struct(parse_json("{"a": 1}"))
    • Difficulty: cannot inference the schema of struct before parsing the JSON
  2. Specify the STRUCT schema and convert:
    • Example: select to_struct<a int, b int>(parse_json("a": 1, "b": 2))
    • Difficulty: not easy to use

Describe alternatives you've considered

Additional context

貢獻者指南