@Test public void testGetPartitionSplitsTableOfflinePartition() throws Exception { ConnectorTableHandle tableHandle = getTableHandle(tableOfflinePartition); assertNotNull(tableHandle); ConnectorColumnHandle dsColumn = metadata.getColumnHandle(tableHandle, "ds"); assertNotNull(dsColumn); Domain domain = Domain.singleValue(utf8Slice("2012-12-30")); TupleDomain<ConnectorColumnHandle> tupleDomain = TupleDomain.withColumnDomains(ImmutableMap.of(dsColumn, domain)); ConnectorPartitionResult partitionResult = splitManager.getPartitions(tableHandle, tupleDomain); for (ConnectorPartition partition : partitionResult.getPartitions()) { if (domain.equals(partition.getTupleDomain().getDomains().get(dsColumn))) { try { getSplitCount(splitManager.getPartitionSplits(tableHandle, ImmutableList.of(partition))); fail("Expected PartitionOfflineException"); } catch (PartitionOfflineException e) { assertEquals(e.getTableName(), tableOfflinePartition); assertEquals(e.getPartition(), "ds=2012-12-30"); } } else { getSplitCount(splitManager.getPartitionSplits(tableHandle, ImmutableList.of(partition))); } } }
@Test public void testGetPartitionsWithBindings() throws Exception { ConnectorTableHandle tableHandle = getTableHandle(table); ConnectorPartitionResult partitionResult = splitManager.getPartitions( tableHandle, TupleDomain.withColumnDomains( ImmutableMap.<ConnectorColumnHandle, Domain>of(intColumn, Domain.singleValue(5L)))); assertExpectedPartitions(partitionResult.getPartitions()); }