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

Add option to control whether to normalize ident #5124

Merged
merged 5 commits into from
Feb 1, 2023

Conversation

jiacai2050
Copy link
Contributor

Which issue does this PR close?

Closes #4551.

Rationale for this change

See issue above.

What changes are included in this PR?

  • Add new field enable_ident_normalization in ParserOptions
  • Add SqlParserOptions in ConfigOptions

Are these changes tested?

Add new UT: parse_ident_normalization

Are there any user-facing changes?

Yes, users can configure this new option when parse SQL

@github-actions github-actions bot added core Core datafusion crate sql SQL Planner sqllogictest labels Jan 31, 2023
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.

The idea and code look good to me @jiacai2050 -- thank you!

I think we need two more tests to ensure this feature is not broken in the future:

  1. A test for parse_float_as_decimal
  2. a "sql level" test for this feature -- perhaps in https://github.com/apache/arrow-datafusion/blob/master/datafusion/core/tests/sqllogictests/test_files/ddl.slt ?

Here is an example of changing a setting in sql: https://github.com/apache/arrow-datafusion/blob/1f7885bb48dd33ce7b9df995214393bbff080e08/datafusion/core/tests/sqllogictests/test_files/information_schema.slt#L28-L30

@jiacai2050
Copy link
Contributor Author

jiacai2050 commented Feb 1, 2023

@jiacai2050 jiacai2050 requested a review from alamb February 1, 2023 10:27
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.

LGTM -- thanks @jiacai2050

Comment on lines +36 to +39
let table_ref = object_name_to_table_reference(
name,
self.options.enable_ident_normalization,
)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

This code could potentially be improved by making a self.object_name_to_table_reference rather than having to pass self.options.enable_ident_normalization, at each callsite, but we can do that as a follow on PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make sense, I can fix this in following PR.

Comment on lines +517 to +520
query R
select 10000000000000000000.01
----
10000000000000000000.01
Copy link
Contributor

Choose a reason for hiding this comment

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

Another query you can do is select arrow_typeof(10000000000000000000.01) to see the actual type of the expression

Copy link
Contributor Author

@jiacai2050 jiacai2050 Feb 1, 2023

Choose a reason for hiding this comment

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

Don't know this function before, will add this test soon.

@alamb alamb merged commit f8607c2 into apache:master Feb 1, 2023
@alamb
Copy link
Contributor

alamb commented Feb 1, 2023

Thanks again @jiacai2050

@ursabot
Copy link

ursabot commented Feb 1, 2023

Benchmark runs are scheduled for baseline = 11e8906 and contender = f8607c2. f8607c2 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core datafusion crate sql SQL Planner sqllogictest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add option to determine whether to convert identifiers
3 participants