Github user dongjoon-hyun commented on the issue:
https://github.com/apache/spark/pull/14132
In database, the purpose of view is **hiding the underneath tables**. We
should not support to specify the table inside the view. However, you can
specify the hint on the view itself. Let me give you example. I assumed that
you asked the following scenario.
```scala
scala> sql("create temporary view view_u as select * from u")
```
We know that `u` is inside the view. But any table names inside the view
should be ignored because they are not is unrecognized table name in this
context.
```scala
scala> sql("SELECT /*+ MAPJOIN(u) */ * FROM t JOIN view_u ON t.id =
view_u.id").explain(true)
== Physical Plan ==
*SortMergeJoin [id#0L], [id#4L], Inner
:- *Sort [id#0L ASC], false, 0
: +- Exchange hashpartitioning(id#0L, 200)
: +- *Range (0, 1000000000, splits=8)
+- *Sort [id#4L ASC], false, 0
+- ReusedExchange [id#4L], Exchange hashpartitioning(id#0L, 200)
```
However, if you give the hint on view **view_u**, it can be propagated.
```scala
scala> sql("SELECT /*+ MAPJOIN(view_u) */ * FROM t JOIN view_u ON t.id =
view_u.id").explain
== Physical Plan ==
*BroadcastHashJoin [id#0L], [id#4L], Inner, BuildRight
:- *Range (0, 1000000000, splits=8)
+- BroadcastExchange HashedRelationBroadcastMode(List(input[0, bigint,
false]))
+- *Range (0, 1000000000, splits=8)
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]