[ https://issues.apache.org/jira/browse/IGNITE-16115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrey Mashenkov updated IGNITE-16115: -------------------------------------- Description: It is allowed to map an object to a single nullable column, which makes 'null' values legal in the KeyValue view. Once the 'null' value is possible there is no way to distinguish, if there is no row in a table for the given key, or the row exists and the mapped column contains the 'null' value. Let's introduce {{NullableValue}} class-wrapper for a value and implement {{{}getNullable(){}}}, and {{getOrDefault()}} + bulk methods. {{getNullable()}} is useful for cases, when it's not possible to use a "default", but creates an additional wrapper. Also, the KeyValueView.get(key) method behavior should be changed: * return {{null}} if the table has no row for the key. * return a non-null value for the key. * fail with a suggestion to use a getNullable, if a {{null}} value returned for the key to avoid ambiguity. was: It is allowed to map an object to a single nullable column, which makes 'null' values legal in the KeyValue view. Once the 'null' value is possible there is no way to distinguish, if there is no row in a table for the given key, or the row exists and the mapped column contains the 'null' value. Let's introduce NullableValue class-wrapper for a value and implement getNullable, and getOrDefault methods for that purpose. The first one is useful for cases, when it's not possible to use a "default", but creates an additional wrapper. Also, the KeyValueView.get(key) method behavior should be changed: * return {{null}} if the table has no row for the key. * return a non-null value for the key. * fail with a suggestion to use a getNullable, if a {{null}} value returned for the key to avoid ambiguity. > Implement getNullable and getOrDefault operations. > -------------------------------------------------- > > Key: IGNITE-16115 > URL: https://issues.apache.org/jira/browse/IGNITE-16115 > Project: Ignite > Issue Type: Improvement > Reporter: Andrey Mashenkov > Assignee: Andrey Mashenkov > Priority: Major > Labels: ignite-3 > Fix For: 3.0.0-alpha4 > > Time Spent: 20m > Remaining Estimate: 0h > > It is allowed to map an object to a single nullable column, which makes > 'null' values legal in the KeyValue view. > Once the 'null' value is possible there is no way to distinguish, if there is > no row in a table for the given key, or the row exists and the mapped column > contains the 'null' value. > Let's introduce {{NullableValue}} class-wrapper for a value and implement > {{{}getNullable(){}}}, and {{getOrDefault()}} + bulk methods. > {{getNullable()}} is useful for cases, when it's not possible to use a > "default", but creates an additional wrapper. > Also, the KeyValueView.get(key) method behavior should be changed: > * return {{null}} if the table has no row for the key. > * return a non-null value for the key. > * fail with a suggestion to use a getNullable, if a {{null}} value returned > for the key to avoid ambiguity. -- This message was sent by Atlassian Jira (v8.20.1#820001)