Java Code Examples for com.amazonaws.services.glue.model.Table#setPartitionKeys()
The following examples show how to use
com.amazonaws.services.glue.model.Table#setPartitionKeys() .
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: EntityConversionTest.java From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 | 5 votes |
@Test public void testTableConversionWithNullPartitionKeys() { Table catalogTable = TestObjects.getTestTable(); catalogTable.setPartitionKeys(null); org.apache.hadoop.hive.metastore.api.Table hiveTable = CatalogToHiveConverter.convertTable(catalogTable, TEST_DB_NAME); assertNotNull(hiveTable.getPartitionKeys()); assertTrue(hiveTable.getPartitionKeys().isEmpty()); }
Example 2
Source File: TestObjects.java From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 | 5 votes |
public static Table getTestTable() { Table table = new Table(); table.setName("testtable" + UUID.randomUUID().toString().replaceAll("[^a-zA-Z0-9]+", "").substring(0,4)); table.setOwner("owner"); table.setCreateTime(new Date(System.currentTimeMillis() / 1000 * 1000)); table.setLastAccessTime(new Date(System.currentTimeMillis() / 1000 * 1000)); table.setParameters(new HashMap<String, String>()); table.setPartitionKeys(getTestFieldList()); table.setStorageDescriptor(getTestStorageDescriptor()); table.setTableType("MANAGED_TABLE"); table.setRetention(1); table.setViewOriginalText("originalText"); table.setViewExpandedText("expandedText"); return table; }
Example 3
Source File: AWSCatalogMetastoreClientTest.java From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 | 5 votes |
@Test public void testListPartitionNames() throws Exception { List<String> values1 = Arrays.asList("a", "x"); Partition partition1 = new Partition() .withDatabaseName(testDB.getName()) .withTableName(testTable.getTableName()) .withValues(values1); List<String> values2 = Arrays.asList("a", "y"); Partition partition2 = new Partition() .withDatabaseName(testDB.getName()) .withTableName(testTable.getTableName()) .withValues(values2); Table table = HiveToCatalogConverter.convertTable(testTable); table.setPartitionKeys(Arrays.asList(new Column().withName("foo"), new Column().withName("bar"))); when(glueClient.getPartitions(any(GetPartitionsRequest.class))) .thenReturn(new GetPartitionsResult().withPartitions(Arrays.asList(partition1, partition2))); when(glueClient.getTable(any(GetTableRequest.class))) .thenReturn(new GetTableResult().withTable(table)); List<String> partitionNames = metastoreClient.listPartitionNames( testDB.getName(), testTable.getTableName(), (short) -1); assertThat(partitionNames, containsInAnyOrder("foo=a/bar=x", "foo=a/bar=y")); }