io.prestosql.spi.NodeManager.getAllNodes()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中io.prestosql.spi.NodeManager.getAllNodes()方法的一些代码示例,展示了NodeManager.getAllNodes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NodeManager.getAllNodes()方法的具体详情如下:
包路径:io.prestosql.spi.NodeManager
类名称:NodeManager
方法名:getAllNodes

NodeManager.getAllNodes介绍

暂无

代码示例

代码示例来源:origin: prestosql/presto

@Override
  public ConnectorSplitSource getSplits(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorTableLayoutHandle layout, SplitSchedulingStrategy splitSchedulingStrategy)
  {
    LocalFileTableLayoutHandle layoutHandle = (LocalFileTableLayoutHandle) layout;
    LocalFileTableHandle tableHandle = layoutHandle.getTable();

    TupleDomain<LocalFileColumnHandle> effectivePredicate = layoutHandle.getConstraint()
        .transform(LocalFileColumnHandle.class::cast);

    List<ConnectorSplit> splits = nodeManager.getAllNodes().stream()
        .map(node -> new LocalFileSplit(node.getHostAndPort(), tableHandle.getSchemaTableName(), effectivePredicate))
        .collect(Collectors.toList());

    return new FixedSplitSource(splits);
  }
}

代码示例来源:origin: prestosql/presto

@Override
  public ConnectorSplitSource getSplits(ConnectorTransactionHandle transaction, ConnectorSession session, ConnectorTableLayoutHandle layout, SplitSchedulingStrategy splitSchedulingStrategy)
  {
    JmxTableLayoutHandle jmxLayout = (JmxTableLayoutHandle) layout;
    JmxTableHandle tableHandle = jmxLayout.getTable();
    TupleDomain<ColumnHandle> predicate = jmxLayout.getConstraint();

    //TODO is there a better way to get the node column?
    Optional<JmxColumnHandle> nodeColumnHandle = tableHandle.getColumnHandles().stream()
        .filter(jmxColumnHandle -> jmxColumnHandle.getColumnName().equals(NODE_COLUMN_NAME))
        .findFirst();
    checkState(nodeColumnHandle.isPresent(), "Failed to find %s column", NODE_COLUMN_NAME);

    List<ConnectorSplit> splits = nodeManager.getAllNodes().stream()
        .filter(node -> {
          NullableValue value = NullableValue.of(createUnboundedVarcharType(), utf8Slice(node.getNodeIdentifier()));
          return predicate.overlaps(fromFixedValues(ImmutableMap.of(nodeColumnHandle.get(), value)));
        })
        .map(node -> new JmxSplit(tableHandle, ImmutableList.of(node.getHostAndPort())))
        .collect(toList());

    return new FixedSplitSource(splits);
  }
}

相关文章