public CoverageRecordSet(CoverageSplit split, List<RiakColumnHandle> columnHandles, RiakConfig riakConfig, TupleDomain<ColumnHandle> tupleDomain, DirectConnection directConnection) { this.split = checkNotNull(split, "split is null"); this.columnHandles = checkNotNull(columnHandles, "column handles is null"); ImmutableList.Builder<Type> types = ImmutableList.builder(); for (RiakColumnHandle column : columnHandles) { types.add(column.getColumn().getType()); } this.types = types.build(); this.tupleDomain = checkNotNull(tupleDomain); this.directConnection = checkNotNull(directConnection); }
@Override public PartitionResult getPartitions(TableHandle tableHandle, TupleDomain tupleDomain) { checkNotNull(tableHandle, "tableHandle is null"); SchemaTableName tableName = getTableName(tableHandle); Table table; try { table = metastore().getTable(tableName.getSchemaName(), tableName.getTableName()); Map<String, String> props = table.getParameters(); if (!KafkaTableHandle.kafkaTableMarkPresent(props)) { throw new RuntimeException("table not a kakfa mapped table."); } } catch (NoSuchObjectException e) { throw new RuntimeException(tableName + " not found."); } return hiveClient.getPartitions(tableHandle, tupleDomain); }
@JsonCreator public CoverageSplit( @JsonProperty("tableHandle") RiakTableHandle tableHandle, @JsonProperty("table") PRTable table, @JsonProperty("host") String host, @JsonProperty("splitData") String splitData, @JsonProperty("tupleDomain") TupleDomain<ColumnHandle> tupleDomain) { this.tableHandle = checkNotNull(tableHandle); this.table = checkNotNull(table); this.host = checkNotNull(host); this.splitData = checkNotNull(splitData); this.tupleDomain = checkNotNull(tupleDomain); }
public RiakPartition(String schemaName, String tableName, TupleDomain<ColumnHandle> tupleDomain, List<String> indexedColumns ) { this.schemaName = checkNotNull(schemaName, "schema name is null"); this.tableName = checkNotNull(tableName, "table name is null"); this.tupleDomain = checkNotNull(tupleDomain); this.indexedColumns = checkNotNull(indexedColumns); }
@Test public void testCoverageSplit() { RiakTableHandle handle = new RiakTableHandle("c", "s", "t"); PRTable table = TestPRTable.example("boom"); CoverageSplit coverageSplit = new CoverageSplit(handle, table, "192.168.0.1", "", TupleDomain.<ColumnHandle>all()); String s = MetadataUtil.COV_CODEC.toJson(coverageSplit); CoverageSplit cs2 = MetadataUtil.COV_CODEC.fromJson(s); assert(coverageSplit.getTableHandle().getTableName() .equals(cs2.getTableHandle().getTableName())); }
@Override public PartitionResult getPartitions(TableHandle table, TupleDomain tupleDomain) { // checkArgument(table instanceof CloudataTableHandle, "tableHandle is not an instance of CloudataTableHandle"); assert table instanceof CloudataTableHandle; CloudataTableHandle tableHandle = (CloudataTableHandle) table; // example connector has only one partition List<Partition> partitions = ImmutableList.<Partition> of(new CloudataPartition(tableHandle.getSchemaName(), tableHandle.getTableName())); // example connector does not do any additional processing/filtering with the TupleDomain, so just return the // whole TupleDomain return new PartitionResult(partitions, tupleDomain); }
@Override public PartitionResult getPartitions(TableHandle tableHandle, TupleDomain tupleDomain) { checkArgument(tableHandle instanceof MockTableHandle, "tableHandle is not an instance of MockTableHandle"); MockTableHandle exampleTableHandle = (MockTableHandle) tableHandle; // example connector has only one partition List<Partition> partitions = ImmutableList.<Partition> of(new MockPartition(exampleTableHandle.getSchemaName(), exampleTableHandle.getTableName())); // example connector does not do any additional processing/filtering with the TupleDomain, so just return the // whole TupleDomain ; return new PartitionResult(partitions, tupleDomain); }
@JsonProperty public TupleDomain<ColumnHandle> getTupleDomain() { return tupleDomain; }
@Override public TupleDomain<ColumnHandle> getTupleDomain() { return tupleDomain; }
public PartitionResult getPartitions(TableHandle tableHandle, TupleDomain tupleDomain) { TableHandle newHandle = castToHiveTableHandle(tableHandle); return this.hiveClient.getPartitions(newHandle, tupleDomain); }
@Override public TupleDomain getTupleDomain() { return TupleDomain.all(); }