Fix joinGet with nullable return types.

This commit is contained in:
Amos Bird 2020-02-05 21:51:41 +08:00
parent 8c23840cc8
commit 0dee987831
No known key found for this signature in database
GPG Key ID: 80D430DCBECFEDB4
3 changed files with 20 additions and 0 deletions

View File

@ -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; }

View File

@ -0,0 +1 @@
2 2

View File

@ -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;