use of org.apache.flink.table.catalog.QueryOperationCatalogView in project flink by apache.
the class FlinkCalciteCatalogReader method toPreparingTable.
/**
* Translate this {@link CatalogSchemaTable} into Flink source table.
*/
private static FlinkPreparingTableBase toPreparingTable(RelOptSchema relOptSchema, List<String> names, RelDataType rowType, CatalogSchemaTable schemaTable) {
final ResolvedCatalogBaseTable<?> resolvedBaseTable = schemaTable.getContextResolvedTable().getResolvedTable();
final CatalogBaseTable originTable = resolvedBaseTable.getOrigin();
if (originTable instanceof QueryOperationCatalogView) {
return convertQueryOperationView(relOptSchema, names, rowType, (QueryOperationCatalogView) originTable);
} else if (originTable instanceof ConnectorCatalogTable) {
ConnectorCatalogTable<?, ?> connectorTable = (ConnectorCatalogTable<?, ?>) originTable;
if ((connectorTable).getTableSource().isPresent()) {
return convertLegacyTableSource(relOptSchema, rowType, schemaTable.getContextResolvedTable().getIdentifier(), connectorTable, schemaTable.getStatistic(), schemaTable.isStreamingMode());
} else {
throw new ValidationException("Cannot convert a connector table " + "without source.");
}
} else if (originTable instanceof CatalogView) {
return convertCatalogView(relOptSchema, names, rowType, schemaTable.getStatistic(), (CatalogView) originTable);
} else if (originTable instanceof CatalogTable) {
return convertCatalogTable(relOptSchema, names, rowType, schemaTable);
} else {
throw new ValidationException("Unsupported table type: " + originTable);
}
}
use of org.apache.flink.table.catalog.QueryOperationCatalogView in project flink by apache.
the class TableEnvironmentImpl method createTemporaryView.
private void createTemporaryView(UnresolvedIdentifier identifier, Table view) {
if (((TableImpl) view).getTableEnvironment() != this) {
throw new TableException("Only table API objects that belong to this TableEnvironment can be registered.");
}
ObjectIdentifier tableIdentifier = catalogManager.qualifyIdentifier(identifier);
QueryOperation queryOperation = qualifyQueryOperation(tableIdentifier, view.getQueryOperation());
CatalogBaseTable tableTable = new QueryOperationCatalogView(queryOperation);
catalogManager.createTemporaryTable(tableTable, tableIdentifier, false);
}
Aggregations