BiteTheDDDDt opened a new pull request, #15212:
URL: https://github.com/apache/doris/pull/15212

   # Proposed changes
   
   ```sql
   mysql [test]>create table d_table(
       -> k1 int null,
       -> k2 int null,
       -> k3 bigint null,
       -> k4 bigint null,
       ->   k5 varchar(50) null
       -> )
       -> duplicate key (k1,k2,k3)
       -> distributed BY hash(k1) buckets 3
       -> properties("replication_num" = "1");
   Query OK, 0 rows affected (0.06 sec)
   
   mysql [test]>
   mysql [test]>insert into d_table values(1,1,1,1,'a');
   Query OK, 1 row affected (0.09 sec)
   {'label':'insert_ea19c520da154420_80fb4d03ed0e4d4f', 'status':'VISIBLE', 
'txnId':'53049'}
   
   mysql [test]>insert into d_table values(2,2,2,2,'b');
   Query OK, 1 row affected (0.03 sec)
   {'label':'insert_3840f65b926d407b_b3f9cbd706c0e681', 'status':'VISIBLE', 
'txnId':'53050'}
   
   mysql [test]>insert into d_table values(3,-3,3,-3,'c');
   Query OK, 1 row affected (0.03 sec)
   {'label':'insert_5e7f7a2475447b9_b4015a391767aa6c', 'status':'VISIBLE', 
'txnId':'53051'}
   
   mysql [test]>
   mysql [test]>create materialized view k12a as select k1,abs(k2) from 
d_table; 
   Query OK, 0 rows affected (0.00 sec)
   
   mysql [test]>select k1,abs(k2) from d_table;
   +------+---------+
   | k1   | abs(k2) |
   +------+---------+
   |    2 |       2 |
   |    1 |       1 |
   |    3 |       3 |
   +------+---------+
   3 rows in set (0.03 sec)
   
   
   mysql [test]>explain verbose select k1,abs(k2) from d_table;
   +----------------------------------------------------------------------+
   | Explain String                                                       |
   +----------------------------------------------------------------------+
   | PLAN FRAGMENT 0                                                      |
   |   OUTPUT EXPRS:                                                      |
   |     k1                                                               |
   |     `default_cluster:test`.`d_table`.`abs(k2)`                       |
   |   PARTITION: UNPARTITIONED                                           |
   |                                                                      |
   |   VRESULT SINK                                                       |
   |                                                                      |
   |   1:VEXCHANGE                                                        |
   |      tuple ids: 0                                                    |
   |                                                                      |
   | PLAN FRAGMENT 1                                                      |
   |                                                                      |
   |   PARTITION: HASH_PARTITIONED: `default_cluster:test`.`d_table`.`k1` |
   |                                                                      |
   |   STREAM DATA SINK                                                   |
   |     EXCHANGE ID: 01                                                  |
   |     UNPARTITIONED                                                    |
   |                                                                      |
   |   0:VOlapScanNode                                                    |
   |      TABLE: default_cluster:test.d_table(k12a), PREAGGREGATION: ON   |
   |      partitions=1/1, tablets=3/3, tabletList=229086,229088,229090    |
   |      cardinality=0, avgRowSize=12.0, numNodes=1                      |
   |      tuple ids: 0                                                    |
   |                                                                      |
   | Tuples:                                                              |
   | TupleDescriptor{id=0, tbl=d_table, byteSize=16}                      |
   |   SlotDescriptor{id=0, col=k1, type=INT, nullable=true}              |
   |   SlotDescriptor{id=2, col=abs(k2), type=BIGINT, nullable=false}     |
   +----------------------------------------------------------------------+
   29 rows in set (0.00 sec)
   
   mysql [test]>desc d_table all;
   
+-----------+---------------+---------+-------------+------+-------+---------+-------+---------+
   | IndexName | IndexKeysType | Field   | Type        | Null | Key   | Default 
| Extra | Visible |
   
+-----------+---------------+---------+-------------+------+-------+---------+-------+---------+
   | d_table   | DUP_KEYS      | k1      | INT         | Yes  | true  | NULL    
|       | true    |
   |           |               | k2      | INT         | Yes  | true  | NULL    
|       | true    |
   |           |               | k3      | BIGINT      | Yes  | true  | NULL    
|       | true    |
   |           |               | k4      | BIGINT      | Yes  | false | NULL    
| NONE  | true    |
   |           |               | k5      | VARCHAR(50) | Yes  | false | NULL    
| NONE  | true    |
   |           |               |         |             |      |       |         
|       |         |
   | k12a      | DUP_KEYS      | k1      | INT         | No   | true  |         
|       | true    |
   |           |               | abs(k2) | BIGINT      | No   | true  |         
|       | true    |
   
+-----------+---------------+---------+-------------+------+-------+---------+-------+---------+
   8 rows in set (0.01 sec)
   ```
   ## Problem summary
   
   Describe your changes.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [ ] Yes
       - [ ] No
       - [ ] I don't know
   2. Has unit tests been added:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   3. Has document been added or modified:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   4. Does it need to update dependencies:
       - [ ] Yes
       - [ ] No
   5. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [ ] No
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at 
[d...@doris.apache.org](mailto:d...@doris.apache.org) by explaining why you 
chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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: commits-unsubscr...@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to