morningman commented on a change in pull request #3812:
URL: https://github.com/apache/incubator-doris/pull/3812#discussion_r437468475



##########
File path: 
fe/src/main/java/org/apache/doris/analysis/CreateMaterializedViewStmt.java
##########
@@ -235,6 +236,9 @@ private void analyzeOrderByClause() throws 
AnalysisException {
                     if (mvColumnItem.getAggregationType() != null) {
                         break;
                     }
+                    if (mvColumnItem.getType().isFloatingPointType()) {
+                        throw new AnalysisException("Float or double can not 
used as a key, use decimal instead.");

Review comment:
       ```suggestion
                           throw new AnalysisException("Float or double can not 
used as a sort key, use decimal instead.");
   ```

##########
File path: 
fe/src/main/java/org/apache/doris/analysis/CreateMaterializedViewStmt.java
##########
@@ -255,10 +259,15 @@ private void analyzeOrderByClause() throws 
AnalysisException {
                 MVColumnItem mvColumnItem = mvColumnItemList.get(i);
                 Expr resultColumn = selectStmt.getResultExprs().get(i);
                 keyStorageLayoutBytes += 
resultColumn.getType().getStorageLayoutBytes();
-                if ((i + 1) <= FeConstants.shortkey_max_column_count
-                        || keyStorageLayoutBytes < 
FeConstants.shortkey_maxsize_bytes) {
+                if ((!mvColumnItem.getType().isFloatingPointType())

Review comment:
       We should be break if we met a floating point type column. The following 
case will get wrong result in your logic:
   
   `k1 int, k2 float, k3 int`




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