Skip to content

Commit

Permalink
add nested data test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgazelka committed Dec 19, 2024
1 parent f8f76e5 commit 1cab7ea
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/connect/test_print_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,14 @@ def test_print_schema_with_nulls(spark_session, capsys) -> None:
captured = capsys.readouterr()
expected = "root\n" " |-- id: long (nullable = true)\n" " |-- value: string (nullable = true)\n\n"
assert captured.out == expected


def test_print_schema_nested(spark_session) -> None:
nested_data = [(1, {"name": "John", "age": 30}), (2, {"name": "Jane", "age": 25})]

# Create DataFrame with nested structures
df = spark_session.createDataFrame(nested_data, ["id", "info"])

# Print schema
print("DataFrame Schema:")
df.printSchema()

0 comments on commit 1cab7ea

Please sign in to comment.