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/19 15:01:04 UTC

[GitHub] [incubator-doris] morningman opened a new pull request #3916: [Bug] Can not use non-key column as partition column in duplicate table

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


   The following statement will throw error:
   ```
   create table test.tbl2
   (k1 int, k2 int, k3 float)
   duplicate key(k1)
   partition by range(k2)
   (partition p1 values less than("10"))
   distributed by hash(k3) buckets 1
   properties('replication_num' = '1'); 
   ```
   Error: `Only key column can be partition column`
   
   But in duplicate key table, columns can be partition or distribution column
   even if they are not in duplicate keys.
   
   This bug is introduced by #3812 


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


[GitHub] [incubator-doris] morningman merged pull request #3916: [Bug] Can not use non-key column as partition column in duplicate table

Posted by GitBox <gi...@apache.org>.
morningman merged pull request #3916:
URL: https://github.com/apache/incubator-doris/pull/3916


   


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


[GitHub] [incubator-doris] morningman commented on a change in pull request #3916: [Bug] Can not use non-key column as partition column in duplicate table

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #3916:
URL: https://github.com/apache/incubator-doris/pull/3916#discussion_r443189982



##########
File path: fe/src/main/java/org/apache/doris/analysis/RangePartitionDesc.java
##########
@@ -145,9 +149,14 @@ public PartitionInfo toPartitionInfo(List<Column> schema, Map<String, Long> part
             boolean find = false;
             for (Column column : schema) {
                 if (column.getName().equalsIgnoreCase(colName)) {
-                    if (!column.isKey()) {
+                    if (!column.isKey() && column.getAggregationType() != AggregateType.NONE) {

Review comment:
       Historical issues...
   It is OK, may be removed in future.




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


[GitHub] [incubator-doris] EmmyMiao87 commented on a change in pull request #3916: [Bug] Can not use non-key column as partition column in duplicate table

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 commented on a change in pull request #3916:
URL: https://github.com/apache/incubator-doris/pull/3916#discussion_r443190547



##########
File path: fe/src/main/java/org/apache/doris/analysis/RangePartitionDesc.java
##########
@@ -145,9 +149,14 @@ public PartitionInfo toPartitionInfo(List<Column> schema, Map<String, Long> part
             boolean find = false;
             for (Column column : schema) {
                 if (column.getName().equalsIgnoreCase(colName)) {
-                    if (!column.isKey()) {
+                    if (!column.isKey() && column.getAggregationType() != AggregateType.NONE) {
                         throw new DdlException("Partition column[" + colName + "] is not key column");

Review comment:
       ```suggestion
                           throw new DdlException("The partition column could not be aggregated column");
   ```




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


[GitHub] [incubator-doris] EmmyMiao87 commented on a change in pull request #3916: [Bug] Can not use non-key column as partition column in duplicate table

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 commented on a change in pull request #3916:
URL: https://github.com/apache/incubator-doris/pull/3916#discussion_r443184920



##########
File path: fe/src/main/java/org/apache/doris/analysis/RangePartitionDesc.java
##########
@@ -71,9 +72,12 @@ public void analyze(List<ColumnDef> columnDefs, Map<String, String> otherPropert
             boolean found = false;
             for (ColumnDef columnDef : columnDefs) {
                 if (columnDef.getName().equals(partitionCol)) {
-                    if (!columnDef.isKey()) {
+                    if (!columnDef.isKey() && columnDef.getAggregateType() != AggregateType.NONE) {
                         throw new AnalysisException("Only key column can be partition column");

Review comment:
       ```suggestion
                           throw new AnalysisException("The partition column could not be aggregated column");
   ```

##########
File path: fe/src/main/java/org/apache/doris/analysis/RangePartitionDesc.java
##########
@@ -145,9 +149,14 @@ public PartitionInfo toPartitionInfo(List<Column> schema, Map<String, Long> part
             boolean find = false;
             for (Column column : schema) {
                 if (column.getName().equalsIgnoreCase(colName)) {
-                    if (!column.isKey()) {
+                    if (!column.isKey() && column.getAggregationType() != AggregateType.NONE) {

Review comment:
       Why does it need a second check here?




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