Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support parsing map type: map(k,v) #17860

Merged
merged 2 commits into from
Aug 13, 2024

Conversation

xxchan
Copy link
Member

@xxchan xxchan commented Jul 30, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

part of #17743

  • parser: support parsing map(k,v) type.
  • expr/type: support map cast

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

Copy link
Member Author

xxchan commented Jul 30, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @xxchan and the rest of your teammates on Graphite Graphite

@xxchan xxchan force-pushed the 07-26-feat_support_create_table_with_map_type branch 2 times, most recently from 94f7632 to bfbb254 Compare July 30, 2024 06:57
@xxchan xxchan force-pushed the 07-26-feat_support_create_table_with_map_type branch from bfbb254 to 61d2cbe Compare August 6, 2024 17:54
@xxchan xxchan marked this pull request as ready for review August 6, 2024 17:54
@xxchan xxchan force-pushed the 07-26-feat_support_create_table_with_map_type branch from 61d2cbe to aa33f2f Compare August 6, 2024 18:09
@xxchan xxchan force-pushed the 07-26-feat_support_create_table_with_map_type branch from aa33f2f to d757a66 Compare August 8, 2024 09:17
@xxchan xxchan requested a review from xiangjinwu August 8, 2024 09:24
@xxchan xxchan force-pushed the 07-26-feat_support_create_table_with_map_type branch 2 times, most recently from a563afa to 519cd3d Compare August 8, 2024 10:55
@xxchan xxchan changed the title feat: support create table with map type feat: support parsing map type: map(k,v) Aug 8, 2024
@xxchan xxchan requested review from chenzl25 and BugenZhao August 8, 2024 11:06
Copy link
Contributor

@chenzl25 chenzl25 left a comment

Choose a reason for hiding this comment

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

LGTM! Nice work.

@xxchan xxchan mentioned this pull request Aug 9, 2024
9 tasks
@xxchan xxchan force-pushed the 07-26-feat_support_create_table_with_map_type branch from 519cd3d to 83e6410 Compare August 12, 2024 08:51
Base automatically changed from xxchan/map to main August 12, 2024 09:53
@graphite-app graphite-app bot requested review from a team August 12, 2024 09:54
@BugenZhao
Copy link
Member

Shall we rebase this PR?

support cast

improve check
@xxchan xxchan force-pushed the 07-26-feat_support_create_table_with_map_type branch from 83e6410 to 34e9829 Compare August 13, 2024 04:01
e2e_test/batch/types/map.slt.part Show resolved Hide resolved
e2e_test/batch/types/map.slt.part Show resolved Hide resolved
Comment on lines +247 to +251
let new_ctx = Context {
arg_types: vec![ctx.arg_types[0].clone().as_map().clone().into_list()],
return_type: ctx.return_type.as_map().clone().into_list(),
variadic: ctx.variadic,
};
Copy link
Member

Choose a reason for hiding this comment

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

Though implemented ingeniously, does it mean that we need to construct (and allocate) the new context per row? 😕

Copy link
Member Author

Choose a reason for hiding this comment

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

The real reason was that I didn't fully understand what list_cast is doing, so I just chose to invoke it directly instead of imitating. 🤡

let cast = build_func(
PbType::Cast,
ctx.return_type.as_list().clone(),
vec![InputRefExpression::new(ctx.arg_types[0].as_list().clone(), 0).boxed()],
)
.unwrap();

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, list_cast also clones datatypes and allocates vec every time..

src/frontend/src/handler/create_mv.rs Outdated Show resolved Hide resolved
src/frontend/src/binder/insert.rs Outdated Show resolved Hide resolved
src/frontend/src/binder/insert.rs Show resolved Hide resolved
src/frontend/src/binder/select.rs Outdated Show resolved Hide resolved
@xxchan xxchan enabled auto-merge August 13, 2024 06:11
@xxchan xxchan added this pull request to the merge queue Aug 13, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 13, 2024
@xxchan xxchan added this pull request to the merge queue Aug 13, 2024
Merged via the queue into main with commit f2bcff7 Aug 13, 2024
30 of 31 checks passed
@xxchan xxchan deleted the 07-26-feat_support_create_table_with_map_type branch August 13, 2024 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants