Modified: hive/branches/cbo/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/CreateTableHook.java URL: http://svn.apache.org/viewvc/hive/branches/cbo/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/CreateTableHook.java?rev=1610806&r1=1610805&r2=1610806&view=diff ============================================================================== --- hive/branches/cbo/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/CreateTableHook.java (original) +++ hive/branches/cbo/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/CreateTableHook.java Tue Jul 15 18:50:51 2014 @@ -30,8 +30,6 @@ import org.apache.hadoop.hive.conf.HiveC import org.apache.hadoop.hive.metastore.api.FieldSchema; import org.apache.hadoop.hive.ql.exec.DDLTask; import org.apache.hadoop.hive.ql.exec.Task; -import org.apache.hadoop.hive.ql.io.RCFileInputFormat; -import org.apache.hadoop.hive.ql.io.RCFileOutputFormat; import org.apache.hadoop.hive.ql.metadata.Hive; import org.apache.hadoop.hive.ql.metadata.HiveException; import org.apache.hadoop.hive.ql.metadata.HiveStorageHandler; @@ -41,6 +39,7 @@ import org.apache.hadoop.hive.ql.parse.B import org.apache.hadoop.hive.ql.parse.HiveParser; import org.apache.hadoop.hive.ql.parse.HiveSemanticAnalyzerHookContext; import org.apache.hadoop.hive.ql.parse.SemanticException; +import org.apache.hadoop.hive.ql.parse.StorageFormat; import org.apache.hadoop.hive.ql.plan.CreateTableDesc; import org.apache.hadoop.hive.ql.security.authorization.Privilege; import org.apache.hive.hcatalog.common.HCatConstants; @@ -66,14 +65,20 @@ final class CreateTableHook extends HCat // Analyze and create tbl properties object int numCh = ast.getChildCount(); - String inputFormat = null, outputFormat = null; tableName = BaseSemanticAnalyzer.getUnescapedName((ASTNode) ast .getChild(0)); boolean likeTable = false; + StorageFormat format = new StorageFormat(context.getConf()); for (int num = 1; num < numCh; num++) { ASTNode child = (ASTNode) ast.getChild(num); - + if (format.fillStorageFormat(child)) { + if (org.apache.commons.lang.StringUtils + .isNotEmpty(format.getStorageHandler())) { + return ast; + } + continue; + } switch (child.getToken().getType()) { case HiveParser.TOK_QUERY: // CTAS @@ -84,17 +89,6 @@ final class CreateTableHook extends HCat case HiveParser.TOK_TABLEBUCKETS: break; - case HiveParser.TOK_TBLSEQUENCEFILE: - inputFormat = HCatConstants.SEQUENCEFILE_INPUT; - outputFormat = HCatConstants.SEQUENCEFILE_OUTPUT; - break; - - case HiveParser.TOK_TBLTEXTFILE: - inputFormat = org.apache.hadoop.mapred.TextInputFormat.class.getName(); - outputFormat = org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat.class.getName(); - - break; - case HiveParser.TOK_LIKETABLE: likeTable = true; break; @@ -125,43 +119,14 @@ final class CreateTableHook extends HCat } } break; - - case HiveParser.TOK_STORAGEHANDLER: - String storageHandler = BaseSemanticAnalyzer - .unescapeSQLString(child.getChild(0).getText()); - if (org.apache.commons.lang.StringUtils - .isNotEmpty(storageHandler)) { - return ast; - } - - break; - - case HiveParser.TOK_TABLEFILEFORMAT: - if (child.getChildCount() < 2) { - throw new SemanticException( - "Incomplete specification of File Format. " + - "You must provide InputFormat, OutputFormat."); - } - inputFormat = BaseSemanticAnalyzer.unescapeSQLString(child - .getChild(0).getText()); - outputFormat = BaseSemanticAnalyzer.unescapeSQLString(child - .getChild(1).getText()); - break; - - case HiveParser.TOK_TBLRCFILE: - inputFormat = RCFileInputFormat.class.getName(); - outputFormat = RCFileOutputFormat.class.getName(); - break; - } } - if (!likeTable && (inputFormat == null || outputFormat == null)) { + if (!likeTable && (format.getInputFormat() == null || format.getOutputFormat() == null)) { throw new SemanticException( "STORED AS specification is either incomplete or incorrect."); } - return ast; }
Modified: hive/branches/cbo/itests/hive-unit/src/test/java/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java URL: http://svn.apache.org/viewvc/hive/branches/cbo/itests/hive-unit/src/test/java/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java?rev=1610806&r1=1610805&r2=1610806&view=diff ============================================================================== --- hive/branches/cbo/itests/hive-unit/src/test/java/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java (original) +++ hive/branches/cbo/itests/hive-unit/src/test/java/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java Tue Jul 15 18:50:51 2014 @@ -19,7 +19,7 @@ package org.apache.hadoop.hive.jdbc; import static org.apache.hadoop.hive.ql.exec.ExplainTask.EXPL_COLUMN_NAME; -import static org.apache.hadoop.hive.ql.processors.SetProcessor.SET_COLUMN_NAME; +import static org.apache.hadoop.hive.conf.SystemVariables.SET_COLUMN_NAME; import java.sql.Connection; import java.sql.DatabaseMetaData; Modified: hive/branches/cbo/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestAuthorizationApiAuthorizer.java URL: http://svn.apache.org/viewvc/hive/branches/cbo/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestAuthorizationApiAuthorizer.java?rev=1610806&r1=1610805&r2=1610806&view=diff ============================================================================== --- hive/branches/cbo/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestAuthorizationApiAuthorizer.java (original) +++ hive/branches/cbo/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestAuthorizationApiAuthorizer.java Tue Jul 15 18:50:51 2014 @@ -145,7 +145,7 @@ public abstract class TestAuthorizationA FunctionInvoker invoker = new FunctionInvoker() { @Override public void invoke() throws Exception { - msc.revoke_role(null, null, null); + msc.revoke_role(null, null, null, false); } }; testFunction(invoker); Modified: hive/branches/cbo/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java URL: http://svn.apache.org/viewvc/hive/branches/cbo/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java?rev=1610806&r1=1610805&r2=1610806&view=diff ============================================================================== --- hive/branches/cbo/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java (original) +++ hive/branches/cbo/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java Tue Jul 15 18:50:51 2014 @@ -19,7 +19,7 @@ package org.apache.hive.jdbc; import static org.apache.hadoop.hive.ql.exec.ExplainTask.EXPL_COLUMN_NAME; -import static org.apache.hadoop.hive.ql.processors.SetProcessor.SET_COLUMN_NAME; +import static org.apache.hadoop.hive.conf.SystemVariables.SET_COLUMN_NAME; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -1888,7 +1888,7 @@ public class TestJdbcDriver2 { */ @Test public void testFetchFirstSetCmds() throws Exception { - execFetchFirst("set -v", SetProcessor.SET_COLUMN_NAME, false); + execFetchFirst("set -v", SET_COLUMN_NAME, false); } /** Modified: hive/branches/cbo/jdbc/pom.xml URL: http://svn.apache.org/viewvc/hive/branches/cbo/jdbc/pom.xml?rev=1610806&r1=1610805&r2=1610806&view=diff ============================================================================== --- hive/branches/cbo/jdbc/pom.xml (original) +++ hive/branches/cbo/jdbc/pom.xml Tue Jul 15 18:50:51 2014 @@ -121,6 +121,7 @@ <goal>shade</goal> </goals> <configuration> + <minimizeJar>true</minimizeJar> <shadedArtifactAttached>true</shadedArtifactAttached> <shadedClassifierName>${hive.jdbc.driver.classifier}</shadedClassifierName> <artifactSet> Modified: hive/branches/cbo/metastore/if/hive_metastore.thrift URL: http://svn.apache.org/viewvc/hive/branches/cbo/metastore/if/hive_metastore.thrift?rev=1610806&r1=1610805&r2=1610806&view=diff ============================================================================== --- hive/branches/cbo/metastore/if/hive_metastore.thrift (original) +++ hive/branches/cbo/metastore/if/hive_metastore.thrift Tue Jul 15 18:50:51 2014 @@ -101,6 +101,11 @@ enum CompactionType { MAJOR = 2, } +enum GrantRevokeType { + GRANT = 1, + REVOKE = 2, +} + struct HiveObjectRef{ 1: HiveObjectType objectType, 2: string dbName, @@ -168,6 +173,20 @@ struct GetPrincipalsInRoleResponse { 1: required list<RolePrincipalGrant> principalGrants; } +struct GrantRevokeRoleRequest { + 1: GrantRevokeType requestType; + 2: string roleName; + 3: string principalName; + 4: PrincipalType principalType; + 5: optional string grantor; // Needed for grant + 6: optional PrincipalType grantorType; // Needed for grant + 7: optional bool grantOption; +} + +struct GrantRevokeRoleResponse { + 1: optional bool success; +} + // namespace for tables struct Database { 1: string name, @@ -958,11 +977,14 @@ service ThriftHiveMetastore extends fb30 bool create_role(1:Role role) throws(1:MetaException o1) bool drop_role(1:string role_name) throws(1:MetaException o1) list<string> get_role_names() throws(1:MetaException o1) + // Deprecated, use grant_revoke_role() bool grant_role(1:string role_name, 2:string principal_name, 3:PrincipalType principal_type, 4:string grantor, 5:PrincipalType grantorType, 6:bool grant_option) throws(1:MetaException o1) + // Deprecated, use grant_revoke_role() bool revoke_role(1:string role_name, 2:string principal_name, 3:PrincipalType principal_type) throws(1:MetaException o1) list<Role> list_roles(1:string principal_name, 2:PrincipalType principal_type) throws(1:MetaException o1) + GrantRevokeRoleResponse grant_revoke_role(1:GrantRevokeRoleRequest request) throws(1:MetaException o1) // get all role-grants for users/roles that have been granted the given role // Note that in the returned list of RolePrincipalGrants, the roleName is
