Skip to content

Conversation

yoavcloud
Copy link
Contributor

This PR adds support to parse the MsSQL TRY_CONVERT function, similar to CONVERT

@yoavcloud yoavcloud changed the title Mssql try convert MsSQL TRY_CONVERT Oct 18, 2024
Keyword::CASE => self.parse_case_expr(),
Keyword::CONVERT => self.parse_convert_expr(),
Keyword::CONVERT => self.parse_convert_expr(false),
Keyword::TRY_CONVERT if dialect_of!(self is MsSqlDialect) => self.parse_convert_expr(true),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have the guard as a dialect method e.g. self.dialect.supports_try_convert()? We can probably include support for the generic dialect as well

ms().parse_sql_statements(error_sql).unwrap_err()
);

ms().verified_expr("TRY_CONVERT(VARCHAR(MAX), 'foo')");
Copy link
Contributor

Choose a reason for hiding this comment

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

with the dialect method we can move this over to common.rs as a generic test over the dialects that support the feature

@yoavcloud yoavcloud requested a review from iffyio October 19, 2024 05:46
Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

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

@yoavcloud can we also add the flag to generic dialect? Other than that LGTM!

@yoavcloud yoavcloud requested a review from iffyio October 19, 2024 06:49
Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

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

LGTM! cc @alamb

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 @yoavcloud and @iffyio

@alamb alamb merged commit 45c5d69 into apache:main Oct 20, 2024
10 checks passed
@alamb
Copy link
Contributor

alamb commented Oct 20, 2024

Thanks agian @yoavcloud and @iffyio

@coveralls
Copy link

Pull Request Test Coverage Report for Build 11429342019

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 18 of 21 (85.71%) changed or added relevant lines in 7 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.004%) to 89.387%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/dialect/generic.rs 1 2 50.0%
src/dialect/mod.rs 1 2 50.0%
src/dialect/mssql.rs 1 2 50.0%
Totals Coverage Status
Change from base Build 11428547119: -0.004%
Covered Lines: 30464
Relevant Lines: 34081

💛 - Coveralls

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