alamb opened a new pull request, #23620:
URL: https://github.com/apache/datafusion/pull/23620

   ## Which issue does this PR close?
   
   N/A (found while reviewing test coverage for #23540)
   
   ## Rationale for this change
   
   While checking `cargo llvm-cov` coverage of `regexp_instr`, I found that the 
two `statement error` tests for `start < 1` in `regexp_instr.slt` never 
actually exercise the start validation. The expected error message is placed on 
the line *after* `statement error`, so the sqllogictest runner parses that text 
as part of the SQL. The resulting two-line statement fails to parse, and the 
bare `statement error` accepts the parse error — the tests pass for the wrong 
reason. (The expected text also says `1 based` while the actual error message 
says `1-based`, which would have failed if the match had ever been evaluated.)
   
   Coverage also showed two paths of `regexp_instr` untested anywhere:
   
   - the `N must be 1 or greater` error for `nth < 1`
   - looking up an already-compiled regex from the per-batch cache when the 
pattern column returns to a previously seen pattern (e.g. `['abc', 'def', 
'abc']`). This path becomes more important with the memoization added in #23540.
   
   ## What changes are included in this PR?
   
   - Fix the two malformed `statement error` tests so the expected error is 
matched inline against the real message
   - Add a `statement error` test for `nth < 1`
   - Add a test with a pattern column that alternates between two regexes 
within a single batch
   
   ## Are these changes tested?
   
   Yes, this PR is only tests. Verified locally with `cargo test --test 
sqllogictests -- regexp_instr`, and confirmed with `cargo llvm-cov` that the 
`start < 1`, `nth < 1`, and cache-lookup paths in `regexpinstr.rs` are now 
executed.
   
   ## Are there any user-facing changes?
   
   No
   


-- 
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]

Reply via email to