Tiago Marques Godinho created IGNITE-25408:
----------------------------------------------

             Summary: Catalog API: createTableAsync does not fetch the created 
table in non-default schema
                 Key: IGNITE-25408
                 URL: https://issues.apache.org/jira/browse/IGNITE-25408
             Project: Ignite
          Issue Type: Bug
          Components: sql
    Affects Versions: 3.0
            Reporter: Tiago Marques Godinho


Apparently, the IgniteCatalogSqlImpl#createTableAsync(TableDefinition) method 
is not handling custom schemas well.

It seems that it is fetching the newly created table from the table API using 
only the table name.
{code:java}
@Override
public CompletableFuture<Table> createTableAsync(TableDefinition definition) {
    return new CreateFromDefinitionImpl(sql)
            .from(definition)
            .executeAsync()
            .thenCompose(tableZoneId -> 
tables.tableAsync(tableZoneId.tableName()));
} {code}
When the table is created in a custom schema, the returned result is null.

The code below fix the behavior in my use-case.
{code:java}
@Override
public CompletableFuture<Table> createTableAsync(TableDefinition definition) {
    return new CreateFromDefinitionImpl(sql)
            .from(definition)
            .executeAsync()
            .thenCompose(tableZoneId -> 
tables.tableAsync(QualifiedName.of(definition.schemaName(), 
definition.tableName())));
}{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to