We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object singleResult = entityManager .createQuery("SELECT count (distinct i.orderItemId) from OrderItemEntity i where i.orderId = :orderId") .setParameter("orderId", 11111111111111111L) .getSingleResult();
when use count distinct and entitymanager#getSingleResult() cause javax.persistence.NoResultException
count distinct
entitymanager#getSingleResult()
[4.0.1 , 4.1.1] the bug remains
ShardingSphere-JDBC
Actual SQL lack of count ,is it intentional or a bug?
[INFO ] 2020-07-13 17:01:36,835 --main-- [ShardingSphere-SQL] Logic SQL: select count(distinct orderiteme0_.order_item_id) as col_0_0_ from t_order_item orderiteme0_ where orderiteme0_.order_id=? [INFO ] 2020-07-13 17:01:36,835 --main-- [ShardingSphere-SQL] SQLStatement: SelectStatementContext(super=CommonSQLStatementContext(sqlStatement=org.apache.shardingsphere.sql.parser.sql.statement.dml.SelectStatement@6fbf5db2, tablesContext=org.apache.shardingsphere.sql.parser.binder.segment.table.TablesContext@509a6095), tablesContext=org.apache.shardingsphere.sql.parser.binder.segment.table.TablesContext@509a6095, projectionsContext=ProjectionsContext(startIndex=7, stopIndex=60, distinctRow=false, projections=[AggregationProjection(type=COUNT, innerExpression=(distinct orderiteme0_.order_item_id), alias=Optional[col_0_0_], derivedAggregationProjections=[], index=-1)]), groupByContext=org.apache.shardingsphere.sql.parser.binder.segment.select.groupby.GroupByContext@57cabdc3, orderByContext=org.apache.shardingsphere.sql.parser.binder.segment.select.orderby.OrderByContext@75bd28d, paginationContext=org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContext@129c4d19, containsSubquery=false) [INFO ] 2020-07-13 17:01:36,835 --main-- [ShardingSphere-SQL] Actual SQL: demo_ds_0 ::: select DISTINCT orderiteme0_.order_item_id as col_0_0_ from t_order_item orderiteme0_ where orderiteme0_.order_id=? ::: [11111111111111111] [INFO ] 2020-07-13 17:01:36,835 --main-- [ShardingSphere-SQL] Actual SQL: demo_ds_1 ::: select DISTINCT orderiteme0_.order_item_id as col_0_0_ from t_order_item orderiteme0_ where orderiteme0_.order_id=? ::: [11111111111111111]
.setParameter("orderId", 11111111111111111L) this step is necessary
The text was updated successfully, but these errors were encountered:
It has been fixed in #6118 for master branch 5.0.0-RC1
Sorry, something went wrong.
@kimmking Will this fix merge into 4.x ?
No branches or pull requests
Bug Report
when use
count distinct
andentitymanager#getSingleResult()
cause javax.persistence.NoResultExceptionWhich version of ShardingSphere did you use?
[4.0.1 , 4.1.1] the bug remains
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
Expected behavior
Actual behavior
Reason analyze (If you can)
Actual SQL lack of count ,is it intentional or a bug?
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
.setParameter("orderId", 11111111111111111L)
this step is necessary
Example codes for reproduce this issue (such as a github link).
The text was updated successfully, but these errors were encountered: