[ 
https://issues.apache.org/jira/browse/SPARK-27078?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dongjoon Hyun updated SPARK-27078:
----------------------------------
    Fix Version/s:     (was: 2.4.2)
                   2.4.1

> Read Hive materialized view throw MatchError
> --------------------------------------------
>
>                 Key: SPARK-27078
>                 URL: https://issues.apache.org/jira/browse/SPARK-27078
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: Yuming Wang
>            Assignee: Yuming Wang
>            Priority: Major
>             Fix For: 2.4.1, 3.0.0
>
>
> How to reproduce:
> Hive side:
> {code:sql}
> CREATE TABLE materialized_view_tbl (key INT);
> CREATE MATERIALIZED VIEW view_1 AS SELECT * FROM materialized_view_tbl;  -- 
> Hive 3.x
> CREATE MATERIALIZED VIEW view_1 DISABLE REWRITE AS SELECT * FROM 
> materialized_view_tbl;  -- Hive 2.3.x
> {code}
> Spark side(read from Hive 2.3.x):
> {code:java}
> bin/spark-sql --conf spark.sql.hive.metastore.version=2.3.4 --conf 
> spark.sql.hive.metastore.jars=maven
> spark-sql> select * from view_1;
> 19/03/06 16:33:44 ERROR SparkSQLDriver: Failed in [select * from view_1]
> scala.MatchError: MATERIALIZED_VIEW (of class 
> org.apache.hadoop.hive.metastore.TableType)
>       at 
> org.apache.spark.sql.hive.client.HiveClientImpl.$anonfun$getTableOption$3(HiveClientImpl.scala:434)
>       at scala.Option.map(Option.scala:163)
>       at 
> org.apache.spark.sql.hive.client.HiveClientImpl.$anonfun$getTableOption$1(HiveClientImpl.scala:370)
>       at 
> org.apache.spark.sql.hive.client.HiveClientImpl.$anonfun$withHiveState$1(HiveClientImpl.scala:277)
> {code}
> Spark side(read from Hive 3.1.x):
> {code:java}
> bin/spark-sql --conf spark.sql.hive.metastore.version=3.1.1 --conf 
> spark.sql.hive.metastore.jars=maven
> spark-sql> select * from view_1;
> 19/03/05 19:55:37 ERROR SparkSQLDriver: Failed in [select * from view_1]
> java.lang.NoSuchFieldError: INDEX_TABLE
>       at 
> org.apache.spark.sql.hive.client.HiveClientImpl.$anonfun$getTableOption$3(HiveClientImpl.scala:438)
>       at scala.Option.map(Option.scala:163)
>       at 
> org.apache.spark.sql.hive.client.HiveClientImpl.$anonfun$getTableOption$1(HiveClientImpl.scala:370)
>       at 
> org.apache.spark.sql.hive.client.HiveClientImpl.$anonfun$withHiveState$1(HiveClientImpl.scala:277)
>       at 
> org.apache.spark.sql.hive.client.HiveClientImpl.liftedTree1$1(HiveClientImpl.scala:215)
>       at 
> org.apache.spark.sql.hive.client.HiveClientImpl.retryLocked(HiveClientImpl.scala:214)
>       at 
> org.apache.spark.sql.hive.client.HiveClientImpl.withHiveState(HiveClientImpl.scala:260)
>       at 
> org.apache.spark.sql.hive.client.HiveClientImpl.getTableOption(HiveClientImpl.scala:368)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to