diff options
author | kungurtsev <kungasc@ydb.tech> | 2024-03-07 09:50:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-07 09:50:37 +0100 |
commit | d9db5d6a97386e9f7db96f9ed1a16ac07df95cd9 (patch) | |
tree | 26331f89a1cc2c67cdee5acb9cbd43704ea02fcb | |
parent | 942831fd106045ea38f70f55076d5edde30f3083 (diff) | |
download | ydb-d9db5d6a97386e9f7db96f9ed1a16ac07df95cd9.tar.gz |
Fix kv init 'It is not allowed to create not null data column' 23-3 error (#2118)
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | ydb/docs/en/core/reference/ydb-cli/workload-kv.md | 10 | ||||
-rw-r--r-- | ydb/docs/ru/core/reference/ydb-cli/workload-kv.md | 10 | ||||
-rw-r--r-- | ydb/library/workload/kv_workload.cpp | 11 |
4 files changed, 20 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore index 024b9b483a..425e164c32 100644 --- a/.gitignore +++ b/.gitignore @@ -75,3 +75,4 @@ util/all_util.cpp util/charset/all_charset.cpp list_result.log +bin/config.json diff --git a/ydb/docs/en/core/reference/ydb-cli/workload-kv.md b/ydb/docs/en/core/reference/ydb-cli/workload-kv.md index 3c61f1c3b2..93538a03d9 100644 --- a/ydb/docs/en/core/reference/ydb-cli/workload-kv.md +++ b/ydb/docs/en/core/reference/ydb-cli/workload-kv.md @@ -46,13 +46,13 @@ The following command is used to create a table: ```yql CREATE TABLE `kv_test`( - c0 Uint64 NOT NULL, - c1 Uint64 NOT NULL, + c0 Uint64, + c1 Uint64, ... - cI Uint64 NOT NULL, - cI+1 String NOT NULL, + cI Uint64, + cI+1 String, ... - cN String NOT NULL, + cN String, PRIMARY KEY(c0, c1, ... cK)) WITH ( AUTO_PARTITIONING_BY_LOAD = ENABLED, AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = partsNum, diff --git a/ydb/docs/ru/core/reference/ydb-cli/workload-kv.md b/ydb/docs/ru/core/reference/ydb-cli/workload-kv.md index 1f426a1954..806243ce22 100644 --- a/ydb/docs/ru/core/reference/ydb-cli/workload-kv.md +++ b/ydb/docs/ru/core/reference/ydb-cli/workload-kv.md @@ -46,13 +46,13 @@ ```yql CREATE TABLE `kv_test`( - c0 Uint64 NOT NULL, - c1 Uint64 NOT NULL, + c0 Uint64, + c1 Uint64, ... - cI Uint64 NOT NULL, - cI+1 String NOT NULL, + cI Uint64, + cI+1 String, ... - cN String NOT NULL, + cN String, PRIMARY KEY(c0, c1, ... cK)) WITH ( AUTO_PARTITIONING_BY_LOAD = ENABLED, AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = partsNum, diff --git a/ydb/library/workload/kv_workload.cpp b/ydb/library/workload/kv_workload.cpp index fc16af69ab..a32c52766d 100644 --- a/ydb/library/workload/kv_workload.cpp +++ b/ydb/library/workload/kv_workload.cpp @@ -78,11 +78,18 @@ void AddResultSet(const NYdb::TResultSet& resultSet, TVector<TRow>& rows) { for (size_t col = 0; col < parser.ColumnsCount(); col++) { auto& valueParser = parser.ColumnParser(col); + bool optional = valueParser.GetKind() == NYdb::TTypeParser::ETypeKind::Optional; + if (optional) { + valueParser.OpenOptional(); + } if (valueParser.GetPrimitiveType() == NYdb::EPrimitiveType::Uint64) { row.Ints.push_back(valueParser.GetUint64()); } else { row.Strings.push_back(valueParser.GetString()); } + if (optional) { + valueParser.CloseOptional(); + } } rows.push_back(std::move(row)); @@ -147,9 +154,9 @@ std::string TKvWorkloadGenerator::GetDDLQueries() const { for (size_t i = 0; i < Params.ColumnsCnt; ++i) { if (i < Params.IntColumnsCnt) { - ss << "c" << i << " Uint64 NOT NULL, "; + ss << "c" << i << " Uint64, "; } else { - ss << "c" << i << " String NOT NULL, "; + ss << "c" << i << " String, "; } } |