leaves12138 commented on code in PR #906:
URL: https://github.com/apache/paimon-rust/pull/906#discussion_r4062443631
##########
bindings/python/src/read.rs:
##########
@@ -376,7 +378,17 @@ impl PyReadBuilder {
mut slf: PyRefMut<'py, Self>,
predicate: &Bound<'_, PyDict>,
) -> PyResult<PyRefMut<'py, Self>> {
- let filter = dict_to_predicate(predicate, slf.table.schema().fields(),
slf.case_sensitive)?;
+ let mut fields = slf.table.schema().fields().to_vec();
+ // _ROW_ID is synthesized during read and absent from the table schema.
+ // Appending it preserves every physical column's original predicate
index.
+ if !fields.iter().any(|field| field.name() == ROW_ID_FIELD_NAME) {
Review Comment:
[P2] Preserve physical-column resolution when matching case-insensitively
The guard only checks the exact `_ROW_ID` spelling, but `dict_to_predicate`
resolves fields using `slf.case_sensitive`. A physical column named `_row_id`
is legal (only the exact system name is reserved). With this change, even a
regular table without row tracking gets an additional synthetic `_ROW_ID`, so a
previously valid case-insensitive filter now fails with `ValueError: Ambiguous
column '_row_id': multiple schema fields match case-insensitively`.
Reproduced with a table created as `CREATE TABLE paimon.review.t (_row_id
BIGINT, value STRING)` and:
```python
table.new_read_builder().with_case_sensitive(False).with_filter({
"method": "equal", "field": "_row_id", "literals": [123],
})
```
The same query with case-sensitive matching succeeds. Could we preserve
physical schema resolution and only append the synthetic field when no existing
field matches under the active case-sensitivity mode? Please also cover a
physical `_row_id` column with `with_case_sensitive(False)` in a regression
test.
--
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]