forked from ydb-platform/ydb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ydb-platform:main' into main
- Loading branch information
Showing
42 changed files
with
783 additions
and
427 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ SRCS( | |
run_ydb.cpp | ||
supported_codecs.cpp | ||
supported_codecs_fixture.cpp | ||
ydb-dump.cpp | ||
) | ||
|
||
PEERDIR( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#include "run_ydb.h" | ||
|
||
#include <util/string/split.h> | ||
|
||
#include <library/cpp/testing/common/env.h> | ||
#include <library/cpp/testing/unittest/registar.h> | ||
|
||
#include <ydb/public/sdk/cpp/client/ydb_table/table.h> | ||
|
||
#include <ydb/public/api/protos/ydb_table.pb.h> | ||
|
||
Y_UNIT_TEST_SUITE(YdbDump) { | ||
|
||
Y_UNIT_TEST(NotNullTypeDump) { | ||
RunYdb({"-v", "yql", "-s", | ||
R"(CREATE TABLE TableWithNotNullTypeForDump ( | ||
k Uint32 NOT NULL, | ||
v String NOT NULL, | ||
ov String, | ||
PRIMARY KEY(k)); | ||
)"}, | ||
TList<TString>()); | ||
|
||
const TString output = RunYdb({"-v", "tools", "dump", "--scheme-only"}, TList<TString>()); | ||
|
||
struct TFlags { | ||
const bool HasNullFlag; | ||
const bool IsOptionalType; | ||
}; | ||
|
||
TVector<TFlags> column_flags; | ||
auto fillFlag = [&column_flags](const TString& str) { | ||
Ydb::Table::ColumnMeta meta; | ||
google::protobuf::TextFormat::ParseFromString(str, &meta); | ||
column_flags.emplace_back(TFlags{meta.has_not_null(), meta.type().has_optional_type()}); | ||
}; | ||
|
||
const TString token = "columns {"; | ||
size_t start = 0; | ||
while (true) { | ||
start = output.find(token, start); | ||
if (start != TString::npos) { | ||
int scope = 1; | ||
start += token.size(); | ||
size_t pos = start; | ||
while (pos < output.size() && scope != 0) { | ||
if (output[pos] == '{') { | ||
scope++; | ||
} else if (output[pos] == '}') { | ||
scope--; | ||
} | ||
pos++; | ||
} | ||
Y_ABORT_UNLESS(pos > start); | ||
fillFlag(output.substr(start, pos - start - 1)); | ||
start = pos; | ||
} else { | ||
break; | ||
} | ||
} | ||
|
||
// For compatibility reason we do not show not null flag | ||
UNIT_ASSERT_VALUES_EQUAL(column_flags.size(), 3); | ||
UNIT_ASSERT_VALUES_EQUAL(column_flags[0].HasNullFlag, false); | ||
UNIT_ASSERT_VALUES_EQUAL(column_flags[0].IsOptionalType, false); | ||
UNIT_ASSERT_VALUES_EQUAL(column_flags[1].HasNullFlag, false); | ||
UNIT_ASSERT_VALUES_EQUAL(column_flags[1].IsOptionalType, false); | ||
UNIT_ASSERT_VALUES_EQUAL(column_flags[2].HasNullFlag, false); | ||
UNIT_ASSERT_VALUES_EQUAL(column_flags[2].IsOptionalType, true); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,34 @@ | ||
<!DOCTYPE html> | ||
<!-- Based on https://github.com/martine/webtreemap --> | ||
<head> | ||
<title>binary size</title> | ||
<link rel="stylesheet" href="webtreemap.css"> | ||
<link rel="stylesheet" href="bloat.css"> | ||
<script src='webtreemap.js'></script> | ||
<title>Build bloat</title> | ||
<link rel="stylesheet" href="webtreemap.css"> | ||
<link rel="stylesheet" href="bloat.css"> | ||
</head> | ||
|
||
<body> | ||
<legend> | ||
<h2>Legend:</h2> | ||
<div class="webtreemap-node webtreemap-symbol-dir webtreemap-aggregate"> | ||
<div class="webtreemap-node webtreemap-symbol-dir"> | ||
Dir | ||
<div class="content"> | ||
<div class="header"> | ||
<div class="note">Click on a box to zoom in. Click on the outermost box to zoom out.</div> | ||
<legend> | ||
<div>Legend:</div> | ||
<div class="webtreemap-node webtreemap-type-dir">Dir</div> | ||
<div class="webtreemap-node webtreemap-type-cpp">Cpp</div> | ||
<div class="webtreemap-node webtreemap-type-h">Header</div> | ||
</legend> | ||
</div> | ||
<div id='map'></div> | ||
</div> | ||
<div class="webtreemap-node webtreemap-symbol-cpp webtreemap-aggregate"> | ||
<div class="webtreemap-node webtreemap-symbol-cpp"> | ||
Cpp | ||
</div> | ||
</div> | ||
<div class="webtreemap-node webtreemap-symbol-h webtreemap-aggregate"> | ||
<div class="webtreemap-node webtreemap-symbol-h"> | ||
Header | ||
</div> | ||
</div> | ||
</legend> | ||
|
||
<h1>build time bloat</h1> | ||
<p>Click on a box to zoom in. Click on the outermost box to zoom out.</p> | ||
|
||
<div id='map'></div> | ||
|
||
<script src="bloat.json"></script> | ||
<script> | ||
var map = document.getElementById('map'); | ||
appendTreemap(map, kTree); | ||
</script> | ||
<script src="bloat.json"></script> | ||
<script type="text/javascript" src='webtreemap.js'></script> | ||
<script type="text/javascript"> | ||
var map = document.getElementById('map'); | ||
var bloat = null; | ||
|
||
renderTreemap(map, kTree); | ||
window.addEventListener("resize", (event) => { | ||
renderTreemap(map, kTree); | ||
}); | ||
</script> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.