com.facebook.presto.spi.HostAddress Java Examples

The following examples show how to use com.facebook.presto.spi.HostAddress. 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: ElasticsearchSplit.java    From presto-connectors with Apache License 2.0 6 votes vote down vote up
@JsonCreator
public ElasticsearchSplit(
        @JsonProperty("connectorId") String connectorId,
        @JsonProperty("schema") String schema,
        @JsonProperty("table") String table,
        @JsonProperty("searchRequest") byte[] searchRequest,
        @JsonProperty("timeValue") long timeValue,
        @JsonProperty("pushDownDsl") Map<String, String> pushDownDsl,
        @JsonProperty("hostPort") Optional<String> hostPort)
{
    this.connectorId = requireNonNull(connectorId, "connectorId is null");
    this.schema = requireNonNull(schema, "schema is null");
    this.table = requireNonNull(table, "table is null");
    this.searchRequest = requireNonNull(searchRequest, "searchRequest is null");
    this.timeValue = timeValue;
    this.pushDownDsl = requireNonNull(pushDownDsl, "pushDownDsl is null");

    // Parse the host address into a list of addresses, this would be an Elasticsearch Tablet server or some localhost thing
    if (hostPort.isPresent()) {
        addresses = ImmutableList.of(HostAddress.fromString(hostPort.get()));
    }
    else {
        addresses = ImmutableList.of();
    }
}
 
Example #2
Source File: HbaseSplit.java    From presto-connectors with Apache License 2.0 6 votes vote down vote up
@JsonCreator
public HbaseSplit(
        @JsonProperty("connectorId") String connectorId,
        @JsonProperty("schema") String schema,
        @JsonProperty("table") String table,
        @JsonProperty("rowId") String rowId,
        @JsonProperty("splitMetadata") TabletSplitMetadata splitMetadata,
        @JsonProperty("constraints") List<HbaseColumnConstraint> constraints,
        @JsonProperty("scanAuthorizations") Optional<String> scanAuthorizations)
{
    this.connectorId = requireNonNull(connectorId, "connectorId is null");
    this.rowId = requireNonNull(rowId, "rowId is null");
    this.schema = requireNonNull(schema, "schema is null");
    this.table = requireNonNull(table, "table is null");
    this.constraints = ImmutableList.copyOf(requireNonNull(constraints, "constraints is null"));
    this.splitMetadata = requireNonNull(splitMetadata, "splitMetadata is null");

    // Parse the host address into a list of addresses, this would be an Hbase Tablet server or some localhost thing
    this.addresses = ImmutableList.of(HostAddress.fromString(splitMetadata.getRegionLocation()));
}
 
Example #3
Source File: ParaflowSplit.java    From paraflow with Apache License 2.0 6 votes vote down vote up
@JsonCreator
public ParaflowSplit(
        @JsonProperty("connectorId") ParaflowConnectorId connectorId,
        @JsonProperty("table") SchemaTableName table,
        @JsonProperty("path") String path,
        @JsonProperty("start") long start,
        @JsonProperty("len") long len,
        @JsonProperty("addresses") List<HostAddress> addresses
)
{
    this.connectorId = requireNonNull(connectorId, "connectorId is null");
    this.table = requireNonNull(table, "table is null");
    this.path = requireNonNull(path, "path is null");
    this.start = requireNonNull(start);
    this.len = requireNonNull(len);
    this.addresses = ImmutableList.copyOf(requireNonNull(addresses, "addresses is null"));
}
 
Example #4
Source File: FSFactory.java    From paraflow with Apache License 2.0 6 votes vote down vote up
public List<HostAddress> getBlockLocations(Path file, long start, long len)
{
    Set<HostAddress> addresses = new HashSet<>();
    BlockLocation[] locations = new BlockLocation[0];
    try {
        locations = this.fileSystem.getFileBlockLocations(file, start, len);
    }
    catch (IOException e) {
        log.error(e);
    }
    assert locations.length <= 1;
    for (BlockLocation location : locations) {
        try {
            addresses.addAll(toHostAddress(location.getHosts()));
        }
        catch (IOException e) {
            log.error(e);
        }
    }
    return new ArrayList<>(addresses);
}
 
Example #5
Source File: KubeRecordCursor.java    From kubesql with Apache License 2.0 5 votes vote down vote up
public KubeRecordCursor(KubeTables kubeTables, List<KubeColumnHandle> columns, SchemaTableName tableName, HostAddress address, TupleDomain<KubeColumnHandle> predicate) {
    this.columns = requireNonNull(columns, "columns is null");
    this.address = requireNonNull(address, "address is null");

    fieldToColumnName = new String[columns.size()];
    fieldToColumnIndex = new int[columns.size()];
    for (int i = 0; i < columns.size(); i++) {
        KubeColumnHandle columnHandle = columns.get(i);
        fieldToColumnIndex[i] = columnHandle.getOrdinalPosition();
        fieldToColumnName[i] = columnHandle.getColumnName();
    }
    resources = kubeTables.getKubeCache().getCache(tableName).values().iterator();
}
 
Example #6
Source File: TestHdfsFile.java    From paraflow with Apache License 2.0 5 votes vote down vote up
@Test
public void testFileLocation()
{
    Path tablePath = new Path("hdfs://dbiir01:9000/paraflow/test/tpch/019355364443918028120303902");
    List<HostAddress> addresses = fsFactory.getBlockLocations(tablePath, 0, Long.MAX_VALUE);
    for (HostAddress s : addresses) {
        System.out.println(s.getHostText());
    }
}
 
Example #7
Source File: KubeSplit.java    From kubesql with Apache License 2.0 5 votes vote down vote up
@JsonCreator
public KubeSplit(
        @JsonProperty("address") HostAddress address,
        @JsonProperty("tableName") SchemaTableName tableName,
        @JsonProperty("effectivePredicate") TupleDomain<KubeColumnHandle> effectivePredicate)
{
    this.address = requireNonNull(address, "address is null");
    this.tableName = requireNonNull(tableName, "tableName is null");
    this.effectivePredicate = requireNonNull(effectivePredicate, "effectivePredicate is null");
}
 
Example #8
Source File: FSFactory.java    From paraflow with Apache License 2.0 5 votes vote down vote up
private List<HostAddress> toHostAddress(String[] hosts)
{
    ImmutableList.Builder<HostAddress> builder = ImmutableList.builder();
    for (String host : hosts) {
        builder.add(HostAddress.fromString(host));
    }
    return builder.build();
}
 
Example #9
Source File: HbaseSplit.java    From presto-connectors with Apache License 2.0 4 votes vote down vote up
@Override
public List<HostAddress> getAddresses()
{
    return addresses;
}
 
Example #10
Source File: KinesisSplit.java    From presto-kinesis with Apache License 2.0 4 votes vote down vote up
@Override
public List<HostAddress> getAddresses()
{
    return ImmutableList.of();
}
 
Example #11
Source File: KuduSplit.java    From presto-kudu with Apache License 2.0 4 votes vote down vote up
@Override
public List<HostAddress> getAddresses() {
    return ImmutableList.of();
}
 
Example #12
Source File: EthereumSplit.java    From presto-ethereum with Apache License 2.0 4 votes vote down vote up
@Override
public List<HostAddress> getAddresses() {
    return Collections.emptyList();
}
 
Example #13
Source File: ParaflowSplit.java    From paraflow with Apache License 2.0 4 votes vote down vote up
@JsonProperty
@Override
public List<HostAddress> getAddresses()
{
    return addresses;
}
 
Example #14
Source File: ElasticsearchSplit.java    From presto-connectors with Apache License 2.0 4 votes vote down vote up
@Override
public List<HostAddress> getAddresses()
{
    return addresses;
}
 
Example #15
Source File: KubeSplit.java    From kubesql with Apache License 2.0 4 votes vote down vote up
public List<HostAddress> getAddresses()
{
    return ImmutableList.of(address);
}
 
Example #16
Source File: KubeSplit.java    From kubesql with Apache License 2.0 4 votes vote down vote up
@Override
public List<HostAddress> getPreferredNodes(List<HostAddress> sortedCandidates)
{
    return ImmutableList.of(address);
}
 
Example #17
Source File: KubeSplit.java    From kubesql with Apache License 2.0 4 votes vote down vote up
@JsonProperty
public HostAddress getAddress()
{
    return address;
}