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

Cast Impl & Char_length & Abs function #1363

Merged
merged 3 commits into from
Feb 7, 2024
Merged

Conversation

yliuuuu
Copy link
Contributor

@yliuuuu yliuuuu commented Feb 6, 2024

Relevant Issues

  • [Closes/Related To] N/A

Description

Other Information

  • Updated Unreleased Section in CHANGELOG: [YES/NO]

    • N/A
  • Any backward-incompatible changes? [YES/NO]

    • N/A
  • Any new external dependencies? [YES/NO]

    • N/A
  • Do your changes comply with the Contributing Guidelines
    and Code Style Guidelines? [YES/NO]

  • Yes.

License Information

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

github-actions bot commented Feb 6, 2024

Conformance comparison report-Cross Engine

Base (legacy) eval +/-
% Passing 92.47% 54.86% -37.61%
✅ Passing 5380 3192 -2188
❌ Failing 438 2626 2188
🔶 Ignored 0 0 0
Total Tests 5818 5818 0
Number passing in both: 3189

Number failing in both: 435

Number passing in legacy engine but fail in eval engine: 2191

Number failing in legacy engine but pass in eval engine: 3
⁉️ CONFORMANCE REPORT REGRESSION DETECTED ⁉️
The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact.
The following test(s) are failing in legacy but pass in eval. Before merging, confirm they are intended to pass:

Click here to see
  • nullif valid cases{first:"missing",second:"missing",result:missing}, compileOption: PERMISSIVE

  • nullif valid cases{first:"missing",second:"missing",result:missing}, compileOption: LEGACY

  • missing and true, compileOption: PERMISSIVE

Conformance comparison report-Cross Commit-LEGACY

Base (97f9926) 48e5c2d +/-
% Passing 92.47% 92.47% 0.00%
✅ Passing 5380 5380 0
❌ Failing 438 438 0
🔶 Ignored 0 0 0
Total Tests 5818 5818 0
Number passing in both: 5380

Number failing in both: 438

Number passing in Base (97f9926) but now fail: 0

Number failing in Base (97f9926) but now pass: 0

Conformance comparison report-Cross Commit-EVAL

Base (97f9926) 48e5c2d +/-
% Passing 25.95% 54.86% 28.91%
✅ Passing 1510 3192 1682
❌ Failing 4308 2626 -1682
🔶 Ignored 0 0 0
Total Tests 5818 5818 0
Number passing in both: 1510

Number failing in both: 2626

Number passing in Base (97f9926) but now fail: 0

Number failing in Base (97f9926) but now pass: 1682
1682 test(s) were previously failing but now pass. Before merging, confirm they are intended to pass
The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact.

@yliuuuu yliuuuu marked this pull request as ready for review February 6, 2024 00:14
@yliuuuu yliuuuu requested a review from RCHowell February 6, 2024 00:14
Copy link
Member

@RCHowell RCHowell left a comment

Choose a reason for hiding this comment

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

Approved with some general feedback

Comment on lines +52 to +72
override fun toInt8(): Int8Value {
val byte = this.value?.toByte() ?: return int8Value(null, annotations)
if (byte.toShort() != this.value) {
throw DataException("Overflow when casting ${this.value} to INT8")
}
return int8Value(byte, annotations)
}

override fun toInt16(): Int16Value = this

override fun toInt32(): Int32Value = int32Value(this.value?.toInt(), annotations)

override fun toInt64(): Int64Value = int64Value(this.value?.toLong(), annotations)

override fun toInt(): IntValue = intValue(this.value?.toLong()?.let { BigInteger.valueOf(it) }, annotations)

override fun toDecimal(): DecimalValue = decimalValue(this.value?.toBigDecimal(), annotations)

override fun toFloat32(): Float32Value = float32Value(this.value?.toFloat(), annotations)

override fun toFloat64(): Float64Value = float64Value(this.value?.toDouble(), annotations)
Copy link
Member

Choose a reason for hiding this comment

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

Random note, and I don't think we need to change anything here. Just wanted to call out that we are preserving annotations on the cast.

Comment on lines +1732 to +1733
GeneratedParser.MOD -> exprBinary(Expr.Binary.Op.MODULO, args[0], args[1])
else -> visitNonReservedFunctionCall(ctx, args)
Copy link
Member

Choose a reason for hiding this comment

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

I'm very curious to explore why we have the reserved function names at all. Other SQL ANTLR grammars simply use a qualified name. I don't think we should change it here, but let's check with John as to why he included those.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree. Maybe we can have an alias parameter in FnSignature or something to resolve the multiple naming issue. (i.e., char_length and character_length)

@@ -145,13 +147,32 @@ class EvalExecutor(
private fun infer(env: StructElement): Connector {
val map = mutableMapOf<String, StaticType>()
env.fields.forEach {
map[it.name] = StaticType.ANY
map[it.name] = inferEnv(it.value)
Copy link
Member

Choose a reason for hiding this comment

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

Nice

Comment on lines +53 to +55
val arg = arg.eval(record)
try {
return when (arg.type) {
Copy link
Member

Choose a reason for hiding this comment

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

This is ok for now, but considering the planner knows the argument input type we can actually select a branch at compile-time rather than runtime.

@codecov-commenter
Copy link

codecov-commenter commented Feb 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (partiql-eval@97f9926). Click here to learn what that means.

Additional details and impacted files
@@               Coverage Diff               @@
##             partiql-eval    #1363   +/-   ##
===============================================
  Coverage                ?   50.32%           
  Complexity              ?     1045           
===============================================
  Files                   ?      165           
  Lines                   ?    13129           
  Branches                ?     2452           
===============================================
  Hits                    ?     6607           
  Misses                  ?     5862           
  Partials                ?      660           
Flag Coverage Δ
CLI 13.77% <0.00%> (?)
EXAMPLES 80.28% <0.00%> (?)
LANG 54.71% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@RCHowell RCHowell merged commit c8f9060 into partiql-eval Feb 7, 2024
10 checks passed
@RCHowell RCHowell deleted the partiql-eval-rexOpCast branch February 7, 2024 17:46
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