Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix missing spec columns #16061

Merged
merged 2 commits into from
Mar 22, 2025
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion .github/config/muted_ya.txt
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ ydb/tests/olap/ttl_tiering data_migration_when_alter_ttl.py.TestDataMigrationWhe
ydb/tests/olap/ttl_tiering sole chunk chunk
ydb/tests/olap/ttl_tiering ttl_delete_s3.py.TestDeleteS3Ttl.test_data_unchanged_after_ttl_change
ydb/tests/olap/ttl_tiering ttl_delete_s3.py.TestDeleteS3Ttl.test_delete_s3_tiering
ydb/tests/olap/ttl_tiering ttl_delete_s3.py.TestDeleteS3Ttl.test_ttl_delete
ydb/tests/olap/ttl_tiering unstable_connection.py.TestUnstableConnection.test
ydb/tests/postgres_integrations/go-libpq [docker_wrapper_test.py] chunk chunk
ydb/tests/postgres_integrations/go-libpq docker_wrapper_test.py.test_pg_generated[Test64BitErrorChecking]
Expand Down
28 changes: 28 additions & 0 deletions ydb/core/kqp/ut/olap/kqp_olap_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3305,5 +3305,33 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
CompareYson("[[[\"aa\"];10u;\"n1\"];[[\"cc\"];30u;\"n3\"]]", FormatResultSetYson(result.GetResultSet(0)));
}
}

Y_UNIT_TEST(CountWithPredicate) {
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableTableServiceConfig()->SetEnableOlapSink(true);
auto runnerSettings = TKikimrSettings().SetAppConfig(appConfig).SetWithSampleTables(true);

TTestHelper testHelper(runnerSettings);
auto client = testHelper.GetKikimr().GetQueryClient();

TVector<TTestHelper::TColumnSchema> schema = {
TTestHelper::TColumnSchema().SetName("time").SetType(NScheme::NTypeIds::Timestamp).SetNullable(false),
TTestHelper::TColumnSchema().SetName("class").SetType(NScheme::NTypeIds::Utf8).SetNullable(false),
};

TTestHelper::TColumnTable testTable;
testTable.SetName("/Root/ColumnTableTest").SetPrimaryKey({ "time", "class" }).SetSchema(schema);
testHelper.CreateTable(testTable);

auto ts = TInstant::Now();
{
TTestHelper::TUpdatesBuilder tableInserter(testTable.GetArrowSchema(schema));
tableInserter.AddRow().Add(100).Add("test");
tableInserter.AddRow().Add(ts.MicroSeconds() * 2).Add("test");
testHelper.BulkUpsert(testTable, tableInserter);
}

testHelper.ReadData("SELECT COUNT(*) FROM `/Root/ColumnTableTest` WHERE time > CurrentUtcTimestamp()", "[[1u]]");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ std::shared_ptr<TFetchingScript> TSpecialReadContext::DoGetColumnsFetchingPlan(c
NCommon::TFetchingScriptBuilder acc(*this);
acc.SetBranchName("FAKE");
acc.AddStep(std::make_shared<TBuildFakeSpec>());
acc.AddStep(std::make_shared<NCommon::TBuildStageResultStep>());
return std::move(acc).Build();
}
}
Expand Down Expand Up @@ -157,6 +158,8 @@ std::shared_ptr<TFetchingScript> TSpecialReadContext::BuildColumnsFetchingPlan(c
if (needSnapshots || GetFFColumns()->Cross(*GetSpecColumns())) {
acc.AddAssembleStep(*GetSpecColumns(), "SPEC", EStageFeaturesIndexes::Filter, false);
acc.AddStep(std::make_shared<TSnapshotFilter>());
} else if (GetProgramInputColumns()->Cross(*GetSpecColumns())) {
acc.AddStep(std::make_shared<TBuildFakeSpec>());
}
acc.AddFetchingStep(*GetFFColumns(), EStageFeaturesIndexes::Fetching);
acc.AddAssembleStep(*GetFFColumns(), "LAST", EStageFeaturesIndexes::Fetching, !exclusiveSource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ TConclusion<bool> TBuildFakeSpec::DoExecuteInplace(const std::shared_ptr<IDataSo
std::make_shared<NArrow::NAccessor::TTrivialArray>(
NArrow::TThreadSimpleArraysCache::GetConst(f->type(), NArrow::DefaultScalar(f->type()), source->GetRecordsCount())), true);
}
source->BuildStageResult(source);
return true;
}

Expand Down
Loading