Skip to content

Conversation

@bitemyapp
Copy link
Contributor

I'm reviving this patch from #652

Please let me know what I'd need to do to make this merge-able. I'd like to be able to stop operating a fork of sqlparser-rs for parsing our Hive/Athena SQL so any direction you can give is much appreciated.

parse_describe validates the behavior for the hive and generic dialects.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 6577799521

  • 8 of 8 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.003%) to 87.357%

Totals Coverage Status
Change from base Build 6435373786: 0.003%
Covered Lines: 16783
Relevant Lines: 19212

💛 - Coveralls

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.

Thank you @bitemyapp -- I have just a small test request


fn generic(options: Option<ParserOptions>) -> TestedDialects {
TestedDialects {
dialects: vec![Box::new(GenericDialect {})],
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also please test HiveDialect given this is in the sqlparser_hive.rs module?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course, good point. Thank you.

Copy link
Contributor Author

@bitemyapp bitemyapp Oct 23, 2023

Choose a reason for hiding this comment

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

I didn't find any test-cases that tested generic and not hive. Everything was either hive alone or hive and generic, e.g. the parse_create_function test. I'm not sure it makes sense to blend them given how they get used in the tests. I think it makes sense to test hive-isms that generic should be able to handle in the module that tests hive-isms rather than duplicating everything into the generic test module.

Copy link
Contributor

Choose a reason for hiding this comment

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

How about something like this in sqlparser_common.rs?

https://github.com/sqlparser-rs/sqlparser-rs/blob/ce62fe6d274d354fef34fad919b58f6ba16c61a3/tests/sqlparser_common.rs#L7303-L7316

(maybe we can do this 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.

I don't mind doing a follow-up PR.

Perhaps I could do something like parse_deeply_nested_expr_hits_recursion_limits in the common module but parameterized over the dialect, then invoke the helper in the generic & hive test modules? If that sounds acceptable let me know and I will pursue that.

Copy link
Contributor

Choose a reason for hiding this comment

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

What I was suggesting was to remove generic() and test parse_describe with both hive and generic

@alamb alamb changed the title Patch to deal with backticked identifiers in GenericDialect Support with identifiers surrounded with `` in GenericDialect` Oct 20, 2023
@alamb alamb changed the title Support with identifiers surrounded with `` in GenericDialect` Support with identifiers surrounded with \ in GenericDialect` Oct 20, 2023
@alamb alamb changed the title Support with identifiers surrounded with \ in GenericDialect` Support with identifiers surrounded with ```` in GenericDialect` Oct 20, 2023
@alamb alamb changed the title Support with identifiers surrounded with ```` in GenericDialect` Support with identifiers surrounded with \ in GenericDialect` Oct 20, 2023
@alamb alamb changed the title Support with identifiers surrounded with \ in GenericDialect` Support with identifiers surrounded with backticks in GenericDialect Oct 20, 2023
@bitemyapp bitemyapp changed the title Support with identifiers surrounded with backticks in GenericDialect Support "with" identifiers surrounded by backticks in GenericDialect Oct 23, 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.

Looks good to me -- thank you @bitemyapp


fn generic(options: Option<ParserOptions>) -> TestedDialects {
TestedDialects {
dialects: vec![Box::new(GenericDialect {})],
Copy link
Contributor

Choose a reason for hiding this comment

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

How about something like this in sqlparser_common.rs?

https://github.com/sqlparser-rs/sqlparser-rs/blob/ce62fe6d274d354fef34fad919b58f6ba16c61a3/tests/sqlparser_common.rs#L7303-L7316

(maybe we can do this as a follow on PR)

@alamb alamb merged commit 9832adb into apache:main Oct 24, 2023
serprex pushed a commit to serprex/sqlparser-rs that referenced this pull request Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants