You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/06/09 16:36:50 UTC

[GitHub] [incubator-doris] morningman commented on a change in pull request #3812: Forbidden float column in short key

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:
users@infra.apache.org



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