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