From f73eb1576ab481e3b64f39c43b4de306ec2e710b Mon Sep 17 00:00:00 2001 From: Andrew Gazelka Date: Wed, 20 Nov 2024 01:09:53 -0800 Subject: [PATCH] [FEAT] connect: `df.schema` --- 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"