Skip to content

Conversation

@xy720
Copy link
Member

@xy720 xy720 commented Feb 6, 2023

Proposed changes

Support complex type struct and map to Doris.

Design docs for struct and map

Problem summary

This commit support:

1、Insert + select for struct/map type
2、Json stream load for struct type
3、m[key] function for map type

How to use:

Set the fe config to create table for struct and map type
1、admin set frontend config("enable_struct_type" = "true");
2、admin set frontend config("enable_map_type" = "true");

#16547

Co-authored-by: xy720 <xuyang25@baidu.com>
Co-authored-by: amory <wangqiannan@selectdb.com>
Co-authored-by: cambyzju <zhuxiaoli01@baidu.com>
Co-authored-by: hucheng01 <hucheng01@baidu.com>

Checklist(Required)

  1. Does it affect the original behavior:
    • Yes
    • No
    • I don't know
  2. Has unit tests been added:
    • Yes
    • No
    • No Need
  3. Has document been added or modified:
    • Yes
    • No
    • No Need
  4. Does it need to update dependencies:
    • Yes
    • No
  5. Are there any changes that cannot be rolled back:
    • Yes (If Yes, please explain WHY)
    • No

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@github-actions github-actions bot added area/planner Issues or PRs related to the query planner area/sql/function Issues or PRs related to the SQL functions area/vectorization kind/docs Categorizes issue or PR as related to documentation. labels Feb 6, 2023
@xy720 xy720 changed the title [Feature](Struct/Map-type) Add struct and map type to Doris [Feature](Complex-type) Add struct and map type to Doris Feb 6, 2023
@xy720 xy720 added struct-type Issues or PRs related to struct type map-type Issues or PRs related to map type labels Feb 6, 2023
@hello-stephen
Copy link
Contributor

hello-stephen commented Feb 6, 2023

TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 34.54 seconds
load time: 471 seconds
storage size: 17171008864 Bytes
https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20230206134540_clickbench_pr_90973.html

@morningman
Copy link
Contributor

LGTM with thrift and proto.
cc @xiaokang , PTAL

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

cambyzju
cambyzju previously approved these changes Feb 8, 2023
Copy link
Contributor

@cambyzju cambyzju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Feb 8, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2023

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2023

PR approved by anyone and no changes requested.

Copy link
Contributor

@xiaokang xiaokang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

add some comments that can be fixed by further PRs

;

struct_literal ::=
LBRACE expr_list:list RBRACE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User may get confused if map literal and struct literal both use brace{}.

Copy link
Member Author

@xy720 xy720 Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, we keep struct literal using brace{}.
After we implement struct() function, we can support paren() for struct.

public String getStringValue() {
List<String> list = new ArrayList<>(children.size());
children.forEach(v -> list.add(v.getStringValue()));
return "{" + StringUtils.join(list, ", ") + "}";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest using '(' ')' to keep consistency.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be we should support '(' ')' only in insert stmt in future.
For select stmt and other places, we keep using brace{}.

@@ -95,7 +97,10 @@ class DataTypeFactory {
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

register Map to _invert_data_type_map like Array

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be we will add this part in next map pr.

xiaokang
xiaokang previously approved these changes Feb 8, 2023
@xy720 xy720 dismissed stale reviews from xiaokang and cambyzju via 7049dec February 8, 2023 07:34
@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Feb 8, 2023
Copy link
Contributor

@cambyzju cambyzju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Feb 10, 2023
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@xy720 xy720 merged commit 1b3902b into master Feb 10, 2023
YangShaw pushed a commit to YangShaw/doris that referenced this pull request Feb 17, 2023
This commit support:
1、Insert + select for struct/map type
2、Json stream load for struct type
3、m[key] function for map type

How to use:
Set the fe config to create table for struct and map type
1、admin set frontend config("enable_struct_type" = "true");
2、admin set frontend config("enable_map_type" = "true");

apache#16547

Co-authored-by: xy720 <xuyang25@baidu.com>
Co-authored-by: amory <wangqiannan@selectdb.com>
Co-authored-by: cambyzju <zhuxiaoli01@baidu.com>
Co-authored-by: hucheng01 <hucheng01@baidu.com>
@xy720 xy720 mentioned this pull request Feb 24, 2023
88 tasks
@adonis0147 adonis0147 deleted the struct-map-type branch November 13, 2023 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. area/planner Issues or PRs related to the query planner area/sql/function Issues or PRs related to the SQL functions area/vectorization kind/docs Categorizes issue or PR as related to documentation. kind/test map-type Issues or PRs related to map type reviewed struct-type Issues or PRs related to struct type

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants