本文整理了Java中com.facebook.presto.metadata.Metadata.getColumnMetadata()
方法的一些代码示例,展示了Metadata.getColumnMetadata()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metadata.getColumnMetadata()
方法的具体详情如下:
包路径:com.facebook.presto.metadata.Metadata
类名称:Metadata
方法名:getColumnMetadata
[英]Gets the metadata for the specified table column.
[中]获取指定表列的元数据。
代码示例来源:origin: prestodb/presto
@Override
public Void visitTableScan(TableScanNode node, Void context)
{
TableHandle tableHandle = node.getTable();
Set<Column> columns = new HashSet<>();
for (ColumnHandle columnHandle : node.getAssignments().values()) {
columns.add(createColumn(metadata.getColumnMetadata(session, tableHandle, columnHandle)));
}
inputs.add(createInput(metadata.getTableMetadata(session, tableHandle), node.getLayout(), columns));
return null;
}
代码示例来源:origin: prestodb/presto
@Override
public Void visitIndexSource(IndexSourceNode node, Void context)
{
TableHandle tableHandle = node.getTableHandle();
Set<Column> columns = new HashSet<>();
for (ColumnHandle columnHandle : node.getAssignments().values()) {
columns.add(createColumn(metadata.getColumnMetadata(session, tableHandle, columnHandle)));
}
inputs.add(createInput(metadata.getTableMetadata(session, tableHandle), node.getLayout(), columns));
return null;
}
代码示例来源:origin: prestodb/presto
private Set<ColumnConstraint> parseConstraints(TableHandle tableHandle, TupleDomain<ColumnHandle> constraint)
{
checkArgument(!constraint.isNone());
ImmutableSet.Builder<ColumnConstraint> columnConstraints = ImmutableSet.builder();
for (Map.Entry<ColumnHandle, Domain> entry : constraint.getDomains().get().entrySet()) {
ColumnMetadata columnMetadata = metadata.getColumnMetadata(session, tableHandle, entry.getKey());
columnConstraints.add(new ColumnConstraint(
columnMetadata.getName(),
columnMetadata.getType().getTypeSignature(),
parseDomain(entry.getValue().simplify())));
}
return columnConstraints.build();
}
代码示例来源:origin: prestodb/presto
protected final List<Type> getColumnTypes(String tableName, String... columnNames)
{
checkState(session.getCatalog().isPresent(), "catalog not set");
checkState(session.getSchema().isPresent(), "schema not set");
// look up the table
Metadata metadata = localQueryRunner.getMetadata();
QualifiedObjectName qualifiedTableName = new QualifiedObjectName(session.getCatalog().get(), session.getSchema().get(), tableName);
TableHandle tableHandle = metadata.getTableHandle(session, qualifiedTableName)
.orElseThrow(() -> new IllegalArgumentException(format("Table %s does not exist", qualifiedTableName)));
Map<String, ColumnHandle> allColumnHandles = metadata.getColumnHandles(session, tableHandle);
return Arrays.stream(columnNames)
.map(allColumnHandles::get)
.map(columnHandle -> metadata.getColumnMetadata(session, tableHandle, columnHandle).getType())
.collect(toImmutableList());
}
代码示例来源:origin: prestodb/presto
Map<String, ColumnHandle> columnHandles = metadata.getColumnHandles(session, tableHandle);
List<ColumnHandle> visibleColumnHandles = columnHandles.values().stream()
.filter(handle -> !metadata.getColumnMetadata(session, tableHandle, handle).isHidden())
.collect(toImmutableList());
checkSpatialPartitioningTable(visibleColumnHandles.size() == 1, "Expected single column for table %s, but found %s columns", name, columnHandles.size());
代码示例来源:origin: prestodb/presto
for (Symbol symbol : inputs) {
ColumnHandle column = tableScan.getAssignments().get(symbol);
ColumnMetadata columnMetadata = metadata.getColumnMetadata(session, tableScan.getTable(), column);
代码示例来源:origin: prestodb/presto
if (metadata.getColumnMetadata(session, tableHandle, columnHandle).isHidden()) {
throw new SemanticException(NOT_SUPPORTED, statement, "Cannot drop hidden column");
代码示例来源:origin: prestodb/presto
if (metadata.getColumnMetadata(session, tableHandle, columnHandle).isHidden()) {
throw new SemanticException(NOT_SUPPORTED, statement, "Cannot rename hidden column");
代码示例来源:origin: prestodb/presto
TableHandle handle = analysis.getTableHandle(node.getTable());
ColumnHandle rowIdHandle = metadata.getUpdateRowIdColumnHandle(session, handle);
Type rowIdType = metadata.getColumnMetadata(session, handle, rowIdHandle).getType();
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
@Override
public Void visitIndexSource(IndexSourceNode node, Void context)
{
TableHandle tableHandle = node.getTableHandle();
Optional<ColumnHandle> sampleWeightColumn = metadata.getSampleWeightColumnHandle(session, tableHandle);
Set<Column> columns = new HashSet<>();
for (ColumnHandle columnHandle : node.getAssignments().values()) {
if (!columnHandle.equals(sampleWeightColumn.orElse(null))) {
columns.add(createColumnEntry(metadata.getColumnMetadata(session, tableHandle, columnHandle)));
}
}
inputs.put(createTableEntry(metadata.getTableMetadata(session, tableHandle)), columns);
return null;
}
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
@Override
public Void visitTableScan(TableScanNode node, Void context)
{
TableHandle tableHandle = node.getTable();
Optional<ColumnHandle> sampleWeightColumn = metadata.getSampleWeightColumnHandle(session, tableHandle);
Set<Column> columns = new HashSet<>();
for (ColumnHandle columnHandle : node.getAssignments().values()) {
if (!columnHandle.equals(sampleWeightColumn.orElse(null))) {
columns.add(createColumnEntry(metadata.getColumnMetadata(session, tableHandle, columnHandle)));
}
}
inputs.put(createTableEntry(metadata.getTableMetadata(session, tableHandle)), columns);
return null;
}
代码示例来源:origin: com.facebook.presto/presto-benchmark
protected final List<Type> getColumnTypes(String tableName, String... columnNames)
{
checkState(session.getCatalog().isPresent(), "catalog not set");
checkState(session.getSchema().isPresent(), "schema not set");
// look up the table
Metadata metadata = localQueryRunner.getMetadata();
QualifiedObjectName qualifiedTableName = new QualifiedObjectName(session.getCatalog().get(), session.getSchema().get(), tableName);
TableHandle tableHandle = metadata.getTableHandle(session, qualifiedTableName)
.orElseThrow(() -> new IllegalArgumentException(format("Table %s does not exist", qualifiedTableName)));
Map<String, ColumnHandle> allColumnHandles = metadata.getColumnHandles(session, tableHandle);
return Arrays.stream(columnNames)
.map(allColumnHandles::get)
.map(columnHandle -> metadata.getColumnMetadata(session, tableHandle, columnHandle).getType())
.collect(toImmutableList());
}
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
for (Symbol symbol : inputs) {
ColumnHandle column = tableScan.getAssignments().get(symbol);
ColumnMetadata columnMetadata = metadata.getColumnMetadata(session, tableScan.getTable(), column);
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
for (ColumnHandle columnHandle : columnHandles.keySet()) {
try {
ColumnMetadata columnMetadata = metadata.getColumnMetadata(session, tableHandle.get(), columnHandle);
Signature operator = metadata.getFunctionRegistry().getCoercion(columnMetadata.getType(), VARCHAR);
MethodHandle methodHandle = metadata.getFunctionRegistry().getScalarFunctionImplementation(operator).getMethodHandle();
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
TableHandle handle = analysis.getTableHandle(node.getTable());
ColumnHandle rowIdHandle = metadata.getUpdateRowIdColumnHandle(session, handle);
Type rowIdType = metadata.getColumnMetadata(session, handle, rowIdHandle).getType();
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
selectList.add(unaliasedName("partition_number"));
for (ColumnHandle columnHandle : partitionColumns) {
ColumnMetadata column = metadata.getColumnMetadata(session, tableHandle.get(), columnHandle);
Expression key = equal(nameReference("partition_key"), new StringLiteral(column.getName()));
Expression value = caseWhen(key, nameReference("partition_value"));
内容来源于网络,如有侵权,请联系作者删除!