Skip to content

Commit

Permalink
Fix kv init 'It is not allowed to create not null data column' 23-3 e…
Browse files Browse the repository at this point in the history
…rror (#2118)
  • Loading branch information
kunga authored Mar 7, 2024
1 parent 942831f commit d9db5d6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ util/all_util.cpp
util/charset/all_charset.cpp

list_result.log
bin/config.json
10 changes: 5 additions & 5 deletions ydb/docs/en/core/reference/ydb-cli/workload-kv.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions ydb/docs/ru/core/reference/ydb-cli/workload-kv.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 9 additions & 2 deletions ydb/library/workload/kv_workload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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, ";
}
}

Expand Down

0 comments on commit d9db5d6

Please sign in to comment.