Skip to content

test(spark): characterize SparkPredicateToVortexExpression conversion - #9452

Open
jackylee-ch wants to merge 1 commit into
vortex-data:developfrom
jackylee-ch:spark-predicate-convert-tests
Open

test(spark): characterize SparkPredicateToVortexExpression conversion#9452
jackylee-ch wants to merge 1 commit into
vortex-data:developfrom
jackylee-ch:spark-predicate-convert-tests

Conversation

@jackylee-ch

Copy link
Copy Markdown
Contributor

Rationale for this change

isPushable documents an invariant: when it returns true, convert must succeed. Otherwise VortexScanBuilder.pushPredicates lets Spark drop a predicate that VortexPartitionReader silently skips, and the scan returns rows the query excluded. Only isPushable was tested; convert had no coverage.

What changes are included in this PR?

Test only. Asserts both sides of the invariant over every accepted shape: the comparison operators with the column on either side, column-to-column, null checks, IN, the string matches with %, _ and \ in the needle, bare boolean columns, the constants, nested AND/OR/NOT, and all 13 literal types. Rejections too: wrong arity, unknown predicate name, empty named reference, and a decimal that does not fit its scale.

Verified non-vacuous: five mutations — dropping BOOLEAN_EXPRESSION from convert, the null decimal literal, the commuted comparison, columnOf's zero-part guard, and default -> false — each fail a targeted test.

27 pass on :vortex-spark_2.13:test and on :vortex-spark_2.12:test; the full suites and spotlessCheck are clean apart from the S3Mock test, which needs Docker.

What APIs are changed? Are there any user-facing changes?

None.

AI assistance

Prepared with agentic AI assistance. I read the translator end to end and confirmed the mutations above fail.

`isPushable` documents an invariant: when it returns true, `convert` must
succeed, otherwise a predicate Spark is allowed to drop is silently skipped
by the reader and the scan returns rows the query excluded. The two sides
are maintained by separate code, but only `isPushable` was tested.

Assert both sides over every accepted shape: the comparison operators with
the column on either side, column-to-column, null checks, `IN`, the string
matches with LIKE meta-characters in the needle, bare boolean columns, the
constants, nested `AND`/`OR`/`NOT`, and all 13 literal types. Rejections are
covered on both sides too, including the empty named reference whose guard
lives only in `columnOf`.

Signed-off-by: jackylee <qcsd2011@gmail.com>
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.

1 participant