Skip to content

Commit

Permalink
[FEAT] connect: Add support for select
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgazelka committed Nov 21, 2024
1 parent cbe9d3b commit 70c7000
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/connect/test_select.py
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"

0 comments on commit 70c7000

Please sign in to comment.