本文整理汇总了Java中com.facebook.presto.spi.SchemaTableName.getTableName方法的典型用法代码示例。如果您正苦于以下问题:Java SchemaTableName.getTableName方法的具体用法?Java SchemaTableName.getTableName怎么用?Java SchemaTableName.getTableName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.presto.spi.SchemaTableName
的用法示例。
在下文中一共展示了SchemaTableName.getTableName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTableHandle
import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
private ConnectorTableHandle getTableHandle(SchemaTableName tableName)
{
requireNonNull(tableName, "tableName is null");
Table table = dao.getTableInformation(tableName.getSchemaName(), tableName.getTableName());
if (table == null) {
return null;
}
List<TableColumn> tableColumns = dao.getTableColumns(table.getTableId());
checkArgument(!tableColumns.isEmpty(), "Table %s does not have any columns", tableName);
RaptorColumnHandle sampleWeightColumnHandle = null;
for (TableColumn tableColumn : tableColumns) {
if (SAMPLE_WEIGHT_COLUMN_NAME.equals(tableColumn.getColumnName())) {
sampleWeightColumnHandle = getRaptorColumnHandle(tableColumn);
}
}
return new RaptorTableHandle(
connectorId,
tableName.getSchemaName(),
tableName.getTableName(),
table.getTableId(),
OptionalLong.empty(),
Optional.ofNullable(sampleWeightColumnHandle));
}
示例2: createView
import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
@Override
public void createView(ConnectorSession session, SchemaTableName viewName, String viewData, boolean replace)
{
String schemaName = viewName.getSchemaName();
String tableName = viewName.getTableName();
if (replace) {
runTransaction(dbi, (handle, status) -> {
MetadataDao dao = handle.attach(MetadataDao.class);
dao.dropView(schemaName, tableName);
dao.insertView(schemaName, tableName, viewData);
return null;
});
return;
}
try {
dao.insertView(schemaName, tableName, viewData);
}
catch (PrestoException e) {
if (viewExists(session, viewName)) {
throw new PrestoException(ALREADY_EXISTS, "View already exists: " + viewName);
}
throw e;
}
}
示例3: getTableHandle
import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
@Override
public RedisTableHandle getTableHandle(ConnectorSession session, SchemaTableName schemaTableName)
{
RedisTableDescription table = getDefinedTables().get(schemaTableName);
if (table == null) {
return null;
}
// check if keys are supplied in a zset
// via the table description doc
String keyName = null;
if (table.getKey() != null) {
keyName = table.getKey().getName();
}
return new RedisTableHandle(
connectorId,
schemaTableName.getSchemaName(),
schemaTableName.getTableName(),
getDataFormat(table.getKey()),
getDataFormat(table.getValue()),
keyName);
}
示例4: getColumnHandles
import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
@Override
public Map<String, ColumnHandle> getColumnHandles(ConnectorSession session, ConnectorTableHandle tableHandle) {
SpreadsheetTableHandle spreadsheetTableHandle = (SpreadsheetTableHandle) tableHandle;
SpreadsheetReader spreadSheetHelper = getSpreadSheetHelper(getUgi(session), session, spreadsheetTableHandle,
_configuration, _useFileCache);
SchemaTableName schemaTableName = spreadsheetTableHandle.getTableName();
String tableName = schemaTableName.getTableName();
Table table = spreadSheetHelper.getTable(tableName);
List<String> columnNames = table.getColumnNames();
ImmutableMap.Builder<String, ColumnHandle> builder = ImmutableMap.builder();
for (String columnName : columnNames) {
TableType columnType = table.getType(columnName);
Type type = getType(columnType);
builder.put(columnName, new SpreadsheetColumnHandle(columnName, type));
}
return builder.build();
}
示例5: renameTable
import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
@Override
public void renameTable(ConnectorSession session, ConnectorTableHandle tableHandle, SchemaTableName newTableName)
{
BlackHoleTableHandle oldTableHandle = checkType(tableHandle, BlackHoleTableHandle.class, "tableHandle");
BlackHoleTableHandle newTableHandle = new BlackHoleTableHandle(
oldTableHandle.getSchemaName(),
newTableName.getTableName(),
oldTableHandle.getColumnHandles(),
oldTableHandle.getSplitCount(),
oldTableHandle.getPagesPerSplit(),
oldTableHandle.getRowsPerPage(),
oldTableHandle.getFieldsLength()
);
tables.remove(oldTableHandle.getTableName());
tables.put(newTableName.getTableName(), newTableHandle);
}
示例6: getTableHandle
import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
@Override
public TpchTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName)
{
requireNonNull(tableName, "tableName is null");
if (!tableNames.contains(tableName.getTableName())) {
return null;
}
// parse the scale factor
double scaleFactor = schemaNameToScaleFactor(tableName.getSchemaName());
if (scaleFactor < 0) {
return null;
}
return new TpchTableHandle(connectorId, tableName.getTableName(), scaleFactor);
}
示例7: getTableMetadata
import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
private TableMetadata getTableMetadata(SchemaTableName schemaTableName)
{
String schemaName = schemaTableName.getSchemaName();
String tableName = schemaTableName.getTableName();
KeyspaceMetadata keyspaceMetadata = getCheckedKeyspaceMetadata(schemaName);
TableMetadata tableMetadata = keyspaceMetadata.getTable(tableName);
if (tableMetadata != null) {
return tableMetadata;
}
for (TableMetadata table : keyspaceMetadata.getTables()) {
if (table.getName().equalsIgnoreCase(tableName)) {
return table;
}
}
throw new TableNotFoundException(schemaTableName);
}
示例8: getChannelId
import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
private String getChannelId(SchemaTableName schemaTableName)
{
String schemaName = schemaTableName.getSchemaName();
String tableName = schemaTableName.getTableName();
if (CHANNEL_SCHEMA.equalsIgnoreCase(schemaName)) {
return channels.get(tableName).getId();
}
if (IM_SCHEMA.equalsIgnoreCase(schemaName)) {
String userId = users.get(tableName).getId();
return ims.get(userId).getId();
}
throw new IllegalArgumentException("Unknown schema: " + schemaName);
}
示例9: getTableHandle
import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
@Override
public EthereumTableHandle getTableHandle(ConnectorSession session, SchemaTableName schemaTableName) {
if (EthereumTable.BLOCK.getName().equals(schemaTableName.getTableName())) {
return new EthereumTableHandle(connectorId, DEFAULT_SCHEMA, EthereumTable.BLOCK.getName());
} else if (EthereumTable.TRANSACTION.getName().equals(schemaTableName.getTableName())) {
return new EthereumTableHandle(connectorId, DEFAULT_SCHEMA, EthereumTable.TRANSACTION.getName());
} else if (EthereumTable.ERC20.getName().equals(schemaTableName.getTableName())) {
return new EthereumTableHandle(connectorId, DEFAULT_SCHEMA, EthereumTable.ERC20.getName());
} else {
throw new IllegalArgumentException("Unknown Table Name " + schemaTableName.getTableName());
}
}
示例10: createSimpleJsonStreamDescription
import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
public static Map.Entry<SchemaTableName, KinesisStreamDescription> createSimpleJsonStreamDescription(String streamName, SchemaTableName schemaTableName)
{
// Format: {"id" : 1324, "name" : "some string"}
ArrayList<KinesisStreamFieldDescription> fieldList = new ArrayList<KinesisStreamFieldDescription>();
fieldList.add(new KinesisStreamFieldDescription("id", BigintType.BIGINT, "id", "comment", null, null, false));
fieldList.add(new KinesisStreamFieldDescription("name", VarcharType.VARCHAR, "name", "comment", null, null, false));
KinesisStreamFieldGroup grp = new KinesisStreamFieldGroup("json", fieldList);
KinesisStreamDescription desc = new KinesisStreamDescription(schemaTableName.getTableName(), schemaTableName.getSchemaName(), streamName, grp);
return new AbstractMap.SimpleImmutableEntry<>(schemaTableName, desc);
}
示例11: loadTpchTopicDescription
import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
public static Map.Entry<SchemaTableName, KafkaTopicDescription> loadTpchTopicDescription(JsonCodec<KafkaTopicDescription> topicDescriptionJsonCodec, String topicName, SchemaTableName schemaTableName)
throws IOException
{
KafkaTopicDescription tpchTemplate = topicDescriptionJsonCodec.fromJson(ByteStreams.toByteArray(TestUtils.class.getResourceAsStream(format("/tpch/%s.json", schemaTableName.getTableName()))));
return new AbstractMap.SimpleImmutableEntry<>(
schemaTableName,
new KafkaTopicDescription(schemaTableName.getTableName(), schemaTableName.getSchemaName(), topicName, tpchTemplate.getKey(), tpchTemplate.getMessage()));
}
示例12: getTableHandle
import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
@Override
public ExampleTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName)
{
if (!listSchemaNames(session).contains(tableName.getSchemaName())) {
return null;
}
ExampleTable table = exampleClient.getTable(tableName.getSchemaName(), tableName.getTableName());
if (table == null) {
return null;
}
return new ExampleTableHandle(connectorId, tableName.getSchemaName(), tableName.getTableName());
}
示例13: createEmptyTableDescription
import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
public static Map.Entry<SchemaTableName, RedisTableDescription> createEmptyTableDescription(SchemaTableName schemaTableName)
{
RedisTableDescription tableDescription = new RedisTableDescription(
schemaTableName.getTableName(),
schemaTableName.getSchemaName(),
null,
null);
return new AbstractMap.SimpleImmutableEntry<>(schemaTableName, tableDescription);
}
示例14: getRecordSet
import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
@Override
public RecordSet getRecordSet(ConnectorTransactionHandle transactionHandle, ConnectorSession session,
ConnectorSplit split, List<? extends ColumnHandle> columns) {
SpreadsheetSplit spreadsheetSplit = (SpreadsheetSplit) split;
SpreadsheetTableHandle spreadsheetTableHandle = spreadsheetSplit.getTableHandle();
SchemaTableName schemaTableName = spreadsheetTableHandle.getTableName();
UserGroupInformation proxy = SpreadsheetMetadata.getUgi(session, _proxyUser, _ugi);
SpreadsheetReader spreadSheetHelper = SpreadsheetMetadata.getSpreadSheetHelper(proxy, session,
spreadsheetTableHandle, _configuration, _useFileCache);
return new SpreadsheetRecordSet(schemaTableName.getTableName(), spreadSheetHelper, columns);
}
示例15: getTableHandle
import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
@Override
public ConnectorTableHandle getTableHandle(ConnectorSession connectorSession, SchemaTableName tableName)
{
if (!TABLES.containsKey(tableName)) {
return null;
}
return new InformationSchemaTableHandle(catalogName, tableName.getSchemaName(), tableName.getTableName());
}