Java Code Examples for org.apache.flink.table.api.TableSchema#getTypes()

The following examples show how to use org.apache.flink.table.api.TableSchema#getTypes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SideStream.java    From alchemy with Apache License 2.0 6 votes vote down vote up
private static RowTypeInfo createReturnType(TableSchema leftTable, RowTypeInfo sideType) {
    String[] leftFields = leftTable.getColumnNames();
    TypeInformation[] leftTypes = leftTable.getTypes();
    int leftArity = leftFields.length;
    int rightArity = sideType.getArity();
    int size = leftArity + rightArity;
    String[] columnNames = new String[size];
    TypeInformation[] columnTypes = new TypeInformation[size];
    for (int i = 0; i < leftArity; i++) {
        columnNames[i] = leftFields[i];
        columnTypes[i] = leftTypes[i];
    }
    for (int i = 0; i < rightArity; i++) {
        columnNames[leftArity + i] = sideType.getFieldNames()[i];
        columnTypes[leftArity + i] = sideType.getTypeAt(i);
    }

    return new RowTypeInfo(columnTypes, columnNames);
}
 
Example 2
Source File: MockTableSinkProvider.java    From AthenaX with Apache License 2.0 5 votes vote down vote up
@Override
public AppendStreamTableSink<Row> getAppendStreamTableSink(ExternalCatalogTable table) throws IOException {
  DescriptorProperties params = new DescriptorProperties(true);
  table.addProperties(params);
  TableSchema tableSchema = params.getTableSchema(MockExternalCatalogTable.TABLE_SCHEMA_CONNECTOR_PROPERTY);
  RowTypeInfo type = new RowTypeInfo(tableSchema.getTypes(), tableSchema.getColumnNames());
  return new MockAppendStreamTableSink(type);
}
 
Example 3
Source File: MockTableSourceFactory.java    From AthenaX with Apache License 2.0 5 votes vote down vote up
@Override
public TableSource<Row> create(Map<String, String> properties) {
  DescriptorProperties params = new DescriptorProperties(true);
  params.putProperties(properties);
  TableSchema schema = params.getTableSchema(TABLE_SCHEMA_CONNECTOR_PROPERTY);
  List<Row> rows = deserializeRows(params.getString(TABLE_DATA_CONNECTOR_PROPERTY));
  return new MockTableSource(rows, new RowTypeInfo(schema.getTypes(), schema.getColumnNames()));
}
 
Example 4
Source File: KafkaUtils.java    From AthenaX with Apache License 2.0 4 votes vote down vote up
static RowTypeInfo toRowType(TableSchema schema) {
  return new RowTypeInfo(schema.getTypes(), schema.getColumnNames());
}