Search in sources :

Example 1 with SchemaRegistry

use of org.apache.ignite.internal.schema.SchemaRegistry in project ignite-3 by apache.

the class JdbcMetadataCatalog method createPrimaryKeyMeta.

/**
 * Creates primary key metadata from table object.
 *
 * @param tbl Table.
 * @return Jdbc primary key metadata.
 */
private JdbcPrimaryKeyMeta createPrimaryKeyMeta(Table tbl) {
    String schemaName = getTblSchema(tbl.name());
    String tblName = getTblName(tbl.name());
    final String keyName = PK + tblName;
    SchemaRegistry registry = ((TableImpl) tbl).schemaView();
    List<String> keyColNames = Arrays.stream(registry.schema().keyColumns().columns()).map(Column::name).collect(Collectors.toList());
    return new JdbcPrimaryKeyMeta(schemaName, tblName, keyName, keyColNames);
}
Also used : TableImpl(org.apache.ignite.internal.table.TableImpl) JdbcPrimaryKeyMeta(org.apache.ignite.client.proto.query.event.JdbcPrimaryKeyMeta) SchemaRegistry(org.apache.ignite.internal.schema.SchemaRegistry)

Aggregations

JdbcPrimaryKeyMeta (org.apache.ignite.client.proto.query.event.JdbcPrimaryKeyMeta)1 SchemaRegistry (org.apache.ignite.internal.schema.SchemaRegistry)1 TableImpl (org.apache.ignite.internal.table.TableImpl)1