[GitHub] [incubator-doris] morningman commented on a change in pull request #1823: Add a ALTER operation to change distribution type from RANDOM to HASH

2019-09-18 Thread GitBox
morningman commented on a change in pull request #1823: Add a ALTER operation 
to change distribution type from RANDOM to HASH
URL: https://github.com/apache/incubator-doris/pull/1823#discussion_r325493929
 
 

 ##
 File path: 
fe/src/main/java/org/apache/doris/analysis/ModifyTablePropertiesClause.java
 ##
 @@ -46,31 +39,24 @@ public void analyze(Analyzer analyzer) throws 
AnalysisException {
 throw new AnalysisException("Properties is not set");
 }
 
-if (properties.size() == 1 && 
properties.containsKey(KEY_COLOCATE_WITH)) {
-if (Config.disable_colocate_join) {
-throw new AnalysisException("Colocate table is disabled by 
Admin");
-}
-
-if (!Catalog.getCurrentCatalog().getAuth().checkDbPriv(
-ConnectContext.get(), ConnectContext.get().getDatabase(), 
PrivPredicate.ALTER)) {
-
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
-"ALTER");
-}
-} else if 
(!Catalog.getCurrentCatalog().getAuth().checkGlobalPriv(ConnectContext.get(), 
PrivPredicate.ALTER)) {
-
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
-"ALTER");
+if (properties.size() != 1) {
 
 Review comment:
   Privilege is already checked in AlterStmt, here is redundant


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


With regards,
Apache Git Services

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



[GitHub] [incubator-doris] morningman commented on a change in pull request #1823: Add a ALTER operation to change distribution type from RANDOM to HASH

2019-09-17 Thread GitBox
morningman commented on a change in pull request #1823: Add a ALTER operation 
to change distribution type from RANDOM to HASH
URL: https://github.com/apache/incubator-doris/pull/1823#discussion_r325493356
 
 

 ##
 File path: docs/documentation/cn/sql-reference/sql-statements/Data 
Definition/ALTER TABLE.md
 ##
 @@ -232,7 +232,12 @@
 PROPERTIES ("bloom_filter_columns"="k1,k2,k3");
 
 12. 修改表的Colocate 属性
-ALTER TABLE example_db.my_table set ("colocate_with"="t1");
+
+ALTER TABLE example_db.my_table set ("colocate_with" = "t1");
+
+13. 将表的分桶方式由 Random Distribution 改为 Hash Distribution
 
 Review comment:
   I thought about convert it when saving meta image or loading meta image.
   But it is very easy to forget to modify someplace, especially when replaying 
some edit logs related to distribution.
   
   So I think using a command and handle it like a alter table job is more 
safety.


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


With regards,
Apache Git Services

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



[GitHub] [incubator-doris] morningman commented on a change in pull request #1823: Add a ALTER operation to change distribution type from RANDOM to HASH

2019-09-17 Thread GitBox
morningman commented on a change in pull request #1823: Add a ALTER operation 
to change distribution type from RANDOM to HASH
URL: https://github.com/apache/incubator-doris/pull/1823#discussion_r325492314
 
 

 ##
 File path: fe/src/main/java/org/apache/doris/catalog/OlapTable.java
 ##
 @@ -1115,4 +1115,20 @@ public int getKeysNum() {
 }
 return keysNum;
 }
+
+public boolean convertRandomDistributionToHashDistribution() {
+boolean hasChanged = false;
+List baseSchema = indexIdToSchema.get(baseIndexId);
+if (defaultDistributionInfo.getType() == DistributionInfoType.RANDOM) {
+defaultDistributionInfo = ((RandomDistributionInfo) 
defaultDistributionInfo).toHashDistributionInfo(baseSchema);
+hasChanged = true;
+}
+
+for (Partition partition : idToPartition.values()) {
+if 
(partition.convertRandomDistributionToHashDistribution(baseSchema)) {
 
 Review comment:
   I don't know, just for safety...


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


With regards,
Apache Git Services

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