-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT] connect: Add support for
select
- Loading branch information
1 parent
3402dc6
commit 731259a
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from __future__ import annotations | ||
|
||
from pyspark.sql.functions import col | ||
|
||
|
||
def test_select(spark_session): | ||
# Create DataFrame from range(10) | ||
df = spark_session.range(10) | ||
|
||
# Select just the 'id' column | ||
df_selected = df.select(col("id")) | ||
|
||
# Verify the schema is unchanged since we selected same column | ||
assert df_selected.schema == df.schema, "Schema should be unchanged after selecting same column" | ||
assert df_selected.count() == df.count(), "Row count should be unchanged after select" | ||
|
||
# Verify the data is unchanged | ||
df_pandas = df.toPandas() | ||
df_selected_pandas = df_selected.toPandas() | ||
assert df_pandas["id"].equals(df_selected_pandas["id"]), "Data should be unchanged after select" |