Skip to content

Commit 37478cb

Browse files
shnikdnshestakov
authored andcommitted
Support ALTER OBJECT for SHOW CREATE TABLE (ydb-platform#18493)
1 parent 70b8994 commit 37478cb

File tree

9 files changed

+715
-53
lines changed

9 files changed

+715
-53
lines changed

ydb/core/sys_view/show_create/create_table_formatter.cpp

Lines changed: 483 additions & 50 deletions
Large diffs are not rendered by default.

ydb/core/sys_view/show_create/create_table_formatter.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class TCreateTableFormatter {
3333
TFormatResult Format(const TString& tablePath, const TString& fullPath, const NKikimrSchemeOp::TTableDescription& tableDesc, bool temporary,
3434
const THashMap<TString, THolder<NKikimrSchemeOp::TPersQueueGroupDescription>>& persQueues,
3535
const THashMap<TPathId, THolder<NSequenceProxy::TEvSequenceProxy::TEvGetSequenceResult>>& sequences);
36-
TFormatResult Format(const TString& tablePath, const NKikimrSchemeOp::TColumnTableDescription& tableDesc, bool temporary);
36+
TFormatResult Format(const TString& tablePath, const TString& fullPath, const NKikimrSchemeOp::TColumnTableDescription& tableDesc, bool temporary);
3737

3838
private:
3939
void Format(const NKikimrSchemeOp::TColumnDescription& columnDesc);
@@ -56,12 +56,17 @@ class TCreateTableFormatter {
5656
void Format(const NKikimrSchemeOp::TColumnTableSharding& tableSharding);
5757
void Format(const NKikimrSchemeOp::TColumnDataLifeCycle& ttlSettings);
5858

59-
void Format(const NKikimrColumnShardColumnDefaults::TColumnDefault& defaultValue);
59+
void FormatAlterColumn(const TString& fullPath, const NKikimrSchemeOp::TOlapColumnDescription& columnDesc, const NKikimrSchemeOp::TFamilyDescription* family);
60+
void FormatUpsertIndex(const TString& fullPath, const NKikimrSchemeOp::TOlapIndexDescription& indexDesc,
61+
const std::map<ui32, const NKikimrSchemeOp::TOlapColumnDescription*>& columns);
62+
void FormatUpsertOptions(const TString& fullPath, const NKikimrSchemeOp::TColumnTableSchemeOptions& options);
6063

6164
void Format(const Ydb::TypedValue& value, bool isPartition = false);
6265
void FormatValue(NYdb::TValueParser& parser, bool isPartition = false, TString del = "");
6366
void FormatPrimitive(NYdb::TValueParser& parser);
6467

68+
TString ValueToString(const NKikimrColumnShardColumnDefaults::TColumnDefault& defaultValue);
69+
6570
TStringStream Stream;
6671
NMiniKQL::TScopedAlloc Alloc;
6772
};

ydb/core/sys_view/show_create/formatters_common.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,12 @@ void EscapeBinary(const TString& str, TStringStream& stream) {
1616
NYql::EscapeBinaryAtom(str, '\'', &stream);
1717
}
1818

19+
void EscapeValue(bool value, TStringStream& stream) {
20+
if (value) {
21+
EscapeName("true", stream);
22+
} else {
23+
EscapeName("false", stream);
24+
}
25+
}
26+
1927
}

ydb/core/sys_view/show_create/formatters_common.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,20 @@
44

55
#include <util/generic/yexception.h>
66
#include <util/stream/str.h>
7+
#include <util/string/cast.h>
78
#include <yql/essentials/public/issue/yql_issue.h>
89

910
namespace NKikimr::NSysView {
1011

1112
void EscapeName(const TString& str, TStringStream& stream);
1213
void EscapeString(const TString& str, TStringStream& stream);
1314
void EscapeBinary(const TString& str, TStringStream& stream);
15+
void EscapeValue(bool value, TStringStream& stream);
16+
17+
template<class T>
18+
void EscapeValue(const T& value, TStringStream& stream) {
19+
EscapeName(ToString<T>(value), stream);
20+
}
1421

1522
class TFormatFail : public yexception {
1623
public:

ydb/core/sys_view/show_create/show_create.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ class TShowCreate : public TScanActorBase<TShowCreate> {
313313
}
314314

315315
TCreateTableFormatter formatter;
316-
auto formatterResult = formatter.Format(tablePath, columnTableDesc, temporary);
316+
auto formatterResult = formatter.Format(tablePath, Path, columnTableDesc, temporary);
317317
if (formatterResult.IsSuccess()) {
318318
path = tablePath;
319319
statement = formatterResult.ExtractOut();

ydb/core/sys_view/show_create/ya.make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ SRCS(
99

1010
PEERDIR(
1111
ydb/core/base
12+
ydb/core/formats/arrow/serializer
1213
ydb/core/kqp/runtime
1314
ydb/core/protos
1415
ydb/core/sys_view/common

ydb/core/sys_view/ut_common.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ TTestEnv::TTestEnv(ui32 staticNodes, ui32 dynamicNodes, const TTestEnvSettings&
4949
featureFlags.SetEnableVectorIndex(true);
5050
featureFlags.SetEnableTieringInColumnShard(true);
5151
featureFlags.SetEnableExternalDataSources(true);
52+
featureFlags.SetEnableSparsedColumns(settings.EnableSparsedColumns);
53+
featureFlags.SetEnableOlapCompression(settings.EnableOlapCompression);
5254

5355
Settings->SetFeatureFlags(featureFlags);
5456

@@ -61,6 +63,7 @@ TTestEnv::TTestEnv(ui32 staticNodes, ui32 dynamicNodes, const TTestEnvSettings&
6163
NKikimrConfig::TAppConfig appConfig;
6264
*appConfig.MutableFeatureFlags() = Settings->FeatureFlags;
6365
appConfig.MutableQueryServiceConfig()->AddAvailableExternalDataSources("ObjectStorage");
66+
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(settings.AlterObjectEnabled);
6467
Settings->SetAppConfig(appConfig);
6568

6669
for (ui32 i : xrange(settings.StoragePools)) {

ydb/core/sys_view/ut_common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ struct TTestEnvSettings {
2323
bool EnableSVP = false;
2424
bool EnableForceFollowers = false;
2525
bool ShowCreateTable = false;
26+
bool AlterObjectEnabled = false;
27+
bool EnableSparsedColumns = false;
28+
bool EnableOlapCompression = false;
2629
NKikimrProto::TAuthConfig AuthConfig = {};
2730
};
2831

ydb/core/sys_view/ut_kqp.cpp

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,6 +2026,208 @@ ALTER TABLE `test_show_create`
20262026
);
20272027
}
20282028

2029+
Y_UNIT_TEST(ShowCreateTableColumnAlterColumn) {
2030+
TTestEnv env(1, 4, {.StoragePools = 3, .ShowCreateTable = true, .AlterObjectEnabled = true, .EnableSparsedColumns = true, .EnableOlapCompression = true});
2031+
2032+
env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::KQP_EXECUTER, NActors::NLog::PRI_DEBUG);
2033+
env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::KQP_COMPILE_SERVICE, NActors::NLog::PRI_DEBUG);
2034+
env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::KQP_YQL, NActors::NLog::PRI_TRACE);
2035+
env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::SYSTEM_VIEWS, NActors::NLog::PRI_DEBUG);
2036+
2037+
TShowCreateChecker checker(env);
2038+
2039+
checker.CheckShowCreateTable(R"(
2040+
CREATE TABLE `/Root/test_show_create` (
2041+
Col1 Uint64 NOT NULL,
2042+
Col2 JsonDocument,
2043+
Col3 Uint32,
2044+
PRIMARY KEY (Col1)
2045+
)
2046+
PARTITION BY HASH(Col1)
2047+
WITH (STORE = COLUMN, AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = 2);
2048+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=ALTER_COLUMN, NAME=Col2, `FORCE_SIMD_PARSING`=`true`, `DATA_ACCESSOR_CONSTRUCTOR.CLASS_NAME`=`SUB_COLUMNS`, `OTHERS_ALLOWED_FRACTION`=`0.5`);
2049+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=ALTER_COLUMN, NAME=Col2, `ENCODING.DICTIONARY.ENABLED`=`true`);
2050+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=ALTER_COLUMN, NAME=Col3, `DEFAULT_VALUE`=`5`);
2051+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=ALTER_COLUMN, NAME=Col2, `SERIALIZER.CLASS_NAME`=`ARROW_SERIALIZER`, `COMPRESSION.TYPE`=`zstd`, `COMPRESSION.LEVEL`=`4`);
2052+
)", "test_show_create",
2053+
R"(CREATE TABLE `test_show_create` (
2054+
`Col1` Uint64 NOT NULL,
2055+
`Col2` JsonDocument,
2056+
`Col3` Uint32,
2057+
PRIMARY KEY (`Col1`)
2058+
)
2059+
PARTITION BY HASH (`Col1`)
2060+
WITH (
2061+
STORE = COLUMN,
2062+
AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = 2
2063+
);
2064+
2065+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION = ALTER_COLUMN, NAME = Col2, `DATA_ACCESSOR_CONSTRUCTOR.CLASS_NAME` = `SUB_COLUMNS`, `SPARSED_DETECTOR_KFF` = `20`, `COLUMNS_LIMIT` = `1024`, `MEM_LIMIT_CHUNK` = `52428800`, `OTHERS_ALLOWED_FRACTION` = `0.5`, `DATA_EXTRACTOR_CLASS_NAME` = `JSON_SCANNER`, `SCAN_FIRST_LEVEL_ONLY` = `false`, `FORCE_SIMD_PARSING` = `true`, `ENCODING.DICTIONARY.ENABLED` = `true`, `SERIALIZER.CLASS_NAME` = `ARROW_SERIALIZER`, `COMPRESSION.TYPE` = `zstd`, `COMPRESSION.LEVEL` = `4`);
2066+
2067+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION = ALTER_COLUMN, NAME = Col3, `DEFAULT_VALUE` = `5`);
2068+
)"
2069+
);
2070+
}
2071+
2072+
Y_UNIT_TEST(ShowCreateTableColumnUpsertOptions) {
2073+
TTestEnv env(1, 4, {.StoragePools = 3, .ShowCreateTable = true, .AlterObjectEnabled = true});
2074+
2075+
env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::KQP_EXECUTER, NActors::NLog::PRI_DEBUG);
2076+
env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::KQP_COMPILE_SERVICE, NActors::NLog::PRI_DEBUG);
2077+
env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::KQP_YQL, NActors::NLog::PRI_TRACE);
2078+
env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::SYSTEM_VIEWS, NActors::NLog::PRI_DEBUG);
2079+
2080+
TShowCreateChecker checker(env);
2081+
2082+
checker.CheckShowCreateTable(R"(
2083+
CREATE TABLE `/Root/test_show_create` (
2084+
Col1 Uint64 NOT NULL,
2085+
Col2 JsonDocument,
2086+
PRIMARY KEY (Col1)
2087+
)
2088+
PARTITION BY HASH(Col1)
2089+
WITH (STORE = COLUMN, AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = 2);
2090+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=UPSERT_OPTIONS, `SCAN_READER_POLICY_NAME`=`SIMPLE`);
2091+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=UPSERT_OPTIONS, `COMPACTION_PLANNER.CLASS_NAME`=`lc-buckets`,
2092+
`COMPACTION_PLANNER.FEATURES`=`{"levels" : [{"class_name" : "Zero", "portions_live_duration" : "5s", "expected_blobs_size" : 1000000000000, "portions_count_available" : 2},
2093+
{"class_name" : "Zero"}]}`);
2094+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=UPSERT_OPTIONS, `METADATA_MEMORY_MANAGER.CLASS_NAME`=`local_db`,
2095+
`METADATA_MEMORY_MANAGER.FEATURES`=`{"memory_cache_size" : 0}`);
2096+
)", "test_show_create",
2097+
R"(CREATE TABLE `test_show_create` (
2098+
`Col1` Uint64 NOT NULL,
2099+
`Col2` JsonDocument,
2100+
PRIMARY KEY (`Col1`)
2101+
)
2102+
PARTITION BY HASH (`Col1`)
2103+
WITH (
2104+
STORE = COLUMN,
2105+
AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = 2
2106+
);
2107+
2108+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION = UPSERT_OPTIONS, `SCAN_READER_POLICY_NAME` = 'SIMPLE', `COMPACTION_PLANNER.CLASS_NAME` = 'lc-buckets', `COMPACTION_PLANNER.FEATURES` = `{"levels":[{"portions_count_available":2,"portions_live_duration":"5.000000s","class_name":"Zero","expected_blobs_size":1000000000000},{"class_name":"Zero"}]}`, `METADATA_MEMORY_MANAGER.CLASS_NAME` = 'local_db', `METADATA_MEMORY_MANAGER.FEATURES` = `{"memory_cache_size":0,"fetch_on_start":false}`);
2109+
)"
2110+
);
2111+
}
2112+
2113+
Y_UNIT_TEST(ShowCreateTableColumnUpsertIndex) {
2114+
TTestEnv env(1, 4, {.StoragePools = 3, .ShowCreateTable = true, .AlterObjectEnabled = true});
2115+
2116+
env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::KQP_EXECUTER, NActors::NLog::PRI_DEBUG);
2117+
env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::KQP_COMPILE_SERVICE, NActors::NLog::PRI_DEBUG);
2118+
env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::KQP_YQL, NActors::NLog::PRI_TRACE);
2119+
env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::SYSTEM_VIEWS, NActors::NLog::PRI_DEBUG);
2120+
2121+
TShowCreateChecker checker(env);
2122+
2123+
checker.CheckShowCreateTable(R"(
2124+
CREATE TABLE `/Root/test_show_create` (
2125+
Col1 Uint64 NOT NULL,
2126+
Col2 Uint32 NOT NULL,
2127+
Col3 JsonDocument,
2128+
PRIMARY KEY (Col1)
2129+
)
2130+
PARTITION BY HASH(Col1)
2131+
WITH (STORE = COLUMN, AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = 2);
2132+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=UPSERT_INDEX, NAME=count_min_sketch_index, TYPE=COUNT_MIN_SKETCH,
2133+
FEATURES=`{"column_names" : ['Col2']}`);
2134+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=UPSERT_INDEX, NAME=bloom_ngramm_filter_index, TYPE=BLOOM_NGRAMM_FILTER,
2135+
FEATURES=`{"column_name" : "Col3", "ngramm_size" : 3, "hashes_count" : 2, "filter_size_bytes" : 4096,
2136+
"records_count" : 1024, "case_sensitive" : false, "data_extractor" : {"class_name" : "SUB_COLUMN", "sub_column_name" : '"b.c.d"'}}`);
2137+
ALTER OBJECT `Root/test_show_create` (TYPE TABLE) SET (ACTION=UPSERT_INDEX, NAME=bloom_filter_index, TYPE=BLOOM_FILTER,
2138+
FEATURES=`{"column_name" : "Col2", "false_positive_probability" : 0.01, "bits_storage_type": "BITSET"}`);
2139+
ALTER OBJECT `Root/test_show_create` (TYPE TABLE) SET (ACTION=UPSERT_INDEX, NAME=max_index, TYPE=MAX, FEATURES=`{"column_name": "Col2"}`);
2140+
)", "test_show_create",
2141+
R"(CREATE TABLE `test_show_create` (
2142+
`Col1` Uint64 NOT NULL,
2143+
`Col2` Uint32 NOT NULL,
2144+
`Col3` JsonDocument,
2145+
PRIMARY KEY (`Col1`)
2146+
)
2147+
PARTITION BY HASH (`Col1`)
2148+
WITH (
2149+
STORE = COLUMN,
2150+
AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = 2
2151+
);
2152+
2153+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION = UPSERT_INDEX, NAME = max_index, TYPE = MAX, FEATURES = `{"column_name":"Col2"}`);
2154+
2155+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION = UPSERT_INDEX, NAME = count_min_sketch_index, TYPE = COUNT_MIN_SKETCH, FEATURES = `{"column_names":["Col2"]}`);
2156+
2157+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION = UPSERT_INDEX, NAME = bloom_ngramm_filter_index, TYPE = BLOOM_NGRAMM_FILTER, FEATURES = `{"bits_storage_type":"SIMPLE_STRING","records_count":1024,"case_sensitive":false,"ngramm_size":3,"filter_size_bytes":4096,"data_extractor":{"class_name":"SUB_COLUMN","sub_column_name":"\\\"b.c.d\\\""},"hashes_count":2,"column_name":"Col3"}`);
2158+
2159+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION = UPSERT_INDEX, NAME = bloom_filter_index, TYPE = BLOOM_FILTER, FEATURES = `{"false_positive_probability":0.01,"data_extractor":{"class_name":"DEFAULT"},"bits_storage_type":"BITSET","column_name":"Col2"}`);
2160+
)"
2161+
);
2162+
}
2163+
2164+
Y_UNIT_TEST(ShowCreateTableColumnAlterObject) {
2165+
TTestEnv env(1, 4, {.StoragePools = 3, .ShowCreateTable = true, .AlterObjectEnabled = true, .EnableSparsedColumns = true, .EnableOlapCompression = true});
2166+
2167+
env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::KQP_EXECUTER, NActors::NLog::PRI_DEBUG);
2168+
env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::KQP_COMPILE_SERVICE, NActors::NLog::PRI_DEBUG);
2169+
env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::KQP_YQL, NActors::NLog::PRI_TRACE);
2170+
env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::SYSTEM_VIEWS, NActors::NLog::PRI_DEBUG);
2171+
2172+
TShowCreateChecker checker(env);
2173+
2174+
checker.CheckShowCreateTable(R"(
2175+
CREATE TABLE `/Root/test_show_create` (
2176+
Col1 Uint64 NOT NULL,
2177+
Col2 Uint32 NOT NULL,
2178+
Col3 JsonDocument,
2179+
PRIMARY KEY (Col1)
2180+
)
2181+
PARTITION BY HASH(Col1)
2182+
WITH (STORE = COLUMN, AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = 2);
2183+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=UPSERT_INDEX, NAME=count_min_sketch_index, TYPE=COUNT_MIN_SKETCH,
2184+
FEATURES=`{"column_names" : ['Col2']}`);
2185+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=UPSERT_INDEX, NAME=bloom_ngramm_filter_index, TYPE=BLOOM_NGRAMM_FILTER,
2186+
FEATURES=`{"column_name" : "Col2", "ngramm_size" : 3, "hashes_count" : 2, "filter_size_bytes" : 4096,
2187+
"records_count" : 1024, "case_sensitive" : true, "data_extractor" : {"class_name" : "SUB_COLUMN", "sub_column_name" : "a"}}`);
2188+
ALTER OBJECT `Root/test_show_create` (TYPE TABLE) SET (ACTION=UPSERT_INDEX, NAME=bloom_filter_index, TYPE=BLOOM_FILTER,
2189+
FEATURES=`{"column_name" : "Col2", "false_positive_probability" : 0.01}`);
2190+
ALTER OBJECT `Root/test_show_create` (TYPE TABLE) SET (ACTION=UPSERT_INDEX, NAME=max_index, TYPE=MAX, FEATURES=`{"column_name": "Col2"}`);
2191+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=UPSERT_OPTIONS, `SCAN_READER_POLICY_NAME`=`SIMPLE`);
2192+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=UPSERT_OPTIONS, `COMPACTION_PLANNER.CLASS_NAME`=`lc-buckets`,
2193+
`COMPACTION_PLANNER.FEATURES`=`{"levels" : [{"class_name" : "Zero", "portions_live_duration" : "180s", "expected_blobs_size" : 2048000},
2194+
{"class_name" : "Zero", "expected_blobs_size" : 2048000}, {"class_name" : "Zero"}]}`);
2195+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=UPSERT_OPTIONS, `METADATA_MEMORY_MANAGER.CLASS_NAME`=`local_db`,
2196+
`METADATA_MEMORY_MANAGER.FEATURES`=`{"memory_cache_size" : 0}`);
2197+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=ALTER_COLUMN, NAME=Col3, `FORCE_SIMD_PARSING`=`true`, `DATA_ACCESSOR_CONSTRUCTOR.CLASS_NAME`=`SUB_COLUMNS`, `OTHERS_ALLOWED_FRACTION`=`0.5`);
2198+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=ALTER_COLUMN, NAME=Col3, `ENCODING.DICTIONARY.ENABLED`=`true`);
2199+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=ALTER_COLUMN, NAME=Col2, `DEFAULT_VALUE`=`100`);
2200+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION=ALTER_COLUMN, NAME=Col3, `SERIALIZER.CLASS_NAME`=`ARROW_SERIALIZER`, `COMPRESSION.TYPE`=`lz4`);
2201+
)", "test_show_create",
2202+
R"(CREATE TABLE `test_show_create` (
2203+
`Col1` Uint64 NOT NULL,
2204+
`Col2` Uint32 NOT NULL,
2205+
`Col3` JsonDocument,
2206+
PRIMARY KEY (`Col1`)
2207+
)
2208+
PARTITION BY HASH (`Col1`)
2209+
WITH (
2210+
STORE = COLUMN,
2211+
AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = 2
2212+
);
2213+
2214+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION = ALTER_COLUMN, NAME = Col2, `DEFAULT_VALUE` = `100`);
2215+
2216+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION = ALTER_COLUMN, NAME = Col3, `DATA_ACCESSOR_CONSTRUCTOR.CLASS_NAME` = `SUB_COLUMNS`, `SPARSED_DETECTOR_KFF` = `20`, `COLUMNS_LIMIT` = `1024`, `MEM_LIMIT_CHUNK` = `52428800`, `OTHERS_ALLOWED_FRACTION` = `0.5`, `DATA_EXTRACTOR_CLASS_NAME` = `JSON_SCANNER`, `SCAN_FIRST_LEVEL_ONLY` = `false`, `FORCE_SIMD_PARSING` = `true`, `ENCODING.DICTIONARY.ENABLED` = `true`, `SERIALIZER.CLASS_NAME` = `ARROW_SERIALIZER`, `COMPRESSION.TYPE` = `lz4`);
2217+
2218+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION = UPSERT_INDEX, NAME = max_index, TYPE = MAX, FEATURES = `{"column_name":"Col2"}`);
2219+
2220+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION = UPSERT_INDEX, NAME = count_min_sketch_index, TYPE = COUNT_MIN_SKETCH, FEATURES = `{"column_names":["Col2"]}`);
2221+
2222+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION = UPSERT_INDEX, NAME = bloom_ngramm_filter_index, TYPE = BLOOM_NGRAMM_FILTER, FEATURES = `{"bits_storage_type":"SIMPLE_STRING","records_count":1024,"case_sensitive":true,"ngramm_size":3,"filter_size_bytes":4096,"data_extractor":{"class_name":"SUB_COLUMN","sub_column_name":"a"},"hashes_count":2,"column_name":"Col2"}`);
2223+
2224+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION = UPSERT_INDEX, NAME = bloom_filter_index, TYPE = BLOOM_FILTER, FEATURES = `{"false_positive_probability":0.01,"data_extractor":{"class_name":"DEFAULT"},"bits_storage_type":"SIMPLE_STRING","column_name":"Col2"}`);
2225+
2226+
ALTER OBJECT `/Root/test_show_create` (TYPE TABLE) SET (ACTION = UPSERT_OPTIONS, `SCAN_READER_POLICY_NAME` = 'SIMPLE', `COMPACTION_PLANNER.CLASS_NAME` = 'lc-buckets', `COMPACTION_PLANNER.FEATURES` = `{"levels":[{"portions_live_duration":"180.000000s","class_name":"Zero","expected_blobs_size":2048000},{"class_name":"Zero","expected_blobs_size":2048000},{"class_name":"Zero"}]}`, `METADATA_MEMORY_MANAGER.CLASS_NAME` = 'local_db', `METADATA_MEMORY_MANAGER.FEATURES` = `{"memory_cache_size":0,"fetch_on_start":false}`);
2227+
)"
2228+
);
2229+
}
2230+
20292231
Y_UNIT_TEST(Nodes) {
20302232
TTestEnv env;
20312233
CreateTenantsAndTables(env, false);

0 commit comments

Comments
 (0)