panbingkun commented on code in PR #48630:
URL: https://github.com/apache/spark/pull/48630#discussion_r1814154168


##########
sql/connect/server/src/test/scala/org/apache/spark/sql/connect/ProtoToParsedPlanTestSuite.scala:
##########
@@ -259,4 +261,35 @@ class ProtoToParsedPlanTestSuite
       writer.close()
     }
   }
+
+  protected def normalizeRelation(rel: proto.Relation): proto.Relation = {
+    rel.getRelTypeCase match {
+      case proto.Relation.RelTypeCase.READ =>
+        
proto.Relation.newBuilder(rel).setRead(normalizeDataSource(rel.getRead)).build()
+      case _ => rel
+    }
+  }
+
+  private def normalizeDataSource(read: proto.Read): proto.Read = {
+    read.getReadTypeCase match {
+      case proto.Read.ReadTypeCase.DATA_SOURCE if !read.getIsStreaming =>
+        if (read.getDataSource.getFormat != "jdbc" && 
read.getDataSource.getPredicatesCount == 0) {
+          if (read.getDataSource.getPathsCount != 0) {
+            val dataSourceBuilder = 
proto.Read.DataSource.newBuilder(read.getDataSource)
+            read.getDataSource.getPathsList.asScala.toSeq.map(path => 
normalizePath(path)).
+              zipWithIndex.foreach { case (newPath, index) =>
+                dataSourceBuilder.setPaths(index, newPath)
+            }
+            return 
proto.Read.newBuilder(read).setDataSource(dataSourceBuilder.build()).build()
+          }
+        }
+      case _ =>
+    }
+    read
+  }
+
+  private def normalizePath(path: String): String = {

Review Comment:
   Change the path similar to 
`../common/src/test/resources/query-tests/test-data/people.csv` to 
`"{SPARK_HOME}/sql/connect/common/src/test/resources/query-tests/test-data/people.csv"`



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