You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/05/09 09:51:27 UTC

[GitHub] [shardingsphere] pcyan opened a new issue, #17481: sharding-jdbc: Oracle batch insert error

pcyan opened a new issue, #17481:
URL: https://github.com/apache/shardingsphere/issues/17481

   two kind of oracle batch insert didn't work.
   
   version
   ```xml
   <groupId>org.apache.shardingsphere</groupId>
   <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
   <version>5.1.1</version>
   ```
   
   testcase
   ```groovy
       def "testOracleInsertAll"(){
           when: "insert all case 1"
           def insert_all_sql = """
   insert all into t_user( usename )  values ( ? ) select 1 from dual
   """
           prepareStatement(insert_all_sql)
           then:
           thrown NullPointerException
   
           when: "insert all case 2"
           def insert_all_sql2 = """
   insert into pager (PAG_ID,PAG_PARENT,PAG_NAME,PAG_ACTIVE)
             select ?, ?, ?, 1 from dual union all
             select ?, ?, ?, 1 from dual
   """
           prepareStatement(insert_all_sql2)
           then:
           thrown ClassCastException
       }
   
       private void prepareStatement(def sql) {
           try (def connection = sqlSessionFactory.openSession().getConnection()) {
               connection.prepareStatement(sql)
           }
       }
   
   ```
   
   detail of exception
   ```log
   Caused by: java.lang.NullPointerException
   	at org.apache.shardingsphere.infra.binder.statement.dml.InsertStatementContext.<init>(InsertStatementContext.java:94)
   	at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.getDMLStatementContext(SQLStatementContextFactory.java:155)
   	at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:129)
   	at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:114)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:181)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:149)
   	at org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection.prepareStatement(ShardingSphereConnection.java:80)
   
   Caused by: java.lang.ClassCastException: class org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.ParameterMarkerExpressionSegment cannot be cast to class org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.LiteralExpressionSegment (org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.ParameterMarkerExpressionSegment and org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.LiteralExpressionSegment are in unnamed module of loader 'app')
   	at org.apache.shardingsphere.sql.parser.oracle.visitor.statement.impl.OracleDMLStatementSQLVisitor.createProjection(OracleDMLStatementSQLVisitor.java:754)
   	at org.apache.shardingsphere.sql.parser.oracle.visitor.statement.impl.OracleDMLStatementSQLVisitor.visitSelectProjection(OracleDMLStatementSQLVisitor.java:700)
   	at org.apache.shardingsphere.sql.parser.oracle.visitor.statement.impl.OracleDMLStatementSQLVisitor.visitSelectProjection(OracleDMLStatementSQLVisitor.java:162)
   	at org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser$SelectProjectionContext.accept(OracleStatementParser.java:10829)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.oracle.visitor.statement.impl.OracleDMLStatementSQLVisitor.visitSelectList(OracleDMLStatementSQLVisitor.java:670)
   	at org.apache.shardingsphere.sql.parser.oracle.visitor.statement.impl.OracleDMLStatementSQLVisitor.visitSelectList(OracleDMLStatementSQLVisitor.java:162)
   	at org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser$SelectListContext.accept(OracleStatementParser.java:10507)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.oracle.visitor.statement.impl.OracleDMLStatementSQLVisitor.visitQueryBlock(OracleDMLStatementSQLVisitor.java:503)
   	at org.apache.shardingsphere.sql.parser.oracle.visitor.statement.impl.OracleDMLStatementSQLVisitor.visitQueryBlock(OracleDMLStatementSQLVisitor.java:162)
   	at org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser$QueryBlockContext.accept(OracleStatementParser.java:4790)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.oracle.visitor.statement.impl.OracleDMLStatementSQLVisitor.visitSelectSubquery(OracleDMLStatementSQLVisitor.java:488)
   	at org.apache.shardingsphere.sql.parser.oracle.visitor.statement.impl.OracleDMLStatementSQLVisitor.visitSelectSubquery(OracleDMLStatementSQLVisitor.java:162)
   	at org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser$SelectSubqueryContext.accept(OracleStatementParser.java:4501)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.oracle.visitor.statement.impl.OracleDMLStatementSQLVisitor.visitInsertSingleTable(OracleDMLStatementSQLVisitor.java:188)
   	at org.apache.shardingsphere.sql.parser.oracle.visitor.statement.impl.OracleDMLStatementSQLVisitor.visitInsertSingleTable(OracleDMLStatementSQLVisitor.java:162)
   	at org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser$InsertSingleTableContext.accept(OracleStatementParser.java:1548)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.oracle.visitor.statement.impl.OracleDMLStatementSQLVisitor.visitInsert(OracleDMLStatementSQLVisitor.java:173)
   	at org.apache.shardingsphere.sql.parser.oracle.visitor.statement.impl.OracleDMLStatementSQLVisitor.visitInsert(OracleDMLStatementSQLVisitor.java:162)
   	at org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser$InsertContext.accept(OracleStatementParser.java:1469)
   	at org.apache.shardingsphere.sql.parser.api.SQLVisitorEngine.visit(SQLVisitorEngine.java:55)
   	at org.apache.shardingsphere.infra.parser.sql.SQLStatementParserExecutor.parse(SQLStatementParserExecutor.java:48)
   	at org.apache.shardingsphere.infra.parser.cache.SQLStatementCacheLoader.load(SQLStatementCacheLoader.java:41)
   	at org.apache.shardingsphere.infra.parser.cache.SQLStatementCacheLoader.load(SQLStatementCacheLoader.java:30)
   	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3533)
   	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2282)
   	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2159)
   	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2049)
   	... 11 more
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] cheese8 commented on issue #17481: sharding-jdbc: Oracle batch insert error

Posted by GitBox <gi...@apache.org>.
cheese8 commented on issue #17481:
URL: https://github.com/apache/shardingsphere/issues/17481#issuecomment-1121942929

   duplicated ##15689 see #17431 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] cheese8 closed issue #17481: sharding-jdbc: Oracle batch insert error

Posted by GitBox <gi...@apache.org>.
cheese8 closed issue #17481: sharding-jdbc: Oracle batch insert error
URL: https://github.com/apache/shardingsphere/issues/17481


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org