From dda251020898561e12d7a1fab20b7a7daa623628 Mon Sep 17 00:00:00 2001 From: Artem Zuikov Date: Tue, 14 Jul 2020 12:34:47 +0300 Subject: [PATCH] Try enable multiple_joins_rewriter_version v2 by default (#12469) --- src/Core/Settings.h | 2 +- .../01392_column_resolve.reference | 3 ++ .../0_stateless/01392_column_resolve.sql | 33 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 tests/queries/0_stateless/01392_column_resolve.reference create mode 100644 tests/queries/0_stateless/01392_column_resolve.sql diff --git a/src/Core/Settings.h b/src/Core/Settings.h index 5e10e6308b9..21650b0c6fa 100644 --- a/src/Core/Settings.h +++ b/src/Core/Settings.h @@ -377,7 +377,7 @@ struct Settings : public SettingsCollection \ 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) \ diff --git a/tests/queries/0_stateless/01392_column_resolve.reference b/tests/queries/0_stateless/01392_column_resolve.reference new file mode 100644 index 00000000000..26d66bc0853 --- /dev/null +++ b/tests/queries/0_stateless/01392_column_resolve.reference @@ -0,0 +1,3 @@ +Conversion 1 Click 1 14 +Conversion 1 Click 2 15 +Conversion 1 Click 3 16 diff --git a/tests/queries/0_stateless/01392_column_resolve.sql b/tests/queries/0_stateless/01392_column_resolve.sql new file mode 100644 index 00000000000..93d84359e1f --- /dev/null +++ b/tests/queries/0_stateless/01392_column_resolve.sql @@ -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;