use of com.facebook.presto.elasticsearch.client.ElasticsearchNode in project presto by prestodb.
the class NodesSystemTable method pageSource.
@Override
public ConnectorPageSource pageSource(ConnectorTransactionHandle transaction, ConnectorSession session, TupleDomain<Integer> constraint) {
Set<ElasticsearchNode> nodes = client.getNodes();
BlockBuilder nodeId = VARCHAR.createBlockBuilder(null, nodes.size());
BlockBuilder prestoAddress = VARCHAR.createBlockBuilder(null, nodes.size());
BlockBuilder elasticsearchNodeId = VARCHAR.createBlockBuilder(null, nodes.size());
BlockBuilder elasticsearchAddress = VARCHAR.createBlockBuilder(null, nodes.size());
for (ElasticsearchNode node : nodes) {
VARCHAR.writeString(nodeId, currentNode.getNodeIdentifier());
VARCHAR.writeString(prestoAddress, currentNode.getHostAndPort().toString());
VARCHAR.writeString(elasticsearchNodeId, node.getId());
if (node.getAddress().isPresent()) {
VARCHAR.writeString(elasticsearchAddress, node.getAddress().get());
} else {
elasticsearchAddress.appendNull();
}
}
return new FixedPageSource(ImmutableList.of(new Page(nodeId.build(), prestoAddress.build(), elasticsearchNodeId.build(), elasticsearchAddress.build())));
}
Aggregations