cloud-fan commented on code in PR #58581:
URL: https://github.com/apache/spark/pull/58581#discussion_r3992303766


##########
sql/connect/common/src/main/scala/org/apache/spark/sql/connect/SparkSession.scala:
##########
@@ -223,7 +223,9 @@ class SparkSession private[sql] (
 
   /** @inheritdoc */
   def createDataFrame(rows: java.util.List[Row], schema: StructType): 
DataFrame = {
-    createDataset(RowEncoder.encoderFor(schema), 
rows.iterator().asScala).toDF()
+    // The client cannot observe the server's CHAR/VARCHAR configuration. 
Encode an explicitly
+    // provided schema independently of the client's local configuration, as 
for result schemas.
+    createDataset(RowEncoder.encoderForResultSchema(schema), 
rows.iterator().asScala).toDF()

Review Comment:
   The empty/non-empty reconciliation is now shared for standard and default 
semantics, but the legacy-as-string configuration is still bypassed: 
encoderForResultSchema pads CHAR values client-side, and the server rebuilds 
the relation with the original CHAR/VARCHAR attributes. Please also honor and 
cover spark.sql.legacy.charVarcharAsString=true.
   
   <!-- SPARK_DEV_REVIEW_REPLY 
{"feedback_id":"inline:3960045571","thread_id":"inline:3960045571","verdict_sha256":"6589e22ffe707c3bd9369fb32374493f89e04a55522cafa345f3f56c24ee1b04"}
 -->



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