Skip to content
Closed
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
6 changes: 4 additions & 2 deletions python/pyspark/sql/tests/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,14 +506,16 @@ def test_toDF_with_schema_string(self):

# number of fields must match.
self.assertRaisesRegex(
Exception, "FIELD_STRUCT_LENGTH_MISMATCH", lambda: rdd.toDF("key: int").collect()
Exception,
"FIELD_STRUCT_LENGTH_MISMATCH",
lambda: rdd.coalesce(1).toDF("key: int").collect(),
)

# field types mismatch will cause exception at runtime.
self.assertRaisesRegex(
Exception,
"FIELD_DATA_TYPE_UNACCEPTABLE",
lambda: rdd.toDF("key: float, value: string").collect(),
lambda: rdd.coalesce(1).toDF("key: float, value: string").collect(),
)

# flat schema values will be wrapped into row.
Expand Down