From 73f94bc6ffd2cd615b6e491d89ce62efa2f667e4 Mon Sep 17 00:00:00 2001 From: Andrew Gazelka Date: Tue, 26 Nov 2024 15:07:51 -0800 Subject: [PATCH] [CHORE] connect: `df.schema` (#3353) --- tests/connect/test_schema.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/connect/test_schema.py diff --git a/tests/connect/test_schema.py b/tests/connect/test_schema.py new file mode 100644 index 0000000000..1f4e1182fa --- /dev/null +++ b/tests/connect/test_schema.py @@ -0,0 +1,15 @@ +from __future__ import annotations + +from pyspark.sql.types import LongType, StructField, StructType + + +def test_schema(spark_session): + # Create DataFrame from range(10) + df = spark_session.range(10) + + # Define the expected schema + # in reality should be nullable=False, but daft has all our structs as nullable=True + expected_schema = StructType([StructField("id", LongType(), nullable=True)]) + + # Verify the schema is as expected + assert df.schema == expected_schema, "Schema should match the expected schema"