Skip to content

Update ASCII scalar function to support Utf8View #11834 - #11884

Merged
alamb merged 1 commit into
apache:mainfrom
s5dsn-eqee:update-ascii-utf8view-11834
Aug 8, 2024
Merged

Update ASCII scalar function to support Utf8View #11834#11884
alamb merged 1 commit into
apache:mainfrom
s5dsn-eqee:update-ascii-utf8view-11834

Conversation

@s5dsn-eqee

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #11834.

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions Bot added the sqllogictest SQL Logic Tests (.slt) label Aug 8, 2024
@s5dsn-eqee
s5dsn-eqee force-pushed the update-ascii-utf8view-11834 branch from c94858c to 3dddecc Compare August 8, 2024 11:16
let string_array = args[0].as_string_view();
calculate_ascii(string_array.iter())
}
_ => unreachable!(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we return internal_err!("Unsupported data type") instead of panic here?


fn calculate_ascii<'a, I>(string_array: I) -> Result<ArrayRef>
where
I: IntoIterator<Item = Option<&'a str>>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
I: IntoIterator<Item = Option<&'a str>>,
I: ArrayAccessor<Item = &'a str>,

As exampled in https://github.com/apache/arrow-rs/blob/e28cf44e65cdd1fefaa1b857ca4336e7a9da5d06/arrow-array/src/array/mod.rs#L487-L507

@s5dsn-eqee
s5dsn-eqee force-pushed the update-ascii-utf8view-11834 branch 2 times, most recently from e380fa1 to dad81cf Compare August 8, 2024 14:03
@s5dsn-eqee
s5dsn-eqee force-pushed the update-ascii-utf8view-11834 branch from dad81cf to ea14dbc Compare August 8, 2024 14:05

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great to me -- thank you @dmitrybugakov and @XiangpengHao for the revieww

@alamb
alamb merged commit 0ce6d16 into apache:main Aug 8, 2024
@s5dsn-eqee
s5dsn-eqee deleted the update-ascii-utf8view-11834 branch August 8, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update the ASCII scalar function to support Utf8View

3 participants