From 58ce786f62baca1443291c05568270e5323fed0a 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..0e42e1b32c --- /dev/null +++ b/tests/connect/test_schema.py @@ -0,0 +1,15 @@ +from __future__ import annotations + +from pyspark.sql.types import StructType, StructField, LongType + + +def test_schema(spark_session): + # Create DataFrame from range(10) + df = spark_session.range(10) + + # Define the expected schema + # in reality shoudl 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"