wangyum commented on code in PR #36625:
URL: https://github.com/apache/spark/pull/36625#discussion_r883307999


##########
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala:
##########
@@ -518,7 +518,15 @@ private[hive] class HiveClientImpl(
       createTime = h.getTTable.getCreateTime.toLong * 1000,
       lastAccessTime = h.getLastAccessTime.toLong * 1000,
       storage = CatalogStorageFormat(
-        locationUri = shim.getDataLocation(h).map(CatalogUtils.stringToURI),
+        locationUri = shim.getDataLocation(h).map { location =>
+          val tableUri = CatalogUtils.stringToURI(location)
+          if (!tableUri.isAbsolute) {
+            val dbUri = 
CatalogUtils.stringToURI(client.getDatabase(h.getDbName).getLocationUri)

Review Comment:
   It can't handle all cases. For example `rawTable`'s location is incorrect:
   
https://github.com/apache/spark/blob/4df8512b11dc9cc3a179fd5ccedf91af1f3fc6ee/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveExternalCatalog.scala#L1283-L1289
   
   
https://github.com/apache/spark/blob/4df8512b11dc9cc3a179fd5ccedf91af1f3fc6ee/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala#L761-L769
   
   This makes `fromHivePartition` can' correct the partition location:
   
https://github.com/apache/spark/blob/4df8512b11dc9cc3a179fd5ccedf91af1f3fc6ee/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala#L1157



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