1

我正在使用 SnappyData SQL shell(snappy-sql) 并运行 sql 语句 (PUT INTO) 并遇到错误:

ERROR 38000: (SQLState=38000 Severity=20000) (Server=localhost/127.0.0.1[1528] Thread=pool-3-thread-3) The exception 'com.pivotal.gemfirexd.internal.engine.jdbc.GemFireXDRuntimeException: myID: s4-03(19442)<v1>:43452, caused by java.lang.IllegalArgumentException: spark.sql.execution.id is already set' was thrown while evaluating an expression.
Caused by: ServerException: Server STACK: java.sql.SQLException(38000): The exception 'com.pivotal.gemfirexd.internal.engine.jdbc.GemFireXDRuntimeException: myID: s4-03(19442)<v1>:43452, caused by java.lang.IllegalArgumentException: spark.sql.execution.id is already set' was thrown while evaluating an expression.
    at com.pivotal.gemfirexd.internal.iapi.error.StandardException.newException(StandardException.java:473)
    at com.pivotal.gemfirexd.internal.engine.Misc.processFunctionException(Misc.java:808)
    at com.pivotal.gemfirexd.internal.engine.Misc.processFunctionException(Misc.java:753)
    at com.pivotal.gemfirexd.internal.engine.sql.execute.SnappySelectResultSet.setup(SnappySelectResultSet.java:282)
    at com.pivotal.gemfirexd.internal.engine.distributed.message.GfxdFunctionMessage.e

xecuteFunction(GfxdFunctionMessage.java:332)
        at com.pivotal.gemfirexd.internal.engine.distributed.message.GfxdFunctionMessage.executeFunction(GfxdFunctionMessage.
(truncated for brevity.)

这就是我所做的:从https://www.snappydata.io/download (v0.8) 下载 SnappyData 二进制文件。解压,跑

sbin/snappy-start-all.sh
bin/snappy-sql
snappy> connect client 'localhost:1527';

snappy> create table table_a(key1 INT primary key, val INT);

snappy> create table table_b(key1 INT primary key, val INT);

snappy> insert into table_a values (1, 1);

snappy> insert into table_b values (1, 2);

snappy> insert into table_b values (2, 3);

snappy> select * from table_a;
KEY1       |VAL        
-----------------------
1          |1          

1 row selected
snappy> select * from table_b;
KEY1       |VAL        
-----------------------
2          |3          
1          |2          

2 rows selected

snappy> put into table_a select * from table_b;
(then the above error.)

搜索错误(spark.sql.execution.id 已设置)导致此处: https ://issues.apache.org/jira/browse/SPARK-13​​747 (SQL 中的并发执行不适用于 Scala ForkJoinPool)似乎是 Spark 2.2.0 中修复的错误。

这可能是由于 SnappyData 仍在使用 spark 2.0(至少现在在 github 中它说已移至 spark 2.0)。但我不确定。

现在,如果可能,我尝试使用PUT INTOSnappyData 中的语句,如果有人可以帮助我解决这个问题,我将不胜感激。提前致谢 :)

4

1 回答 1

2

您只需要在 put into 语句中提供 table_a 模式 - 所以它应该是: snappy> put into table_a (key1, val) select * from table_b;

我们将看到“0 行插入/更新/删除”问题可以做些什么。“放入”有点棘手,因为它可以在一个 DML 中进行插入和更新。

于 2017-04-14T02:30:47.350 回答