Skip to content

Commit b62d162

Browse files
committed
GroupByWithMakeDatetime has been added (#19749)
1 parent 722054e commit b62d162

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

ydb/core/kqp/ut/olap/kqp_olap_ut.cpp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3887,5 +3887,57 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
38873887
CompareYson(result, R"([[20u]])");
38883888
}
38893889
}
3890+
3891+
Y_UNIT_TEST(GroupByWithMakeDatetime) {
3892+
return; // TODO: fix me
3893+
auto settings = TKikimrSettings()
3894+
.SetWithSampleTables(false);
3895+
TKikimrRunner kikimr(settings);
3896+
3897+
auto tableClient = kikimr.GetTableClient();
3898+
auto tableSession = tableClient.CreateSession().GetValueSync().GetSession();
3899+
3900+
auto queryClient = kikimr.GetQueryClient();
3901+
auto result = queryClient.GetSession().GetValueSync();
3902+
NStatusHelpers::ThrowOnError(result);
3903+
auto querySession = result.GetSession();
3904+
3905+
{
3906+
auto result = tableSession.ExecuteSchemeQuery(R"(
3907+
CREATE TABLE `/Root/query_stat` (
3908+
ts Timestamp NOT NULL,
3909+
folder_id String,
3910+
primary key(ts)
3911+
)
3912+
PARTITION BY HASH(ts)
3913+
WITH (STORE = COLUMN);
3914+
)").GetValueSync();
3915+
UNIT_ASSERT_C(result.IsSuccess(), result.GetIssues().ToString());
3916+
}
3917+
3918+
{
3919+
auto result = querySession.ExecuteQuery(R"(
3920+
INSERT INTO `/Root/query_stat` (ts, folder_id)
3921+
VALUES (
3922+
CurrentUtcTimestamp(),
3923+
"abc"
3924+
)
3925+
)", NYdb::NQuery::TTxControl::NoTx()).GetValueSync();
3926+
UNIT_ASSERT_C(result.IsSuccess(), result.GetIssues().ToString());
3927+
}
3928+
3929+
{
3930+
auto result = querySession.ExecuteQuery(R"(
3931+
SELECT
3932+
ts1, count(*)
3933+
FROM
3934+
query_stat
3935+
where
3936+
folder_id not in [ "b1g0gammoel2iuh0hir6" ]
3937+
GROUP BY DateTime::MakeDatetime(DateTime::StartOf(ts, DateTime::IntervalFromDays(1))) as ts1
3938+
)", NYdb::NQuery::TTxControl::NoTx()).GetValueSync();
3939+
UNIT_ASSERT_C(result.IsSuccess(), result.GetIssues().ToString());
3940+
}
3941+
}
38903942
}
38913943
}

0 commit comments

Comments
 (0)