Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <util/generic/serialized_enum.h>
#include <util/generic/size_literals.h>
#include <util/string/printf.h>
#include <util/system/sanitizers.h>

#include <fmt/format.h>

Expand Down Expand Up @@ -16521,6 +16522,17 @@ Y_UNIT_TEST_SUITE(KqpOlapScheme) {
Y_UNIT_TEST(TenThousandColumns) {
using namespace NArrow;

// Under sanitizers (tsan/asan/msan) the BulkUpsert of a wide (9901-column)
// x 10000-row batch cannot complete within the 5-minute RPC timeout due to
// the 5-15x instrumentation overhead (see GitHub issue #48623). Keep the
// full column count (the test validates wide-schema behavior) but reduce
// the row count so the BulkUpsert fits within the timeout. See
// NSan::PlainOrUnderSanitizer.
const ui64 numColumns = 9900;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: Nit
Confidence: Low

numColumns, alterColumnsFrom, and alterColumnsTo are constant-valued -- they don't use PlainOrUnderSanitizer and always evaluate to 9900, 9900, and 9999 respectively. They serve purely as named constants replacing magic numbers.

This is a nice readability improvement (makes the relationship between the values explicit and easier to change in the future), but it goes slightly beyond the minimal sanitizer fix. No action needed -- just noting for completeness.

const ui64 numRows = NSan::PlainOrUnderSanitizer<ui64>(10000, 100);
const ui64 alterColumnsFrom = 9900;
const ui64 alterColumnsTo = 9999;

TKikimrSettings runnerSettings;
runnerSettings.WithSampleTables = false;
TTestHelper testHelper(runnerSettings);
Expand All @@ -16529,7 +16541,7 @@ Y_UNIT_TEST_SUITE(KqpOlapScheme) {
TTestHelper::TColumnSchema().SetName("id").SetType(NScheme::NTypeIds::Uint64).SetNullable(false)
};

for (ui64 i = 0; i < 9900; ++i) {
for (ui64 i = 0; i < numColumns; ++i) {
schema.emplace_back(TTestHelper::TColumnSchema().SetName("column" + ToString(i)).SetType(NScheme::NTypeIds::Int32).SetNullable(true));
}

Expand All @@ -16542,19 +16554,19 @@ Y_UNIT_TEST_SUITE(KqpOlapScheme) {
for (ui64 i = 1; i < schema.size(); ++i) {
dataBuilders.push_back(std::make_shared<NConstruction::TSimpleArrayConstructor<NConstruction::TIntSeqFiller<arrow::Int32Type>>>(schema[i].GetName()));
}
auto batch = NConstruction::TRecordBatchConstructor(dataBuilders).BuildBatch(10000);
auto batch = NConstruction::TRecordBatchConstructor(dataBuilders).BuildBatch(numRows);
testHelper.BulkUpsert(testTable, batch);

testHelper.ReadData("SELECT COUNT(*) FROM `/Root/ColumnTableTest`", "[[10000u]]");
testHelper.ReadData("SELECT COUNT(*) FROM `/Root/ColumnTableTest`", TStringBuilder() << "[[" << numRows << "u]]");

for (ui64 i = 9900; i < 9999; ++i) {
for (ui64 i = alterColumnsFrom; i < alterColumnsTo; ++i) {
auto alterQuery = TStringBuilder() << "ALTER TABLE `" << testTable.GetName() << "` ADD COLUMN column" << i << " Uint64;";
Cerr << alterQuery << Endl;
auto alterResult = testHelper.GetSession().ExecuteSchemeQuery(alterQuery).GetValueSync();
UNIT_ASSERT_VALUES_EQUAL_C(alterResult.GetStatus(), EStatus::SUCCESS, alterResult.GetIssues().ToString());
}

testHelper.ReadData("SELECT COUNT(*) FROM `/Root/ColumnTableTest`", "[[10000u]]");
testHelper.ReadData("SELECT COUNT(*) FROM `/Root/ColumnTableTest`", TStringBuilder() << "[[" << numRows << "u]]");
}

Y_UNIT_TEST(NullKeySchema) {
Expand Down
Loading