Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,29 @@


class SparkConnectDataFramePropertyTests(SparkConnectSQLTestCase):
def test_cached_property_is_copied(self):
schema = StructType(
[
StructField("id", IntegerType(), True),
StructField("name", StringType(), True),
StructField("age", IntegerType(), True),
StructField("city", StringType(), True),
]
)
# Create some dummy data
data = [
(1, "Alice", 30, "New York"),
(2, "Bob", 25, "San Francisco"),
(3, "Cathy", 29, "Los Angeles"),
(4, "David", 35, "Chicago"),
]
df = self.spark.createDataFrame(data, schema)
df_columns = df.columns
assert len(df.columns) == 4
for col in ["id", "name"]:
df_columns.remove(col)
assert len(df.columns) == 4

def test_cached_schema_to(self):
cdf = self.connect.read.table(self.tbl_name)
sdf = self.spark.read.table(self.tbl_name)
Expand Down
24 changes: 0 additions & 24 deletions python/pyspark/sql/tests/connect/test_parity_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,13 @@

from pyspark.sql.tests.test_dataframe import DataFrameTestsMixin
from pyspark.testing.connectutils import ReusedConnectTestCase
from pyspark.sql.types import StructType, StructField, IntegerType, StringType


class DataFrameParityTests(DataFrameTestsMixin, ReusedConnectTestCase):
def test_help_command(self):
df = self.spark.createDataFrame(data=[{"foo": "bar"}, {"foo": "baz"}])
super().check_help_command(df)

def test_cached_property_is_copied(self):
schema = StructType(
[
StructField("id", IntegerType(), True),
StructField("name", StringType(), True),
StructField("age", IntegerType(), True),
StructField("city", StringType(), True),
]
)
# Create some dummy data
data = [
(1, "Alice", 30, "New York"),
(2, "Bob", 25, "San Francisco"),
(3, "Cathy", 29, "Los Angeles"),
(4, "David", 35, "Chicago"),
]
df = self.spark.createDataFrame(data, schema)
df_columns = df.columns
assert len(df.columns) == 4
for col in ["id", "name"]:
df_columns.remove(col)
assert len(df.columns) == 4

@unittest.skip("Spark Connect does not support RDD but the tests depend on them.")
def test_toDF_with_schema_string(self):
super().test_toDF_with_schema_string()
Expand Down