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 2020/08/25 10:46:16 UTC

[GitHub] [shardingsphere] strongduanmu commented on issue #7052: sql cannot be sharded using Group BY

strongduanmu commented on issue #7052:
URL: https://github.com/apache/shardingsphere/issues/7052#issuecomment-679949749


   @seowen808 @tristaZero @kimmking I have used the master branch to test the `Select ... Group By` syntax, and the routing results were correct.
   
   ```sql
   [INFO ] 18:45:23.563 [ShardingSphere-Command-2] ShardingSphere-SQL - Logic SQL: /* ApplicationName=DataGrip 2020.2 */ SELECT * FROM t_order WHERE order_id IN (1, 2, 3) GROUP BY order_id ORDER BY order_id
   [INFO ] 18:45:23.563 [ShardingSphere-Command-2] ShardingSphere-SQL - SQLStatement: SelectStatementContext(super=CommonSQLStatementContext(sqlStatement=org.apache.shardingsphere.sql.parser.sql.statement.dml.SelectStatement@4c764d7, tablesContext=TablesContext(tables=[SimpleTableSegment(tableName=TableNameSegment(startIndex=52, stopIndex=58, identifier=IdentifierValue(value=t_order, quoteCharacter=NONE)), owner=Optional.empty, alias=Optional.empty)])), tablesContext=TablesContext(tables=[SimpleTableSegment(tableName=TableNameSegment(startIndex=52, stopIndex=58, identifier=IdentifierValue(value=t_order, quoteCharacter=NONE)), owner=Optional.empty, alias=Optional.empty)]), projectionsContext=ProjectionsContext(startIndex=45, stopIndex=45, distinctRow=false, projections=[ShorthandProjection(owner=Optional.empty, actualColumns=[ColumnProjection(owner=null, name=order_id, alias=Optional.empty), ColumnProjection(owner=null, name=user_id, alias=Optional.empty), ColumnProjection(owner=null,
  name=status, alias=Optional.empty)])]), groupByContext=org.apache.shardingsphere.sql.parser.binder.segment.select.groupby.GroupByContext@707c83c, orderByContext=org.apache.shardingsphere.sql.parser.binder.segment.select.orderby.OrderByContext@63c9e303, paginationContext=org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContext@1caf41ce, containsSubquery=false)
   [INFO ] 18:45:23.564 [ShardingSphere-Command-2] ShardingSphere-SQL - Actual SQL: ds ::: /* ApplicationName=DataGrip 2020.2 */ SELECT * FROM t_order_0 WHERE order_id IN (1, 2, 3) GROUP BY order_id ORDER BY order_id
   [INFO ] 18:45:23.564 [ShardingSphere-Command-2] ShardingSphere-SQL - Actual SQL: ds ::: /* ApplicationName=DataGrip 2020.2 */ SELECT * FROM t_order_1 WHERE order_id IN (1, 2, 3) GROUP BY order_id ORDER BY order_id
   ```


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

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