本文整理汇总了Java中com.facebook.presto.spi.SchemaTablePrefix.getTableName方法的典型用法代码示例。如果您正苦于以下问题:Java SchemaTablePrefix.getTableName方法的具体用法?Java SchemaTablePrefix.getTableName怎么用?Java SchemaTablePrefix.getTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.presto.spi.SchemaTablePrefix
的用法示例。
在下文中一共展示了SchemaTablePrefix.getTableName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listTableColumns
import com.facebook.presto.spi.SchemaTablePrefix; //导入方法依赖的package包/类
@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
{
requireNonNull(prefix, "prefix is null");
if (prefix.getSchemaName() != null && !prefix.getSchemaName().equals(SCHEMA_NAME)) {
return ImmutableMap.of();
}
ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> columns = ImmutableMap.builder();
List<SchemaTableName> tableNames;
if (prefix.getTableName() == null) {
tableNames = listTables(session, prefix.getSchemaName());
}
else {
tableNames = ImmutableList.of(new SchemaTableName(prefix.getSchemaName(), prefix.getTableName()));
}
for (SchemaTableName tableName : tableNames) {
JmxTableHandle tableHandle = getTableHandle(session, tableName);
columns.put(tableName, tableHandle.getTableMetadata().getColumns());
}
return columns.build();
}
示例2: getViews
import com.facebook.presto.spi.SchemaTablePrefix; //导入方法依赖的package包/类
@Override
public Map<SchemaTableName, ConnectorViewDefinition> getViews(ConnectorSession session, SchemaTablePrefix prefix)
{
ImmutableMap.Builder<SchemaTableName, ConnectorViewDefinition> views = ImmutableMap.builder();
List<SchemaTableName> tableNames;
if (prefix.getTableName() != null) {
tableNames = ImmutableList.of(new SchemaTableName(prefix.getSchemaName(), prefix.getTableName()));
}
else {
tableNames = listViews(session, prefix.getSchemaName());
}
for (SchemaTableName schemaTableName : tableNames) {
Optional<Table> table = metastore.getTable(schemaTableName.getSchemaName(), schemaTableName.getTableName());
if (table.isPresent() && HiveUtil.isPrestoView(table.get())) {
views.put(schemaTableName, new ConnectorViewDefinition(
schemaTableName,
Optional.ofNullable(table.get().getOwner()),
decodeViewData(table.get().getViewOriginalText())));
}
}
return views.build();
}
示例3: listTableColumns
import com.facebook.presto.spi.SchemaTablePrefix; //导入方法依赖的package包/类
@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
{
checkNotNull(prefix, "prefix is null");
log.debug("Called listTableColumns on %s.%s", prefix.getSchemaName(), prefix.getTableName());
ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> columns = ImmutableMap.builder();
// NOTE: prefix.getTableName or prefix.getSchemaName can be null
List<SchemaTableName> tableNames;
if (prefix.getSchemaName() != null && prefix.getTableName() != null) {
tableNames = ImmutableList.of(new SchemaTableName(prefix.getSchemaName(), prefix.getTableName()));
}
else {
tableNames = listTables(session, null);
}
for (SchemaTableName tableName : tableNames) {
ConnectorTableMetadata tableMetadata = getTableMetadata(tableName);
if (tableMetadata != null) {
columns.put(tableName, tableMetadata.getColumns());
}
}
return columns.build();
}
示例4: listTables
import com.facebook.presto.spi.SchemaTablePrefix; //导入方法依赖的package包/类
public List<SchemaTableName> listTables(SchemaTablePrefix prefix)
{
log.info("List all tables with prefix " + prefix.toString());
List<SchemaTableName> tables = new ArrayList<>();
String dbPrefix = prefix.getSchemaName();
log.debug("listTables dbPrefix: " + dbPrefix);
String tblPrefix = prefix.getTableName();
log.debug("listTables tblPrefix: " + tblPrefix);
// if dbPrefix not mean to match all
String tblName;
String dbName;
if (dbPrefix != null) {
if (tblPrefix != null) {
tblName = tblPrefix;
dbName = dbPrefix;
}
else {
MetaProto.StringListType stringListType = metaClient.listTables(dbPrefix);
log.info("record size: " + stringListType.getStrCount());
if (stringListType.getStrCount() == 0) {
return tables;
}
for (int i = 0; i < stringListType.getStrCount(); i++) {
tblName = stringListType.getStr(0);
dbName = dbPrefix;
log.debug("listTables tableName: " + formName(dbName, tblName));
tables.add(new SchemaTableName(dbName, tblName));
}
}
}
return tables;
}
示例5: listTableColumns
import com.facebook.presto.spi.SchemaTablePrefix; //导入方法依赖的package包/类
@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
{
ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> tableColumns = ImmutableMap.builder();
for (String schemaName : getSchemaNames(session, prefix.getSchemaName())) {
for (TpchTable<?> tpchTable : TpchTable.getTables()) {
if (prefix.getTableName() == null || tpchTable.getTableName().equals(prefix.getTableName())) {
ConnectorTableMetadata tableMetadata = getTableMetadata(schemaName, tpchTable);
tableColumns.put(new SchemaTableName(schemaName, tpchTable.getTableName()), tableMetadata.getColumns());
}
}
}
return tableColumns.build();
}
示例6: listTables
import com.facebook.presto.spi.SchemaTablePrefix; //导入方法依赖的package包/类
private List<SchemaTableName> listTables(ConnectorSession session, SchemaTablePrefix prefix)
{
if (prefix.getSchemaName() == null || prefix.getTableName() == null) {
return listTables(session, prefix.getSchemaName());
}
return ImmutableList.of(new SchemaTableName(prefix.getSchemaName(), prefix.getTableName()));
}