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 BIGNUMERIC of bigquery #811

Merged
merged 7 commits into from
Mar 2, 2023

Conversation

@coveralls
Copy link

coveralls commented Feb 22, 2023

Pull Request Test Coverage Report for Build 4311890584

  • 46 of 49 (93.88%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.02%) to 86.195%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/ast/data_type.rs 1 2 50.0%
src/parser.rs 2 4 50.0%
Files with Coverage Reduction New Missed Lines %
src/ast/data_type.rs 1 89.21%
Totals Coverage Status
Change from base Build 4307197107: 0.02%
Covered Lines: 13530
Relevant Lines: 15697

💛 - Coveralls

@@ -3658,6 +3658,69 @@ fn parse_json_keyword() {
);
}

#[test]
fn parse_bignumeric_keyword() {
Copy link
Contributor

Choose a reason for hiding this comment

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

@togami2864, can you please add tests for the resulting string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, what do you mean by 'resulting string'?

Copy link
Contributor

Choose a reason for hiding this comment

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

After parsing a statement with this clause, what's the re-serialization of the query? (usually we use the verified_stmt or one_parses_to functions)

Comment on lines 82 to 91

/// BigNumeric type used in BigQuery
///
/// [bigquery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#bignumeric_literals
BigNumeric,

/// This is alias for BigNumeric type used in BigQuery
///
/// [bigquery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#bignumeric_literals
BigDecimal,
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Why the spaces between the data types? Seems unnecessary
  • The link you put is related to nothing.
    What about:
Suggested change
/// BigNumeric type used in BigQuery
///
/// [bigquery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#bignumeric_literals
BigNumeric,
/// This is alias for BigNumeric type used in BigQuery
///
/// [bigquery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#bignumeric_literals
BigDecimal,
/// [BigNumeric] type used in BigQuery
///
/// [BigNumeric]: https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#bignumeric_literals
BigNumeric,
/// This is alias for [BigNumeric] type used in BigQuery
///
/// [BigNumeric]: https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#bignumeric_literals
BigDecimal,

Comment on lines 209 to 210
DataType::BigNumeric => write!(f, "BIGNUMERIC"),
DataType::BigDecimal => write!(f, "BIGDECIMAL"),
Copy link
Contributor

Choose a reason for hiding this comment

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

You're not adding the precision/scale for those types. Any reason why?

Are you only focused on literals?

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 just considered for literals at first, but found that BigNumeric & Numeric with precision/scale are used in bq scripting. https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#parameterized_data_types

I'll implement because this is needed in the future.

///
/// [BigNumeric]: https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#bignumeric_literals
BigNumeric(ExactNumberInfo),
/// This is alias for [BigNumeric] type used in BigQuery
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// This is alias for [BigNumeric] type used in BigQuery
/// This is alias for [BigDecimal] type used in BigQuery

BigNumeric(ExactNumberInfo),
/// This is alias for [BigNumeric] type used in BigQuery
///
/// [BigNumeric]: https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#bignumeric_literals
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// [BigNumeric]: https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#bignumeric_literals
/// [BigDecimal]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#decimal_types

@togami2864 togami2864 force-pushed the feat/bq-numeric-keyword branch from 2e6bbdc to ffd79da Compare March 2, 2023 08:09
@togami2864 togami2864 force-pushed the feat/bq-numeric-keyword branch from ffd79da to 698cb41 Compare March 2, 2023 08:13
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 -- thank you @AugustoFKL and @togami2864

@alamb alamb merged commit fbbf1a4 into apache:main Mar 2, 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.

None yet

4 participants