HyukjinKwon commented on code in PR #47253:
URL: https://github.com/apache/arrow/pull/47253#discussion_r2667845476
##########
python/pyarrow/parquet/core.py:
##########
@@ -90,6 +90,69 @@ def _check_filters(filters, check_null_strings=True):
return filters
+def _map_spark_to_arrow_types(datatype: pa.DataType) -> str | None:
+ lookup = {
+ "NA": "null",
+ "BOOL": "boolean",
+ "INT8": "byte",
+ "INT16": "short",
+ **dict.fromkeys(
+ ["UINT8", "UINT16", "UINT32", "UINT64", "INT32"], "integer"),
+ "INT64": "long",
+ **dict.fromkeys(["HALF_FLOAT", "FLOAT"], "float"),
+ "DOUBLE": "double",
+ "BINARY": "binary",
+ "STRING": "string",
+ **dict.fromkeys(
+ ["DECIMAL" + str(2 ** i) for i in range(5, 9)], "decimal"),
+ **dict.fromkeys(
+ ["LIST", "LARGE_LIST", "LIST_VIEW", "LARGE_LIST_VIEW",
"FIXED_SIZE_LIST"],
+ "array",
+ ),
+ "MAP": "map",
+ **dict.fromkeys(["DATE32", "DATE64"], "date"),
+ "TIMESTAMP": "timestamp",
+ "INTERVAL_MONTH_DAY_NANO": "Calendar Interval", # TODO: Correct this
Review Comment:
TBH, I think it's too much to handle Spark specific cases like this in
PyArrow. Spark is even adding more types such as variant type, and more
interval types.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]