zhengruifeng commented on code in PR #38979:
URL: https://github.com/apache/spark/pull/38979#discussion_r1044352394
##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala:
##########
@@ -380,7 +396,26 @@ class SparkConnectPlanner(session: SparkSession) {
}
val attributes = structType.toAttributes
val proj = UnsafeProjection.create(attributes, attributes)
- new logical.LocalRelation(attributes, rows.map(r => proj(r).copy()).toSeq)
+ val relation = logical.LocalRelation(attributes, rows.map(r =>
proj(r).copy()).toSeq)
+
+ if (rel.hasDatatype || rel.hasDatatypeStr) {
+ // rename columns and update datatypes
+ val schema = if (rel.hasDatatype) {
+ DataTypeProtoConverter
+ .toCatalystType(rel.getDatatype)
+ .asInstanceOf[StructType]
+ } else {
+ parseDatatypeString(rel.getDatatypeStr)
+ .asInstanceOf[StructType]
+ }
+ Dataset
+ .ofRows(session, logicalPlan = relation)
+ .toDF(schema.names: _*)
Review Comment:
still fails:
```
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated
with:
status = StatusCode.UNKNOWN
details = "Couldn't find 0#1215L in
[0#1219L,1#1220L,2#1221L,3#1222L]"
debug_error_string =
"{"created":"@1670584625.321243000","description":"Error received from peer
ipv6:[::1]:15002","file":"src/core/lib/surface/call.cc","file_line":1064,"grpc_message":"Couldn't
find 0#1215L in [0#1219L,1#1220L,2#1221L,3#1222L]","grpc_status":2}"
```
--
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]