@@ -99,6 +99,81 @@ Y_UNIT_TEST_SUITE(TOlap) {
9999 TestLs (runtime, " /MyRoot/DirA/DirB/OlapStore" , false , NLs::PathExist);
100100 }
101101
102+ Y_UNIT_TEST (CreateTableWithNullableKeysNotAllowed) {
103+ TTestBasicRuntime runtime;
104+ TTestEnv env (runtime);
105+ ui64 txId = 100 ;
106+
107+ auto & appData = runtime.GetAppData ();
108+ appData.ColumnShardConfig .SetAllowNullableColumnsInPK (false );
109+
110+ TestCreateOlapStore (runtime, ++txId, " /MyRoot" , R"(
111+ Name: "MyStore"
112+ ColumnShardCount: 1
113+ SchemaPresets {
114+ Name: "default"
115+ Schema {
116+ Columns { Name: "timestamp" Type: "Timestamp" NotNull: true }
117+ Columns { Name: "key1" Type: "Uint32" }
118+ Columns { Name: "data" Type: "Utf8" }
119+ KeyColumnNames: [ "timestamp", "key1" ]
120+ }
121+ }
122+ )" , {NKikimrScheme::StatusSchemeError});
123+ env.TestWaitNotification (runtime, txId);
124+ }
125+
126+ Y_UNIT_TEST (CreateTableWithNullableKeys) {
127+ TTestBasicRuntime runtime;
128+ TTestEnv env (runtime);
129+ ui64 txId = 100 ;
130+
131+ auto & appData = runtime.GetAppData ();
132+ appData.ColumnShardConfig .SetAllowNullableColumnsInPK (true );
133+
134+ TestCreateOlapStore (runtime, ++txId, " /MyRoot" , R"(
135+ Name: "MyStore"
136+ ColumnShardCount: 1
137+ SchemaPresets {
138+ Name: "default"
139+ Schema {
140+ Columns { Name: "timestamp" Type: "Timestamp" NotNull: true }
141+ Columns { Name: "key1" Type: "Uint32" }
142+ Columns { Name: "data" Type: "Utf8" }
143+ KeyColumnNames: [ "timestamp", "key1" ]
144+ }
145+ }
146+ )" );
147+ env.TestWaitNotification (runtime, txId);
148+
149+ TestLs (runtime, " /MyRoot/MyStore" , false , NLs::PathExist);
150+
151+ TestMkDir (runtime, ++txId, " /MyRoot" , " MyDir" );
152+ env.TestWaitNotification (runtime, txId);
153+
154+ TestLs (runtime, " /MyRoot/MyDir" , false , NLs::PathExist);
155+
156+ TestCreateColumnTable (runtime, ++txId, " /MyRoot/MyDir" , R"(
157+ Name: "MyTable"
158+ ColumnShardCount: 1
159+ Schema {
160+ Columns { Name: "timestamp" Type: "Timestamp" NotNull: true }
161+ Columns { Name: "key1" Type: "Uint32" }
162+ Columns { Name: "data" Type: "Utf8" }
163+ KeyColumnNames: [ "timestamp", "key1" ]
164+ }
165+ )" );
166+ env.TestWaitNotification (runtime, txId);
167+
168+ TestLsPathId (runtime, 4 , NLs::PathStringEqual (" /MyRoot/MyDir/MyTable" ));
169+
170+ TestDropColumnTable (runtime, ++txId, " /MyRoot/MyDir" , " MyTable" );
171+ env.TestWaitNotification (runtime, txId);
172+
173+ TestLs (runtime, " /MyRoot/MyDir/MyTable" , false , NLs::PathNotExist);
174+ TestLsPathId (runtime, 4 , NLs::PathStringEqual (" " ));
175+ }
176+
102177 Y_UNIT_TEST (CreateTable) {
103178 TTestBasicRuntime runtime;
104179 TTestEnv env (runtime);
@@ -825,5 +900,5 @@ Y_UNIT_TEST_SUITE(TOlap) {
825900 env.TestWaitNotification (runtime, txId);
826901
827902 TestLs (runtime, " /MyRoot/OlapStore" , false , NLs::PathExist);
828- }
903+ }
829904}
0 commit comments