diff --git hcatalog/core/src/test/java/org/apache/hive/hcatalog/common/TestHCatUtil.java hcatalog/core/src/test/java/org/apache/hive/hcatalog/common/TestHCatUtil.java index 91aa4fa269..457b90685b 100644 --- hcatalog/core/src/test/java/org/apache/hive/hcatalog/common/TestHCatUtil.java +++ hcatalog/core/src/test/java/org/apache/hive/hcatalog/common/TestHCatUtil.java @@ -123,7 +123,7 @@ public void testGetTableSchemaWithPtnColsApi() throws IOException { "org.apache.hadoop.mapred.TextOutputFormat", false, -1, new SerDeInfo(), new ArrayList(), new ArrayList(), new HashMap()); org.apache.hadoop.hive.metastore.api.Table apiTable = - new org.apache.hadoop.hive.metastore.api.Table("test_tblname", "test_dbname", "test_owner", + new org.apache.hadoop.hive.metastore.api.Table(1, "test_tblname", "test_dbname", "test_owner", 0, 0, 0, sd, new ArrayList(), new HashMap(), "viewOriginalText", "viewExpandedText", TableType.EXTERNAL_TABLE.name()); Table table = new Table(apiTable); @@ -168,7 +168,7 @@ public void testGetTableSchemaWithPtnColsSerDeReportedFields() throws IOExceptio new HashMap()); org.apache.hadoop.hive.metastore.api.Table apiTable = - new org.apache.hadoop.hive.metastore.api.Table("test_tblname", "test_dbname", "test_owner", + new org.apache.hadoop.hive.metastore.api.Table(1, "test_tblname", "test_dbname", "test_owner", 0, 0, 0, sd, new ArrayList(), new HashMap(), "viewOriginalText", "viewExpandedText", TableType.EXTERNAL_TABLE.name()); Table table = new Table(apiTable); diff --git itests/hcatalog-unit/src/test/java/org/apache/hive/hcatalog/listener/TestDbNotificationListener.java itests/hcatalog-unit/src/test/java/org/apache/hive/hcatalog/listener/TestDbNotificationListener.java index 82429e36a5..c7956a3e67 100644 --- itests/hcatalog-unit/src/test/java/org/apache/hive/hcatalog/listener/TestDbNotificationListener.java +++ itests/hcatalog-unit/src/test/java/org/apache/hive/hcatalog/listener/TestDbNotificationListener.java @@ -400,7 +400,7 @@ public void createTable() throws Exception { new StorageDescriptor(cols, serdeLocation, "input", "output", false, 0, serde, null, null, emptyParameters); Table table = - new Table(tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, null, + new Table(1, tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, null, emptyParameters, null, null, TableType.MANAGED_TABLE.toString()); msClient.createTable(table); @@ -427,7 +427,7 @@ public void createTable() throws Exception { // When hive.metastore.transactional.event.listeners is set, // a failed event should not create a new notification table = - new Table(tblName2, defaultDbName, tblOwner, startTime, startTime, 0, sd, null, + new Table(1, tblName2, defaultDbName, tblOwner, startTime, startTime, 0, sd, null, emptyParameters, null, null, null); DummyRawStoreFailEvent.setEventSucceed(false); try { @@ -455,14 +455,14 @@ public void alterTable() throws Exception { new StorageDescriptor(cols, serdeLocation, "input", "output", false, 0, serde, null, null, emptyParameters); Table table = - new Table(tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, + new Table(1, tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, new ArrayList(), emptyParameters, null, null, null); // Event 1 msClient.createTable(table); cols.add(col2); table = - new Table(tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, + new Table(1, tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, new ArrayList(), emptyParameters, null, null, null); // Event 2 msClient.alter_table(defaultDbName, tblName, table); @@ -513,7 +513,7 @@ public void dropTable() throws Exception { new StorageDescriptor(cols, serdeLocation, "input", "output", false, 0, serde, null, null, emptyParameters); Table table = - new Table(tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, null, + new Table(1, tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, null, emptyParameters, null, null, null); // Event 1 @@ -550,7 +550,7 @@ public void dropTable() throws Exception { // When hive.metastore.transactional.event.listeners is set, // a failed event should not create a new notification table = - new Table(tblName2, defaultDbName, tblOwner, startTime, startTime, 0, sd, null, + new Table(1, tblName2, defaultDbName, tblOwner, startTime, startTime, 0, sd, null, emptyParameters, null, null, null); msClient.createTable(table); DummyRawStoreFailEvent.setEventSucceed(false); @@ -583,7 +583,7 @@ public void addPartition() throws Exception { List partCol1Vals = Arrays.asList("today"); partCols.add(partCol1); Table table = - new Table(tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, partCols, + new Table(1,tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, partCols, emptyParameters, null, null, null); // Event 1 @@ -651,7 +651,7 @@ public void alterPartition() throws Exception { List partCol1Vals = Arrays.asList("today"); partCols.add(partCol1); Table table = - new Table(tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, partCols, + new Table(1, tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, partCols, emptyParameters, null, null, null); // Event 1 @@ -719,7 +719,7 @@ public void dropPartition() throws Exception { List partCol1Vals = Arrays.asList("today"); partCols.add(partCol1); Table table = - new Table(tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, partCols, + new Table(1, tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, partCols, emptyParameters, null, null, null); // Event 1 @@ -785,7 +785,7 @@ public void exchangePartition() throws Exception { SerDeInfo serde = new SerDeInfo("serde", "seriallib", null); StorageDescriptor sd1 = new StorageDescriptor(cols, "file:/tmp/1", "input", "output", false, 0, serde, null, null, emptyParameters); - Table tab1 = new Table("tab1", dbName, "me", startTime, startTime, 0, sd1, partCols, + Table tab1 = new Table(1, "tab1", dbName, "me", startTime, startTime, 0, sd1, partCols, emptyParameters, null, null, null); msClient.createTable(tab1); NotificationEventResponse rsp = msClient.getNextNotification(firstEventId, 0, null); @@ -793,7 +793,7 @@ public void exchangePartition() throws Exception { StorageDescriptor sd2 = new StorageDescriptor(cols, "file:/tmp/2", "input", "output", false, 0, serde, null, null, emptyParameters); - Table tab2 = new Table("tab2", dbName, "me", startTime, startTime, 0, sd2, partCols, + Table tab2 = new Table(2, "tab2", dbName, "me", startTime, startTime, 0, sd2, partCols, emptyParameters, null, null, null); // add_table msClient.createTable(tab2); rsp = msClient.getNextNotification(firstEventId + 1, 0, null); @@ -993,7 +993,7 @@ public void insertTable() throws Exception { new StorageDescriptor(cols, serdeLocation, "input", "output", false, 0, serde, null, null, emptyParameters); Table table = - new Table(tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, null, + new Table(1, tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, null, emptyParameters, null, null, null); // Event 1 msClient.createTable(table); @@ -1055,7 +1055,7 @@ public void insertPartition() throws Exception { partCols.add(partCol1); Table table = - new Table(tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, partCols, + new Table(1, tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, partCols, emptyParameters, null, null, null); // Event 1 msClient.createTable(table); diff --git itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestReplChangeManager.java itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestReplChangeManager.java index 5ab4f91486..9d53d875e7 100644 --- itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestReplChangeManager.java +++ itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestReplChangeManager.java @@ -141,7 +141,7 @@ public void testRecyclePartTable() throws Exception { false, 0, serdeInfo, null, null, null); Map tableParameters = new HashMap(); - Table tbl = new Table(tblName, dbName, "", 0, 0, 0, sd, partColumns, tableParameters, "", "", ""); + Table tbl = new Table(1, tblName, dbName, "", 0, 0, 0, sd, partColumns, tableParameters, "", "", ""); client.createTable(tbl); @@ -224,7 +224,7 @@ public void testRecycleNonPartTable() throws Exception { false, 0, serdeInfo, null, null, null); Map tableParameters = new HashMap(); - Table tbl = new Table(tblName, dbName, "", 0, 0, 0, sd, null, tableParameters, "", "", ""); + Table tbl = new Table(1, tblName, dbName, "", 0, 0, 0, sd, null, tableParameters, "", "", ""); client.createTable(tbl); diff --git itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/TestHDFSPermissionPolicyProvider.java itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/TestHDFSPermissionPolicyProvider.java index be2a39ebd7..b7596a69b7 100644 --- itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/TestHDFSPermissionPolicyProvider.java +++ itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/TestHDFSPermissionPolicyProvider.java @@ -97,13 +97,13 @@ public static void setup() throws Exception { new StorageDescriptor(cols, defaultTbl1Loc, "input", "output", false, 0, serde, null, null, new HashMap()); Table tbl = - new Table("tbl1", "default", "foo", now, now, 0, sd, null, + new Table(1, "tbl1", "default", "foo", now, now, 0, sd, null, new HashMap(), null, null, TableType.MANAGED_TABLE.toString()); client.createTable(tbl); sd = new StorageDescriptor(cols, defaultTbl2Loc, "input", "output", false, 0, serde, null, null, new HashMap()); - tbl = new Table("tbl2", "default", "foo", now, now, 0, sd, null, + tbl = new Table(2, "tbl2", "default", "foo", now, now, 0, sd, null, new HashMap(), null, null, TableType.MANAGED_TABLE.toString()); client.createTable(tbl); @@ -112,7 +112,7 @@ public static void setup() throws Exception { sd = new StorageDescriptor(cols, db1Tbl1Loc, "input", "output", false, 0, serde, null, null, new HashMap()); - tbl = new Table("tbl1", "db1", "foo", now, now, 0, sd, null, + tbl = new Table(3, "tbl1", "db1", "foo", now, now, 0, sd, null, new HashMap(), null, null, TableType.MANAGED_TABLE.toString()); client.createTable(tbl); } diff --git standalone-metastore/metastore-common/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Table.java standalone-metastore/metastore-common/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Table.java index 78ac909f72..c6ed0b0ba4 100644 --- standalone-metastore/metastore-common/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Table.java +++ standalone-metastore/metastore-common/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Table.java @@ -38,26 +38,27 @@ @org.apache.hadoop.classification.InterfaceAudience.Public @org.apache.hadoop.classification.InterfaceStability.Stable public class Table implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Table"); - private static final org.apache.thrift.protocol.TField TABLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tableName", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField DB_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("dbName", org.apache.thrift.protocol.TType.STRING, (short)2); - private static final org.apache.thrift.protocol.TField OWNER_FIELD_DESC = new org.apache.thrift.protocol.TField("owner", org.apache.thrift.protocol.TType.STRING, (short)3); - private static final org.apache.thrift.protocol.TField CREATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("createTime", org.apache.thrift.protocol.TType.I32, (short)4); - private static final org.apache.thrift.protocol.TField LAST_ACCESS_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("lastAccessTime", org.apache.thrift.protocol.TType.I32, (short)5); - private static final org.apache.thrift.protocol.TField RETENTION_FIELD_DESC = new org.apache.thrift.protocol.TField("retention", org.apache.thrift.protocol.TType.I32, (short)6); - private static final org.apache.thrift.protocol.TField SD_FIELD_DESC = new org.apache.thrift.protocol.TField("sd", org.apache.thrift.protocol.TType.STRUCT, (short)7); - private static final org.apache.thrift.protocol.TField PARTITION_KEYS_FIELD_DESC = new org.apache.thrift.protocol.TField("partitionKeys", org.apache.thrift.protocol.TType.LIST, (short)8); - private static final org.apache.thrift.protocol.TField PARAMETERS_FIELD_DESC = new org.apache.thrift.protocol.TField("parameters", org.apache.thrift.protocol.TType.MAP, (short)9); - private static final org.apache.thrift.protocol.TField VIEW_ORIGINAL_TEXT_FIELD_DESC = new org.apache.thrift.protocol.TField("viewOriginalText", org.apache.thrift.protocol.TType.STRING, (short)10); - private static final org.apache.thrift.protocol.TField VIEW_EXPANDED_TEXT_FIELD_DESC = new org.apache.thrift.protocol.TField("viewExpandedText", org.apache.thrift.protocol.TType.STRING, (short)11); - private static final org.apache.thrift.protocol.TField TABLE_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("tableType", org.apache.thrift.protocol.TType.STRING, (short)12); - private static final org.apache.thrift.protocol.TField PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.STRUCT, (short)13); - private static final org.apache.thrift.protocol.TField TEMPORARY_FIELD_DESC = new org.apache.thrift.protocol.TField("temporary", org.apache.thrift.protocol.TType.BOOL, (short)14); - private static final org.apache.thrift.protocol.TField REWRITE_ENABLED_FIELD_DESC = new org.apache.thrift.protocol.TField("rewriteEnabled", org.apache.thrift.protocol.TType.BOOL, (short)15); - private static final org.apache.thrift.protocol.TField CREATION_METADATA_FIELD_DESC = new org.apache.thrift.protocol.TField("creationMetadata", org.apache.thrift.protocol.TType.STRUCT, (short)16); - private static final org.apache.thrift.protocol.TField CAT_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("catName", org.apache.thrift.protocol.TType.STRING, (short)17); - private static final org.apache.thrift.protocol.TField OWNER_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("ownerType", org.apache.thrift.protocol.TType.I32, (short)18); - private static final org.apache.thrift.protocol.TField WRITE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("writeId", org.apache.thrift.protocol.TType.I64, (short)19); - private static final org.apache.thrift.protocol.TField IS_STATS_COMPLIANT_FIELD_DESC = new org.apache.thrift.protocol.TField("isStatsCompliant", org.apache.thrift.protocol.TType.BOOL, (short)20); + private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1); + private static final org.apache.thrift.protocol.TField TABLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tableName", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField DB_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("dbName", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField OWNER_FIELD_DESC = new org.apache.thrift.protocol.TField("owner", org.apache.thrift.protocol.TType.STRING, (short)4); + private static final org.apache.thrift.protocol.TField CREATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("createTime", org.apache.thrift.protocol.TType.I32, (short)5); + private static final org.apache.thrift.protocol.TField LAST_ACCESS_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("lastAccessTime", org.apache.thrift.protocol.TType.I32, (short)6); + private static final org.apache.thrift.protocol.TField RETENTION_FIELD_DESC = new org.apache.thrift.protocol.TField("retention", org.apache.thrift.protocol.TType.I32, (short)7); + private static final org.apache.thrift.protocol.TField SD_FIELD_DESC = new org.apache.thrift.protocol.TField("sd", org.apache.thrift.protocol.TType.STRUCT, (short)8); + private static final org.apache.thrift.protocol.TField PARTITION_KEYS_FIELD_DESC = new org.apache.thrift.protocol.TField("partitionKeys", org.apache.thrift.protocol.TType.LIST, (short)9); + private static final org.apache.thrift.protocol.TField PARAMETERS_FIELD_DESC = new org.apache.thrift.protocol.TField("parameters", org.apache.thrift.protocol.TType.MAP, (short)10); + private static final org.apache.thrift.protocol.TField VIEW_ORIGINAL_TEXT_FIELD_DESC = new org.apache.thrift.protocol.TField("viewOriginalText", org.apache.thrift.protocol.TType.STRING, (short)11); + private static final org.apache.thrift.protocol.TField VIEW_EXPANDED_TEXT_FIELD_DESC = new org.apache.thrift.protocol.TField("viewExpandedText", org.apache.thrift.protocol.TType.STRING, (short)12); + private static final org.apache.thrift.protocol.TField TABLE_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("tableType", org.apache.thrift.protocol.TType.STRING, (short)13); + private static final org.apache.thrift.protocol.TField PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.STRUCT, (short)14); + private static final org.apache.thrift.protocol.TField TEMPORARY_FIELD_DESC = new org.apache.thrift.protocol.TField("temporary", org.apache.thrift.protocol.TType.BOOL, (short)15); + private static final org.apache.thrift.protocol.TField REWRITE_ENABLED_FIELD_DESC = new org.apache.thrift.protocol.TField("rewriteEnabled", org.apache.thrift.protocol.TType.BOOL, (short)16); + private static final org.apache.thrift.protocol.TField CREATION_METADATA_FIELD_DESC = new org.apache.thrift.protocol.TField("creationMetadata", org.apache.thrift.protocol.TType.STRUCT, (short)17); + private static final org.apache.thrift.protocol.TField CAT_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("catName", org.apache.thrift.protocol.TType.STRING, (short)18); + private static final org.apache.thrift.protocol.TField OWNER_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("ownerType", org.apache.thrift.protocol.TType.I32, (short)19); + private static final org.apache.thrift.protocol.TField WRITE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("writeId", org.apache.thrift.protocol.TType.I64, (short)20); + private static final org.apache.thrift.protocol.TField IS_STATS_COMPLIANT_FIELD_DESC = new org.apache.thrift.protocol.TField("isStatsCompliant", org.apache.thrift.protocol.TType.BOOL, (short)21); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { @@ -65,6 +66,7 @@ schemes.put(TupleScheme.class, new TableTupleSchemeFactory()); } + private long id; // required private String tableName; // required private String dbName; // required private String owner; // required @@ -88,30 +90,31 @@ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { - TABLE_NAME((short)1, "tableName"), - DB_NAME((short)2, "dbName"), - OWNER((short)3, "owner"), - CREATE_TIME((short)4, "createTime"), - LAST_ACCESS_TIME((short)5, "lastAccessTime"), - RETENTION((short)6, "retention"), - SD((short)7, "sd"), - PARTITION_KEYS((short)8, "partitionKeys"), - PARAMETERS((short)9, "parameters"), - VIEW_ORIGINAL_TEXT((short)10, "viewOriginalText"), - VIEW_EXPANDED_TEXT((short)11, "viewExpandedText"), - TABLE_TYPE((short)12, "tableType"), - PRIVILEGES((short)13, "privileges"), - TEMPORARY((short)14, "temporary"), - REWRITE_ENABLED((short)15, "rewriteEnabled"), - CREATION_METADATA((short)16, "creationMetadata"), - CAT_NAME((short)17, "catName"), + ID((short)1, "id"), + TABLE_NAME((short)2, "tableName"), + DB_NAME((short)3, "dbName"), + OWNER((short)4, "owner"), + CREATE_TIME((short)5, "createTime"), + LAST_ACCESS_TIME((short)6, "lastAccessTime"), + RETENTION((short)7, "retention"), + SD((short)8, "sd"), + PARTITION_KEYS((short)9, "partitionKeys"), + PARAMETERS((short)10, "parameters"), + VIEW_ORIGINAL_TEXT((short)11, "viewOriginalText"), + VIEW_EXPANDED_TEXT((short)12, "viewExpandedText"), + TABLE_TYPE((short)13, "tableType"), + PRIVILEGES((short)14, "privileges"), + TEMPORARY((short)15, "temporary"), + REWRITE_ENABLED((short)16, "rewriteEnabled"), + CREATION_METADATA((short)17, "creationMetadata"), + CAT_NAME((short)18, "catName"), /** * * @see PrincipalType */ - OWNER_TYPE((short)18, "ownerType"), - WRITE_ID((short)19, "writeId"), - IS_STATS_COMPLIANT((short)20, "isStatsCompliant"); + OWNER_TYPE((short)19, "ownerType"), + WRITE_ID((short)20, "writeId"), + IS_STATS_COMPLIANT((short)21, "isStatsCompliant"); private static final Map byName = new HashMap(); @@ -126,45 +129,47 @@ */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { - case 1: // TABLE_NAME + case 1: // ID + return ID; + case 2: // TABLE_NAME return TABLE_NAME; - case 2: // DB_NAME + case 3: // DB_NAME return DB_NAME; - case 3: // OWNER + case 4: // OWNER return OWNER; - case 4: // CREATE_TIME + case 5: // CREATE_TIME return CREATE_TIME; - case 5: // LAST_ACCESS_TIME + case 6: // LAST_ACCESS_TIME return LAST_ACCESS_TIME; - case 6: // RETENTION + case 7: // RETENTION return RETENTION; - case 7: // SD + case 8: // SD return SD; - case 8: // PARTITION_KEYS + case 9: // PARTITION_KEYS return PARTITION_KEYS; - case 9: // PARAMETERS + case 10: // PARAMETERS return PARAMETERS; - case 10: // VIEW_ORIGINAL_TEXT + case 11: // VIEW_ORIGINAL_TEXT return VIEW_ORIGINAL_TEXT; - case 11: // VIEW_EXPANDED_TEXT + case 12: // VIEW_EXPANDED_TEXT return VIEW_EXPANDED_TEXT; - case 12: // TABLE_TYPE + case 13: // TABLE_TYPE return TABLE_TYPE; - case 13: // PRIVILEGES + case 14: // PRIVILEGES return PRIVILEGES; - case 14: // TEMPORARY + case 15: // TEMPORARY return TEMPORARY; - case 15: // REWRITE_ENABLED + case 16: // REWRITE_ENABLED return REWRITE_ENABLED; - case 16: // CREATION_METADATA + case 17: // CREATION_METADATA return CREATION_METADATA; - case 17: // CAT_NAME + case 18: // CAT_NAME return CAT_NAME; - case 18: // OWNER_TYPE + case 19: // OWNER_TYPE return OWNER_TYPE; - case 19: // WRITE_ID + case 20: // WRITE_ID return WRITE_ID; - case 20: // IS_STATS_COMPLIANT + case 21: // IS_STATS_COMPLIANT return IS_STATS_COMPLIANT; default: return null; @@ -206,18 +211,21 @@ public String getFieldName() { } // isset id assignments - private static final int __CREATETIME_ISSET_ID = 0; - private static final int __LASTACCESSTIME_ISSET_ID = 1; - private static final int __RETENTION_ISSET_ID = 2; - private static final int __TEMPORARY_ISSET_ID = 3; - private static final int __REWRITEENABLED_ISSET_ID = 4; - private static final int __WRITEID_ISSET_ID = 5; - private static final int __ISSTATSCOMPLIANT_ISSET_ID = 6; + private static final int __ID_ISSET_ID = 0; + private static final int __CREATETIME_ISSET_ID = 1; + private static final int __LASTACCESSTIME_ISSET_ID = 2; + private static final int __RETENTION_ISSET_ID = 3; + private static final int __TEMPORARY_ISSET_ID = 4; + private static final int __REWRITEENABLED_ISSET_ID = 5; + private static final int __WRITEID_ISSET_ID = 6; + private static final int __ISSTATSCOMPLIANT_ISSET_ID = 7; private byte __isset_bitfield = 0; private static final _Fields optionals[] = {_Fields.PRIVILEGES,_Fields.TEMPORARY,_Fields.REWRITE_ENABLED,_Fields.CREATION_METADATA,_Fields.CAT_NAME,_Fields.OWNER_TYPE,_Fields.WRITE_ID,_Fields.IS_STATS_COMPLIANT}; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); tmpMap.put(_Fields.TABLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("tableName", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.DB_NAME, new org.apache.thrift.meta_data.FieldMetaData("dbName", org.apache.thrift.TFieldRequirementType.DEFAULT, @@ -275,6 +283,7 @@ public Table() { } public Table( + long id, String tableName, String dbName, String owner, @@ -289,6 +298,8 @@ public Table( String tableType) { this(); + this.id = id; + setIdIsSet(true); this.tableName = tableName; this.dbName = dbName; this.owner = owner; @@ -311,6 +322,7 @@ public Table( */ public Table(Table other) { __isset_bitfield = other.__isset_bitfield; + this.id = other.id; if (other.isSetTableName()) { this.tableName = other.tableName; } @@ -370,6 +382,8 @@ public Table deepCopy() { @Override public void clear() { + setIdIsSet(false); + this.id = 0; this.tableName = null; this.dbName = null; this.owner = null; @@ -400,6 +414,28 @@ public void clear() { this.isStatsCompliant = false; } + public long getId() { + return this.id; + } + + public void setId(long id) { + this.id = id; + setIdIsSet(true); + } + + public void unsetId() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ID_ISSET_ID); + } + + /** Returns true if field id is set (has been assigned a value) and false otherwise */ + public boolean isSetId() { + return EncodingUtils.testBit(__isset_bitfield, __ID_ISSET_ID); + } + + public void setIdIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value); + } + public String getTableName() { return this.tableName; } @@ -889,6 +925,14 @@ public void setIsStatsCompliantIsSet(boolean value) { public void setFieldValue(_Fields field, Object value) { switch (field) { + case ID: + if (value == null) { + unsetId(); + } else { + setId((Long)value); + } + break; + case TABLE_NAME: if (value == null) { unsetTableName(); @@ -1054,6 +1098,9 @@ public void setFieldValue(_Fields field, Object value) { public Object getFieldValue(_Fields field) { switch (field) { + case ID: + return getId(); + case TABLE_NAME: return getTableName(); @@ -1125,6 +1172,8 @@ public boolean isSet(_Fields field) { } switch (field) { + case ID: + return isSetId(); case TABLE_NAME: return isSetTableName(); case DB_NAME: @@ -1182,6 +1231,15 @@ public boolean equals(Table that) { if (that == null) return false; + boolean this_present_id = true; + boolean that_present_id = true; + if (this_present_id || that_present_id) { + if (!(this_present_id && that_present_id)) + return false; + if (this.id != that.id) + return false; + } + boolean this_present_tableName = true && this.isSetTableName(); boolean that_present_tableName = true && that.isSetTableName(); if (this_present_tableName || that_present_tableName) { @@ -1369,6 +1427,11 @@ public boolean equals(Table that) { public int hashCode() { List list = new ArrayList(); + boolean present_id = true; + list.add(present_id); + if (present_id) + list.add(id); + boolean present_tableName = true && (isSetTableName()); list.add(present_tableName); if (present_tableName) @@ -1480,6 +1543,16 @@ public int compareTo(Table other) { int lastComparison = 0; + lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id); + if (lastComparison != 0) { + return lastComparison; + } + } lastComparison = Boolean.valueOf(isSetTableName()).compareTo(other.isSetTableName()); if (lastComparison != 0) { return lastComparison; @@ -1700,6 +1773,10 @@ public String toString() { StringBuilder sb = new StringBuilder("Table("); boolean first = true; + sb.append("id:"); + sb.append(this.id); + first = false; + if (!first) sb.append(", "); sb.append("tableName:"); if (this.tableName == null) { sb.append("null"); @@ -1898,7 +1975,15 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw break; } switch (schemeField.id) { - case 1: // TABLE_NAME + case 1: // ID + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.id = iprot.readI64(); + struct.setIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // TABLE_NAME if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.tableName = iprot.readString(); struct.setTableNameIsSet(true); @@ -1906,7 +1991,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 2: // DB_NAME + case 3: // DB_NAME if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.dbName = iprot.readString(); struct.setDbNameIsSet(true); @@ -1914,7 +1999,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 3: // OWNER + case 4: // OWNER if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.owner = iprot.readString(); struct.setOwnerIsSet(true); @@ -1922,7 +2007,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 4: // CREATE_TIME + case 5: // CREATE_TIME if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.createTime = iprot.readI32(); struct.setCreateTimeIsSet(true); @@ -1930,7 +2015,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 5: // LAST_ACCESS_TIME + case 6: // LAST_ACCESS_TIME if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.lastAccessTime = iprot.readI32(); struct.setLastAccessTimeIsSet(true); @@ -1938,7 +2023,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 6: // RETENTION + case 7: // RETENTION if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.retention = iprot.readI32(); struct.setRetentionIsSet(true); @@ -1946,7 +2031,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 7: // SD + case 8: // SD if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.sd = new StorageDescriptor(); struct.sd.read(iprot); @@ -1955,7 +2040,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 8: // PARTITION_KEYS + case 9: // PARTITION_KEYS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list206 = iprot.readListBegin(); @@ -1974,7 +2059,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 9: // PARAMETERS + case 10: // PARAMETERS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { org.apache.thrift.protocol.TMap _map209 = iprot.readMapBegin(); @@ -1994,7 +2079,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 10: // VIEW_ORIGINAL_TEXT + case 11: // VIEW_ORIGINAL_TEXT if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.viewOriginalText = iprot.readString(); struct.setViewOriginalTextIsSet(true); @@ -2002,7 +2087,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 11: // VIEW_EXPANDED_TEXT + case 12: // VIEW_EXPANDED_TEXT if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.viewExpandedText = iprot.readString(); struct.setViewExpandedTextIsSet(true); @@ -2010,7 +2095,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 12: // TABLE_TYPE + case 13: // TABLE_TYPE if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.tableType = iprot.readString(); struct.setTableTypeIsSet(true); @@ -2018,7 +2103,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 13: // PRIVILEGES + case 14: // PRIVILEGES if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.privileges = new PrincipalPrivilegeSet(); struct.privileges.read(iprot); @@ -2027,7 +2112,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 14: // TEMPORARY + case 15: // TEMPORARY if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.temporary = iprot.readBool(); struct.setTemporaryIsSet(true); @@ -2035,7 +2120,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 15: // REWRITE_ENABLED + case 16: // REWRITE_ENABLED if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.rewriteEnabled = iprot.readBool(); struct.setRewriteEnabledIsSet(true); @@ -2043,7 +2128,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 16: // CREATION_METADATA + case 17: // CREATION_METADATA if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.creationMetadata = new CreationMetadata(); struct.creationMetadata.read(iprot); @@ -2052,7 +2137,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 17: // CAT_NAME + case 18: // CAT_NAME if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.catName = iprot.readString(); struct.setCatNameIsSet(true); @@ -2060,7 +2145,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 18: // OWNER_TYPE + case 19: // OWNER_TYPE if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.ownerType = org.apache.hadoop.hive.metastore.api.PrincipalType.findByValue(iprot.readI32()); struct.setOwnerTypeIsSet(true); @@ -2068,7 +2153,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 19: // WRITE_ID + case 20: // WRITE_ID if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.writeId = iprot.readI64(); struct.setWriteIdIsSet(true); @@ -2076,7 +2161,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 20: // IS_STATS_COMPLIANT + case 21: // IS_STATS_COMPLIANT if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.isStatsCompliant = iprot.readBool(); struct.setIsStatsCompliantIsSet(true); @@ -2097,6 +2182,9 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, Table struct) thro struct.validate(); oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(ID_FIELD_DESC); + oprot.writeI64(struct.id); + oprot.writeFieldEnd(); if (struct.tableName != null) { oprot.writeFieldBegin(TABLE_NAME_FIELD_DESC); oprot.writeString(struct.tableName); @@ -2232,67 +2320,73 @@ public TableTupleScheme getScheme() { public void write(org.apache.thrift.protocol.TProtocol prot, Table struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); - if (struct.isSetTableName()) { + if (struct.isSetId()) { optionals.set(0); } - if (struct.isSetDbName()) { + if (struct.isSetTableName()) { optionals.set(1); } - if (struct.isSetOwner()) { + if (struct.isSetDbName()) { optionals.set(2); } - if (struct.isSetCreateTime()) { + if (struct.isSetOwner()) { optionals.set(3); } - if (struct.isSetLastAccessTime()) { + if (struct.isSetCreateTime()) { optionals.set(4); } - if (struct.isSetRetention()) { + if (struct.isSetLastAccessTime()) { optionals.set(5); } - if (struct.isSetSd()) { + if (struct.isSetRetention()) { optionals.set(6); } - if (struct.isSetPartitionKeys()) { + if (struct.isSetSd()) { optionals.set(7); } - if (struct.isSetParameters()) { + if (struct.isSetPartitionKeys()) { optionals.set(8); } - if (struct.isSetViewOriginalText()) { + if (struct.isSetParameters()) { optionals.set(9); } - if (struct.isSetViewExpandedText()) { + if (struct.isSetViewOriginalText()) { optionals.set(10); } - if (struct.isSetTableType()) { + if (struct.isSetViewExpandedText()) { optionals.set(11); } - if (struct.isSetPrivileges()) { + if (struct.isSetTableType()) { optionals.set(12); } - if (struct.isSetTemporary()) { + if (struct.isSetPrivileges()) { optionals.set(13); } - if (struct.isSetRewriteEnabled()) { + if (struct.isSetTemporary()) { optionals.set(14); } - if (struct.isSetCreationMetadata()) { + if (struct.isSetRewriteEnabled()) { optionals.set(15); } - if (struct.isSetCatName()) { + if (struct.isSetCreationMetadata()) { optionals.set(16); } - if (struct.isSetOwnerType()) { + if (struct.isSetCatName()) { optionals.set(17); } - if (struct.isSetWriteId()) { + if (struct.isSetOwnerType()) { optionals.set(18); } - if (struct.isSetIsStatsCompliant()) { + if (struct.isSetWriteId()) { optionals.set(19); } - oprot.writeBitSet(optionals, 20); + if (struct.isSetIsStatsCompliant()) { + optionals.set(20); + } + oprot.writeBitSet(optionals, 21); + if (struct.isSetId()) { + oprot.writeI64(struct.id); + } if (struct.isSetTableName()) { oprot.writeString(struct.tableName); } @@ -2371,37 +2465,41 @@ public void write(org.apache.thrift.protocol.TProtocol prot, Table struct) throw @Override public void read(org.apache.thrift.protocol.TProtocol prot, Table struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(20); + BitSet incoming = iprot.readBitSet(21); if (incoming.get(0)) { + struct.id = iprot.readI64(); + struct.setIdIsSet(true); + } + if (incoming.get(1)) { struct.tableName = iprot.readString(); struct.setTableNameIsSet(true); } - if (incoming.get(1)) { + if (incoming.get(2)) { struct.dbName = iprot.readString(); struct.setDbNameIsSet(true); } - if (incoming.get(2)) { + if (incoming.get(3)) { struct.owner = iprot.readString(); struct.setOwnerIsSet(true); } - if (incoming.get(3)) { + if (incoming.get(4)) { struct.createTime = iprot.readI32(); struct.setCreateTimeIsSet(true); } - if (incoming.get(4)) { + if (incoming.get(5)) { struct.lastAccessTime = iprot.readI32(); struct.setLastAccessTimeIsSet(true); } - if (incoming.get(5)) { + if (incoming.get(6)) { struct.retention = iprot.readI32(); struct.setRetentionIsSet(true); } - if (incoming.get(6)) { + if (incoming.get(7)) { struct.sd = new StorageDescriptor(); struct.sd.read(iprot); struct.setSdIsSet(true); } - if (incoming.get(7)) { + if (incoming.get(8)) { { org.apache.thrift.protocol.TList _list217 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.partitionKeys = new ArrayList(_list217.size); @@ -2415,7 +2513,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Table struct) throws } struct.setPartitionKeysIsSet(true); } - if (incoming.get(8)) { + if (incoming.get(9)) { { org.apache.thrift.protocol.TMap _map220 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); struct.parameters = new HashMap(2*_map220.size); @@ -2430,49 +2528,49 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Table struct) throws } struct.setParametersIsSet(true); } - if (incoming.get(9)) { + if (incoming.get(10)) { struct.viewOriginalText = iprot.readString(); struct.setViewOriginalTextIsSet(true); } - if (incoming.get(10)) { + if (incoming.get(11)) { struct.viewExpandedText = iprot.readString(); struct.setViewExpandedTextIsSet(true); } - if (incoming.get(11)) { + if (incoming.get(12)) { struct.tableType = iprot.readString(); struct.setTableTypeIsSet(true); } - if (incoming.get(12)) { + if (incoming.get(13)) { struct.privileges = new PrincipalPrivilegeSet(); struct.privileges.read(iprot); struct.setPrivilegesIsSet(true); } - if (incoming.get(13)) { + if (incoming.get(14)) { struct.temporary = iprot.readBool(); struct.setTemporaryIsSet(true); } - if (incoming.get(14)) { + if (incoming.get(15)) { struct.rewriteEnabled = iprot.readBool(); struct.setRewriteEnabledIsSet(true); } - if (incoming.get(15)) { + if (incoming.get(16)) { struct.creationMetadata = new CreationMetadata(); struct.creationMetadata.read(iprot); struct.setCreationMetadataIsSet(true); } - if (incoming.get(16)) { + if (incoming.get(17)) { struct.catName = iprot.readString(); struct.setCatNameIsSet(true); } - if (incoming.get(17)) { + if (incoming.get(18)) { struct.ownerType = org.apache.hadoop.hive.metastore.api.PrincipalType.findByValue(iprot.readI32()); struct.setOwnerTypeIsSet(true); } - if (incoming.get(18)) { + if (incoming.get(19)) { struct.writeId = iprot.readI64(); struct.setWriteIdIsSet(true); } - if (incoming.get(19)) { + if (incoming.get(20)) { struct.isStatsCompliant = iprot.readBool(); struct.setIsStatsCompliantIsSet(true); } diff --git standalone-metastore/metastore-common/src/gen/thrift/gen-php/metastore/Types.php standalone-metastore/metastore-common/src/gen/thrift/gen-php/metastore/Types.php index 22deffe1d3..936f7c5a40 100644 --- standalone-metastore/metastore-common/src/gen/thrift/gen-php/metastore/Types.php +++ standalone-metastore/metastore-common/src/gen/thrift/gen-php/metastore/Types.php @@ -6688,6 +6688,10 @@ class StorageDescriptor { class Table { static $_TSPEC; + /** + * @var int + */ + public $id = null; /** * @var string */ @@ -6773,35 +6777,39 @@ class Table { if (!isset(self::$_TSPEC)) { self::$_TSPEC = array( 1 => array( + 'var' => 'id', + 'type' => TType::I64, + ), + 2 => array( 'var' => 'tableName', 'type' => TType::STRING, ), - 2 => array( + 3 => array( 'var' => 'dbName', 'type' => TType::STRING, ), - 3 => array( + 4 => array( 'var' => 'owner', 'type' => TType::STRING, ), - 4 => array( + 5 => array( 'var' => 'createTime', 'type' => TType::I32, ), - 5 => array( + 6 => array( 'var' => 'lastAccessTime', 'type' => TType::I32, ), - 6 => array( + 7 => array( 'var' => 'retention', 'type' => TType::I32, ), - 7 => array( + 8 => array( 'var' => 'sd', 'type' => TType::STRUCT, 'class' => '\metastore\StorageDescriptor', ), - 8 => array( + 9 => array( 'var' => 'partitionKeys', 'type' => TType::LST, 'etype' => TType::STRUCT, @@ -6810,7 +6818,7 @@ class Table { 'class' => '\metastore\FieldSchema', ), ), - 9 => array( + 10 => array( 'var' => 'parameters', 'type' => TType::MAP, 'ktype' => TType::STRING, @@ -6822,55 +6830,58 @@ class Table { 'type' => TType::STRING, ), ), - 10 => array( + 11 => array( 'var' => 'viewOriginalText', 'type' => TType::STRING, ), - 11 => array( + 12 => array( 'var' => 'viewExpandedText', 'type' => TType::STRING, ), - 12 => array( + 13 => array( 'var' => 'tableType', 'type' => TType::STRING, ), - 13 => array( + 14 => array( 'var' => 'privileges', 'type' => TType::STRUCT, 'class' => '\metastore\PrincipalPrivilegeSet', ), - 14 => array( + 15 => array( 'var' => 'temporary', 'type' => TType::BOOL, ), - 15 => array( + 16 => array( 'var' => 'rewriteEnabled', 'type' => TType::BOOL, ), - 16 => array( + 17 => array( 'var' => 'creationMetadata', 'type' => TType::STRUCT, 'class' => '\metastore\CreationMetadata', ), - 17 => array( + 18 => array( 'var' => 'catName', 'type' => TType::STRING, ), - 18 => array( + 19 => array( 'var' => 'ownerType', 'type' => TType::I32, ), - 19 => array( + 20 => array( 'var' => 'writeId', 'type' => TType::I64, ), - 20 => array( + 21 => array( 'var' => 'isStatsCompliant', 'type' => TType::BOOL, ), ); } if (is_array($vals)) { + if (isset($vals['id'])) { + $this->id = $vals['id']; + } if (isset($vals['tableName'])) { $this->tableName = $vals['tableName']; } @@ -6954,48 +6965,55 @@ class Table { switch ($fid) { case 1: + if ($ftype == TType::I64) { + $xfer += $input->readI64($this->id); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: if ($ftype == TType::STRING) { $xfer += $input->readString($this->tableName); } else { $xfer += $input->skip($ftype); } break; - case 2: + case 3: if ($ftype == TType::STRING) { $xfer += $input->readString($this->dbName); } else { $xfer += $input->skip($ftype); } break; - case 3: + case 4: if ($ftype == TType::STRING) { $xfer += $input->readString($this->owner); } else { $xfer += $input->skip($ftype); } break; - case 4: + case 5: if ($ftype == TType::I32) { $xfer += $input->readI32($this->createTime); } else { $xfer += $input->skip($ftype); } break; - case 5: + case 6: if ($ftype == TType::I32) { $xfer += $input->readI32($this->lastAccessTime); } else { $xfer += $input->skip($ftype); } break; - case 6: + case 7: if ($ftype == TType::I32) { $xfer += $input->readI32($this->retention); } else { $xfer += $input->skip($ftype); } break; - case 7: + case 8: if ($ftype == TType::STRUCT) { $this->sd = new \metastore\StorageDescriptor(); $xfer += $this->sd->read($input); @@ -7003,7 +7021,7 @@ class Table { $xfer += $input->skip($ftype); } break; - case 8: + case 9: if ($ftype == TType::LST) { $this->partitionKeys = array(); $_size182 = 0; @@ -7021,7 +7039,7 @@ class Table { $xfer += $input->skip($ftype); } break; - case 9: + case 10: if ($ftype == TType::MAP) { $this->parameters = array(); $_size188 = 0; @@ -7041,28 +7059,28 @@ class Table { $xfer += $input->skip($ftype); } break; - case 10: + case 11: if ($ftype == TType::STRING) { $xfer += $input->readString($this->viewOriginalText); } else { $xfer += $input->skip($ftype); } break; - case 11: + case 12: if ($ftype == TType::STRING) { $xfer += $input->readString($this->viewExpandedText); } else { $xfer += $input->skip($ftype); } break; - case 12: + case 13: if ($ftype == TType::STRING) { $xfer += $input->readString($this->tableType); } else { $xfer += $input->skip($ftype); } break; - case 13: + case 14: if ($ftype == TType::STRUCT) { $this->privileges = new \metastore\PrincipalPrivilegeSet(); $xfer += $this->privileges->read($input); @@ -7070,21 +7088,21 @@ class Table { $xfer += $input->skip($ftype); } break; - case 14: + case 15: if ($ftype == TType::BOOL) { $xfer += $input->readBool($this->temporary); } else { $xfer += $input->skip($ftype); } break; - case 15: + case 16: if ($ftype == TType::BOOL) { $xfer += $input->readBool($this->rewriteEnabled); } else { $xfer += $input->skip($ftype); } break; - case 16: + case 17: if ($ftype == TType::STRUCT) { $this->creationMetadata = new \metastore\CreationMetadata(); $xfer += $this->creationMetadata->read($input); @@ -7092,28 +7110,28 @@ class Table { $xfer += $input->skip($ftype); } break; - case 17: + case 18: if ($ftype == TType::STRING) { $xfer += $input->readString($this->catName); } else { $xfer += $input->skip($ftype); } break; - case 18: + case 19: if ($ftype == TType::I32) { $xfer += $input->readI32($this->ownerType); } else { $xfer += $input->skip($ftype); } break; - case 19: + case 20: if ($ftype == TType::I64) { $xfer += $input->readI64($this->writeId); } else { $xfer += $input->skip($ftype); } break; - case 20: + case 21: if ($ftype == TType::BOOL) { $xfer += $input->readBool($this->isStatsCompliant); } else { @@ -7133,33 +7151,38 @@ class Table { public function write($output) { $xfer = 0; $xfer += $output->writeStructBegin('Table'); + if ($this->id !== null) { + $xfer += $output->writeFieldBegin('id', TType::I64, 1); + $xfer += $output->writeI64($this->id); + $xfer += $output->writeFieldEnd(); + } if ($this->tableName !== null) { - $xfer += $output->writeFieldBegin('tableName', TType::STRING, 1); + $xfer += $output->writeFieldBegin('tableName', TType::STRING, 2); $xfer += $output->writeString($this->tableName); $xfer += $output->writeFieldEnd(); } if ($this->dbName !== null) { - $xfer += $output->writeFieldBegin('dbName', TType::STRING, 2); + $xfer += $output->writeFieldBegin('dbName', TType::STRING, 3); $xfer += $output->writeString($this->dbName); $xfer += $output->writeFieldEnd(); } if ($this->owner !== null) { - $xfer += $output->writeFieldBegin('owner', TType::STRING, 3); + $xfer += $output->writeFieldBegin('owner', TType::STRING, 4); $xfer += $output->writeString($this->owner); $xfer += $output->writeFieldEnd(); } if ($this->createTime !== null) { - $xfer += $output->writeFieldBegin('createTime', TType::I32, 4); + $xfer += $output->writeFieldBegin('createTime', TType::I32, 5); $xfer += $output->writeI32($this->createTime); $xfer += $output->writeFieldEnd(); } if ($this->lastAccessTime !== null) { - $xfer += $output->writeFieldBegin('lastAccessTime', TType::I32, 5); + $xfer += $output->writeFieldBegin('lastAccessTime', TType::I32, 6); $xfer += $output->writeI32($this->lastAccessTime); $xfer += $output->writeFieldEnd(); } if ($this->retention !== null) { - $xfer += $output->writeFieldBegin('retention', TType::I32, 6); + $xfer += $output->writeFieldBegin('retention', TType::I32, 7); $xfer += $output->writeI32($this->retention); $xfer += $output->writeFieldEnd(); } @@ -7167,7 +7190,7 @@ class Table { if (!is_object($this->sd)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } - $xfer += $output->writeFieldBegin('sd', TType::STRUCT, 7); + $xfer += $output->writeFieldBegin('sd', TType::STRUCT, 8); $xfer += $this->sd->write($output); $xfer += $output->writeFieldEnd(); } @@ -7175,7 +7198,7 @@ class Table { if (!is_array($this->partitionKeys)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } - $xfer += $output->writeFieldBegin('partitionKeys', TType::LST, 8); + $xfer += $output->writeFieldBegin('partitionKeys', TType::LST, 9); { $output->writeListBegin(TType::STRUCT, count($this->partitionKeys)); { @@ -7192,7 +7215,7 @@ class Table { if (!is_array($this->parameters)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } - $xfer += $output->writeFieldBegin('parameters', TType::MAP, 9); + $xfer += $output->writeFieldBegin('parameters', TType::MAP, 10); { $output->writeMapBegin(TType::STRING, TType::STRING, count($this->parameters)); { @@ -7207,17 +7230,17 @@ class Table { $xfer += $output->writeFieldEnd(); } if ($this->viewOriginalText !== null) { - $xfer += $output->writeFieldBegin('viewOriginalText', TType::STRING, 10); + $xfer += $output->writeFieldBegin('viewOriginalText', TType::STRING, 11); $xfer += $output->writeString($this->viewOriginalText); $xfer += $output->writeFieldEnd(); } if ($this->viewExpandedText !== null) { - $xfer += $output->writeFieldBegin('viewExpandedText', TType::STRING, 11); + $xfer += $output->writeFieldBegin('viewExpandedText', TType::STRING, 12); $xfer += $output->writeString($this->viewExpandedText); $xfer += $output->writeFieldEnd(); } if ($this->tableType !== null) { - $xfer += $output->writeFieldBegin('tableType', TType::STRING, 12); + $xfer += $output->writeFieldBegin('tableType', TType::STRING, 13); $xfer += $output->writeString($this->tableType); $xfer += $output->writeFieldEnd(); } @@ -7225,17 +7248,17 @@ class Table { if (!is_object($this->privileges)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } - $xfer += $output->writeFieldBegin('privileges', TType::STRUCT, 13); + $xfer += $output->writeFieldBegin('privileges', TType::STRUCT, 14); $xfer += $this->privileges->write($output); $xfer += $output->writeFieldEnd(); } if ($this->temporary !== null) { - $xfer += $output->writeFieldBegin('temporary', TType::BOOL, 14); + $xfer += $output->writeFieldBegin('temporary', TType::BOOL, 15); $xfer += $output->writeBool($this->temporary); $xfer += $output->writeFieldEnd(); } if ($this->rewriteEnabled !== null) { - $xfer += $output->writeFieldBegin('rewriteEnabled', TType::BOOL, 15); + $xfer += $output->writeFieldBegin('rewriteEnabled', TType::BOOL, 16); $xfer += $output->writeBool($this->rewriteEnabled); $xfer += $output->writeFieldEnd(); } @@ -7243,27 +7266,27 @@ class Table { if (!is_object($this->creationMetadata)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } - $xfer += $output->writeFieldBegin('creationMetadata', TType::STRUCT, 16); + $xfer += $output->writeFieldBegin('creationMetadata', TType::STRUCT, 17); $xfer += $this->creationMetadata->write($output); $xfer += $output->writeFieldEnd(); } if ($this->catName !== null) { - $xfer += $output->writeFieldBegin('catName', TType::STRING, 17); + $xfer += $output->writeFieldBegin('catName', TType::STRING, 18); $xfer += $output->writeString($this->catName); $xfer += $output->writeFieldEnd(); } if ($this->ownerType !== null) { - $xfer += $output->writeFieldBegin('ownerType', TType::I32, 18); + $xfer += $output->writeFieldBegin('ownerType', TType::I32, 19); $xfer += $output->writeI32($this->ownerType); $xfer += $output->writeFieldEnd(); } if ($this->writeId !== null) { - $xfer += $output->writeFieldBegin('writeId', TType::I64, 19); + $xfer += $output->writeFieldBegin('writeId', TType::I64, 20); $xfer += $output->writeI64($this->writeId); $xfer += $output->writeFieldEnd(); } if ($this->isStatsCompliant !== null) { - $xfer += $output->writeFieldBegin('isStatsCompliant', TType::BOOL, 20); + $xfer += $output->writeFieldBegin('isStatsCompliant', TType::BOOL, 21); $xfer += $output->writeBool($this->isStatsCompliant); $xfer += $output->writeFieldEnd(); } diff --git standalone-metastore/metastore-common/src/gen/thrift/gen-py/hive_metastore/ttypes.py standalone-metastore/metastore-common/src/gen/thrift/gen-py/hive_metastore/ttypes.py index 38fac465d7..958f13c18e 100644 --- standalone-metastore/metastore-common/src/gen/thrift/gen-py/hive_metastore/ttypes.py +++ standalone-metastore/metastore-common/src/gen/thrift/gen-py/hive_metastore/ttypes.py @@ -4707,6 +4707,7 @@ def __ne__(self, other): class Table: """ Attributes: + - id - tableName - dbName - owner @@ -4731,29 +4732,31 @@ class Table: thrift_spec = ( None, # 0 - (1, TType.STRING, 'tableName', None, None, ), # 1 - (2, TType.STRING, 'dbName', None, None, ), # 2 - (3, TType.STRING, 'owner', None, None, ), # 3 - (4, TType.I32, 'createTime', None, None, ), # 4 - (5, TType.I32, 'lastAccessTime', None, None, ), # 5 - (6, TType.I32, 'retention', None, None, ), # 6 - (7, TType.STRUCT, 'sd', (StorageDescriptor, StorageDescriptor.thrift_spec), None, ), # 7 - (8, TType.LIST, 'partitionKeys', (TType.STRUCT,(FieldSchema, FieldSchema.thrift_spec)), None, ), # 8 - (9, TType.MAP, 'parameters', (TType.STRING,None,TType.STRING,None), None, ), # 9 - (10, TType.STRING, 'viewOriginalText', None, None, ), # 10 - (11, TType.STRING, 'viewExpandedText', None, None, ), # 11 - (12, TType.STRING, 'tableType', None, None, ), # 12 - (13, TType.STRUCT, 'privileges', (PrincipalPrivilegeSet, PrincipalPrivilegeSet.thrift_spec), None, ), # 13 - (14, TType.BOOL, 'temporary', None, False, ), # 14 - (15, TType.BOOL, 'rewriteEnabled', None, None, ), # 15 - (16, TType.STRUCT, 'creationMetadata', (CreationMetadata, CreationMetadata.thrift_spec), None, ), # 16 - (17, TType.STRING, 'catName', None, None, ), # 17 - (18, TType.I32, 'ownerType', None, 1, ), # 18 - (19, TType.I64, 'writeId', None, -1, ), # 19 - (20, TType.BOOL, 'isStatsCompliant', None, None, ), # 20 + (1, TType.I64, 'id', None, None, ), # 1 + (2, TType.STRING, 'tableName', None, None, ), # 2 + (3, TType.STRING, 'dbName', None, None, ), # 3 + (4, TType.STRING, 'owner', None, None, ), # 4 + (5, TType.I32, 'createTime', None, None, ), # 5 + (6, TType.I32, 'lastAccessTime', None, None, ), # 6 + (7, TType.I32, 'retention', None, None, ), # 7 + (8, TType.STRUCT, 'sd', (StorageDescriptor, StorageDescriptor.thrift_spec), None, ), # 8 + (9, TType.LIST, 'partitionKeys', (TType.STRUCT,(FieldSchema, FieldSchema.thrift_spec)), None, ), # 9 + (10, TType.MAP, 'parameters', (TType.STRING,None,TType.STRING,None), None, ), # 10 + (11, TType.STRING, 'viewOriginalText', None, None, ), # 11 + (12, TType.STRING, 'viewExpandedText', None, None, ), # 12 + (13, TType.STRING, 'tableType', None, None, ), # 13 + (14, TType.STRUCT, 'privileges', (PrincipalPrivilegeSet, PrincipalPrivilegeSet.thrift_spec), None, ), # 14 + (15, TType.BOOL, 'temporary', None, False, ), # 15 + (16, TType.BOOL, 'rewriteEnabled', None, None, ), # 16 + (17, TType.STRUCT, 'creationMetadata', (CreationMetadata, CreationMetadata.thrift_spec), None, ), # 17 + (18, TType.STRING, 'catName', None, None, ), # 18 + (19, TType.I32, 'ownerType', None, 1, ), # 19 + (20, TType.I64, 'writeId', None, -1, ), # 20 + (21, TType.BOOL, 'isStatsCompliant', None, None, ), # 21 ) - def __init__(self, tableName=None, dbName=None, owner=None, createTime=None, lastAccessTime=None, retention=None, sd=None, partitionKeys=None, parameters=None, viewOriginalText=None, viewExpandedText=None, tableType=None, privileges=None, temporary=thrift_spec[14][4], rewriteEnabled=None, creationMetadata=None, catName=None, ownerType=thrift_spec[18][4], writeId=thrift_spec[19][4], isStatsCompliant=None,): + def __init__(self, id=None, tableName=None, dbName=None, owner=None, createTime=None, lastAccessTime=None, retention=None, sd=None, partitionKeys=None, parameters=None, viewOriginalText=None, viewExpandedText=None, tableType=None, privileges=None, temporary=thrift_spec[15][4], rewriteEnabled=None, creationMetadata=None, catName=None, ownerType=thrift_spec[19][4], writeId=thrift_spec[20][4], isStatsCompliant=None,): + self.id = id self.tableName = tableName self.dbName = dbName self.owner = owner @@ -4785,42 +4788,47 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 1: + if ftype == TType.I64: + self.id = iprot.readI64() + else: + iprot.skip(ftype) + elif fid == 2: if ftype == TType.STRING: self.tableName = iprot.readString() else: iprot.skip(ftype) - elif fid == 2: + elif fid == 3: if ftype == TType.STRING: self.dbName = iprot.readString() else: iprot.skip(ftype) - elif fid == 3: + elif fid == 4: if ftype == TType.STRING: self.owner = iprot.readString() else: iprot.skip(ftype) - elif fid == 4: + elif fid == 5: if ftype == TType.I32: self.createTime = iprot.readI32() else: iprot.skip(ftype) - elif fid == 5: + elif fid == 6: if ftype == TType.I32: self.lastAccessTime = iprot.readI32() else: iprot.skip(ftype) - elif fid == 6: + elif fid == 7: if ftype == TType.I32: self.retention = iprot.readI32() else: iprot.skip(ftype) - elif fid == 7: + elif fid == 8: if ftype == TType.STRUCT: self.sd = StorageDescriptor() self.sd.read(iprot) else: iprot.skip(ftype) - elif fid == 8: + elif fid == 9: if ftype == TType.LIST: self.partitionKeys = [] (_etype185, _size182) = iprot.readListBegin() @@ -4831,7 +4839,7 @@ def read(self, iprot): iprot.readListEnd() else: iprot.skip(ftype) - elif fid == 9: + elif fid == 10: if ftype == TType.MAP: self.parameters = {} (_ktype189, _vtype190, _size188 ) = iprot.readMapBegin() @@ -4842,59 +4850,59 @@ def read(self, iprot): iprot.readMapEnd() else: iprot.skip(ftype) - elif fid == 10: + elif fid == 11: if ftype == TType.STRING: self.viewOriginalText = iprot.readString() else: iprot.skip(ftype) - elif fid == 11: + elif fid == 12: if ftype == TType.STRING: self.viewExpandedText = iprot.readString() else: iprot.skip(ftype) - elif fid == 12: + elif fid == 13: if ftype == TType.STRING: self.tableType = iprot.readString() else: iprot.skip(ftype) - elif fid == 13: + elif fid == 14: if ftype == TType.STRUCT: self.privileges = PrincipalPrivilegeSet() self.privileges.read(iprot) else: iprot.skip(ftype) - elif fid == 14: + elif fid == 15: if ftype == TType.BOOL: self.temporary = iprot.readBool() else: iprot.skip(ftype) - elif fid == 15: + elif fid == 16: if ftype == TType.BOOL: self.rewriteEnabled = iprot.readBool() else: iprot.skip(ftype) - elif fid == 16: + elif fid == 17: if ftype == TType.STRUCT: self.creationMetadata = CreationMetadata() self.creationMetadata.read(iprot) else: iprot.skip(ftype) - elif fid == 17: + elif fid == 18: if ftype == TType.STRING: self.catName = iprot.readString() else: iprot.skip(ftype) - elif fid == 18: + elif fid == 19: if ftype == TType.I32: self.ownerType = iprot.readI32() else: iprot.skip(ftype) - elif fid == 19: + elif fid == 20: if ftype == TType.I64: self.writeId = iprot.readI64() else: iprot.skip(ftype) - elif fid == 20: + elif fid == 21: if ftype == TType.BOOL: self.isStatsCompliant = iprot.readBool() else: @@ -4909,43 +4917,47 @@ def write(self, oprot): oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) return oprot.writeStructBegin('Table') + if self.id is not None: + oprot.writeFieldBegin('id', TType.I64, 1) + oprot.writeI64(self.id) + oprot.writeFieldEnd() if self.tableName is not None: - oprot.writeFieldBegin('tableName', TType.STRING, 1) + oprot.writeFieldBegin('tableName', TType.STRING, 2) oprot.writeString(self.tableName) oprot.writeFieldEnd() if self.dbName is not None: - oprot.writeFieldBegin('dbName', TType.STRING, 2) + oprot.writeFieldBegin('dbName', TType.STRING, 3) oprot.writeString(self.dbName) oprot.writeFieldEnd() if self.owner is not None: - oprot.writeFieldBegin('owner', TType.STRING, 3) + oprot.writeFieldBegin('owner', TType.STRING, 4) oprot.writeString(self.owner) oprot.writeFieldEnd() if self.createTime is not None: - oprot.writeFieldBegin('createTime', TType.I32, 4) + oprot.writeFieldBegin('createTime', TType.I32, 5) oprot.writeI32(self.createTime) oprot.writeFieldEnd() if self.lastAccessTime is not None: - oprot.writeFieldBegin('lastAccessTime', TType.I32, 5) + oprot.writeFieldBegin('lastAccessTime', TType.I32, 6) oprot.writeI32(self.lastAccessTime) oprot.writeFieldEnd() if self.retention is not None: - oprot.writeFieldBegin('retention', TType.I32, 6) + oprot.writeFieldBegin('retention', TType.I32, 7) oprot.writeI32(self.retention) oprot.writeFieldEnd() if self.sd is not None: - oprot.writeFieldBegin('sd', TType.STRUCT, 7) + oprot.writeFieldBegin('sd', TType.STRUCT, 8) self.sd.write(oprot) oprot.writeFieldEnd() if self.partitionKeys is not None: - oprot.writeFieldBegin('partitionKeys', TType.LIST, 8) + oprot.writeFieldBegin('partitionKeys', TType.LIST, 9) oprot.writeListBegin(TType.STRUCT, len(self.partitionKeys)) for iter195 in self.partitionKeys: iter195.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() if self.parameters is not None: - oprot.writeFieldBegin('parameters', TType.MAP, 9) + oprot.writeFieldBegin('parameters', TType.MAP, 10) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.parameters)) for kiter196,viter197 in self.parameters.items(): oprot.writeString(kiter196) @@ -4953,47 +4965,47 @@ def write(self, oprot): oprot.writeMapEnd() oprot.writeFieldEnd() if self.viewOriginalText is not None: - oprot.writeFieldBegin('viewOriginalText', TType.STRING, 10) + oprot.writeFieldBegin('viewOriginalText', TType.STRING, 11) oprot.writeString(self.viewOriginalText) oprot.writeFieldEnd() if self.viewExpandedText is not None: - oprot.writeFieldBegin('viewExpandedText', TType.STRING, 11) + oprot.writeFieldBegin('viewExpandedText', TType.STRING, 12) oprot.writeString(self.viewExpandedText) oprot.writeFieldEnd() if self.tableType is not None: - oprot.writeFieldBegin('tableType', TType.STRING, 12) + oprot.writeFieldBegin('tableType', TType.STRING, 13) oprot.writeString(self.tableType) oprot.writeFieldEnd() if self.privileges is not None: - oprot.writeFieldBegin('privileges', TType.STRUCT, 13) + oprot.writeFieldBegin('privileges', TType.STRUCT, 14) self.privileges.write(oprot) oprot.writeFieldEnd() if self.temporary is not None: - oprot.writeFieldBegin('temporary', TType.BOOL, 14) + oprot.writeFieldBegin('temporary', TType.BOOL, 15) oprot.writeBool(self.temporary) oprot.writeFieldEnd() if self.rewriteEnabled is not None: - oprot.writeFieldBegin('rewriteEnabled', TType.BOOL, 15) + oprot.writeFieldBegin('rewriteEnabled', TType.BOOL, 16) oprot.writeBool(self.rewriteEnabled) oprot.writeFieldEnd() if self.creationMetadata is not None: - oprot.writeFieldBegin('creationMetadata', TType.STRUCT, 16) + oprot.writeFieldBegin('creationMetadata', TType.STRUCT, 17) self.creationMetadata.write(oprot) oprot.writeFieldEnd() if self.catName is not None: - oprot.writeFieldBegin('catName', TType.STRING, 17) + oprot.writeFieldBegin('catName', TType.STRING, 18) oprot.writeString(self.catName) oprot.writeFieldEnd() if self.ownerType is not None: - oprot.writeFieldBegin('ownerType', TType.I32, 18) + oprot.writeFieldBegin('ownerType', TType.I32, 19) oprot.writeI32(self.ownerType) oprot.writeFieldEnd() if self.writeId is not None: - oprot.writeFieldBegin('writeId', TType.I64, 19) + oprot.writeFieldBegin('writeId', TType.I64, 20) oprot.writeI64(self.writeId) oprot.writeFieldEnd() if self.isStatsCompliant is not None: - oprot.writeFieldBegin('isStatsCompliant', TType.BOOL, 20) + oprot.writeFieldBegin('isStatsCompliant', TType.BOOL, 21) oprot.writeBool(self.isStatsCompliant) oprot.writeFieldEnd() oprot.writeFieldStop() @@ -5005,6 +5017,7 @@ def validate(self): def __hash__(self): value = 17 + value = (value * 31) ^ hash(self.id) value = (value * 31) ^ hash(self.tableName) value = (value * 31) ^ hash(self.dbName) value = (value * 31) ^ hash(self.owner) diff --git standalone-metastore/metastore-common/src/gen/thrift/gen-rb/hive_metastore_types.rb standalone-metastore/metastore-common/src/gen/thrift/gen-rb/hive_metastore_types.rb index 0192c6da31..53a4fd143c 100644 --- standalone-metastore/metastore-common/src/gen/thrift/gen-rb/hive_metastore_types.rb +++ standalone-metastore/metastore-common/src/gen/thrift/gen-rb/hive_metastore_types.rb @@ -1085,28 +1085,30 @@ end class Table include ::Thrift::Struct, ::Thrift::Struct_Union - TABLENAME = 1 - DBNAME = 2 - OWNER = 3 - CREATETIME = 4 - LASTACCESSTIME = 5 - RETENTION = 6 - SD = 7 - PARTITIONKEYS = 8 - PARAMETERS = 9 - VIEWORIGINALTEXT = 10 - VIEWEXPANDEDTEXT = 11 - TABLETYPE = 12 - PRIVILEGES = 13 - TEMPORARY = 14 - REWRITEENABLED = 15 - CREATIONMETADATA = 16 - CATNAME = 17 - OWNERTYPE = 18 - WRITEID = 19 - ISSTATSCOMPLIANT = 20 + ID = 1 + TABLENAME = 2 + DBNAME = 3 + OWNER = 4 + CREATETIME = 5 + LASTACCESSTIME = 6 + RETENTION = 7 + SD = 8 + PARTITIONKEYS = 9 + PARAMETERS = 10 + VIEWORIGINALTEXT = 11 + VIEWEXPANDEDTEXT = 12 + TABLETYPE = 13 + PRIVILEGES = 14 + TEMPORARY = 15 + REWRITEENABLED = 16 + CREATIONMETADATA = 17 + CATNAME = 18 + OWNERTYPE = 19 + WRITEID = 20 + ISSTATSCOMPLIANT = 21 FIELDS = { + ID => {:type => ::Thrift::Types::I64, :name => 'id'}, TABLENAME => {:type => ::Thrift::Types::STRING, :name => 'tableName'}, DBNAME => {:type => ::Thrift::Types::STRING, :name => 'dbName'}, OWNER => {:type => ::Thrift::Types::STRING, :name => 'owner'}, diff --git standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift index 85a5c601e0..b68be4a021 100644 --- standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift +++ standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift @@ -424,26 +424,27 @@ struct StorageDescriptor { // table information struct Table { - 1: string tableName, // name of the table - 2: string dbName, // database name ('default') - 3: string owner, // owner of this table - 4: i32 createTime, // creation time of the table - 5: i32 lastAccessTime, // last access time (usually this will be filled from HDFS and shouldn't be relied on) - 6: i32 retention, // retention time - 7: StorageDescriptor sd, // storage descriptor of the table - 8: list partitionKeys, // partition keys of the table. only primitive types are supported - 9: map parameters, // to store comments or any other user level parameters - 10: string viewOriginalText, // original view text, null for non-view - 11: string viewExpandedText, // expanded view text, null for non-view - 12: string tableType, // table type enum, e.g. EXTERNAL_TABLE - 13: optional PrincipalPrivilegeSet privileges, - 14: optional bool temporary=false, - 15: optional bool rewriteEnabled, // rewrite enabled or not - 16: optional CreationMetadata creationMetadata, // only for MVs, it stores table names used and txn list at MV creation - 17: optional string catName, // Name of the catalog the table is in - 18: optional PrincipalType ownerType = PrincipalType.USER, // owner type of this table (default to USER for backward compatibility) - 19: optional i64 writeId=-1, - 20: optional bool isStatsCompliant + 1: i64 id, // id of the table + 2: string tableName, // name of the table + 3: string dbName, // database name ('default') + 4: string owner, // owner of this table + 5: i32 createTime, // creation time of the table + 6: i32 lastAccessTime, // last access time (usually this will be filled from HDFS and shouldn't be relied on) + 7: i32 retention, // retention time + 8: StorageDescriptor sd, // storage descriptor of the table + 9: list partitionKeys, // partition keys of the table. only primitive types are supported + 10: map parameters, // to store comments or any other user level parameters + 11: string viewOriginalText, // original view text, null for non-view + 12: string viewExpandedText, // expanded view text, null for non-view + 13: string tableType, // table type enum, e.g. EXTERNAL_TABLE + 14: optional PrincipalPrivilegeSet privileges, + 15: optional bool temporary=false, + 16: optional bool rewriteEnabled, // rewrite enabled or not + 17: optional CreationMetadata creationMetadata, // only for MVs, it stores table names used and txn list at MV creation + 18: optional string catName, // Name of the catalog the table is in + 19: optional PrincipalType ownerType = PrincipalType.USER, // owner type of this table (default to USER for backward compatibility) + 20: optional i64 writeId=-1, + 21: optional bool isStatsCompliant } struct Partition { diff --git standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java index d27224b235..5b345e6e5b 100644 --- standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java +++ standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java @@ -1917,7 +1917,7 @@ private Table convertToTable(MTable mtbl) throws MetaException { tableType = TableType.MANAGED_TABLE.toString(); } } - final Table t = new Table(mtbl.getTableName(), mtbl.getDatabase().getName(), mtbl + final Table t = new Table(mtbl.getId(), mtbl.getTableName(), mtbl.getDatabase().getName(), mtbl .getOwner(), mtbl.getCreateTime(), mtbl.getLastAccessTime(), mtbl .getRetention(), convertToStorageDescriptor(mtbl.getSd()), convertToFieldSchemas(mtbl.getPartitionKeys()), convertMap(mtbl.getParameters()), @@ -1973,7 +1973,7 @@ private MTable convertToMTable(Table tbl) throws InvalidObjectException, String ownerType = (ownerPrincipalType == null) ? PrincipalType.USER.name() : ownerPrincipalType.name(); // A new table is always created with a new column descriptor - MTable mtable = new MTable(normalizeIdentifier(tbl.getTableName()), mdb, + MTable mtable = new MTable(tbl.getId(), normalizeIdentifier(tbl.getTableName()), mdb, convertToMStorageDescriptor(tbl.getSd()), tbl.getOwner(), ownerType, tbl .getCreateTime(), tbl.getLastAccessTime(), tbl.getRetention(), convertToMFieldSchemas(tbl.getPartitionKeys()), tbl.getParameters(), diff --git standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/client/builder/TableBuilder.java standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/client/builder/TableBuilder.java index fed3dda809..a178c81566 100644 --- standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/client/builder/TableBuilder.java +++ standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/client/builder/TableBuilder.java @@ -55,6 +55,7 @@ private boolean rewriteEnabled, temporary; private Set mvReferencedTables; private PrincipalType ownerType; + private long id; public TableBuilder() { // Set some reasonable defaults @@ -69,6 +70,11 @@ public TableBuilder() { super.setChild(this); } + public TableBuilder setId(long id) { + this.id = id; + return this; + } + public TableBuilder setCatName(String catName) { this.catName = catName; return this; @@ -202,7 +208,7 @@ public Table build(Configuration conf) throws MetaException { } } if (catName == null) catName = MetaStoreUtils.getDefaultCatalog(conf); - Table t = new Table(tableName, dbName, owner, createTime, lastAccessTime, retention, buildSd(), + Table t = new Table(id, tableName, dbName, owner, createTime, lastAccessTime, retention, buildSd(), partCols, tableParams, viewOriginalText, viewExpandedText, type); if (rewriteEnabled) t.setRewriteEnabled(true); if (temporary) t.setTemporary(temporary); diff --git standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/model/MTable.java standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/model/MTable.java index deeb97133d..57a0c3276a 100644 --- standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/model/MTable.java +++ standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/model/MTable.java @@ -23,7 +23,8 @@ import java.util.Map; public class MTable { - + + private long id; private String tableName; private MDatabase database; private MStorageDescriptor sd; @@ -57,10 +58,11 @@ public MTable() {} * @param viewExpandedText * @param tableType */ - public MTable(String tableName, MDatabase database, MStorageDescriptor sd, String owner, String ownerType, + public MTable(long id, String tableName, MDatabase database, MStorageDescriptor sd, String owner, String ownerType, int createTime, int lastAccessTime, int retention, List partitionKeys, Map parameters, String viewOriginalText, String viewExpandedText, boolean rewriteEnabled, String tableType) { + this.id = id; this.tableName = tableName; this.database = database; this.sd = sd; @@ -280,4 +282,19 @@ public long getWriteId() { public void setWriteId(long writeId) { this.writeId = writeId; } + + /** + * @return the id. + */ + public long getId() { + return id; + } + + /** + * + * @param id set the id. + */ + public void setId(long id) { + this.id = id; + } } diff --git standalone-metastore/metastore-server/src/main/resources/package.jdo standalone-metastore/metastore-server/src/main/resources/package.jdo index 2a5f016b1f..369b2cb309 100644 --- standalone-metastore/metastore-server/src/main/resources/package.jdo +++ standalone-metastore/metastore-server/src/main/resources/package.jdo @@ -132,8 +132,8 @@ - - + + diff --git standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java index 4937d9d861..895b416904 100644 --- standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java +++ standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java @@ -1663,6 +1663,52 @@ public void testGetSchemaWithNoClassDefFoundError() throws TException { client.getSchema(dbName, tblName); } + @Test + public void testCreateAndGetTable() throws Exception { + String dbName = "createDb"; + String tblName = "createTbl"; + + client.dropTable(dbName, tblName); + silentDropDatabase(dbName); + new DatabaseBuilder() + .setName(dbName) + .create(client, conf); + + ArrayList invCols = new ArrayList<>(2); + invCols.add(new FieldSchema("key", ColumnType.STRING_TYPE_NAME, "")); + invCols.add(new FieldSchema("value", ColumnType.INT_TYPE_NAME, "")); + + Table tbl = new TableBuilder() + .setId(123) + .setDbName(dbName) + .setTableName(tblName) + .setCols(invCols) + .build(conf); + + client.createTable(tbl); + + Table tblRead = client.getTable(dbName, tblName); + Assert.assertEquals(tbl.getId(), tblRead.getId()); + + } + + @Test + public void testCreateAndGetTableWithDriver() throws Exception { + String dbName = "createDb"; + String tblName = "createTbl"; + + client.dropTable(dbName, tblName); + silentDropDatabase(dbName); + new DatabaseBuilder() + .setName(dbName) + .create(client, conf); + + createTable(dbName, tblName); + + Table tblRead = client.getTable(dbName, tblName); + Assert.assertTrue(tblRead.isSetId()); + } + @Test public void testAlterTable() throws Exception { String dbName = "alterdb"; @@ -2665,6 +2711,15 @@ private void updateTableNameInDB(String oldTableName, String newTableName) throw stmt.executeUpdate(); } + private void createTableInDb(String db, String table) throws SQLException { + String connectionStr = MetastoreConf.getVar(conf, ConfVars.CONNECT_URL_KEY); + Connection conn = DriverManager.getConnection(connectionStr); + + PreparedStatement stmt = conn.prepareStatement("CREATE TABLE " + + db + "." + table + " (foo BIGINT, bar STRING)"); + stmt.execute(); + } + private void cleanUp(String dbName, String tableName, String typeName) throws Exception { if(dbName != null && tableName != null) { client.dropTable(dbName, tableName); diff --git standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStorePartitionSpecs.java standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStorePartitionSpecs.java index df83171648..83de8e5010 100644 --- standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStorePartitionSpecs.java +++ standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStorePartitionSpecs.java @@ -107,7 +107,7 @@ private static void createTable(HiveMetaStoreClient hmsc, boolean enablePartitio Map tableParameters = new HashMap<>(); tableParameters.put("hive.hcatalog.partition.spec.grouping.enabled", enablePartitionGrouping? "true":"false"); - Table table = new Table(tableName, dbName, "", 0, 0, 0, storageDescriptor, partColumns, tableParameters, "", "", ""); + Table table = new Table(1, tableName, dbName, "", 0, 0, 0, storageDescriptor, partColumns, tableParameters, "", "", ""); hmsc.createTable(table); Assert.assertTrue("Table " + dbName + "." + tableName + " does not exist", diff --git standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestObjectStore.java standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestObjectStore.java index b74c3048fa..29495f36ae 100644 --- standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestObjectStore.java +++ standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestObjectStore.java @@ -227,9 +227,12 @@ public void testTableOps() throws MetaException, InvalidObjectException, NoSuchO HashMap params = new HashMap<>(); params.put("EXTERNAL", "false"); Table tbl1 = - new Table(TABLE1, DB1, "owner", 1, 2, 3, sd1, null, params, null, null, "MANAGED_TABLE"); + new Table(1123, TABLE1, DB1, "owner", 1, 2, 3, sd1, null, params, null, null, "MANAGED_TABLE"); objectStore.createTable(tbl1); + Table tblRead = objectStore.getTable(DEFAULT_CATALOG_NAME, DB1, TABLE1); + Assert.assertEquals(tbl1.getId(), tblRead.getId()); + List tables = objectStore.getAllTables(DEFAULT_CATALOG_NAME, DB1); Assert.assertEquals(1, tables.size()); Assert.assertEquals(TABLE1, tables.get(0)); @@ -238,7 +241,7 @@ public void testTableOps() throws MetaException, InvalidObjectException, NoSuchO new StorageDescriptor(ImmutableList.of(new FieldSchema("fk_col", "double", null)), "location", null, null, false, 0, new SerDeInfo("SerDeName", "serializationLib", null), null, null, null); - Table newTbl1 = new Table("new" + TABLE1, DB1, "owner", 1, 2, 3, sd2, null, params, null, null, + Table newTbl1 = new Table(2, "new" + TABLE1, DB1, "owner", 1, 2, 3, sd2, null, params, null, null, "MANAGED_TABLE"); // Change different fields and verify they were altered @@ -324,7 +327,7 @@ public void testPartitionOps() throws MetaException, InvalidObjectException, FieldSchema partitionKey1 = new FieldSchema("Country", ColumnType.STRING_TYPE_NAME, ""); FieldSchema partitionKey2 = new FieldSchema("State", ColumnType.STRING_TYPE_NAME, ""); Table tbl1 = - new Table(TABLE1, DB1, "owner", 1, 2, 3, sd, Arrays.asList(partitionKey1, partitionKey2), + new Table(1, TABLE1, DB1, "owner", 1, 2, 3, sd, Arrays.asList(partitionKey1, partitionKey2), tableParams, null, null, "MANAGED_TABLE"); objectStore.createTable(tbl1); HashMap partitionParams = new HashMap<>(); diff --git standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestOldSchema.java standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestOldSchema.java index 36f91eb01d..a3757ff3c2 100644 --- standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestOldSchema.java +++ standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestOldSchema.java @@ -143,7 +143,7 @@ public void testPartitionOps() throws Exception { serde, null, null, Collections.emptyMap()); List partCols = new ArrayList<>(); partCols.add(new FieldSchema("ds", "string", "")); - Table table = new Table(tableName, dbName, "me", (int) now, (int) now, 0, sd, partCols, + Table table = new Table(1, tableName, dbName, "me", (int) now, (int) now, 0, sd, partCols, Collections.emptyMap(), null, null, null); store.createTable(table); diff --git standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/cache/TestCachedStore.java standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/cache/TestCachedStore.java index bb20d9f42a..7c282c33bc 100644 --- standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/cache/TestCachedStore.java +++ standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/cache/TestCachedStore.java @@ -683,7 +683,7 @@ public void testAggrStatsRepeatedRead() throws Exception { null, null, null); Table tbl = - new Table(tblName, dbName, null, 0, 0, 0, sd, partCols, new HashMap<>(), + new Table(1, tblName, dbName, null, 0, 0, 0, sd, partCols, new HashMap<>(), null, null, TableType.MANAGED_TABLE.toString()); tbl.setCatName(DEFAULT_CATALOG_NAME); cachedStore.createTable(tbl); @@ -753,7 +753,7 @@ public void testPartitionAggrStats() throws Exception { null, null, null); Table tbl = - new Table(tblName, dbName, null, 0, 0, 0, sd, partCols, new HashMap<>(), + new Table(1, tblName, dbName, null, 0, 0, 0, sd, partCols, new HashMap<>(), null, null, TableType.MANAGED_TABLE.toString()); tbl.setCatName(DEFAULT_CATALOG_NAME); cachedStore.createTable(tbl); @@ -827,7 +827,7 @@ public void testPartitionAggrStatsBitVector() throws Exception { null, null, null); Table tbl = - new Table(tblName, dbName, null, 0, 0, 0, sd, partCols, new HashMap<>(), + new Table(1, tblName, dbName, null, 0, 0, 0, sd, partCols, new HashMap<>(), null, null, TableType.MANAGED_TABLE.toString()); tbl.setCatName(DEFAULT_CATALOG_NAME); cachedStore.createTable(tbl); @@ -1055,7 +1055,7 @@ private Table createTestTbl(String dbName, String tblName, String tblOwner, StorageDescriptor sd = new StorageDescriptor(cols, serdeLocation, "input", "output", false, 0, serdeInfo, null, null, serdeParams); sd.setStoredAsSubDirectories(false); - Table tbl = new Table(tblName, dbName, tblOwner, 0, 0, 0, sd, ptnCols, tblParams, null, null, + Table tbl = new Table(1, tblName, dbName, tblOwner, 0, 0, 0, sd, ptnCols, tblParams, null, null, TableType.MANAGED_TABLE.toString()); tbl.setCatName(DEFAULT_CATALOG_NAME); return tbl;