adamreeve commented on code in PR #55665:
URL: https://github.com/apache/arrow/pull/55665#discussion_r4660622073
##########
python/pyarrow/dataset.py:
##########
@@ -500,16 +501,9 @@ def _union_dataset(children, schema=None, **kwargs):
# unify the children datasets' schemas
schema = pa.unify_schemas([child.schema for child in children])
- for child in children:
- if getattr(child, "_scan_options", None):
- raise ValueError(
- "Creating an UnionDataset from filtered or projected Datasets "
- "is currently not supported. Union the unfiltered datasets "
- "and apply the filter to the resulting union."
- )
-
- # create datasets with the requested schema
- children = [child.replace_schema(schema) for child in children]
+ # create datasets with the requested schema, keeping each child's own
filter
+ children = [child._with_filter_attached().replace_schema(schema)
Review Comment:
Fixed in 578b406716b7e0980d3322adcdca3bf17cc97d93 by attaching the filter in
the `UnionDataset` constructor. This ended up with some duplication when fixing
the handling of index based field references raised above, because the filter
needed to be attached before modifying the schema. I think this is fine though,
it's pretty minor, and I didn't want to introduce a behaviour change by moving
the schema unification into the `UnionDataset` constructor.
--
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]