akshat-lakhera opened a new pull request, #20722:
URL: https://github.com/apache/druid/pull/20722
Part of #20525.
### Description
This takes the "SQL expression test helpers" group from the deprecation
table in #20525. ExpressionTestHelper.testExpressionString was deprecated in
favour of testExpression, because it only compared the expression string and
not the whole DruidExpression. I moved all 138 callers over to testExpression
and then removed testExpressionString along with the string-only compare branch
it used.
Since the comparison is now deep, the expected values had to match what the
conversions really produce. Most of the old expected values were a bare STRING
expression with no arguments, so in ExpressionsTest they are now written out as
typed function calls with their column and literal arguments.
buildExpectedExpression, used by the Greatest, Least and IPv4 tests, now takes
the return type and builds typed arguments from the row signature, and
TimeFormatOperatorConversionTest builds its expected timestamp_format call the
same way. For the substring cases the old expectation had a
SubstringDimExtractionFn, but the conversion doesn't produce an extraction
there, so the expected value now matches the real output.
Almost all of the diff is ExpressionsTest, and it's mechanical, the same
pattern for each call. No production code is changed.
The rest of this group, the deprecated makeExpression and
makeColumnExpression helpers in CalciteTestBase, I'm planning as a separate PR
so this one stays reviewable.
#### Testing
ExpressionsTest, GreatestExpressionTest, LeastExpressionTest, the three
IPv4Address expression tests and TimeFormatOperatorConversionTest all pass, 128
tests with no failures. Checkstyle on the sql module is clean.
<hr>
##### Key changed/added classes in this PR
* ExpressionTestHelper
* ExpressionsTest
* GreatestExpressionTest, LeastExpressionTest
* IPv4AddressMatchExpressionTest, IPv4AddressParseExpressionTest,
IPv4AddressStringifyExpressionTest
* TimeFormatOperatorConversionTest
<hr>
This PR has:
- [x] been self-reviewed.
- [x] added unit tests or modified existing tests to cover new code paths,
ensuring the threshold for [code
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
is met.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]