本文整理汇总了Java中com.facebook.presto.Session.toConnectorSession方法的典型用法代码示例。如果您正苦于以下问题:Java Session.toConnectorSession方法的具体用法?Java Session.toConnectorSession怎么用?Java Session.toConnectorSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.presto.Session
的用法示例。
在下文中一共展示了Session.toConnectorSession方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLayouts
import com.facebook.presto.Session; //导入方法依赖的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());
}
示例2: listTables
import com.facebook.presto.Session; //导入方法依赖的package包/类
@Override
public List<QualifiedObjectName> listTables(Session session, QualifiedTablePrefix prefix)
{
requireNonNull(prefix, "prefix is null");
String schemaNameOrNull = prefix.getSchemaName().orElse(null);
Set<QualifiedObjectName> tables = new LinkedHashSet<>();
for (ConnectorEntry entry : allConnectorsFor(prefix.getCatalogName())) {
ConnectorMetadata metadata = entry.getMetadata(session);
ConnectorSession connectorSession = session.toConnectorSession(entry.getCatalog());
for (QualifiedObjectName tableName : transform(metadata.listTables(connectorSession, schemaNameOrNull), convertFromSchemaTableName(prefix.getCatalogName()))) {
tables.add(tableName);
}
}
return ImmutableList.copyOf(tables);
}
示例3: listViews
import com.facebook.presto.Session; //导入方法依赖的package包/类
@Override
public List<QualifiedObjectName> listViews(Session session, QualifiedTablePrefix prefix)
{
requireNonNull(prefix, "prefix is null");
String schemaNameOrNull = prefix.getSchemaName().orElse(null);
Set<QualifiedObjectName> views = new LinkedHashSet<>();
for (ConnectorEntry entry : allConnectorsFor(prefix.getCatalogName())) {
ConnectorMetadata metadata = entry.getMetadata(session);
ConnectorSession connectorSession = session.toConnectorSession(entry.getCatalog());
for (QualifiedObjectName tableName : transform(metadata.listViews(connectorSession, schemaNameOrNull), convertFromSchemaTableName(prefix.getCatalogName()))) {
views.add(tableName);
}
}
return ImmutableList.copyOf(views);
}
示例4: getViews
import com.facebook.presto.Session; //导入方法依赖的package包/类
@Override
public Map<QualifiedObjectName, ViewDefinition> getViews(Session session, QualifiedTablePrefix prefix)
{
requireNonNull(prefix, "prefix is null");
SchemaTablePrefix tablePrefix = prefix.asSchemaTablePrefix();
Map<QualifiedObjectName, ViewDefinition> views = new LinkedHashMap<>();
for (ConnectorEntry connectorEntry : allConnectorsFor(prefix.getCatalogName())) {
ConnectorMetadata metadata = connectorEntry.getMetadata(session);
ConnectorSession connectorSession = session.toConnectorSession(connectorEntry.getCatalog());
for (Entry<SchemaTableName, ConnectorViewDefinition> entry : metadata.getViews(connectorSession, tablePrefix).entrySet()) {
QualifiedObjectName viewName = new QualifiedObjectName(
prefix.getCatalogName(),
entry.getKey().getSchemaName(),
entry.getKey().getTableName());
views.put(viewName, deserializeView(entry.getValue().getViewData()));
}
}
return ImmutableMap.copyOf(views);
}
示例5: beginCreateTable
import com.facebook.presto.Session; //导入方法依赖的package包/类
@Override
public OutputTableHandle beginCreateTable(Session session, String catalogName, TableMetadata tableMetadata)
{
ConnectorEntry entry = connectorsByCatalog.get(catalogName);
checkArgument(entry != null, "Catalog %s does not exist", catalogName);
ConnectorMetadata metadata = entry.getMetadataForWrite(session);
ConnectorTransactionHandle transactionHandle = entry.getTransactionHandle(session);
ConnectorSession connectorSession = session.toConnectorSession(entry.getCatalog());
ConnectorOutputTableHandle handle = metadata.beginCreateTable(connectorSession, tableMetadata.getMetadata());
return new OutputTableHandle(entry.getConnectorId(), transactionHandle, handle);
}
示例6: resolveIndex
import com.facebook.presto.Session; //导入方法依赖的package包/类
@Override
public Optional<ResolvedIndex> resolveIndex(Session session, TableHandle tableHandle, Set<ColumnHandle> indexableColumns, Set<ColumnHandle> outputColumns, TupleDomain<ColumnHandle> tupleDomain)
{
ConnectorEntry entry = lookupConnectorFor(tableHandle);
ConnectorMetadata metadata = entry.getMetadata(session);
ConnectorTransactionHandle transaction = entry.getTransactionHandle(session);
ConnectorSession connectorSession = session.toConnectorSession(entry.getCatalog());
Optional<ConnectorResolvedIndex> resolvedIndex = metadata.resolveIndex(connectorSession, tableHandle.getConnectorHandle(), indexableColumns, outputColumns, tupleDomain);
return resolvedIndex.map(resolved -> new ResolvedIndex(tableHandle.getConnectorId(), transaction, resolved));
}
示例7: ExpressionInterpreter
import com.facebook.presto.Session; //导入方法依赖的package包/类
private ExpressionInterpreter(Expression expression, Metadata metadata, Session session, IdentityHashMap<Expression, Type> expressionTypes, boolean optimize)
{
this.expression = expression;
this.metadata = metadata;
this.session = session.toConnectorSession();
this.expressionTypes = expressionTypes;
this.optimize = optimize;
this.visitor = new Visitor();
}
示例8: createPageSink
import com.facebook.presto.Session; //导入方法依赖的package包/类
@Override
public ConnectorPageSink createPageSink(Session session, OutputTableHandle tableHandle)
{
// assumes connectorId and catalog are the same
ConnectorSession connectorSession = session.toConnectorSession(tableHandle.getConnectorId());
return providerFor(tableHandle.getConnectorId()).createPageSink(tableHandle.getTransactionHandle(), connectorSession, tableHandle.getConnectorHandle());
}
示例9: getSplits
import com.facebook.presto.Session; //导入方法依赖的package包/类
public SplitSource getSplits(Session session, TableLayoutHandle layout)
{
String connectorId = layout.getConnectorId();
ConnectorSplitManager splitManager = getConnectorSplitManager(connectorId);
// assumes connectorId and catalog are the same
ConnectorSession connectorSession = session.toConnectorSession(connectorId);
ConnectorSplitSource source = splitManager.getSplits(layout.getTransactionHandle(), connectorSession, layout.getConnectorHandle());
return new ConnectorAwareSplitSource(connectorId, layout.getTransactionHandle(), source);
}
示例10: createPageSource
import com.facebook.presto.Session; //导入方法依赖的package包/类
@Override
public ConnectorPageSource createPageSource(Session session, Split split, List<ColumnHandle> columns)
{
requireNonNull(split, "split is null");
requireNonNull(columns, "columns is null");
// assumes connectorId and catalog are the same
ConnectorSession connectorSession = session.toConnectorSession(split.getConnectorId());
return getPageSourceProvider(split).createPageSource(split.getTransactionHandle(), connectorSession, split.getConnectorSplit(), columns);
}
示例11: getIndex
import com.facebook.presto.Session; //导入方法依赖的package包/类
public ConnectorIndex getIndex(Session session, IndexHandle indexHandle, List<ColumnHandle> lookupSchema, List<ColumnHandle> outputSchema)
{
ConnectorSession connectorSession = session.toConnectorSession(indexHandle.getConnectorId());
ConnectorIndexProvider provider = getProvider(indexHandle);
return provider.getIndex(indexHandle.getTransactionHandle(), connectorSession, indexHandle.getConnectorHandle(), lookupSchema, outputSchema);
}
示例12: ExpressionOptimizer
import com.facebook.presto.Session; //导入方法依赖的package包/类
public ExpressionOptimizer(FunctionRegistry registry, TypeManager typeManager, Session session)
{
this.registry = registry;
this.typeManager = typeManager;
this.session = session.toConnectorSession();
}