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

feat: support byte string literal in bq #802

Merged
merged 3 commits into from
Feb 19, 2023

Conversation

togami2864
Copy link
Contributor

@coveralls
Copy link

coveralls commented Feb 3, 2023

Pull Request Test Coverage Report for Build 4214280739

  • 29 of 34 (85.29%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.002%) to 86.14%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser.rs 4 6 66.67%
src/tokenizer.rs 11 14 78.57%
Totals Coverage Status
Change from base Build 4206765944: -0.002%
Covered Lines: 13400
Relevant Lines: 15556

💛 - Coveralls

Copy link
Contributor

@AugustoFKL AugustoFKL left a comment

Choose a reason for hiding this comment

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

Left a comment.

One thing that bothers me is that you didn't test the 'b' literal. Please add some tests for it, if possible.

@@ -493,6 +499,25 @@ impl<'a> Tokenizer<'a> {
}
Ok(Some(Token::Whitespace(Whitespace::Newline)))
}
// BigQuery uses b or B for byte string literal
Copy link
Contributor

Choose a reason for hiding this comment

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

This is something related to BigQuery, as I couldn't find this on MySQL. Maybe we could make this dialect-specific so we avoid permissive syntax on other dialects...?

@alamb

Copy link
Contributor Author

@togami2864 togami2864 Feb 16, 2023

Choose a reason for hiding this comment

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

How about using dialect_of! like this.

b @ 'B' | b @ 'b' if dialect_of!(self is BigQueryDialect | GenericDialect) => { ..

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems reasonable

@togami2864
Copy link
Contributor Author

We can only choose between 'b' or 'B' when converting AST into string result for test. So, I didn't test it. Is there any good approach??

@AugustoFKL
Copy link
Contributor

@togami2864 wym?

I'd test it by using 'verified statement' usually... Considering the select, you put as an example:

SELECT B'abc', B"abc"

The resulting query is equals to the input? If so, use the verified_stmt method to show that. This way we can assure how the output is based on the input

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.

This PR is looking good to me - thank you for the work @togami2864 and your help getting this ready for merge @AugustoFKL

It looks like CI is failing (though that may be resolved with a merge from main to get the clippy fixes). Is there anything else we are waiting on?

@togami2864
Copy link
Contributor Author

All tasks are done. There is nothing else we waiting on.

@togami2864 togami2864 requested a review from alamb February 19, 2023 03:44
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 @togami2864 and @AugustoFKL

@alamb alamb merged commit 0c0d088 into apache:main Feb 19, 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.

4 participants