Matthew-DWM opened a new pull request, #9626:
URL: https://github.com/apache/texera/pull/9626

   ### What changes were proposed in this PR?
   
   `largebinary` only checked the `s3://` prefix, so `s3://`, `s3:///object`, 
`s3://bucket` and `s3://bucket/` were accepted and failed later, when a stream 
called S3 with an empty bucket or object key. The constructor now parses the 
URI with `urlparse`, as `get_bucket_name()` and `get_object_key()` already do, 
and raises `ValueError` naming the URI when either part is empty. Mirroring the 
getters also rejects `s3://bucket//` and `s3://bucket/?versionId=1`, which a 
simple regex would accept.
   
   ```
   Before:  largebinary("s3://bucket") -> accepted, key ""  -> fails later 
inside S3
   After:   largebinary("s3://bucket") -> ValueError: largebinary URI must 
include a bucket and object key, got: s3://bucket
   ```
   
   Behavior changes:
   - `largebinary()` with a misconfigured base URI (e.g. `s3://`) now fails on 
creation instead of on upload.
   - The JVM `LargeBinary` still checks only the prefix. A keyless URI built 
there now fails in the next Python operator, even one that only passes the 
tuple on, instead of later in S3. JVM parity is a follow-up.
   
   ### Any related issues, documentation, discussions?
   
   Closes #8279. Builds on #8280 by @carloea2, which proposed the same 
`urlparse` check; this adds the URI to the message, updates the docstring and 
widens the tests.
   
   Follow-up for the JVM side: #9625 
   
   ### How was this PR tested?
   
   New parametrized tests in `test_large_binary.py` cover six incomplete URIs 
(including both regex traps above), accepted URIs with edge-case keys (trailing 
slash, unicode), and `largebinary()` with a misconfigured base URI. The new 
tests were written before the fix and all pass with it; 8 of them fail on main 
with `DID NOT RAISE`.
   
   From `amber`, with Python 3.12, after running `bash bin/python-proto-gen.sh` 
from the repo root:
   
   ```text
   python -m pytest src/test/python/core/models/type/test_large_binary.py -q
   19 passed
   
   python -m pytest src/test/python -m "not integration" -q
   1525 passed, 3 failed, 59 deselected, 1 xfailed
   
   ruff check src/main/python src/test/python
   ruff format --check src/main/python src/test/python
   ```
   
   The 3 failures are `test_python_ui_parameter_value_contract[timestamp-*]`, 
which fail the same way on unmodified main here because the machine is not on 
UTC. Ruff lint and formatting pass, and the URI check behaves identically on 
Python 3.13.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 5.5)
   


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

  • [PR] feat(pyamber): req... Matthew-DWM (via GitHub) via notifications

Reply via email to