Java Code Examples for org.apache.hadoop.hive.metastore.api.Index#setOrigTableName()
The following examples show how to use
org.apache.hadoop.hive.metastore.api.Index#setOrigTableName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CatalogToHiveConverter.java From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 | 6 votes |
public static Index convertTableObjectToIndex(com.amazonaws.services.glue.model.Table catalogTable) { Index hiveIndex = new Index(); Map<String, String> parameters = catalogTable.getParameters(); hiveIndex.setIndexName(catalogTable.getName()); hiveIndex.setCreateTime((int) (catalogTable.getCreateTime().getTime() / 1000)); hiveIndex.setLastAccessTime((int) (catalogTable.getLastAccessTime().getTime() / 1000)); hiveIndex.setSd(convertStorageDescriptor(catalogTable.getStorageDescriptor())); hiveIndex.setParameters(catalogTable.getParameters()); hiveIndex.setDeferredRebuild(parameters.get(INDEX_DEFERRED_REBUILD).equals("TRUE")); hiveIndex.setIndexHandlerClass(parameters.get(INDEX_HANDLER_CLASS)); hiveIndex.setDbName(parameters.get(INDEX_DB_NAME)); hiveIndex.setOrigTableName(parameters.get(INDEX_ORIGIN_TABLE_NAME)); hiveIndex.setIndexTableName(parameters.get(INDEX_TABLE_NAME)); return hiveIndex; }
Example 2
Source File: MetastoreClientIndexIntegrationTest.java From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 | 6 votes |
@Test public void listIndexesValid() throws TException { Index index2 = TestObjects.getTestHiveIndex(hiveDB.getName()); Index index3 = TestObjects.getTestHiveIndex(hiveDB.getName()); Table hiveIndexTable2 = CatalogToHiveConverter.convertTable(getTestTable(), hiveDB.getName()); Table hiveIndexTable3 = CatalogToHiveConverter.convertTable(getTestTable(), hiveDB.getName()); index2.setOrigTableName(hiveTable.getTableName()); index2.setIndexTableName(hiveIndexTable2.getTableName()); index3.setOrigTableName(hiveTable.getTableName()); index3.setIndexTableName(hiveIndexTable3.getTableName()); metastoreClient.createIndex(hiveIndex, hiveIndexTable); metastoreClient.createIndex(index2, hiveIndexTable2); metastoreClient.createIndex(index3, hiveIndexTable3); List<Index> indexList = new ArrayList<>(); indexList.add(hiveIndex); indexList.add(index3); indexList.add(index2); List<Index> result = metastoreClient.listIndexes(hiveDB.getName(), hiveTable.getTableName(), (short) 2); assertTrue(result.containsAll(indexList)); }
Example 3
Source File: MetastoreClientIndexIntegrationTest.java From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 | 6 votes |
@Test (expected = NoSuchObjectException.class) public void listIndexesInvalidWithUnknownTable() throws TException { Index index2 = TestObjects.getTestHiveIndex(hiveDB.getName()); Index index3 = TestObjects.getTestHiveIndex(hiveDB.getName()); Table hiveIndexTable2 = CatalogToHiveConverter.convertTable(getTestTable(), hiveDB.getName()); Table hiveIndexTable3 = CatalogToHiveConverter.convertTable(getTestTable(), hiveDB.getName()); index2.setOrigTableName(hiveTable.getTableName()); index2.setIndexTableName(hiveIndexTable2.getTableName()); index3.setOrigTableName(hiveTable.getTableName()); index3.setIndexTableName(hiveIndexTable3.getTableName()); metastoreClient.createIndex(hiveIndex, hiveIndexTable); metastoreClient.createIndex(index2, hiveIndexTable2); metastoreClient.createIndex(index3, hiveIndexTable3); metastoreClient.listIndexes(hiveDB.getName(), invalidTable, (short) 2); }
Example 4
Source File: MetastoreClientIndexIntegrationTest.java From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 | 6 votes |
@Test (expected = NoSuchObjectException.class) public void listIndexesInvalidWithUnknownDb() throws TException { Index index2 = TestObjects.getTestHiveIndex(hiveDB.getName()); Index index3 = TestObjects.getTestHiveIndex(hiveDB.getName()); Table hiveIndexTable2 = CatalogToHiveConverter.convertTable(getTestTable(), hiveDB.getName()); Table hiveIndexTable3 = CatalogToHiveConverter.convertTable(getTestTable(), hiveDB.getName()); index2.setOrigTableName(hiveTable.getTableName()); index2.setIndexTableName(hiveIndexTable2.getTableName()); index3.setOrigTableName(hiveTable.getTableName()); index3.setIndexTableName(hiveIndexTable3.getTableName()); metastoreClient.createIndex(hiveIndex, hiveIndexTable); metastoreClient.createIndex(index2, hiveIndexTable2); metastoreClient.createIndex(index3, hiveIndexTable3); metastoreClient.listIndexes(invalidDatabase, hiveTable.getTableName(), (short) 2); }
Example 5
Source File: MetastoreClientIndexIntegrationTest.java From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 | 6 votes |
@Test public void listIndexNamesValid() throws TException { Index index2 = TestObjects.getTestHiveIndex(hiveDB.getName()); Index index3 = TestObjects.getTestHiveIndex(hiveDB.getName()); Table hiveIndexTable2 = CatalogToHiveConverter.convertTable(getTestTable(), hiveDB.getName()); Table hiveIndexTable3 = CatalogToHiveConverter.convertTable(getTestTable(), hiveDB.getName()); index2.setOrigTableName(hiveTable.getTableName()); index2.setIndexTableName(hiveIndexTable2.getTableName()); index3.setOrigTableName(hiveTable.getTableName()); index3.setIndexTableName(hiveIndexTable3.getTableName()); metastoreClient.createIndex(hiveIndex, hiveIndexTable); metastoreClient.createIndex(index2, hiveIndexTable2); metastoreClient.createIndex(index3, hiveIndexTable3); List<String> indexNameList = new ArrayList<>(); indexNameList.add(hiveIndex.getIndexName()); indexNameList.add(index2.getIndexName()); indexNameList.add(index3.getIndexName()); List<String> result = metastoreClient.listIndexNames(hiveDB.getName(), hiveTable.getTableName(), (short) 2); assertTrue(result.containsAll(indexNameList)); }
Example 6
Source File: MetastoreClientIndexIntegrationTest.java From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 | 6 votes |
@Test (expected = NoSuchObjectException.class) public void listIndexNameInvalidWithUnknownTable() throws TException { Index index2 = TestObjects.getTestHiveIndex(hiveDB.getName()); Index index3 = TestObjects.getTestHiveIndex(hiveDB.getName()); Table hiveIndexTable2 = CatalogToHiveConverter.convertTable(getTestTable(), hiveDB.getName()); Table hiveIndexTable3 = CatalogToHiveConverter.convertTable(getTestTable(), hiveDB.getName()); index2.setOrigTableName(hiveTable.getTableName()); index2.setIndexTableName(hiveIndexTable2.getTableName()); index3.setOrigTableName(hiveTable.getTableName()); index3.setIndexTableName(hiveIndexTable3.getTableName()); metastoreClient.createIndex(hiveIndex, hiveIndexTable); metastoreClient.createIndex(index2, hiveIndexTable2); metastoreClient.createIndex(index3, hiveIndexTable3); metastoreClient.listIndexNames(hiveDB.getName(), invalidTable, (short) 2); }
Example 7
Source File: MetastoreClientIndexIntegrationTest.java From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 | 6 votes |
@Test (expected = NoSuchObjectException.class) public void listIndexNameInvalidWithUnknownDb() throws TException { Index index2 = TestObjects.getTestHiveIndex(hiveDB.getName()); Index index3 = TestObjects.getTestHiveIndex(hiveDB.getName()); Table hiveIndexTable2 = CatalogToHiveConverter.convertTable(getTestTable(), hiveDB.getName()); Table hiveIndexTable3 = CatalogToHiveConverter.convertTable(getTestTable(), hiveDB.getName()); index2.setOrigTableName(hiveTable.getTableName()); index2.setIndexTableName(hiveIndexTable2.getTableName()); index3.setOrigTableName(hiveTable.getTableName()); index3.setIndexTableName(hiveIndexTable3.getTableName()); metastoreClient.createIndex(hiveIndex, hiveIndexTable); metastoreClient.createIndex(index2, hiveIndexTable2); metastoreClient.createIndex(index3, hiveIndexTable3); metastoreClient.listIndexNames(invalidDatabase, hiveTable.getTableName(), (short) 2); }
Example 8
Source File: TestObjects.java From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 | 5 votes |
public static Index getTestHiveIndex(final String dbName) { Index index = new Index(); index.setIndexName("testIndex" + UUID.randomUUID().toString().replaceAll("[^a-zA-Z0-9]+", "")); index.setCreateTime((int)(System.currentTimeMillis() / 1000)); index.setLastAccessTime((int)(System.currentTimeMillis() / 1000)); index.setDbName(dbName); index.setDeferredRebuild(false); index.setOrigTableName("OriginalTable"); index.setIndexTableName("IndexTable"); index.setIndexHandlerClass("handlerClass"); index.setParameters(new HashMap<String, String>()); index.setSd(CatalogToHiveConverter.convertStorageDescriptor(getTestStorageDescriptor())); return index; }
Example 9
Source File: MetastoreClientIndexIntegrationTest.java From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 | 5 votes |
@Test public void alterValidIndex() throws TException { metastoreClient.createIndex(hiveIndex, hiveIndexTable); Index newIndex = TestObjects.getTestHiveIndex(hiveDB.getName()); newIndex.setIndexTableName(hiveIndexTable.getTableName()); newIndex.setOrigTableName(hiveTable.getTableName()); metastoreClient.alter_index(hiveDB.getName(), hiveTable.getTableName(), hiveIndex.getIndexName(), newIndex); assertFalse(indexExist(hiveDB.getName(), hiveTable.getTableName(), hiveIndex.getIndexName())); assertTrue(indexExist(hiveDB.getName(), hiveTable.getTableName(), newIndex.getIndexName())); }
Example 10
Source File: MetastoreClientIndexIntegrationTest.java From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 | 5 votes |
@Test (expected = NoSuchObjectException.class) public void alterIndexInvalidWithUnknownTable() throws TException { metastoreClient.createIndex(hiveIndex, hiveIndexTable); Index newIndex = TestObjects.getTestHiveIndex(hiveDB.getName()); newIndex.setOrigTableName(hiveTable.getTableName()); newIndex.setIndexTableName(hiveIndexTable.getTableName()); metastoreClient.alter_index(hiveDB.getName(), invalidTable, hiveIndex.getIndexName(), newIndex); }