Skip to content

Commit f252052

Browse files
committed
Mark Hybrid experimental
Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com>
1 parent 9f13d3f commit f252052

7 files changed

Lines changed: 31 additions & 3 deletions

File tree

docs/en/engines/table-engines/special/hybrid.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ Typical use cases include:
2222

2323
By giving mutually exclusive predicates to the segments (for example, `date < watermark` and `date >= watermark`), you ensure that each row is read from exactly one source.
2424

25+
## Enable the engine
26+
27+
The Hybrid engine is experimental. Enable it per session (or in the user profile) before creating tables:
28+
29+
```sql
30+
SET allow_experimental_hybrid_table = 1;
31+
```
32+
2533
## Engine definition
2634

2735
```sql

src/Core/Settings.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7337,6 +7337,9 @@ Enable experimental hash functions
73377337
Allows creation of tables with the [TimeSeries](../../engines/table-engines/integrations/time-series.md) table engine. Possible values:
73387338
- 0 — the [TimeSeries](../../engines/table-engines/integrations/time-series.md) table engine is disabled.
73397339
- 1 — the [TimeSeries](../../engines/table-engines/integrations/time-series.md) table engine is enabled.
7340+
)", EXPERIMENTAL) \
7341+
DECLARE(Bool, allow_experimental_hybrid_table, false, R"(
7342+
Allows creation of tables with the [Hybrid](../../engines/table-engines/special/hybrid.md) table engine.
73407343
)", EXPERIMENTAL) \
73417344
DECLARE(Bool, allow_experimental_codecs, false, R"(
73427345
If it is set to true, allow to specify experimental compression codecs (but we don't have those yet and this option does nothing).

src/Core/SettingsChangesHistory.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ const VersionToSettingsChangesMap & getSettingsChangesHistory()
275275
{"allow_experimental_ytsaurus_table_engine", false, false, "New setting."},
276276
{"allow_experimental_ytsaurus_table_function", false, false, "New setting."},
277277
{"allow_experimental_ytsaurus_dictionary_source", false, false, "New setting."},
278+
{"allow_experimental_hybrid_table", false, false, "Added new setting to allow the Hybrid table engine."},
278279
{"per_part_index_stats", false, false, "New setting."},
279280
{"allow_experimental_iceberg_compaction", 0, 0, "New setting"},
280281
{"delta_lake_snapshot_version", -1, -1, "New setting"},

src/Databases/enableAllExperimentalSettings.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ void enableAllExperimentalSettings(ContextMutablePtr context)
5656
context->setSetting("allow_experimental_ytsaurus_table_engine", 1);
5757
context->setSetting("allow_experimental_ytsaurus_dictionary_source", 1);
5858
context->setSetting("allow_experimental_time_series_aggregate_functions", 1);
59+
context->setSetting("allow_experimental_hybrid_table", 1);
5960
context->setSetting("allow_experimental_lightweight_update", 1);
6061
context->setSetting("allow_experimental_insert_into_iceberg", 1);
6162
context->setSetting("allow_experimental_iceberg_compaction", 1);

src/Storages/StorageDistributed.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ namespace Setting
201201
extern const SettingsUInt64 allow_experimental_parallel_reading_from_replicas;
202202
extern const SettingsBool prefer_global_in_and_join;
203203
extern const SettingsBool enable_global_with_statement;
204+
extern const SettingsBool allow_experimental_hybrid_table;
204205
}
205206

206207
namespace DistributedSetting
@@ -234,6 +235,7 @@ namespace ErrorCodes
234235
extern const int DISTRIBUTED_TOO_MANY_PENDING_BYTES;
235236
extern const int ARGUMENT_OUT_OF_BOUND;
236237
extern const int TOO_LARGE_DISTRIBUTED_DEPTH;
238+
extern const int SUPPORT_IS_DISABLED;
237239
}
238240

239241
namespace ActionLocks
@@ -2258,8 +2260,6 @@ void registerStorageDistributed(StorageFactory & factory)
22582260

22592261
void registerStorageHybrid(StorageFactory & factory)
22602262
{
2261-
// Register Hybrid engine
2262-
// TODO: consider moving it to a separate file / subclass of StorageDistributed
22632263
factory.registerStorage("Hybrid", [](const StorageFactory::Arguments & args) -> StoragePtr
22642264
{
22652265
ASTs & engine_args = args.engine_args;
@@ -2273,6 +2273,13 @@ void registerStorageHybrid(StorageFactory & factory)
22732273
if (!local_context)
22742274
local_context = global_context;
22752275

2276+
if (args.mode <= LoadingStrictnessLevel::CREATE
2277+
&& !local_context->getSettingsRef()[Setting::allow_experimental_hybrid_table])
2278+
{
2279+
throw Exception(ErrorCodes::SUPPORT_IS_DISABLED,
2280+
"Experimental Hybrid table engine is not enabled (the setting 'allow_experimental_hybrid_table')");
2281+
}
2282+
22762283
// Validate first argument - must be a table function
22772284
ASTPtr first_arg = engine_args[0];
22782285
if (const auto * func = first_arg->as<ASTFunction>())

tests/queries/0_stateless/03642_hybrid.sql

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
-- Test Hybrid engine registration and basic validation
1+
SELECT 'Hybrid creation requires allow_experimental_hybrid_table';
2+
SET allow_experimental_hybrid_table = 0;
3+
CREATE TABLE test_hybrid_requires_setting (`dummy` UInt8) ENGINE = Hybrid(remote('localhost:9000'), 1); -- { serverError SUPPORT_IS_DISABLED }
4+
DROP TABLE IF EXISTS test_hybrid_requires_setting SYNC;
5+
6+
SET allow_experimental_hybrid_table = 1;
7+
28
SELECT 'Check Hybrid engine is registered';
39
SELECT name FROM system.table_engines WHERE name = 'Hybrid';
410

tests/queries/0_stateless/04182_hybrid_unqualified_table.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
SET allow_experimental_hybrid_table = 1;
2+
13
SELECT 'Hybrid allows unqualified local tables by default';
24

35
DROP TABLE IF EXISTS test_hybrid_unqualified_segment SYNC;

0 commit comments

Comments
 (0)