cloud-fan commented on code in PR #55487:
URL: https://github.com/apache/spark/pull/55487#discussion_r3196787881
##########
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveExternalCatalog.scala:
##########
@@ -834,8 +841,17 @@ private[spark] class HiveExternalCatalog(conf: SparkConf,
hadoopConf: Configurat
var table = inputTable
+ // HMS round-trips both regular views and metric views as
`HiveTableType.VIRTUAL_VIEW`,
+ // which `HiveClientImpl.getTableOption` always maps back to
`CatalogTableType.VIEW`. Lift
+ // it back to `CatalogTableType.METRIC_VIEW` when the persisted sub-type
marker is present.
+ if (table.tableType == VIEW &&
+ table.properties.get(CatalogTable.VIEW_SUB_TYPE)
+ .contains(CatalogTable.VIEW_SUB_TYPE_METRIC_VIEW)) {
+ table = table.copy(tableType = METRIC_VIEW)
+ }
+
table.properties.get(DATASOURCE_PROVIDER) match {
- case None if table.tableType == VIEW =>
+ case None if table.tableType == VIEW || table.tableType == METRIC_VIEW =>
Review Comment:
Same audit miss as the comment on line 605 (and as R6's `views.scala:175`
fix) -- late catch from me. The lift block immediately above (line 847's `if
(table.tableType == VIEW && ... .contains(METRIC_VIEW))`) is correctly
type-strict on `VIEW` because that's what's being lifted-from; but this
case-guard's intent is "treat both VIEW and METRIC_VIEW the same way", which is
exactly what `isViewLike` expresses.
```suggestion
case None if table.isViewLike =>
```
--
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]