我们在使用JDBC通过Apache Spark连接到MonetDB群集时遇到问题。 连接到非群集的数据库有效。但是当我们尝试通过Apache Spark连接到集群的MonetDB数据库时,它会失败并显示"未处理的结果类型错误"。整个查询如下:
我们已经尝试过将纯JDBC连接到monetdb集群并且它可以工作。只有Spark失败了。
val v1 = hiveContext.load("jdbc",Map("url" -> "jdbc:monetdb://1.1.1.1/tpch1?user=monetdb&password=monetdb","dbtable" -> "(select count(*) from customer)v1"))
**java.sql.SQLException: node */tpch/1/monet returned unhandled result type**
java.sql.SQLException: node */tpch/2/monet returned unhandled result type
at nl.cwi.monetdb.jdbc.MonetConnection$ResponseList.executeQuery(MonetConnection.java:2536)
at nl.cwi.monetdb.jdbc.MonetConnection$ResponseList.processQuery(MonetConnection.java:2284)
at nl.cwi.monetdb.jdbc.MonetStatement.internalExecute(MonetStatement.java:508)
at nl.cwi.monetdb.jdbc.MonetStatement.execute(MonetStatement.java:349)
at nl.cwi.monetdb.jdbc.MonetPreparedStatement.<init>(MonetPreparedStatement.java:118)
at nl.cwi.monetdb.jdbc.MonetConnection.prepareStatement(MonetConnection.java:901)
at nl.cwi.monetdb.jdbc.MonetConnection.prepareStatement(MonetConnection.java:825)
at org.apache.spark.sql.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:96)
at org.apache.spark.sql.jdbc.JDBCRelation.<init>(JDBCRelation.scala:125)
at org.apache.spark.sql.jdbc.DefaultSource.createRelation(JDBCRelation.scala:114)
at org.apache.spark.sql.sources.ResolvedDataSource$.apply(ddl.scala:290)
at org.apache.spark.sql.SQLContext.load(SQLContext.scala:679)
at $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC.<init>(<console>:23)
at $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC.<init>(<console>:28)
at $iwC$$iwC$$iwC$$iwC$$iwC$$iwC.<init>(<console>:30)
at $iwC$$iwC$$iwC$$iwC$$iwC.<init>(<console>:32)
at $iwC$$iwC$$iwC$$iwC.<init>(<console>:34)
at $iwC$$iwC$$iwC.<init>(<console>:36)
at $iwC$$iwC.<init>(<console>:38)
at $iwC.<init>(<console>:40)
at <init>(<console>:42)
at .<init>(<console>:46)
at .<clinit>(<console>)
at .<init>(<console>:7)
at .<clinit>(<console>)
at $print(<console>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.spark.repl.SparkIMain$ReadEvalPrint.call(SparkIMain.scala:1065)
at org.apache.spark.repl.SparkIMain$Request.loadAndRun(SparkIMain.scala:1338)
at org.apache.spark.repl.SparkIMain.loadAndRunReq$1(SparkIMain.scala:840)
at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:871)
at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:819)
at org.apache.spark.repl.SparkILoop.reallyInterpret$1(SparkILoop.scala:856)
at org.apache.spark.repl.SparkILoop.interpretStartingWith(SparkILoop.scala:901)
at org.apache.spark.repl.SparkILoop.command(SparkILoop.scala:813)
at org.apache.spark.repl.SparkILoop.processLine$1(SparkILoop.scala:656)
at org.apache.spark.repl.SparkILoop.innerLoop$1(SparkILoop.scala:664)
at org.apache.spark.repl.SparkILoop.org$apache$spark$repl$SparkILoop$$loop(SparkILoop.scala:669)
at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply$mcZ$sp(SparkILoop.scala:996)
at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply(SparkILoop.scala:944)
at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply(SparkILoop.scala:944)
at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
at org.apache.spark.repl.SparkILoop.org$apache$spark$repl$SparkILoop$$process(SparkILoop.scala:944)
at org.apache.spark.repl.SparkILoop.process(SparkILoop.scala:1058)
at org.apache.spark.repl.Main$.main(Main.scala:31)
at org.apache.spark.repl.Main.main(Main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:569)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:166)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:189)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:110)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
RD 1429856293844:读取最终块:67字节RX 1429856293845:
bwnthqobupI3CPY:merovingian:9:RIPEMD160,SHA256,SHA1,MD5:LIT:SHA512:RD 1429856293845:插入提示TD 1429856293846:写入最终块: 99字节TX 1429856293846: BIG:梅罗文加王朝:{} SHA256 7070477fd396595c929386453a32ac5059a9b76976e54dab3fbb7a8f5299bd25:SQL:tpch1: RD 1429856293847:读取最终块:0字节RX 1429856293847:RD 1429856293847:插入提示TD 1429856293847:写入最终块: 49字节TX 1429856293847:sSET TIME ZONE INTERVAL&#39; +05:30&#39;小时候 分钟; RD 1429856293848:读取最终块:3个字节RX 1429856293848: 和3RD 1429856293848:插入提示TD 1429856293855:写入最终 块:15字节TX 1429856293855:Xreply_size 250 RD 1429856293855: 读取最终块:0字节RX 1429856293855:RD 1429856293855: 插入提示TD 1429856293855:写入最终块:68字节TX 1429856293855:sPREPARE SELECT * FROM(从中选择count(*) 客户)v1 WHERE 1 = 0; RD 1429856293856:读取最终块:52个字节 RX 1429856293856:!node * / tpch / 2 / monet返回未处理的结果类型
RD 1429856293856:插入提示
答案 0 :(得分:0)
问题不在于JDBC,而在于merovingian漏斗。似乎漏斗不喜欢语句PREPARE SELECT * FROM (select count(*) from customer)v1 WHERE 1=0 ;
看看你是否可以阻止你的应用程序使用预准备语句。请随意在http://bugs.monetdb.org