2016-08-03 14 views
6

背景を通じてハイブトランザクション対応表から得られるフェッチすることができません: - 私はspark1.6.0でHDPを使用しています火花-SQL

  • と続く1.2.1

手順をハイブ: -

は、ハイブのテーブルを作成します -

hive> 
CREATE TABLE orctest(PROD_ID bigint, CUST_ID bigint, TIME_ID timestamp, CHANNEL_ID bigint, PROMO_ID bigint, QUANTITY_SOLD decimal(10,0), AMOUNT_SOLD decimal(10,0)) CLUSTERED BY (PROD_ID) INTO 32 BUCKETS STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY", "transactional"="true"); 

挿入レコードがorctest

hive> 
insert into orctest values(1, 1, '2016-08-02 21:36:54.000000000', 1, 1, 10, 10000); 

に火花シェルからorctestテーブルにアクセスしてみ

scala> 
val hiveContext = new org.apache.spark.sql.hive.HiveContext(sc) 

val s = hiveContext.table("orctest")* 

スローされる例外: -

16/08/02 22:06:54 INFO OrcRelation: Listing hdfs://hadoop03:8020/apps/hive/warehouse/orctest on driver 
16/08/02 22:06:54 
INFO OrcRelation: Listing hdfs://hadoop03:8020/apps/hive/warehouse/orctest/delta_0000005_0000005 on driver 
**java.lang.AssertionError: assertion failed** 
at scala.Predef$.assert(Predef.scala:165) 
at org.apache.spark.sql.execution.datasources.LogicalRelation$$anonfun$1.apply(LogicalRelation.scala:39) 
at org.apache.spark.sql.execution.datasources.LogicalRelation$$anonfun$1.apply(LogicalRelation.scala:38) 
at scala.Option.map(Option.scala:145) 
at org.apache.spark.sql.execution.datasources.LogicalRelation.<init>(LogicalRelation.scala:38) 
at org.apache.spark.sql.execution.datasources.LogicalRelation.copy(LogicalRelation.scala:31) 
at org.apache.spark.sql.hive.HiveMetastoreCatalog.org$apache$spark$sql$hive$HiveMetastoreCatalog$$convertToOrcRelation(HiveMetastoreCatalog.scala:588) 

どのようなヘルプも本当に感謝します。

+0

を見てくださいhttp://stackoverflow.com/questions/27171702/error-in-scala-compiler-java-lang-assertionerror-assertion-failed-even-when-p – BruceWayne

+0

あなたのコメントに感謝クリシュナ。 しかし、私はスカラプロジェクトでこれを試していませんでしたが、私は直接スパークシェルでこれを試しました。 私の考え: - トランスナショナルなプロパティを持つハイブテーブルを作成すると、sparkを使ってテーブルの内容にアクセスすることができなくなります(私が間違っていたら修正してください) PS:HDPを使用していますスパーク1.6.0とハイブ1.2.1) –

+0

私も同様の問題に直面しています。スパークデータフレームにトランザクション対応表をロードできません。この問題の回避策を見つけましたか?ロードしようとする前に、sqlContext.setConf()を使用してハイブトランザクションプロパティを設定しようとしました。私はまた、ソーストランザクションテーブルのビューを作成し、スパークからビューを打つことを試みたが役に立たなかった –

答えて

2

てみ設定:hiveContext.setConf("spark.sql.hive.convertMetastoreOrc", "false")