zhengruifeng commented on code in PR #40402:
URL: https://github.com/apache/spark/pull/40402#discussion_r1134776117


##########
connector/connect/common/src/main/protobuf/spark/connect/base.proto:
##########
@@ -272,6 +272,9 @@ message ExecutePlanResponse {
   // The metrics observed during the execution of the query plan.
   repeated ObservedMetrics observed_metrics = 6;
 
+  // The Spark schema
+  DataType schema = 7;

Review Comment:
   Is it a optional field only available in `df.collect`?



##########
python/pyspark/sql/connect/dataframe.py:
##########
@@ -1344,9 +1344,9 @@ def collect(self) -> List[Row]:
         if self._session is None:
             raise Exception("Cannot collect on empty session.")
         query = self._plan.to_proto(self._session.client)
-        table = self._session.client.to_table(query)
+        table, schema = self._session.client.to_table(query)
 
-        schema = from_arrow_schema(table.schema)
+        schema = schema or from_arrow_schema(table.schema)

Review Comment:
   when I was implementing the collection I was thinking about this dumb 
question: is it possible to make arrow schema 100% compatible with spark schema 
if we store the different fields in arrow metadata?
   e.g. for a spark `MapType`, store the `valueContainsNull` as a metadata in 
the `pa.schema`.



-- 
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]


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

Reply via email to