Dongjoon Hyun created SPARK-54068:
-------------------------------------

             Summary: Fix 
`pyspark.pandas.tests.connect.io.test_parity_feather.FeatherParityTests.test_to_feather`
 in Python 3.14
                 Key: SPARK-54068
                 URL: https://issues.apache.org/jira/browse/SPARK-54068
             Project: Spark
          Issue Type: Sub-task
          Components: Connect, PySpark
    Affects Versions: 4.1.0
            Reporter: Dongjoon Hyun


{code}
======================================================================
ERROR [1.960s]: test_to_feather 
(pyspark.pandas.tests.connect.io.test_parity_feather.FeatherParityTests.test_to_feather)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/__w/spark/spark/python/pyspark/pandas/tests/io/test_feather.py", line 
43, in test_to_feather
    self.psdf.to_feather(path2)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^
  File "/__w/spark/spark/python/pyspark/pandas/frame.py", line 2702, in 
to_feather
    return validate_arguments_and_invoke_function(
        self._to_internal_pandas(), self.to_feather, pd.DataFrame.to_feather, 
args
    )
  File "/__w/spark/spark/python/pyspark/pandas/utils.py", line 592, in 
validate_arguments_and_invoke_function
    return pandas_func(**args)
  File "/usr/local/lib/python3.14/dist-packages/pandas/core/frame.py", line 
2949, in to_feather
    to_feather(self, path, **kwargs)
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.14/dist-packages/pandas/io/feather_format.py", 
line 65, in to_feather
    feather.write_feather(df, handles.handle, **kwargs)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.14/dist-packages/pyarrow/feather.py", line 156, 
in write_feather
    table = Table.from_pandas(df, preserve_index=preserve_index)
  File "pyarrow/table.pxi", line 4795, in pyarrow.lib.Table.from_pandas
  File "/usr/local/lib/python3.14/dist-packages/pyarrow/pandas_compat.py", line 
663, in dataframe_to_arrays
    pandas_metadata = construct_metadata(
        columns_to_convert, df, column_names, index_columns, index_descriptors,
        preserve_index, types, column_field_names=column_field_names
    )
  File "/usr/local/lib/python3.14/dist-packages/pyarrow/pandas_compat.py", line 
281, in construct_metadata
    b'pandas': json.dumps({
               ~~~~~~~~~~^^
        'index_columns': index_descriptors,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
        'pandas_version': _pandas_api.version
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    }).encode('utf8')
    ^^
  File "/usr/lib/python3.14/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^
  File "/usr/lib/python3.14/json/encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.14/json/encoder.py", line 261, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.14/json/encoder.py", line 180, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
                    f'is not JSON serializable')
TypeError: Object of type PlanMetrics is not JSON serializable
when serializing list item 0
when serializing dict item 'metrics'
when serializing dict item 'attributes'
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to