Skip to content

Config: Add support default sql varchar to view types #15104

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

Merged
merged 7 commits into from
Mar 12, 2025

Conversation

zhuqi-lucas
Copy link
Contributor

Which issue does this PR close?

This is the first step of our incremental work for this issue:
#15096

Rationale for this change

Config: Add support default sql varchar to view types

What changes are included in this PR?

Config: Add support default sql varchar to view types

Are these changes tested?

Yes

Are there any user-facing changes?

Support default sql varchar to utf8view

@github-actions github-actions bot added sql SQL Planner core Core DataFusion crate common Related to common crate labels Mar 9, 2025
@github-actions github-actions bot added documentation Improvements or additions to documentation sqllogictest SQL Logic Tests (.slt) labels Mar 9, 2025
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks @zhuqi-lucas ! This looks great. I have a few comments. Let me know what you think

Comment on lines 255 to 258
/// If true, permit `VARCHAR` default convert to `Utf8View` in the logical plan.
/// If false, `VARCHAR` will be converted to `Utf8` in the logical plan.
/// Default is false.
pub support_varchar_to_view_types: bool, default = false
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend naming this slightly differently to make it clearer what it is doing

Suggested change
/// If true, permit `VARCHAR` default convert to `Utf8View` in the logical plan.
/// If false, `VARCHAR` will be converted to `Utf8` in the logical plan.
/// Default is false.
pub support_varchar_to_view_types: bool, default = false
/// If true, `VARCHAR` is mapped to `Utf8View` during SQL planning.
/// If false, `VARCHAR` is mappped to `Utf8` during SQL planning.
/// Default is false.
pub default_varchar_views: bool, default = false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @alamb for good suggestion, addressed in latest PR.

@@ -5673,3 +5673,43 @@ async fn test_fill_null_all_columns() -> Result<()> {
assert_batches_sorted_eq!(expected, &results);
Ok(())
}

#[tokio::test]
async fn test_sql_support_sql_to_view_types() -> Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of adding rust based tests, could you please make these sqllogictest based instead? sqllogictest is easier to maintain and run

The instructions are here
https://github.com/apache/datafusion/tree/main/datafusion/sqllogictest

Perhaps as a new test in https://github.com/apache/datafusion/blob/main/datafusion/sqllogictest/test_files/ddl.slt

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion! Addressed in latest PR.

@zhuqi-lucas
Copy link
Contributor Author

Thanks @zhuqi-lucas ! This looks great. I have a few comments. Let me know what you think

Thank you @alamb for review, great suggestions. Addressed in latest PR.

@zhuqi-lucas zhuqi-lucas requested a review from alamb March 9, 2025 14:31
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks @zhuqi-lucas

/// If true, `VARCHAR` is mapped to `Utf8View` during SQL planning.
/// If false, `VARCHAR` is mapped to `Utf8` during SQL planning.
/// Default is false.
pub default_varchar_views: bool, default = false
Copy link
Member

Choose a reason for hiding this comment

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

Could we define this parameter more clearly and readably, such as map_varchar_to_utf8view?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could we define this parameter more clearly and readably, such as map_varchar_to_utf8view?

Thank you @Weijun-H for review and good suggestion! Addressed in latest PR.

@zhuqi-lucas zhuqi-lucas requested a review from Weijun-H March 11, 2025 15:27
Copy link
Member

@Weijun-H Weijun-H left a comment

Choose a reason for hiding this comment

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

LGTM

@Weijun-H Weijun-H merged commit e7e7758 into apache:main Mar 12, 2025
26 checks passed
@Weijun-H
Copy link
Member

Thanks @zhuqi-lucas and @alamb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Related to common crate core Core DataFusion crate documentation Improvements or additions to documentation sql SQL Planner sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants