Index: ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java (revision 1722) +++ ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java (working copy) @@ -30,6 +30,8 @@ import org.apache.hadoop.hive.ql.metadata.Hive; import org.apache.hadoop.hive.ql.metadata.HiveException; import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.ql.authorization.Authorizer; +import org.apache.hadoop.hive.ql.authorization.GenericAuthorizer; import org.apache.hadoop.hive.ql.exec.Utilities; import org.apache.hadoop.hive.ql.history.HiveHistory; @@ -59,6 +61,8 @@ */ protected Hive db; + protected Authorizer authorizer; + /* * HiveHistory Object */ @@ -96,11 +100,14 @@ public SessionState (HiveConf conf, Hive db) { this.conf = conf; this.db = db; + this.authorizer = new GenericAuthorizer(db); for(HiveConf.ConfVars oneVar: HiveConf.metaVars) { dbOptions.put(oneVar, conf.getVar(oneVar)); } } + + public Authorizer getAuthorizer() { return authorizer; } /** * cached values of such options Index: ql/src/java/org/apache/hadoop/hive/ql/exec/Task.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/exec/Task.java (revision 1722) +++ ql/src/java/org/apache/hadoop/hive/ql/exec/Task.java (working copy) @@ -21,6 +21,7 @@ import java.io.*; import java.util.*; import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.ql.authorization.Authorizer; import org.apache.hadoop.hive.ql.metadata.Hive; import org.apache.hadoop.hive.ql.metadata.HiveException; import org.apache.hadoop.hive.ql.session.SessionState; @@ -41,6 +42,7 @@ transient boolean isdone; transient protected HiveConf conf; transient protected Hive db; + transient protected Authorizer authorizer; transient protected Log LOG; transient protected LogHelper console; @@ -63,9 +65,11 @@ if (ss == null) { // test case - no session setup perhaps db = Hive.get(conf); + // TODO: find authorizer here } else { // normal case - session has handle to db db = ss.getDb(); + authorizer = ss.getAuthorizer(); } } catch (HiveException e) { // Bail out ungracefully - we should never hit Index: ql/src/java/org/apache/hadoop/hive/ql/exec/TaskFactory.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/exec/TaskFactory.java (revision 1722) +++ ql/src/java/org/apache/hadoop/hive/ql/exec/TaskFactory.java (working copy) @@ -49,6 +49,7 @@ taskvec.add(new taskTuple(FunctionWork.class, FunctionTask.class)); taskvec.add(new taskTuple(explainWork.class, ExplainTask.class)); taskvec.add(new taskTuple(ConditionalWork.class, ConditionalTask.class)); + taskvec.add(new taskTuple(UserWork.class, UserTask.class)); // we are taking this out to allow us to instantiate either MapRedTask or // ExecDriver dynamically at run time based on configuration // taskvec.add(new taskTuple(mapredWork.class, ExecDriver.class)); Index: ql/src/java/org/apache/hadoop/hive/ql/exec/UserTask.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/exec/UserTask.java (revision 0) +++ ql/src/java/org/apache/hadoop/hive/ql/exec/UserTask.java (revision 0) @@ -0,0 +1,57 @@ +/** + * 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.hadoop.hive.ql.exec; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.hive.ql.authorization.Privilege; +import org.apache.hadoop.hive.ql.plan.UserWork; +import org.apache.hadoop.hive.ql.plan.createUserDesc; +import org.apache.hadoop.hive.ql.plan.dropUserDesc; + +public class UserTask extends Task { + private static final long serialVersionUID = 1L; + private static final Log LOG = LogFactory.getLog("hive.ql.exec.UserTask"); + + @Override + public int execute() { + createUserDesc createUserDesc = work.getCreateUserDesc(); + if (createUserDesc != null) { + return createUser(createUserDesc); + } + + dropUserDesc dropUserDesc = work.getDropUserDesc(); + if (dropUserDesc != null) { + return dropUser(dropUserDesc); + } + return 0; + } + + private int createUser(createUserDesc createUserDesc) { + if(!authorizer.authorize(Privilege.CREATE_USER_PRIV)) + return 1; + return 0; + } + + private int dropUser(dropUserDesc dropUserDesc) { + if(!authorizer.authorize(Privilege.CREATE_USER_PRIV)) + return 1; + return 0; + } +} Index: ql/src/java/org/apache/hadoop/hive/ql/plan/createUserDesc.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/plan/createUserDesc.java (revision 0) +++ ql/src/java/org/apache/hadoop/hive/ql/plan/createUserDesc.java (revision 0) @@ -0,0 +1,54 @@ +/** + * 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.hadoop.hive.ql.plan; + +import java.io.Serializable; +import java.util.List; + +@explain(displayName="Create User") +public class createUserDesc implements Serializable { + private static final long serialVersionUID = 1L; + + private List userNames; + private List passwords; + + public createUserDesc(List userNames, List passwords) { + this.userNames = userNames; + this.passwords = passwords; + } + + @explain(displayName="list of username") + public List getUserNames() { + return userNames; + } + + public void setUserNames(List userNames) { + this.userNames = userNames; + } + + @explain(displayName="list of password") + public List getPasswords() { + return passwords; + } + + public void setPasswords(List passwords) { + this.passwords = passwords; + } + +} Index: ql/src/java/org/apache/hadoop/hive/ql/plan/dropUserDesc.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/plan/dropUserDesc.java (revision 0) +++ ql/src/java/org/apache/hadoop/hive/ql/plan/dropUserDesc.java (revision 0) @@ -0,0 +1,43 @@ +/** + * 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.hadoop.hive.ql.plan; + +import java.io.Serializable; +import java.util.List; + +@explain(displayName="Drop User") +public class dropUserDesc implements Serializable { + private static final long serialVersionUID = 1L; + + private List userNames; + + public dropUserDesc(List userNames) { + this.userNames = userNames; + } + + @explain(displayName="list of username") + public List getUserNames() { + return userNames; + } + + public void setUserNames(List userNames) { + this.userNames = userNames; + } + +} Index: ql/src/java/org/apache/hadoop/hive/ql/plan/UserWork.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/plan/UserWork.java (revision 0) +++ ql/src/java/org/apache/hadoop/hive/ql/plan/UserWork.java (revision 0) @@ -0,0 +1,50 @@ +/** + * 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.hadoop.hive.ql.plan; + +import java.io.Serializable; + +public class UserWork implements Serializable { + private static final long serialVersionUID = 1L; + private createUserDesc createUserDesc; + private dropUserDesc dropUserDesc; + + public UserWork(createUserDesc createUserDesc) { + this.createUserDesc = createUserDesc; + } + + public UserWork(dropUserDesc dropUserDesc) { + this.dropUserDesc = dropUserDesc; + } + + public createUserDesc getCreateUserDesc() { + return createUserDesc; + } + public void setCreateUserDesc(createUserDesc createUserDesc) { + this.createUserDesc = createUserDesc; + } + + public dropUserDesc getDropUserDesc() { + return dropUserDesc; + } + public void setDropUserDesc(dropUserDesc dropUserDesc) { + this.dropUserDesc = dropUserDesc; + } + +} Index: ql/src/java/org/apache/hadoop/hive/ql/authorization/Privilege.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/authorization/Privilege.java (revision 0) +++ ql/src/java/org/apache/hadoop/hive/ql/authorization/Privilege.java (revision 0) @@ -0,0 +1,29 @@ +/** + * 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.hadoop.hive.ql.authorization; + +public enum Privilege { + SELECT_PRIV, + INSERT_PRIV, + CREATE_PRIV, + DROP_PRIV, + GRANT_PRIV, + ALTER_PRIV, + CREATE_USER_PRIV, + SUPER_PRIV +} Index: ql/src/java/org/apache/hadoop/hive/ql/authorization/GenericAuthorizer.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/authorization/GenericAuthorizer.java (revision 0) +++ ql/src/java/org/apache/hadoop/hive/ql/authorization/GenericAuthorizer.java (revision 0) @@ -0,0 +1,49 @@ +/** + * 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.hadoop.hive.ql.authorization; + +import org.apache.hadoop.hive.ql.metadata.Hive; +import org.apache.hadoop.hive.ql.metadata.Table; + +/** + * + */ +public class GenericAuthorizer implements Authorizer { + private Hive hive; + + public GenericAuthorizer(Hive hive) { + this.hive = hive; + } + + public boolean authorize(Privilege privilege) { + return false; + } + + public boolean authorize(Privilege[] privilege, Table table) { + return false; + } + + public boolean authorize(Privilege[] privilege, Table table, boolean isOr) { + return false; + } + + public boolean authorize(Privilege privilege, Table[] table) { + return false; + } + +} Index: ql/src/java/org/apache/hadoop/hive/ql/authorization/Authorizer.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/authorization/Authorizer.java (revision 0) +++ ql/src/java/org/apache/hadoop/hive/ql/authorization/Authorizer.java (revision 0) @@ -0,0 +1,36 @@ +/** + * 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.hadoop.hive.ql.authorization; + +import org.apache.hadoop.hive.ql.metadata.Table; + +/** + * The Authorizer verifies a connected user has the authorization + * to perform a requested database operation using the current + * connection. + */ +public interface Authorizer { + + public boolean authorize(Privilege privilege); + + public boolean authorize(Privilege[] privilege, Table table); + + public boolean authorize(Privilege[] privilege, Table table, boolean isOr); + + public boolean authorize(Privilege privilege, Table[] table); +} Index: ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g (revision 1722) +++ ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g (working copy) @@ -137,6 +137,23 @@ TOK_HINTARGLIST; TOK_USERSCRIPTCOLNAMES; TOK_USERSCRIPTCOLSCHEMA; +TOK_CREATEUSER; +TOK_DROPUSER; +TOK_USER; +TOK_USRLIST; +TOK_ALLTABLEREF; +TOK_GRANT; +TOK_REVOKE; +TOK_PRIVLIST; +TOK_PRIVALL; +TOK_PRIVSEL; +TOK_PRIVINS; +TOK_PRIVCRT; +TOK_PRIVALT; +TOK_PRIVDROP; +TOK_PRIVCREATEUSER; +TOK_PRIVGRANT; +TOK_WITHOPTS; } @@ -176,6 +193,7 @@ : queryStatementExpression | loadStatement | ddlStatement + | dclStatement ; loadStatement @@ -196,8 +214,17 @@ | metastoreCheck | createFunctionStatement | dropFunctionStatement + | createUserStatement + | dropUserStatement ; +dclStatement +@init { msgs.push("dcl statement"); } +@after { msgs.pop(); } + : grantStatement + | revokeStatement + ; + ifNotExists @init { msgs.push("if not exists clause"); } @after { msgs.pop(); } @@ -337,6 +364,27 @@ -> ^(TOK_DROPFUNCTION Identifier) ; +createUserStatement +@init { msgs.push("create user statement"); } +@after { msgs.pop(); } + : KW_CREATE KW_USER userItem (COMMA userItem)* + -> ^(TOK_CREATEUSER userItem+) + ; + +userItem +@init { msgs.push("user item"); } +@after { msgs.pop(); } + : (Identifier (KW_IDENTIFIED KW_BY StringLiteral)?) + -> ^(TOK_USER Identifier StringLiteral?) + ; + +dropUserStatement +@init { msgs.push("drop user statement"); } +@after { msgs.pop(); } + : KW_DROP KW_USER Identifier (COMMA Identifier)* + -> ^(TOK_DROPUSER Identifier+) + ; + showStmtIdentifier @init { msgs.push("identifier for show statement"); } @after { msgs.pop(); } @@ -1147,6 +1195,60 @@ Identifier EQUAL constant -> ^(TOK_PARTVAL Identifier constant) ; +//------------------------------------ Rules for DCL ------------------------------------- + +grantStatement +@init { msgs.push("grant statement"); } +@after { msgs.pop(); } + : + KW_GRANT privilegeList KW_ON grantRevokeTarget KW_TO userList (KW_WITH withOptionList)? + -> ^(TOK_GRANT privilegeList grantRevokeTarget userList withOptionList?) + ; + +privilegeList +@init { msgs.push("privilege list"); } +@after { msgs.pop(); } + : privilegeType (COMMA privilegeType)* -> ^(TOK_PRIVLIST privilegeType+) + ; + +privilegeType + : KW_ALL KW_PRIVILEGES? -> TOK_PRIVALL + | KW_SELECT -> TOK_PRIVSEL + | KW_INSERT -> TOK_PRIVINS + | KW_CREATE -> TOK_PRIVCRT + | KW_ALTER -> TOK_PRIVALT + | KW_DROP -> TOK_PRIVDROP + | KW_CREATE KW_USER -> TOK_PRIVCREATEUSER + | KW_GRANT KW_OPTION -> TOK_PRIVGRANT + ; + +userList +@init { msgs.push("user list"); } +@after { msgs.pop(); } + : userItem (COMMA userItem)* -> ^(TOK_USRLIST userItem+) + ; + +grantRevokeTarget + : STAR -> TOK_ALLTABLEREF + | Identifier + ; + +withOptionList + : withOption (COMMA withOption)* -> ^(TOK_WITHOPTS withOption+) + ; + +withOption + : KW_GRANT KW_OPTION -> TOK_PRIVGRANT + ; + +revokeStatement +@init { msgs.push("revoke statement"); } +@after { msgs.pop(); } + : + KW_REVOKE privilegeList KW_ON grantRevokeTarget KW_FROM userList + -> ^(TOK_REVOKE privilegeList grantRevokeTarget userList) + ; + // Keywords KW_TRUE : 'TRUE'; KW_FALSE : 'FALSE'; @@ -1307,6 +1409,11 @@ KW_CONTINUE: 'CONTINUE'; KW_CURSOR: 'CURSOR'; KW_TRIGGER: 'TRIGGER'; +KW_USER: 'USER'; +KW_IDENTIFIED: 'IDENTIFIED'; +KW_PASSWORD: 'PASSWORD'; +KW_OPTION: 'OPTION'; +KW_PRIVILEGES: 'PRIVILEGES'; // Operators Index: ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java (revision 1722) +++ ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java (working copy) @@ -50,6 +50,12 @@ case HiveParser.TOK_CREATEFUNCTION: case HiveParser.TOK_DROPFUNCTION: return new FunctionSemanticAnalyzer(conf); + case HiveParser.TOK_CREATEUSER: + case HiveParser.TOK_DROPUSER: + return new UserSemanticAnalyzer(conf); + case HiveParser.TOK_GRANT: + case HiveParser.TOK_REVOKE: + return new DCLSemanticAnalyzer(conf); default: return new SemanticAnalyzer(conf); } } Index: ql/src/java/org/apache/hadoop/hive/ql/parse/UserSemanticAnalyzer.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/parse/UserSemanticAnalyzer.java (revision 0) +++ ql/src/java/org/apache/hadoop/hive/ql/parse/UserSemanticAnalyzer.java (revision 0) @@ -0,0 +1,75 @@ +/** + * 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.hadoop.hive.ql.parse; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.ql.exec.TaskFactory; +import org.apache.hadoop.hive.ql.plan.UserWork; +import org.apache.hadoop.hive.ql.plan.createUserDesc; +import org.apache.hadoop.hive.ql.plan.dropUserDesc; + +public class UserSemanticAnalyzer extends BaseSemanticAnalyzer { + private static final Log LOG = + LogFactory.getLog("hive.ql.parse.UserSemanticAnalyzer"); + + public UserSemanticAnalyzer(HiveConf conf) throws SemanticException { + super(conf); + } + + public void analyzeInternal(ASTNode ast) throws SemanticException { + if (ast.getToken().getType() == HiveParser.TOK_CREATEUSER) + analyzeCreateUser(ast); + if (ast.getToken().getType() == HiveParser.TOK_DROPUSER) + analyzeDropUser(ast); + + LOG.info("analyze done"); + } + + private void analyzeCreateUser(ASTNode ast) + throws SemanticException { + List userNames = new ArrayList(); + List passwords = new ArrayList(); + for (int i = 0; i < ast.getChildCount(); ++i) { + ASTNode child = (ASTNode) ast.getChild(i); + userNames.add(child.getChild(0).getText()); + if(child.getChild(1) != null) + passwords.add(child.getChild(1).getText()); + else + passwords.add(""); + } + createUserDesc desc = new createUserDesc(userNames, passwords); + rootTasks.add(TaskFactory.get(new UserWork(desc), conf)); + } + + private void analyzeDropUser(ASTNode ast) + throws SemanticException { + List userNames = new ArrayList(); + for (int i = 0; i < ast.getChildCount(); ++i) { + ASTNode child = (ASTNode) ast.getChild(i); + userNames.add(child.getChild(0).getText()); + } + dropUserDesc desc = new dropUserDesc(userNames); + rootTasks.add(TaskFactory.get(new UserWork(desc), conf));; + } +} Index: ql/src/java/org/apache/hadoop/hive/ql/parse/DCLSemanticAnalyzer.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/parse/DCLSemanticAnalyzer.java (revision 0) +++ ql/src/java/org/apache/hadoop/hive/ql/parse/DCLSemanticAnalyzer.java (revision 0) @@ -0,0 +1,56 @@ +/** + * 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.hadoop.hive.ql.parse; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.ql.Context; +import org.apache.hadoop.hive.ql.exec.TaskFactory; +import org.apache.hadoop.hive.ql.plan.FunctionWork; +import org.apache.hadoop.hive.ql.plan.createFunctionDesc; +import org.apache.hadoop.hive.ql.plan.dropFunctionDesc; + +public class DCLSemanticAnalyzer extends BaseSemanticAnalyzer { + private static final Log LOG = + LogFactory.getLog("hive.ql.parse.DCLSemanticAnalyzer"); + + public DCLSemanticAnalyzer(HiveConf conf) throws SemanticException { + super(conf); + } + + public void analyzeInternal(ASTNode ast) throws SemanticException { + if (ast.getToken().getType() == HiveParser.TOK_GRANT) + analyzeGrant(ast); + if (ast.getToken().getType() == HiveParser.TOK_REVOKE) + analyzeRevoke(ast); + + LOG.info("analyze done"); + } + + private void analyzeGrant(ASTNode ast) + throws SemanticException { + // TODO: implement GRANT statement + } + + private void analyzeRevoke(ASTNode ast) + throws SemanticException { + // TODO: implement REVOKE statement + } +}