morrySnow commented on code in PR #26102: URL: https://github.com/apache/doris/pull/26102#discussion_r1379539894
########## fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/AlterMTMVInfo.java: ########## @@ -0,0 +1,58 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.nereids.trees.plans.commands.info; + +import org.apache.doris.catalog.Env; +import org.apache.doris.common.UserException; +import org.apache.doris.mysql.privilege.PrivPredicate; +import org.apache.doris.nereids.exceptions.AnalysisException; +import org.apache.doris.qe.ConnectContext; + +import java.util.Objects; + +/** + * MTMV info in alter MTMV. + */ +public abstract class AlterMTMVInfo { + protected final TableNameInfo mvName; + + /** + * constructor for alter MTMV + */ + public AlterMTMVInfo(TableNameInfo mvName) { + this.mvName = Objects.requireNonNull(mvName, "require mvName object"); + } + + /** + * analyze alter table info + */ + public void analyze(ConnectContext ctx) throws org.apache.doris.common.AnalysisException { + mvName.analyze(ctx); + if (!Env.getCurrentEnv().getAccessManager().checkTblPriv(ConnectContext.get(), mvName.getDb(), + mvName.getTbl(), PrivPredicate.ALTER)) { + throw new AnalysisException("Access denied"); Review Comment: this exception msg should use same format with query priv check ########## fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/AlterMTMVInfo.java: ########## @@ -0,0 +1,58 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.nereids.trees.plans.commands.info; + +import org.apache.doris.catalog.Env; +import org.apache.doris.common.UserException; +import org.apache.doris.mysql.privilege.PrivPredicate; +import org.apache.doris.nereids.exceptions.AnalysisException; +import org.apache.doris.qe.ConnectContext; + +import java.util.Objects; + +/** + * MTMV info in alter MTMV. + */ +public abstract class AlterMTMVInfo { + protected final TableNameInfo mvName; + + /** + * constructor for alter MTMV + */ + public AlterMTMVInfo(TableNameInfo mvName) { + this.mvName = Objects.requireNonNull(mvName, "require mvName object"); + } + + /** + * analyze alter table info + */ + public void analyze(ConnectContext ctx) throws org.apache.doris.common.AnalysisException { Review Comment: do not throw org.apache.doris.common.AnalysisException, u should catch it and throw Nereids' AnalysisException ########## fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java: ########## @@ -0,0 +1,81 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.nereids.trees.plans.commands.info; + +import org.apache.doris.mtmv.EnvInfo; +import org.apache.doris.mtmv.MTMVRefreshInfo; +import org.apache.doris.nereids.trees.plans.logical.LogicalPlan; +import org.apache.doris.nereids.util.Utils; +import org.apache.doris.qe.ConnectContext; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * MTMV info in creating MTMV. + */ +public class CreateMTMVInfo { + private final boolean ifNotExists; + private final TableNameInfo mvName; + private List<String> keys; + private final String comment; + private final DistributionDescriptor distribution; + private Map<String, String> properties; Review Comment: tableProperties? ########## fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java: ########## @@ -0,0 +1,81 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.nereids.trees.plans.commands.info; + +import org.apache.doris.mtmv.EnvInfo; +import org.apache.doris.mtmv.MTMVRefreshInfo; +import org.apache.doris.nereids.trees.plans.logical.LogicalPlan; +import org.apache.doris.nereids.util.Utils; +import org.apache.doris.qe.ConnectContext; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * MTMV info in creating MTMV. + */ +public class CreateMTMVInfo { + private final boolean ifNotExists; + private final TableNameInfo mvName; + private List<String> keys; + private final String comment; + private final DistributionDescriptor distribution; + private Map<String, String> properties; Review Comment: if it could be null, use Optional<Map<String, String>> instead ########## fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4: ########## @@ -328,6 +328,7 @@ LOCATION: 'LOCATION'; LOCK: 'LOCK'; LOGICAL: 'LOGICAL'; LOW_PRIORITY: 'LOW_PRIORITY'; +MANUAL: 'MANUAL'; Review Comment: new keyword should add to non-reserved keyword list ########## fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/AlterMTMVPropertyInfo.java: ########## @@ -0,0 +1,53 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.nereids.trees.plans.commands.info; + +import org.apache.doris.common.AnalysisException; +import org.apache.doris.common.UserException; +import org.apache.doris.qe.ConnectContext; + +import java.util.Map; +import java.util.Objects; + +/** + * rename + */ +public class AlterMTMVPropertyInfo extends AlterMTMVInfo { + private final Map<String, String> properties; + + /** + * constructor for alter MTMV + */ + public AlterMTMVPropertyInfo(TableNameInfo mvName, Map<String, String> properties) { + super(mvName); + this.properties = Objects.requireNonNull(properties, "require properties object"); + } + + public void analyze(ConnectContext ctx) throws AnalysisException { Review Comment: do not throw org.apache.doris.common.AnalysisException -- 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]
