Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 69 additions & 69 deletions pixi.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ readme = "README.md"
requires-python = ">=3.10,<3.15"
dependencies = [
"protobuf >=5,<7",
"substrait-protobuf==0.100.0",
"substrait-extensions==0.100.0",
"substrait-protobuf==0.101.0",
"substrait-extensions==0.101.0",
]
dynamic = ["version"]

[tool.setuptools_scm]
write_to = "src/substrait/_version.py"

[project.optional-dependencies]
extensions = ["substrait-antlr==0.100.0", "pyyaml"]
extensions = ["substrait-antlr==0.101.0", "pyyaml"]
sql = ["sqloxide", "deepdiff"]

[dependency-groups]
dev = ["pytest >= 7.0.0", "substrait-antlr==0.100.0", "pyyaml", "sqloxide", "deepdiff", "duckdb<=1.2.2; python_version < '3.14'", "datafusion"]
dev = ["pytest >= 7.0.0", "substrait-antlr==0.101.0", "pyyaml", "sqloxide", "deepdiff", "duckdb<=1.2.2; python_version < '3.14'", "datafusion"]

[tool.pytest.ini_options]
pythonpath = "src"
Expand Down
6 changes: 3 additions & 3 deletions src/substrait/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,9 @@ def resolve(registry: ExtensionRegistry):
bound = inner(registry)
rel = bound.relations[-1].root.input
rel_inner = getattr(rel, rel.WhichOneof("rel_type"))
# A few relations (a ReferenceRel from .cache(), an UpdateRel) carry no
# RelCommon and so cannot hold a hint -- fail with a clear message
# rather than an opaque AttributeError on `.common`.
# A ReferenceRel (from .cache()) carries no RelCommon and so cannot
# hold a hint -- fail with a clear message rather than an opaque
# AttributeError on `.common`.
if "common" not in rel_inner.DESCRIPTOR.fields_by_name:
raise TypeError(
f"cannot attach a hint to a {rel_inner.DESCRIPTOR.name} "
Expand Down
4 changes: 2 additions & 2 deletions src/substrait/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,8 @@ def to_id_based_outer_references(plan: stplan.Plan) -> stplan.Plan:
therefore cannot be anchored on it and is left offset-based, rather than
aliasing (and corrupting) the left-row anchor.

Raises only if a resolvable binding carries no ``RelCommon`` at all (e.g. an
``UpdateRel``), which no correlated-subquery shape produces.
Raises only if a resolvable binding carries no ``RelCommon`` at all (e.g. a
``Rel`` with no relation set), which no correlated-subquery shape produces.
"""
if not _plan_has_steps_out(plan):
return plan
Expand Down
26 changes: 20 additions & 6 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,17 +823,31 @@ def test_convert_correlation_above_lateral_join_left_as_steps_out():


def test_convert_binding_without_rel_common_raises():
# A binding relation that carries no RelCommon at all (an UpdateRel) cannot hold
# an anchor. No correlated-subquery shape produces this, but the converter
# guards it rather than silently dropping the reference.
# A binding relation that carries no RelCommon at all cannot hold an anchor. A
# ReferenceRel is unwrapped to its subtree first, so with every other relation
# carrying RelCommon only a Rel with no relation set reaches this. No
# correlated-subquery shape produces one, but the converter guards it rather
# than silently dropping the reference.
plan = _plan(_filter(stalg.Rel(), _exists(_filter(_read("i"), _outer(1)))))
with pytest.raises(Exception, match="no RelCommon"):
to_id_based_outer_references(plan)


def test_convert_anchors_update_rel_binding():
# UpdateRel carries a RelCommon (since spec v0.101.0), so a correlation into it
# is anchored like any other binding.
update = stalg.Rel(
update=stalg.UpdateRel(
named_table=stalg.NamedTable(names=["t"]),
)
)
plan = _plan(_filter(update, _exists(_filter(_read("i"), _outer(1)))))
with pytest.raises(Exception, match="no RelCommon"):
to_id_based_outer_references(plan)
out = to_id_based_outer_references(
_plan(_filter(update, _exists(_filter(_read("i"), _outer(1)))))
)
top = out.relations[-1].root.input
ref = top.filter.condition.subquery.set_predicate.tuples.filter.condition.selection.outer_reference
assert ref.WhichOneof("outer_reference_type") == "rel_reference"
assert ref.rel_reference == rel_anchor_of(top.filter.input) == 1


def test_convert_noncorrelated_plan_unchanged():
Expand Down
26 changes: 13 additions & 13 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading