本文整理了Java中com.facebook.presto.metadata.Metadata.createView()
方法的一些代码示例,展示了Metadata.createView()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metadata.createView()
方法的具体详情如下:
包路径:com.facebook.presto.metadata.Metadata
类名称:Metadata
方法名:createView
[英]Creates the specified view with the specified view definition.
[中]使用指定的视图定义创建指定的视图。
代码示例来源:origin: prestodb/presto
@Override
public ListenableFuture<?> execute(CreateView statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters)
{
Session session = stateMachine.getSession();
QualifiedObjectName name = createQualifiedObjectName(session, statement, statement.getName());
accessControl.checkCanCreateView(session.getRequiredTransactionId(), session.getIdentity(), name);
String sql = getFormattedSql(statement.getQuery(), sqlParser, Optional.of(parameters));
Analysis analysis = analyzeStatement(statement, session, metadata, accessControl, parameters, stateMachine.getWarningCollector());
List<ViewColumn> columns = analysis.getOutputDescriptor(statement.getQuery())
.getVisibleFields().stream()
.map(field -> new ViewColumn(field.getName().get(), field.getType()))
.collect(toImmutableList());
String data = codec.toJson(new ViewDefinition(sql, session.getCatalog(), session.getSchema(), columns, Optional.of(session.getUser())));
metadata.createView(session, name, data, statement.isReplace());
return immediateFuture(null);
}
代码示例来源:origin: prestodb/presto
ImmutableList.of(new ViewColumn("a", BIGINT)),
Optional.of("user")));
inSetupTransaction(session -> metadata.createView(session, new QualifiedObjectName(TPCH_CATALOG, "s1", "v1"), viewData1, false));
ImmutableList.of(new ViewColumn("a", VARCHAR)),
Optional.of("user")));
inSetupTransaction(session -> metadata.createView(session, new QualifiedObjectName(TPCH_CATALOG, "s1", "v2"), viewData2, false));
ImmutableList.of(new ViewColumn("a", BIGINT)),
Optional.of("owner")));
inSetupTransaction(session -> metadata.createView(session, new QualifiedObjectName(THIRD_CATALOG, "s3", "v3"), viewData3, false));
ImmutableList.of(new ViewColumn("a", BIGINT)),
Optional.of("user")));
inSetupTransaction(session -> metadata.createView(session, new QualifiedObjectName("tpch", "s1", "v4"), viewData4, false));
ImmutableList.of(new ViewColumn("a", BIGINT)),
Optional.of("user")));
inSetupTransaction(session -> metadata.createView(session, new QualifiedObjectName(TPCH_CATALOG, "s1", "v5"), viewData5, false));
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
@Override
public CompletableFuture<?> execute(CreateView statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine)
{
Session session = stateMachine.getSession();
QualifiedObjectName name = createQualifiedObjectName(session, statement, statement.getName());
accessControl.checkCanCreateView(session.getRequiredTransactionId(), session.getIdentity(), name);
String sql = getFormattedSql(statement);
Analysis analysis = analyzeStatement(statement, session, metadata);
List<ViewColumn> columns = analysis.getOutputDescriptor()
.getVisibleFields().stream()
.map(field -> new ViewColumn(field.getName().get(), field.getType()))
.collect(toImmutableList());
String data = codec.toJson(new ViewDefinition(sql, session.getCatalog(), session.getSchema(), columns, Optional.of(session.getUser())));
metadata.createView(session, name, data, statement.isReplace());
return completedFuture(null);
}
内容来源于网络,如有侵权,请联系作者删除!