diff --git a/dbms/src/Functions/FunctionJoinGet.h b/dbms/src/Functions/FunctionJoinGet.h index 375f2060fa5..8bc1f0d1fcb 100644 --- a/dbms/src/Functions/FunctionJoinGet.h +++ b/dbms/src/Functions/FunctionJoinGet.h @@ -17,6 +17,10 @@ public: static constexpr auto name = "joinGet"; + bool useDefaultImplementationForNulls() const override { return false; } + bool useDefaultImplementationForConstants() const override { return true; } + bool useDefaultImplementationForLowCardinalityColumns() const override { return true; } + void execute(Block & block, const ColumnNumbers & arguments, size_t result, size_t input_rows_count) override; String getName() const override { return name; } @@ -72,6 +76,9 @@ public: FunctionBaseImplPtr build(const ColumnsWithTypeAndName & arguments, const DataTypePtr &) const override; DataTypePtr getReturnType(const ColumnsWithTypeAndName & arguments) const override; + bool useDefaultImplementationForNulls() const override { return false; } + bool useDefaultImplementationForLowCardinalityColumns() const override { return true; } + bool isVariadic() const override { return true; } size_t getNumberOfArguments() const override { return 0; } diff --git a/dbms/tests/queries/0_stateless/01080_join_get_null.reference b/dbms/tests/queries/0_stateless/01080_join_get_null.reference new file mode 100644 index 00000000000..bfde072a796 --- /dev/null +++ b/dbms/tests/queries/0_stateless/01080_join_get_null.reference @@ -0,0 +1 @@ +2 2 diff --git a/dbms/tests/queries/0_stateless/01080_join_get_null.sql b/dbms/tests/queries/0_stateless/01080_join_get_null.sql new file mode 100644 index 00000000000..71e7ddf8e75 --- /dev/null +++ b/dbms/tests/queries/0_stateless/01080_join_get_null.sql @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS test_joinGet; +DROP TABLE IF EXISTS test_join_joinGet; + +CREATE TABLE test_joinGet(id Int32, user_id Nullable(Int32)) Engine = Memory(); +CREATE TABLE test_join_joinGet(user_id Int32, name String) Engine = Join(ANY, LEFT, user_id); + +INSERT INTO test_join_joinGet VALUES (2, 'a'), (6, 'b'), (10, 'c'); + +SELECT 2 id, toNullable(toInt32(2)) user_id WHERE joinGet(test_join_joinGet, 'name', user_id) != ''; + +DROP TABLE test_joinGet; +DROP TABLE test_join_joinGet;