ydb icon indicating copy to clipboard operation
ydb copied to clipboard

ReadTable doesn't work with non-optional key bounds and always emits Optional columns into result

Open vitstn opened this issue 1 year ago • 0 comments

schema: operation_id String NOT NULL, ... data NOT NULL, PRIMARY KEY (operation_id)

working code:

             auto key1 = NYdb::TValueBuilder()
                .BeginTuple()
                    .AddElement().OptionalString(operationId)
                    ...
                .EndTuple()
                .Build();
            auto key2 = NYdb::TValueBuilder()
                .BeginTuple()
                    .AddElement().OptionalString(operationId)
                     ...
                .EndTuple()
                .Build();
            auto from = NYdb::NTable::TKeyBound::Inclusive(key1);
            auto to = NYdb::NTable::TKeyBound::Exclusive(key2);
            auto settings = NYdb::NTable::TReadTableSettings()

I got this error:

(yexception) Status: SCHEME_ERROR
Issues:
<main>: Error: Failed to parse key ranges, code: 200501
<main>: Error: Got ResolveError response from TxProxy

for this code:

             auto key1 = NYdb::TValueBuilder()
                .BeginTuple()
                    .AddElement().String(operationId)
                    ...
                .EndTuple()
                .Build();
            auto key2 = NYdb::TValueBuilder()
                .BeginTuple()
                    .AddElement().String(operationId)
                     ...
                .EndTuple()
                .Build();
            auto from = NYdb::NTable::TKeyBound::Inclusive(key1);
            auto to = NYdb::NTable::TKeyBound::Exclusive(key2);
            auto settings = NYdb::NTable::TReadTableSettings()

Additionally, this code doesn't work

parser.ColumnParser("data").GetString();

I have to use this workaround now:

parser.ColumnParser("data").GetOptionalString();

vitstn avatar Apr 26 '24 09:04 vitstn