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/02/24 11:48:20 UTC

[GitHub] [shardingsphere] yuwentao opened a new issue #15618: sharding sphere 最新版本5.1不支持复杂SQL查询

yuwentao opened a new issue #15618:
URL: https://github.com/apache/shardingsphere/issues/15618


   
   
   version:shardingsphere 5.1.0 
   
   
   SQL:
   SELECT old.id AS id, old.name, new.id AS quoteId, new.name FROM s_field old INNER JOIN (SELECT id, relate_field, name FROM s_field WHERE show_type = 'quote' AND verify_type = 'customer_addr' AND function_id = 1415965658951864322 AND tenant_id = 1 AND tenant_id = 1) new ON new.relate_field = old.copy_field_id WHERE old.tenant_id = 1 UNION SELECT old.id AS id, old.name, new.id AS quoteId, new.name FROM s_field old INNER JOIN (SELECT id, relate_field, name FROM s_field WHERE show_type = 'quote' AND verify_type != 'customer_addr' AND function_id = 1415965658951864322 AND tenant_id = 1 AND tenant_id = 1) new ON new.relate_field = old.id WHERE old.tenant_id = 1
   
   Caused by: org.apache.ibatis.exceptions.PersistenceException: 
   ### Error querying database.  Cause: java.lang.NullPointerException
   ### The error may exist in file [E:\CoderWork\Dolphins\oa_service\dolphins-core\target\classes\mappers\FieldMapper.xml]
   ### The error may involve defaultParameterMap
   ### The error occurred while setting parameters
   ### SQL: SELECT old.id AS id, old.name, new.id AS quoteId, new.name FROM s_field old INNER JOIN (SELECT id, relate_field, name FROM s_field WHERE show_type = 'quote' AND verify_type = 'customer_addr' AND function_id = ? AND tenant_id = 1 AND tenant_id = 1) new ON new.relate_field = old.copy_field_id WHERE old.tenant_id = 1 UNION SELECT old.id AS id, old.name, new.id AS quoteId, new.name FROM s_field old INNER JOIN (SELECT id, relate_field, name FROM s_field WHERE show_type = 'quote' AND verify_type != 'customer_addr' AND function_id = ? AND tenant_id = 1 AND tenant_id = 1) new ON new.relate_field = old.id WHERE old.tenant_id = 1
   ### Cause: java.lang.NullPointerException
           at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
           at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
           at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
           at sun.reflect.GeneratedMethodAccessor171.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426)
           ... 171 more
   Caused by: java.lang.NullPointerException
           at org.apache.shardingsphere.infra.binder.segment.select.subquery.engine.SubqueryTableContextEngine.createSubqueryTableContexts(SubqueryTableContextEngine.java:43)
           at org.apache.shardingsphere.infra.binder.segment.table.TablesContext.createSubqueryTables(TablesContext.java:85)
           at org.apache.shardingsphere.infra.binder.segment.table.TablesContext.<init>(TablesContext.java:78)
   2022-02-24 17:19:05.059        at org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext.<init>(SelectStatementContext.java:105)
            at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.getDMLStatementContext(SQLStatementContextFactory.java:133)
   


-- 
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] yuwentao commented on issue #15618: sharding sphere 5.1version not support this SQL query statements

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


   https://shardingsphere.apache.org/document/5.1.0/cn/features/sharding/use-norms/sql/
   Experimental supported SQL:
   SELECT col1, col2 FROM tbl_name UNION SELECT col1, col2 FROM tbl_name |  
   SELECT col1, col2 FROM tbl_name UNION ALL SELECT col1, col2 FROM tbl_name


-- 
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] strongduanmu commented on issue #15618: sharding sphere 5.1version not support this SQL query statements

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


   @yuwentao Thank you for your feedback, can you translate your title to english? And provide your sharding configuration?


-- 
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] strongduanmu edited a comment on issue #15618: sharding sphere 5.1version not support this SQL query statements

Posted by GitBox <gi...@apache.org>.
strongduanmu edited a comment on issue #15618:
URL: https://github.com/apache/shardingsphere/issues/15618#issuecomment-1049780582


   @yuwentao Thank you for your feedback, can you provide your sharding configuration and table init sql?


-- 
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] yuwentao commented on issue #15618: sharding sphere 5.1version not support this SQL query statements

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


   > @yuwentao Thank you for your feedback, can you provide your sharding configuration and table init sql?
   
   if I need to modify my sql Statment about "union"?


-- 
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] anonymous-lj commented on issue #15618: sharding sphere 5.1version not support this SQL query statements

Posted by GitBox <gi...@apache.org>.
anonymous-lj commented on issue #15618:
URL: https://github.com/apache/shardingsphere/issues/15618#issuecomment-1086607081


   I also encountered similar problems, which should be caused by union


-- 
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] yuwentao commented on issue #15618: sharding sphere 5.1version not support this SQL query statements

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


   have opened sql-federation =true:
   Properties props = new Properties();
   props.setProperty(ConfigurationPropertyKey.SQL_FEDERATION_ENABLED.getKey(), String.valueOf(Boolean.TRUE));
   props.setProperty(ConfigurationPropertyKey.SQL_SHOW.getKey(), Boolean.TRUE.toString());
   


-- 
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