zenoyang opened a new pull request #8787:
URL: https://github.com/apache/incubator-doris/pull/8787


   # Proposed changes
   
   Issue Number: close #8315 
   Fix query result error due to find code by bound.
   
   ## Problem Summary:
   
   Problem recurrence
   SSB single table `lineorder_flat`, the query SQL is as follows:
   ```sql
   SELECT
       sum(LO_REVENUE),
       (LO_ORDERDATE DIV 10000) AS year,
       P_BRAND
   FROM lineorder_flat
   WHERE P_BRAND >= 'MFGR#22211111' AND P_BRAND <= 'MFGR#22281111' AND S_REGION 
= 'ASIA' and (LO_ORDERDATE DIV 10000) = 1992
   GROUP BY
       year,
       P_BRAND
   ORDER BY
       year,
       P_BRAND;
   ```
   
   when `enable_low_cardinality_optimize=false`, query result:
   ```sql
   +-------------------+------+-----------+
   | sum(`LO_REVENUE`) | year | P_BRAND   |
   +-------------------+------+-----------+
   |       65423264312 | 1992 | MFGR#2222 |
   |       66936772687 | 1992 | MFGR#2223 |
   |       64047191934 | 1992 | MFGR#2224 |
   |       65744559138 | 1992 | MFGR#2225 |
   |       66993045668 | 1992 | MFGR#2226 |
   |       67411226147 | 1992 | MFGR#2227 |
   |       69390885970 | 1992 | MFGR#2228 |
   +-------------------+------+-----------+
   ```
   
   when `enable_low_cardinality_optimize=true`, query result:
   ```sql
   +-------------------+------+-----------+
   | sum(`LO_REVENUE`) | year | P_BRAND   |
   +-------------------+------+-----------+
   |       66936772687 | 1992 | MFGR#2223 |
   |       64047191934 | 1992 | MFGR#2224 |
   |       65744559138 | 1992 | MFGR#2225 |
   |       66993045668 | 1992 | MFGR#2226 |
   |       67411226147 | 1992 | MFGR#2227 |
   |       69390885970 | 1992 | MFGR#2228 |
   +-------------------+------+-----------+
   ```
   
   One line less than the correct result.
   
   The reason is that 'MFGR#22211111' is not in the dictionary, so get the 
boundary code (`find_code_by_bound` method), but there is a bug here.
   
   ## 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/No)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at 
[[email protected]](mailto:[email protected]) 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to