File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1828,7 +1828,10 @@ def __dir__(self) -> List[str]:
18281828 def collect (self ) -> List [Row ]:
18291829 table , schema = self ._to_table ()
18301830
1831- schema = schema or from_arrow_schema (table .schema , prefer_timestamp_ntz = True )
1831+ # not all datatypes are supported in arrow based collect
1832+ # here always verify the schema by from_arrow_schema
1833+ schema2 = from_arrow_schema (table .schema , prefer_timestamp_ntz = True )
1834+ schema = schema or schema2
18321835
18331836 assert schema is not None and isinstance (schema , StructType )
18341837
Original file line number Diff line number Diff line change @@ -225,6 +225,11 @@ def test_select_none(self):
225225 message_parameters = {"arg_name" : "columns" },
226226 )
227227
228+ def test_ym_interval_in_collect (self ):
229+ # YearMonthIntervalType is not supported in python side arrow conversion
230+ with self .assertRaises (PySparkTypeError ):
231+ self .connect .sql ("SELECT INTERVAL '10-8' YEAR TO MONTH AS interval" ).first ()
232+
228233
229234if __name__ == "__main__" :
230235 from pyspark .sql .tests .connect .test_connect_error import * # noqa: F401
You can’t perform that action at this time.
0 commit comments