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

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

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

NodeManager.getRequiredWorkerNodes介绍

暂无

代码示例

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

@Override
public ConnectorBucketNodeMap getBucketNodeMap(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle)
{
  Set<Node> nodes = nodeManager.getRequiredWorkerNodes();
  // Split the data using split and skew by the number of nodes available.
  return createBucketNodeMap(toIntExact((long) nodes.size() * splitsPerNode));
}

代码示例来源:origin: io.prestosql/presto-tpch

@Override
public ConnectorBucketNodeMap getBucketNodeMap(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle)
{
  Set<Node> nodes = nodeManager.getRequiredWorkerNodes();
  // Split the data using split and skew by the number of nodes available.
  return createBucketNodeMap(toIntExact((long) nodes.size() * splitsPerNode));
}

代码示例来源:origin: io.prestosql/presto-blackhole

@Override
public ConnectorBucketNodeMap getBucketNodeMap(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle)
{
  // create one bucket per node
  return createBucketNodeMap(nodeManager.getRequiredWorkerNodes().size());
}

代码示例来源:origin: io.prestosql/presto-tpcds

@Override
public ConnectorBucketNodeMap getBucketNodeMap(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle)
{
  Set<Node> nodes = nodeManager.getRequiredWorkerNodes();
  checkState(!nodes.isEmpty(), "No TPCDS nodes available");
  // Split the data using split and skew by the number of nodes available.
  return createBucketNodeMap(toIntExact((long) nodes.size() * splitsPerNode));
}

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

@Override
public ConnectorBucketNodeMap getBucketNodeMap(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle)
{
  // create one bucket per node
  return createBucketNodeMap(nodeManager.getRequiredWorkerNodes().size());
}

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

@Override
public ConnectorBucketNodeMap getBucketNodeMap(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle)
{
  Set<Node> nodes = nodeManager.getRequiredWorkerNodes();
  checkState(!nodes.isEmpty(), "No TPCDS nodes available");
  // Split the data using split and skew by the number of nodes available.
  return createBucketNodeMap(toIntExact((long) nodes.size() * splitsPerNode));
}

代码示例来源:origin: io.prestosql/presto-tpcds

@Override
  public ConnectorSplitSource getSplits(ConnectorTransactionHandle transaction, ConnectorSession session, ConnectorTableLayoutHandle layout, SplitSchedulingStrategy splitSchedulingStrategy)
  {
    TpcdsTableHandle tableHandle = ((TpcdsTableLayoutHandle) layout).getTable();

    Set<Node> nodes = nodeManager.getRequiredWorkerNodes();
    checkState(!nodes.isEmpty(), "No TPCDS nodes available");

    int totalParts = nodes.size() * splitsPerNode;
    int partNumber = 0;

    // Split the data using split and skew by the number of nodes available.
    ImmutableList.Builder<ConnectorSplit> splits = ImmutableList.builder();
    for (Node node : nodes) {
      for (int i = 0; i < splitsPerNode; i++) {
        splits.add(new TpcdsSplit(tableHandle, partNumber, totalParts, ImmutableList.of(node.getHostAndPort()), noSexism));
        partNumber++;
      }
    }
    return new FixedSplitSource(splits.build());
  }
}

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

@Override
  public ConnectorSplitSource getSplits(ConnectorTransactionHandle transaction, ConnectorSession session, ConnectorTableLayoutHandle layout, SplitSchedulingStrategy splitSchedulingStrategy)
  {
    TpcdsTableHandle tableHandle = ((TpcdsTableLayoutHandle) layout).getTable();

    Set<Node> nodes = nodeManager.getRequiredWorkerNodes();
    checkState(!nodes.isEmpty(), "No TPCDS nodes available");

    int totalParts = nodes.size() * splitsPerNode;
    int partNumber = 0;

    // Split the data using split and skew by the number of nodes available.
    ImmutableList.Builder<ConnectorSplit> splits = ImmutableList.builder();
    for (Node node : nodes) {
      for (int i = 0; i < splitsPerNode; i++) {
        splits.add(new TpcdsSplit(tableHandle, partNumber, totalParts, ImmutableList.of(node.getHostAndPort()), noSexism));
        partNumber++;
      }
    }
    return new FixedSplitSource(splits.build());
  }
}

代码示例来源:origin: io.prestosql/presto-tpch

@Override
  public ConnectorSplitSource getSplits(ConnectorTransactionHandle transaction, ConnectorSession session, ConnectorTableLayoutHandle layout, SplitSchedulingStrategy splitSchedulingStrategy)
  {
    TpchTableLayoutHandle tableLayoutHandle = (TpchTableLayoutHandle) layout;
    TpchTableHandle tableHandle = tableLayoutHandle.getTable();

    Set<Node> nodes = nodeManager.getRequiredWorkerNodes();

    int totalParts = nodes.size() * splitsPerNode;
    int partNumber = 0;

    // Split the data using split and skew by the number of nodes available.
    ImmutableList.Builder<ConnectorSplit> splits = ImmutableList.builder();
    for (Node node : nodes) {
      for (int i = 0; i < splitsPerNode; i++) {
        splits.add(new TpchSplit(tableHandle, partNumber, totalParts, ImmutableList.of(node.getHostAndPort()), tableLayoutHandle.getPredicate()));
        partNumber++;
      }
    }
    return new FixedSplitSource(splits.build());
  }
}

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

@Override
  public ConnectorSplitSource getSplits(ConnectorTransactionHandle transaction, ConnectorSession session, ConnectorTableLayoutHandle layout, SplitSchedulingStrategy splitSchedulingStrategy)
  {
    TpchTableLayoutHandle tableLayoutHandle = (TpchTableLayoutHandle) layout;
    TpchTableHandle tableHandle = tableLayoutHandle.getTable();

    Set<Node> nodes = nodeManager.getRequiredWorkerNodes();

    int totalParts = nodes.size() * splitsPerNode;
    int partNumber = 0;

    // Split the data using split and skew by the number of nodes available.
    ImmutableList.Builder<ConnectorSplit> splits = ImmutableList.builder();
    for (Node node : nodes) {
      for (int i = 0; i < splitsPerNode; i++) {
        splits.add(new TpchSplit(tableHandle, partNumber, totalParts, ImmutableList.of(node.getHostAndPort()), tableLayoutHandle.getPredicate()));
        partNumber++;
      }
    }
    return new FixedSplitSource(splits.build());
  }
}

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

@Override
public synchronized MemoryOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional<ConnectorNewTableLayout> layout)
{
  checkSchemaExists(tableMetadata.getTable().getSchemaName());
  checkTableNotExists(tableMetadata.getTable());
  long nextId = nextTableId.getAndIncrement();
  Set<Node> nodes = nodeManager.getRequiredWorkerNodes();
  checkState(!nodes.isEmpty(), "No Memory nodes available");
  tableIds.put(tableMetadata.getTable(), nextId);
  MemoryTableHandle table = new MemoryTableHandle(
      connectorId,
      nextId,
      tableMetadata);
  tables.put(table.getTableId(), table);
  tableDataFragments.put(table.getTableId(), new HashMap<>());
  return new MemoryOutputTableHandle(table, ImmutableSet.copyOf(tableIds.values()));
}

代码示例来源:origin: io.prestosql/presto-memory

@Override
public synchronized MemoryOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional<ConnectorNewTableLayout> layout)
{
  checkSchemaExists(tableMetadata.getTable().getSchemaName());
  checkTableNotExists(tableMetadata.getTable());
  long nextId = nextTableId.getAndIncrement();
  Set<Node> nodes = nodeManager.getRequiredWorkerNodes();
  checkState(!nodes.isEmpty(), "No Memory nodes available");
  tableIds.put(tableMetadata.getTable(), nextId);
  MemoryTableHandle table = new MemoryTableHandle(
      connectorId,
      nextId,
      tableMetadata);
  tables.put(table.getTableId(), table);
  tableDataFragments.put(table.getTableId(), new HashMap<>());
  return new MemoryOutputTableHandle(table, ImmutableSet.copyOf(tableIds.values()));
}

相关文章