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 2019/08/05 00:28:07 UTC

[GitHub] [incubator-shardingsphere] sunbufu commented on a change in pull request #2800: Support to use `DISTINCT table.*`

sunbufu commented on a change in pull request #2800: Support to use `DISTINCT table.*`
URL: https://github.com/apache/incubator-shardingsphere/pull/2800#discussion_r310411431
 
 

 ##########
 File path: sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/sharding/segment/select/item/SelectItems.java
 ##########
 @@ -115,9 +120,18 @@ public boolean isUnqualifiedShorthandItem() {
     public List<String> getColumnLabels() {
         List<String> result = new ArrayList<>(items.size());
         for (SelectItem each : items) {
-            // TODO read * from metadata
             if (!(each instanceof ShorthandSelectItem)) {
                 result.add(each.getColumnLabel());
+            } else {
+                // get tableMetaData from ownerTableMetaDataMap by owner
+                // add tableMetaData's all columnLabels
+                if (((ShorthandSelectItem) each).getOwner().isPresent()) {
 
 Review comment:
   Hello, In my opinion, `SelectItemsEngine` should find all related table and table's columns, and `SelectItems` should final exact table and table's columns.
   Such as in `SELECT t_order.* FROM t_order, t_order_item WHERE t_order.order_id = t_order_item.order_id`. 
   `SelectItemsEngine` find table `t_order`, `t_order_item` and `t_order`'s columns, `t_order_item`'s columns, but `SelectItems` should return `t_order` and `t_order`'s columns.

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


With regards,
Apache Git Services