The insert statement is abnormal."ERROR: Cannot invoke "org.antlr.v4.runtime.tree.ParseTree.accept(org.antlr.v4.runtime.tree.ParseTreeVisitor)" "
See original GitHub issueWhich version of ShardingSphere did you use?
we find java version: java17, full_version=17.0.1 ShardingSphere-5.2.0
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy
Expected behavior
The insert statement is normal.
Actual behavior
The insert statement is abnormal.
Reason analyze (If you can)
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
drop table customer;
CREATE TABLE CUSTOMER ( C_CUSTKEY INTEGER NOT NULL,
C_NAME VARCHAR(25) NOT NULL,
C_ADDRESS VARCHAR(40) NOT NULL,
C_NATIONKEY INTEGER NOT NULL,
C_PHONE CHAR(15) NOT NULL,
C_ACCTBAL DECIMAL(15,2) NOT NULL,
C_MKTSEGMENT CHAR(10) NOT NULL,
C_COMMENT VARCHAR(117) NOT NULL);
INSERT INTO customer (c_custkey, c_name, c_address, c_nationkey, c_phone, c_acctbal, c_mktsegment, c_comment) VALUES (107451, 'Customer#000107451', 'jZiY8FZz1pESpfE0ZvicC4f9evS1lrF', 24, '34-474-838-7669', -709.94, 'FURNITURE ', 'ans. furiously final theodolites are carefully. carefully final theodolites alongside of the'); --abnormal
INSERT INTO customer (c_custkey, c_name, c_address, c_nationkey, c_phone, c_acctbal, c_mktsegment, c_comment) VALUES (720, 'Customer#000000720', '8shFEL7J9sq1NJXR8dixBqaTO,kbSx', 22, '32-575-838-4260', 5357.32, 'HOUSEHOLD ', 'furiously above the furiously ironic c'); --normal
background log
[ERROR] 2022-09-24 10:10:28.595 [epollEventLoopGroup-3-7] o.a.s.p.f.c.CommandExecutorTask - Exception occur:
java.lang.NullPointerException: Cannot invoke "org.antlr.v4.runtime.tree.ParseTree.accept(org.antlr.v4.runtime.tree.ParseTreeVisitor)" because "tree" is null
at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at org.apache.shardingsphere.sql.parser.opengauss.visitor.statement.impl.OpenGaussStatementSQLVisitor.createCommonBinaryOperationSegment(OpenGaussStatementSQLVisitor.java:348)
at org.apache.shardingsphere.sql.parser.opengauss.visitor.statement.impl.OpenGaussStatementSQLVisitor.visitAExpr(OpenGaussStatementSQLVisitor.java:303)
at org.apache.shardingsphere.sql.parser.opengauss.visitor.statement.impl.OpenGaussStatementSQLVisitor.visitAExpr(OpenGaussStatementSQLVisitor.java:194)
at org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser$AExprContext.accept(OpenGaussStatementParser.java:14788)
at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at org.apache.shardingsphere.sql.parser.opengauss.visitor.statement.impl.OpenGaussStatementSQLVisitor.createInsertValuesSegments(OpenGaussStatementSQLVisitor.java:770)
at org.apache.shardingsphere.sql.parser.opengauss.visitor.statement.impl.OpenGaussStatementSQLVisitor.createInsertValuesSegments(OpenGaussStatementSQLVisitor.java:767)
at org.apache.shardingsphere.sql.parser.opengauss.visitor.statement.impl.OpenGaussStatementSQLVisitor.createInsertValuesSegments(OpenGaussStatementSQLVisitor.java:767)
at org.apache.shardingsphere.sql.parser.opengauss.visitor.statement.impl.OpenGaussStatementSQLVisitor.createInsertValuesSegments(OpenGaussStatementSQLVisitor.java:758)
at org.apache.shardingsphere.sql.parser.opengauss.visitor.statement.impl.OpenGaussStatementSQLVisitor.visitInsertRest(OpenGaussStatementSQLVisitor.java:696)
at org.apache.shardingsphere.sql.parser.opengauss.visitor.statement.impl.OpenGaussStatementSQLVisitor.visitInsertRest(OpenGaussStatementSQLVisitor.java:194)
at org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser$InsertRestContext.accept(OpenGaussStatementParser.java:3231)
at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at org.apache.shardingsphere.sql.parser.opengauss.visitor.statement.impl.OpenGaussStatementSQLVisitor.visitInsert(OpenGaussStatementSQLVisitor.java:632)
at org.apache.shardingsphere.sql.parser.opengauss.visitor.statement.impl.OpenGaussStatementSQLVisitor.visitInsert(OpenGaussStatementSQLVisitor.java:194)
at org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser$InsertContext.accept(OpenGaussStatementParser.java:3089)
at org.apache.shardingsphere.sql.parser.api.SQLVisitorEngine.visit(SQLVisitorEngine.java:54)
at org.apache.shardingsphere.infra.parser.sql.SQLStatementParserExecutor.parse(SQLStatementParserExecutor.java:48)
at org.apache.shardingsphere.infra.parser.sql.SQLStatementParserEngine.parse(SQLStatementParserEngine.java:47)
at org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine.parse(ShardingSphereSQLParserEngine.java:58)
at org.apache.shardingsphere.proxy.backend.handler.ProxyBackendHandlerFactory.newInstance(ProxyBackendHandlerFactory.java:86)
at org.apache.shardingsphere.proxy.frontend.opengauss.command.query.simple.OpenGaussComQueryExecutor.<init>(OpenGaussComQueryExecutor.java:72)
at org.apache.shardingsphere.proxy.frontend.opengauss.command.OpenGaussCommandExecutorFactory.getCommandExecutor(OpenGaussCommandExecutorFactory.java:114)
at org.apache.shardingsphere.proxy.frontend.opengauss.command.OpenGaussCommandExecutorFactory.newInstance(OpenGaussCommandExecutorFactory.java:76)
at org.apache.shardingsphere.proxy.frontend.opengauss.command.OpenGaussCommandExecuteEngine.getCommandExecutor(OpenGaussCommandExecuteEngine.java:62)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:108)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:77)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:384)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:833)
Example codes for reproduce this issue (such as a github link).
rules:
- !SHARDING
tables:
lineitem:
actualDataNodes: ds_${0..1}.lineitem_${0..1}
databaseStrategy:
standard:
shardingColumn: l_partkey
shardingAlgorithmName: lineitem-database-inline
tableStrategy:
standard:
shardingColumn: l_orderkey
shardingAlgorithmName: lineitem-table-inline
customer:
actualDataNodes: ds_${0..1}.customer_${0..1}
databaseStrategy:
standard:
shardingColumn: c_custkey
shardingAlgorithmName: customer-database-inline
tableStrategy:
standard:
shardingColumn: c_nationkey
shardingAlgorithmName: customer-table-inline
nation:
actualDataNodes: ds_${0..1}.nation_${0..1}
databaseStrategy:
standard:
shardingColumn: n_nationkey
shardingAlgorithmName: nation-database-inline
tableStrategy:
standard:
shardingColumn: n_regionkey
shardingAlgorithmName: nation-table-inline
orders:
actualDataNodes: ds_${0..1}.orders_${0..1}
databaseStrategy:
standard:
shardingColumn: o_orderkey
shardingAlgorithmName: orders-database-inline
tableStrategy:
standard:
shardingColumn: o_custkey
shardingAlgorithmName: orders-table-inline
part:
actualDataNodes: ds_${0..1}.part_${0..1}
databaseStrategy:
standard:
shardingColumn: p_partkey
shardingAlgorithmName: part-database-inline
tableStrategy:
standard:
shardingColumn: p_size
shardingAlgorithmName: part-table-inline
partsupp:
actualDataNodes: ds_${0..1}.partsupp_${0..1}
databaseStrategy:
standard:
shardingColumn: ps_partkey
shardingAlgorithmName: partsupp-database-inline
tableStrategy:
standard:
shardingColumn: ps_suppkey
shardingAlgorithmName: partsupp-table-inline
region:
actualDataNodes: ds_${0..1}.region
databaseStrategy:
standard:
shardingColumn: r_regionkey
shardingAlgorithmName: region-database-inline
supplier:
actualDataNodes: ds_${0..1}.supplier_${0..1}
databaseStrategy:
standard:
shardingColumn: s_suppkey
shardingAlgorithmName: supplier-database-inline
tableStrategy:
standard:
shardingColumn: s_nationkey
shardingAlgorithmName: supplier-table-inline
defaultDatabaseStrategy:
none:
defaultTableStrategy:
none:
shardingAlgorithms:
lineitem-database-inline:
type: INLINE
props:
algorithm-expression: ds_${l_partkey % 2}
lineitem-table-inline:
type: INLINE
props:
algorithm-expression: lineitem_${l_orderkey % 2}
customer-database-inline:
type: INLINE
props:
algorithm-expression: ds_${c_custkey % 2}
customer-table-inline:
type: INLINE
props:
algorithm-expression: customer_${c_nationkey % 2}
nation-database-inline:
type: INLINE
props:
algorithm-expression: ds_${n_nationkey % 2}
nation-table-inline:
type: INLINE
props:
algorithm-expression: nation_${n_regionkey % 2}
orders-database-inline:
type: INLINE
props:
algorithm-expression: ds_${o_orderkey % 2}
orders-table-inline:
type: INLINE
props:
algorithm-expression: orders_${o_custkey % 2}
part-database-inline:
type: INLINE
props:
algorithm-expression: ds_${p_partkey % 2}
part-table-inline:
type: INLINE
props:
algorithm-expression: part_${p_size % 2}
partsupp-database-inline:
type: INLINE
props:
algorithm-expression: ds_${ps_partkey % 2}
partsupp-table-inline:
type: INLINE
props:
algorithm-expression: partsupp_${ps_suppkey % 2}
region-database-inline:
type: INLINE
props:
algorithm-expression: ds_${r_regionkey % 2}
supplier-database-inline:
type: INLINE
props:
algorithm-expression: ds_${s_suppkey % 2}
supplier-table-inline:
type: INLINE
props:
algorithm-expression: supplier_${s_nationkey % 2}
schemaName: tpch_db_2
Issue Analytics
- State:
- Created a year ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
Getting an error when testing my grammar program
The exception message says: Exception in thread "main" java.lang.NullPointerException at org.antlr.v4.runtime.tree.
Read more >java.lang.NullPointerException at org.antlr.v4.runtime.misc ...
Simply build the grammars-v4/php parser for the Java target and run grun Php htmlDocument -tree ..\examples\alternativeSyntax.php . It actually ...
Read more >ParseTreeVisitor (ANTLR 4 Runtime 4.11.1 API)
This interface defines the basic notion of a parse tree visitor. Generated visitors implement this interface and the XVisitor interface for grammar X...
Read more >java.lang.NoClassDefFoundError: org/antlr/runtime
In CDH6.X, when running hive sql using spark execution engine, sometimes i will encounter below error, while this doesn't happen in CDH5.X: scheduler....
Read more >The Definitive ANTLR 4 Reference
the java -jar option or directly invoke the org.antlr.v4.Tool class. ... (Take a quick peek back at the parse tree figure.) The calls...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
fixed by 4114e7ee4cbe5923c2b403a3e86d1f23355cadf3
we find java version: java8, full_version=1.8.0_342, full_path=/home/peilq_sharding/bisheng-jdk1.8.0_342//bin/java ShardingSphere-5.2.1-SNAPSHOT Commit ID: dirty-4114e7ee4cbe5923c2b403a3e86d1f23355cadf3 Commit Message: Fix parse exception when execute insert statement with negative value (#21197) Branch: 4114e7ee4cbe5923c2b403a3e86d1f23355cadf3 Build time: 2022-09-27T16:37:07+0800