本文整理汇总了Java中com.facebook.presto.spi.ConnectorTableLayoutResult类的典型用法代码示例。如果您正苦于以下问题:Java ConnectorTableLayoutResult类的具体用法?Java ConnectorTableLayoutResult怎么用?Java ConnectorTableLayoutResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConnectorTableLayoutResult类属于com.facebook.presto.spi包,在下文中一共展示了ConnectorTableLayoutResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testSanity
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Test
public void testSanity()
throws InterruptedException
{
List<ConnectorTableLayoutResult> layouts = metadata.getTableLayouts(SESSION, tableHandle, Constraint.alwaysTrue(), Optional.empty());
assertEquals(layouts.size(), 1);
ConnectorTableLayoutResult layout = getOnlyElement(layouts);
assertInstanceOf(layout.getTableLayout().getHandle(), RaptorTableLayoutHandle.class);
ConnectorSplitSource splitSource = getSplits(raptorSplitManager, layout);
int splitCount = 0;
while (!splitSource.isFinished()) {
splitCount += getFutureValue(splitSource.getNextBatch(1000)).size();
}
assertEquals(splitCount, 4);
}
开发者ID:y-lan,项目名称:presto,代码行数:17,代码来源:TestRaptorSplitManager.java
示例2: testAssignRandomNodeWhenBackupAvailable
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Test
public void testAssignRandomNodeWhenBackupAvailable()
throws InterruptedException, URISyntaxException
{
InMemoryNodeManager nodeManager = new InMemoryNodeManager();
RaptorConnectorId connectorId = new RaptorConnectorId("raptor");
NodeSupplier nodeSupplier = new RaptorNodeSupplier(nodeManager, connectorId);
PrestoNode node = new PrestoNode(UUID.randomUUID().toString(), new URI("http://127.0.0.1/"), NodeVersion.UNKNOWN);
nodeManager.addNode(connectorId.toString(), node);
RaptorSplitManager raptorSplitManagerWithBackup = new RaptorSplitManager(connectorId, nodeSupplier, shardManager, true);
deleteShardNodes();
ConnectorTableLayoutResult layout = getOnlyElement(metadata.getTableLayouts(SESSION, tableHandle, Constraint.alwaysTrue(), Optional.empty()));
ConnectorSplitSource partitionSplit = getSplits(raptorSplitManagerWithBackup, layout);
List<ConnectorSplit> batch = getFutureValue(partitionSplit.getNextBatch(1), PrestoException.class);
assertEquals(getOnlyElement(getOnlyElement(batch).getAddresses()), node.getHostAndPort());
}
开发者ID:y-lan,项目名称:presto,代码行数:19,代码来源:TestRaptorSplitManager.java
示例3: getTableLayouts
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(
ConnectorSession session,
ConnectorTableHandle handle,
Constraint<ColumnHandle> constraint,
Optional<Set<ColumnHandle>> desiredColumns)
{
requireNonNull(handle, "handle is null");
checkArgument(handle instanceof BlackHoleTableHandle);
BlackHoleTableHandle blackHoleHandle = (BlackHoleTableHandle) handle;
BlackHoleTableLayoutHandle layoutHandle = new BlackHoleTableLayoutHandle(
blackHoleHandle.getSplitCount(),
blackHoleHandle.getPagesPerSplit(),
blackHoleHandle.getRowsPerPage(),
blackHoleHandle.getFieldsLength());
return ImmutableList.of(new ConnectorTableLayoutResult(getTableLayout(session, layoutHandle), TupleDomain.all()));
}
开发者ID:y-lan,项目名称:presto,代码行数:19,代码来源:BlackHoleMetadata.java
示例4: getLayouts
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Override
public List<TableLayoutResult> getLayouts(Session session, TableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
if (constraint.getSummary().isNone()) {
return ImmutableList.of();
}
TupleDomain<ColumnHandle> summary = constraint.getSummary();
String connectorId = table.getConnectorId();
ConnectorTableHandle connectorTable = table.getConnectorHandle();
Predicate<Map<ColumnHandle, NullableValue>> predicate = constraint.predicate();
ConnectorEntry entry = getConnectorMetadata(connectorId);
ConnectorMetadata metadata = entry.getMetadata(session);
ConnectorTransactionHandle transaction = entry.getTransactionHandle(session);
ConnectorSession connectorSession = session.toConnectorSession(entry.getCatalog());
List<ConnectorTableLayoutResult> layouts = metadata.getTableLayouts(connectorSession, connectorTable, new Constraint<>(summary, predicate::test), desiredColumns);
return layouts.stream()
.map(layout -> new TableLayoutResult(fromConnectorLayout(connectorId, transaction, layout.getTableLayout()), layout.getUnenforcedConstraint()))
.collect(toImmutableList());
}
开发者ID:y-lan,项目名称:presto,代码行数:23,代码来源:MetadataManager.java
示例5: testGetRecordsS3
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Test
public void testGetRecordsS3()
throws Exception
{
ConnectorTableHandle table = getTableHandle(tableS3);
List<ColumnHandle> columnHandles = ImmutableList.copyOf(metadata.getColumnHandles(SESSION, table).values());
Map<String, Integer> columnIndex = indexColumns(columnHandles);
List<ConnectorTableLayoutResult> tableLayoutResults = metadata.getTableLayouts(SESSION, table, new Constraint<>(TupleDomain.all(), bindings -> true), Optional.empty());
HiveTableLayoutHandle layoutHandle = (HiveTableLayoutHandle) getOnlyElement(tableLayoutResults).getTableLayout().getHandle();
assertEquals(layoutHandle.getPartitions().get().size(), 1);
ConnectorSplitSource splitSource = splitManager.getSplits(SESSION, layoutHandle);
long sum = 0;
for (ConnectorSplit split : getAllSplits(splitSource)) {
try (ConnectorPageSource pageSource = pageSourceProvider.createPageSource(SESSION, split, columnHandles)) {
MaterializedResult result = materializeSourceDataStream(SESSION, pageSource, getTypes(columnHandles));
for (MaterializedRow row : result) {
sum += (Long) row.getField(columnIndex.get("t_bigint"));
}
}
}
assertEquals(sum, 78300);
}
开发者ID:y-lan,项目名称:presto,代码行数:27,代码来源:AbstractTestHiveClientS3.java
示例6: testGetPartitionSplitsTableOfflinePartition
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Test
public void testGetPartitionSplitsTableOfflinePartition()
throws Exception
{
ConnectorSession session = newSession();
ConnectorTableHandle tableHandle = getTableHandle(tableOfflinePartition);
assertNotNull(tableHandle);
ColumnHandle dsColumn = metadata.getColumnHandles(session, tableHandle).get("ds");
assertNotNull(dsColumn);
Domain domain = Domain.singleValue(VARCHAR, utf8Slice("2012-12-30"));
TupleDomain<ColumnHandle> tupleDomain = TupleDomain.withColumnDomains(ImmutableMap.of(dsColumn, domain));
List<ConnectorTableLayoutResult> tableLayoutResults = metadata.getTableLayouts(session, tableHandle, new Constraint<>(tupleDomain, bindings -> true), Optional.empty());
try {
getSplitCount(splitManager.getSplits(session, getOnlyElement(tableLayoutResults).getTableLayout().getHandle()));
fail("Expected PartitionOfflineException");
}
catch (PartitionOfflineException e) {
assertEquals(e.getTableName(), tableOfflinePartition);
assertEquals(e.getPartition(), "ds=2012-12-30");
}
}
开发者ID:y-lan,项目名称:presto,代码行数:25,代码来源:AbstractTestHiveClient.java
示例7: testPartitionSchemaNonCanonical
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Test
public void testPartitionSchemaNonCanonical()
throws Exception
{
ConnectorSession session = newSession();
ConnectorTableHandle table = getTableHandle(tablePartitionSchemaChangeNonCanonical);
ColumnHandle column = metadata.getColumnHandles(session, table).get("t_boolean");
assertNotNull(column);
List<ConnectorTableLayoutResult> tableLayoutResults = metadata.getTableLayouts(session, table, new Constraint<>(TupleDomain.fromFixedValues(ImmutableMap.of(column, NullableValue.of(BOOLEAN, false))), bindings -> true), Optional.empty());
ConnectorTableLayoutHandle layoutHandle = getOnlyElement(tableLayoutResults).getTableLayout().getHandle();
assertEquals(getAllPartitions(layoutHandle).size(), 1);
assertEquals(getPartitionId(getAllPartitions(layoutHandle).get(0)), "t_boolean=0");
ConnectorSplitSource splitSource = splitManager.getSplits(session, layoutHandle);
ConnectorSplit split = getOnlyElement(getAllSplits(splitSource));
ImmutableList<ColumnHandle> columnHandles = ImmutableList.of(column);
try (ConnectorPageSource ignored = pageSourceProvider.createPageSource(session, split, columnHandles)) {
// TODO coercion of non-canonical values should be supported
fail("expected exception");
}
catch (PrestoException e) {
assertEquals(e.getErrorCode(), HIVE_INVALID_PARTITION_VALUE.toErrorCode());
}
}
开发者ID:y-lan,项目名称:presto,代码行数:27,代码来源:AbstractTestHiveClient.java
示例8: getTableLayouts
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
/**
* Return a list of table layouts that satisfy the given constraint.
* <p>
* For each layout, connectors must return an "unenforced constraint" representing the part of the constraint summary that isn't guaranteed by the layout.
*
* @param session session
* @param table table
* @param constraint constraint
* @param desiredColumns desired columns
*/
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
// get table name from ConnectorTableHandle
HDFSTableHandle hdfsTable = checkType(table, HDFSTableHandle.class, "table");
SchemaTableName tableName = hdfsTable.getSchemaTableName();
// create HDFSTableLayoutHandle
HDFSTableLayoutHandle tableLayout = metaDataQuery.getTableLayout(connectorId, tableName.getSchemaName(), tableName.getTableName()).orElse(null);
tableLayout.setPredicates(constraint.getSummary() != null ? Optional.of(constraint.getSummary()) : Optional.empty());
// ConnectorTableLayout layout = new ConnectorTableLayout(HDFSTableLayoutHandle)
ConnectorTableLayout layout = getTableLayout(session, tableLayout);
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
开发者ID:dbiir,项目名称:paraflow,代码行数:25,代码来源:HDFSMetadata.java
示例9: getTableLayouts
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession connectorSession, ConnectorTableHandle connectorTableHandle, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> optional)
{
RestTableHandle tableHandle = Types.checkType(connectorTableHandle, RestTableHandle.class, "tableHandle");
return ImmutableList.of(
new ConnectorTableLayoutResult(
getTableLayout(connectorSession, new RestConnectorTableLayoutHandle(tableHandle)),
TupleDomain.all()));
}
开发者ID:prestodb-rocks,项目名称:presto-rest,代码行数:10,代码来源:RestMetadata.java
示例10: getTableLayouts
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
KuduTableHandle tableHandle = checkType(table, KuduTableHandle.class, "tableHandle");
ConnectorTableLayout layout = new ConnectorTableLayout(new KuduTableLayoutHandle(tableHandle, constraint.getSummary()));
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
开发者ID:trackingio,项目名称:presto-kudu,代码行数:8,代码来源:KuduMetadata.java
示例11: getTableLayouts
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
KafkaTableHandle handle = convertTableHandle(table);
ConnectorTableLayout layout = new ConnectorTableLayout(new KafkaTableLayoutHandle(handle));
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
开发者ID:y-lan,项目名称:presto,代码行数:8,代码来源:KafkaMetadata.java
示例12: getTableLayouts
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
ExampleTableHandle tableHandle = checkType(table, ExampleTableHandle.class, "table");
ConnectorTableLayout layout = new ConnectorTableLayout(new ExampleTableLayoutHandle(tableHandle));
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
开发者ID:y-lan,项目名称:presto,代码行数:8,代码来源:ExampleMetadata.java
示例13: getTableLayouts
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
RaptorTableHandle handle = checkType(table, RaptorTableHandle.class, "table");
ConnectorTableLayout layout = new ConnectorTableLayout(new RaptorTableLayoutHandle(handle, constraint.getSummary()));
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
开发者ID:y-lan,项目名称:presto,代码行数:8,代码来源:RaptorMetadata.java
示例14: testNoHostForShard
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Test(expectedExceptions = PrestoException.class, expectedExceptionsMessageRegExp = "No host for shard .* found: \\[\\]")
public void testNoHostForShard()
throws InterruptedException
{
deleteShardNodes();
ConnectorTableLayoutResult layout = getOnlyElement(metadata.getTableLayouts(SESSION, tableHandle, Constraint.alwaysTrue(), Optional.empty()));
ConnectorSplitSource splitSource = getSplits(raptorSplitManager, layout);
getFutureValue(splitSource.getNextBatch(1000));
}
开发者ID:y-lan,项目名称:presto,代码行数:11,代码来源:TestRaptorSplitManager.java
示例15: testNoNodes
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Test(expectedExceptions = PrestoException.class, expectedExceptionsMessageRegExp = "No nodes available to run query")
public void testNoNodes()
throws InterruptedException, URISyntaxException
{
deleteShardNodes();
RaptorSplitManager raptorSplitManagerWithBackup = new RaptorSplitManager(new RaptorConnectorId("fbraptor"), ImmutableSet::of, shardManager, true);
ConnectorTableLayoutResult layout = getOnlyElement(metadata.getTableLayouts(SESSION, tableHandle, Constraint.alwaysTrue(), Optional.empty()));
ConnectorSplitSource splitSource = getSplits(raptorSplitManagerWithBackup, layout);
getFutureValue(splitSource.getNextBatch(1000), PrestoException.class);
}
开发者ID:y-lan,项目名称:presto,代码行数:12,代码来源:TestRaptorSplitManager.java
示例16: getTableLayouts
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(
ConnectorSession session,
ConnectorTableHandle table,
Constraint<ColumnHandle> constraint,
Optional<Set<ColumnHandle>> desiredColumns)
{
RedisTableHandle tableHandle = convertTableHandle(table);
ConnectorTableLayout layout = new ConnectorTableLayout(new RedisTableLayoutHandle(tableHandle));
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
开发者ID:y-lan,项目名称:presto,代码行数:14,代码来源:RedisMetadata.java
示例17: getTableLayouts
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
JmxTableHandle handle = checkType(table, JmxTableHandle.class, "table");
ConnectorTableLayout layout = new ConnectorTableLayout(new JmxTableLayoutHandle(handle, constraint.getSummary()));
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
开发者ID:y-lan,项目名称:presto,代码行数:8,代码来源:JmxMetadata.java
示例18: getTableLayouts
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
JdbcTableHandle tableHandle = checkType(table, JdbcTableHandle.class, "table");
ConnectorTableLayout layout = new ConnectorTableLayout(new JdbcTableLayoutHandle(tableHandle, constraint.getSummary()));
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
开发者ID:y-lan,项目名称:presto,代码行数:8,代码来源:JdbcMetadata.java
示例19: getTableLayouts
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
InformationSchemaTableHandle handle = checkType(table, InformationSchemaTableHandle.class, "table");
ConnectorTableLayout layout = new ConnectorTableLayout(new InformationSchemaTableLayoutHandle(handle, constraint.getSummary()));
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
开发者ID:y-lan,项目名称:presto,代码行数:8,代码来源:InformationSchemaMetadata.java
示例20: getTableLayouts
import com.facebook.presto.spi.ConnectorTableLayoutResult; //导入依赖的package包/类
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
{
SystemTableHandle tableHandle = checkType(table, SystemTableHandle.class, "table");
ConnectorTableLayout layout = new ConnectorTableLayout(new SystemTableLayoutHandle(tableHandle.getConnectorId(), tableHandle, constraint.getSummary()));
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
开发者ID:y-lan,项目名称:presto,代码行数:8,代码来源:SystemTablesMetadata.java
注:本文中的com.facebook.presto.spi.ConnectorTableLayoutResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论