Maksim Zhuravkov created IGNITE-20650:
-----------------------------------------

             Summary: Table API. Field names are not resolved correctly.
                 Key: IGNITE-20650
                 URL: https://issues.apache.org/jira/browse/IGNITE-20650
             Project: Ignite
          Issue Type: Bug
          Components: sql
            Reporter: Maksim Zhuravkov
             Fix For: 3.0.0-beta2


Current implementation of Tuple/Record field name is not consistent with 
requirements specified in https://issues.apache.org/jira/browse/IGNITE-16322:

Field access:

{code:java}
Ignite ignite = CLUSTER_NODES.get(0);
IgniteTables tables = ignite.tables();

sql("CREATE TABLE \"values\" (\"Id\" INTEGER PRIMARY KEY, \"Val\" VARCHAR)");
sql("INSERT INTO \"values\" VALUES(1, '1')");

Table table = tables.table("\"values\"");
RecordView<Tuple> recordView = table.recordView();

Tuple key = Tuple.create(Map.of("id", 1));
Tuple record = recordView.get(null, key);

// Works
assertNotNull(record);
// Works
assertNotNull(record.value("\"Id\""));

// https://issues.apache.org/jira/browse/IGNITE-16322
// According to the ticket, the following assertions should not fail:
 
// Invalid column name: columnName=Id
assertNotNull(record.value("Id"));
// Invalid column name: columnName=ID
assertNotNull(record.value("ID"));
{code}

New tuple:

{code:java}
Ignite ignite = CLUSTER_NODES.get(0);
IgniteTables tables = ignite.tables();

sql("CREATE TABLE vals (\"Id\" INTEGER PRIMARY KEY, val VARCHAR)");
sql("INSERT INTO vals VALUES(1, '1')");

Table vals = tables.table("vals");

Tuple val1 = Tuple.create(Map.of("id", 2, "val", "1"));
vals.recordView().insert(null, val1);

Tuple val2 = Tuple.create(Map.of("ID", 2, "val", "2"));
vals.recordView().insert(null, val2);

Tuple val3 = Tuple.create(Map.of("\"Id\"", 3, "val", "3"));
// Error Missed key column: Id
 vals.recordView().insert(null, val3); 
{code}







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

Reply via email to