2016-10-18 2 views
1

이 문제가 발생하거나 해결 방법에 대한 아이디어가있는 사람이 있습니까?Spark 2.0.1 DataFrame에서 내부 조인을 수행 할 때 오류가 발생했습니다.

Spark 2.0.1 및 Scala 2.11을 사용하도록 코드를 업데이트하려고했습니다. Scala 2.10에서는 모든 것이 Spark 1.6.0에서 행복하게 작동했습니다. 데이터 프레임 내부 조인에 대한 간단한 데이터 프레임이있어 오류가 반환됩니다. 이 데이터는 AWS RDS 오로라에서 가져온 것입니다. 아래의 foo 데이터 프레임은 실제로는 92 개의 칼럼이며 두 개의 칼럼은 아닙니다. 두 개의 열만있는 경우에도 문제가 지속됩니다.

관련 정보 :

val asdf = foo.join(bar, foo("Transaction ID") === bar("TranId")) 
println(foo.join(bar, foo("Transaction ID") === bar("TranId")).explain()) 

== Physical Plan == 
*BroadcastHashJoin [Transaction ID#0], [TranId#202], Inner, BuildRight 
:- *Scan JDBCRelation((SELECT 

     ... 
     I REMOVED A BUNCH OF LINES FROM THIS PRINT OUT 
     ... 

    ) as x) [Transaction ID#0,BIN#8] PushedFilters: [IsNotNull(Transaction ID)], ReadSchema: struct<Transaction ID:string,BIN:string> 
+- BroadcastExchange HashedRelationBroadcastMode(List(input[0, string, false])) 
    +- *Filter isnotnull(TranId#202) 
     +- InMemoryTableScan [TranId#202, Amount_USD#203, Currency_Alpha#204], [isnotnull(TranId#202)] 
     : +- InMemoryRelation [TranId#202, Amount_USD#203, Currency_Alpha#204], true, 10000, StorageLevel(disk, memory, deserialized, 1 replicas) 
     :  : +- Scan ExistingRDD[TranId#202,Amount_USD#203,Currency_Alpha#204] 

없음을 설명과 함께 dataframes의 가입 스키마

bar.show() 

+--------------------+-----------------+-------------------+ 
|    TranId|  Amount_USD|  Currency_Alpha| 
+--------------------+-----------------+-------------------+ 
|    bbBW0|   10.99|    USD| 
|    CyX50|   438.53|    USD| 
+--------------------+-----------------+-------------------+ 

println(bar.printSchema()) 

root 
|-- TranId: string (nullable = true) 
|-- Amount_USD: string (nullable = true) 
|-- Currency_Alpha: string (nullable = true) 

와 스키마

foo.show() 

+--------------------+------+ 
|  Transaction ID| BIN| 
+--------------------+------+ 
|    bbBW0|134769| 
|    CyX50|173622| 
+--------------------+------+ 

println(foo.printSchema()) 

root 
|-- Transaction ID: string (nullable = true) 
|-- BIN: string (nullable = true) 

DataFrame 2

DataFrame 1 내가 오류 승 이것이다 :

전체 스택은 여기에서 볼 수 있습니다
16/10/18 11:36:50 ERROR Executor: Exception in task 0.0 in stage 6.0 (TID 6) 
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ID IS NOT NULL)' at line 54 

(http://pastebin.com/C9bg2HFt)

데이터베이스에서 데이터를 끌어 내 코드 또는 내 JDBC 쿼리에서 아무데도

은 내가 ID IS NOT NULL)을해야합니까 . Google 검색 시간을 들여서 Spark 커밋을 발견하여 조인에 대한 쿼리 계획에 null 필터를 추가했습니다. 여기에 커밋 (https://git1-us-west.apache.org/repos/asf?p=spark.git;a=commit;h=ef770031)

답변

0

호기심 만약 당신이 다음을 시도했다;

val dfRenamed = bar.withColumnRenamed("TranId", " Transaction ID") 
val newDF = foo.join(dfRenamed, Seq("Transaction ID"), "inner") 
관련 문제