datafusion-contrib / datafusion-contrib/StreamFusion
Native trim functions: support column-dependent trim sets
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 120
- Forks
- 8
- Avg merge
- 7h 29m
- Merged PRs (30d)
- 76
Description
Rechecked on 2026-09-20 against canonical main 89da01cdad7342c4d825e36eaf4e8dc73bc7af9f, released Apache Flink 2.2.1, JDK 17, default compatibility settings. Each expression was run against independent stock-Flink and StreamFusion-enabled streaming environments with bounded runtime DataStream input (parallelism 1), so source values cannot be folded away. Results and resolved result types agree through Flink fallback; this is a native support gap, not a demonstrated wrong-result bug.
BTRIM/LTRIM/RTRIM have native coverage only when the trim-set argument satisfies the literal gate. Adapted StringFunctionsITCase / ScalarFunctionsTest SQL confirms safe fallback for column-dependent sets.
Runtime s STRING='aabaXYZbaa', chars STRING='ab':
SELECT BTRIM(s, chars) FROM src; -- 'XYZ'
The verified minimal case returns STRING through Calc: BTRIM requires a literal trim set, with zero native substitutions. LTRIM/RTRIM upstream SQL also records the corresponding literal-set gates, including runtime NULL trim sets. Additional minimal probes on the same row return LTRIM(s,chars) = 'XYZbaa' and RTRIM(s,chars) = 'aabaXYZ', both through their respective literal-set gates.
Preserve Flink's set-of-characters semantics and actual argument order for each function. Test dynamic sets varying per row, NULL/empty sets and values, all-trimmed results, supplementary characters, slices and multiple batches. Existing literal-set native paths should remain controls.
Suggested priority: P2, common runtime STRING transformation.
Acceptance: add runtime-source SQL parity tests that assert native Calc execution as well as values and resolved types; include NULLs and boundary/error cases; retain safe fallback for unverified forms and update docs/operators/calc-filter.md with the admitted scope.
Latest-main validation: rebuilt the debug native library from this commit and ran 562 targeted runtime SQL cases covering these support gaps and adjacent controls. This issue group contains 8 successful comparisons that still record explicit fallback. Host-rejected/both-error cases are excluded from that count. This validates released Flink 2.2.1; it does not claim execution of the Flink 1.18 profile. No implementation is included.
Related: PR #44 documented narrower admitted overloads and the remaining fallback; this ticket tracks the unimplemented forms.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the adapted StringFunctionsITCase and ScalarFunctionsTest coverage described in the issue, then review the existing literal-set native paths and PR #44. Exercise dynamic trim sets, NULL and boundary cases against the runtime SQL probes. Done means native Calc execution matches Flink values and resolved types for verified forms, safe fallback remains for unverified forms, and docs/operators/calc-filter.md records the admitted scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, sql
- Domain
- data-engineering, documentation, stream-processing, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100