Try enable multiple_joins_rewriter_version v2 by default (#12469)

This commit is contained in:
Artem Zuikov 2020-07-14 12:34:47 +03:00 committed by GitHub
parent 07b9bf8a30
commit dda2510208
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 1 deletions

View File

@ -377,7 +377,7 @@ struct Settings : public SettingsCollection<Settings>
\
M(SettingBool, deduplicate_blocks_in_dependent_materialized_views, false, "Should deduplicate blocks for materialized views if the block is not a duplicate for the table. Use true to always deduplicate in dependent tables.", 0) \
M(SettingBool, use_compact_format_in_distributed_parts_names, false, "Changes format of directories names for distributed table insert parts.", 0) \
M(SettingUInt64, multiple_joins_rewriter_version, 1, "1 or 2. Second rewriter version knows about table columns and keep not clashed names as is.", 0) \
M(SettingUInt64, multiple_joins_rewriter_version, 2, "1 or 2. Second rewriter version knows about table columns and keep not clashed names as is.", 0) \
M(SettingBool, validate_polygons, true, "Throw exception if polygon is invalid in function pointInPolygon (e.g. self-tangent, self-intersecting). If the setting is false, the function will accept invalid polygons but may silently return wrong result.", 0) \
M(SettingUInt64, max_parser_depth, DBMS_DEFAULT_MAX_PARSER_DEPTH, "Maximum parser depth (recursion depth of recursive descend parser).", 0) \
M(SettingSeconds, temporary_live_view_timeout, DEFAULT_TEMPORARY_LIVE_VIEW_TIMEOUT_SEC, "Timeout after which temporary live view is deleted.", 0) \

View File

@ -0,0 +1,3 @@
Conversion 1 Click 1 14
Conversion 1 Click 2 15
Conversion 1 Click 3 16

View File

@ -0,0 +1,33 @@
DROP TABLE IF EXISTS tableConversion;
DROP TABLE IF EXISTS tableClick;
DROP TABLE IF EXISTS leftjoin;
CREATE TABLE default.tableConversion (conversionId String, value Nullable(Double)) ENGINE = Log();
CREATE TABLE default.tableClick (clickId String, conversionId String, value Nullable(Double)) ENGINE = Log();
CREATE TABLE default.leftjoin (id String) ENGINE = Log();
INSERT INTO default.tableConversion(conversionId, value) VALUES ('Conversion 1', 1);
INSERT INTO default.tableClick(clickId, conversionId, value) VALUES ('Click 1', 'Conversion 1', 14);
INSERT INTO default.tableClick(clickId, conversionId, value) VALUES ('Click 2', 'Conversion 1', 15);
INSERT INTO default.tableClick(clickId, conversionId, value) VALUES ('Click 3', 'Conversion 1', 16);
SELECT
conversion.conversionId AS myConversionId,
click.clickId AS myClickId,
click.myValue AS myValue
FROM (
SELECT conversionId, value as myValue
FROM default.tableConversion
) AS conversion
INNER JOIN (
SELECT clickId, conversionId, value as myValue
FROM default.tableClick
) AS click ON click.conversionId = conversion.conversionId
LEFT JOIN (
SELECT * FROM default.leftjoin
) AS dummy ON (dummy.id = conversion.conversionId)
ORDER BY myValue;
DROP TABLE IF EXISTS tableConversion;
DROP TABLE IF EXISTS tableClick;
DROP TABLE IF EXISTS leftjoin;