Skip to content

Commit

Permalink
Fix multi sink type annotation (#6105)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikvas0 committed Jul 19, 2024
1 parent 071e0b9 commit d93b2e4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
35 changes: 35 additions & 0 deletions ydb/core/kqp/ut/olap/kqp_olap_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2624,6 +2624,41 @@ Y_UNIT_TEST_SUITE(KqpOlap) {

}

Y_UNIT_TEST(MultiInsertWithSinks) {
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableTableServiceConfig()->SetEnableOlapSink(true);
auto settings = TKikimrSettings()
.SetAppConfig(appConfig)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);

TLocalHelper(kikimr).CreateTestOlapTable();

auto db = kikimr.GetQueryClient();

auto result = db.ExecuteQuery(R"(
INSERT INTO `/Root/olapStore/olapTable` (timestamp, uid, resource_id) VALUES (Timestamp('1970-01-01T00:00:00Z'), 'a', '0');
INSERT INTO `/Root/olapStore/olapTable` (timestamp, uid, resource_id) VALUES (Timestamp('1970-01-01T00:00:01Z'), 'b', 't');
INSERT INTO `/Root/olapStore/olapTable` (timestamp, uid, resource_id) VALUES (Timestamp('1970-01-01T00:00:02Z'), 'c', 'test');
)", NYdb::NQuery::TTxControl::BeginTx().CommitTx()).ExtractValueSync();

UNIT_ASSERT_C(result.IsSuccess(), result.GetIssues().ToString());

{
auto it = db.StreamExecuteQuery(R"(
--!syntax_v1
SELECT
*
FROM `/Root/olapStore/olapTable` ORDER BY uid
)", NYdb::NQuery::TTxControl::BeginTx().CommitTx()).GetValueSync();

UNIT_ASSERT_C(it.IsSuccess(), it.GetIssues().ToString());
TString result = StreamResultToYson(it);
CompareYson(result, R"([[#;#;["0"];0u;"a"];[#;#;["t"];1000000u;"b"];[#;#;["test"];2000000u;"c"]])");
}
}

}

}
3 changes: 0 additions & 3 deletions ydb/library/yql/dq/type_ann/dq_type_ann.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,6 @@ TStatus AnnotateStage(const TExprNode::TPtr& stage, TExprContext& ctx) {
}

if (!sinks.empty()) {
for (auto sink : sinks) {
sink->SetTypeAnn(resultType);
}
stageResultTypes.assign(programResultTypesTuple.begin(), programResultTypesTuple.end());
} else {
for (auto transform : transforms) {
Expand Down

0 comments on commit d93b2e4

Please sign in to comment.