Skip to content

Commit 81ac01c

Browse files
timsaucerclaude
andcommitted
test: cover new DF54 expr wrappers, catalog factories, and DataFrame.alias
Add module-metadata checks for HigherOrderFunction, Lambda, LambdaVariable and the top-level TableProviderFactory / TableProviderFactoryExportable re-exports, plus a self-join regression test exercising the new DataFrame.alias() qualifier-based selection path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 59ead26 commit 81ac01c

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

python/tests/test_dataframe.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,20 @@ def test_select_exprs(df):
292292
assert result.column(1) == pa.array([3, 3, 3])
293293

294294

295+
def test_alias_self_join(df):
296+
left = df.alias("l")
297+
right = df.alias("r")
298+
joined = left.join(right, left_on="a", right_on="a").select(
299+
"a",
300+
column("l.b").alias("lb"),
301+
column("r.b").alias("rb"),
302+
)
303+
result = joined.sort(column("a")).collect()[0]
304+
assert result.column(0) == pa.array([1, 2, 3])
305+
assert result.column(1) == pa.array([4, 5, 6])
306+
assert result.column(2) == pa.array([4, 5, 6])
307+
308+
295309
def test_drop_quoted_columns():
296310
ctx = SessionContext()
297311
batch = pa.RecordBatch.from_arrays([pa.array([1, 2, 3])], names=["ID_For_Students"])

python/tests/test_imports.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
DataFrame,
2323
ScalarUDF,
2424
SessionContext,
25+
TableProviderFactory,
26+
TableProviderFactoryExportable,
2527
functions,
2628
)
2729
from datafusion.common import (
@@ -47,6 +49,7 @@
4749
Extension,
4850
Filter,
4951
GroupingSet,
52+
HigherOrderFunction,
5053
ILike,
5154
InList,
5255
InSubquery,
@@ -60,6 +63,8 @@
6063
Join,
6164
JoinConstraint,
6265
JoinType,
66+
Lambda,
67+
LambdaVariable,
6368
Like,
6469
Limit,
6570
Literal,
@@ -160,9 +165,16 @@ def test_class_module_is_datafusion():
160165
DropTable,
161166
Repartition,
162167
Partitioning,
168+
HigherOrderFunction,
169+
Lambda,
170+
LambdaVariable,
163171
]:
164172
assert klass.__module__ == "datafusion.expr"
165173

174+
# catalog factory types (re-exported at top level)
175+
for klass in [TableProviderFactory, TableProviderFactoryExportable]:
176+
assert klass.__module__ == "datafusion.catalog"
177+
166178
# schema
167179
for klass in [DFSchema]:
168180
assert klass.__module__ == "datafusion.common"

0 commit comments

Comments
 (0)