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

fix(udf): support struct[] type in struct #13689

Merged
merged 9 commits into from
Nov 29, 2023
Merged

Conversation

wangrunji0408
Copy link
Contributor

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

What's changed and what's your intention?

This PR fixes the bug that UDF doesn't support struct[] type in struct.

______2023-11-27_11 42 39_720

______2023-11-27_11 41 46_720

On RisingWave side:

  • Fix the datatype comparison with field name ignored.
  • Support casting to arrow for struct[] arrays.

On Python side:

  • Fix parsing nested struct type. e.g. struct<struct<int>>

On Java side:

  • Support data conversion between Arrow vector and user-defined Java class via reflection.

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)

@wangrunji0408 wangrunji0408 force-pushed the wrj/udf-recursive-struct branch from d349ca8 to f627a88 Compare November 28, 2023 08:05
Copy link

codecov bot commented Nov 28, 2023

Codecov Report

Attention: 26 lines in your changes are missing coverage. Please review.

Comparison is base (83e9586) 68.28% compared to head (b112749) 68.25%.
Report is 3 commits behind head on main.

Files Patch % Lines
src/common/src/array/arrow.rs 54.28% 16 Missing ⚠️
src/common/src/array/list_array.rs 0.00% 3 Missing ⚠️
src/expr/core/src/expr/expr_udf.rs 0.00% 3 Missing ⚠️
src/expr/core/src/table_function/user_defined.rs 0.00% 3 Missing ⚠️
src/common/src/types/mod.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13689      +/-   ##
==========================================
- Coverage   68.28%   68.25%   -0.03%     
==========================================
  Files        1523     1523              
  Lines      261481   261505      +24     
==========================================
- Hits       178555   178493      -62     
- Misses      82926    83012      +86     
Flag Coverage Δ
rust 68.25% <42.22%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@liurenjie1024 liurenjie1024 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!


### Changed

- Change the default struct field name to `f{i}`.
Copy link
Member

Choose a reason for hiding this comment

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

Why to change this 🤣

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like it's postgres' default name.

postgres=# select (row(1, 2)).*;
 f1 | f2 
----+----
  1 |  2

@wangrunji0408 wangrunji0408 added this pull request to the merge queue Nov 29, 2023
Merged via the queue into main with commit 40c020f Nov 29, 2023
26 of 27 checks passed
@wangrunji0408 wangrunji0408 deleted the wrj/udf-recursive-struct branch November 29, 2023 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants