Merge pull request #36812 from CurtizJ/hash-array-of-tuples

Allow to execute hash functions with arguments of type `Array(Tuple(..))`
This commit is contained in:
Anton Popov 2022-05-06 14:15:38 +02:00 committed by GitHub
commit 0caf91602f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -987,7 +987,8 @@ private:
const size_t nested_size = nested_column->size();
typename ColumnVector<ToType>::Container vec_temp(nested_size);
executeAny<true>(nested_type, nested_column, vec_temp);
bool nested_is_first = true;
executeForArgument(nested_type, nested_column, vec_temp, nested_is_first);
const size_t size = offsets.size();
@ -1058,8 +1059,7 @@ private:
else if (which.isString()) executeString<first>(icolumn, vec_to);
else if (which.isFixedString()) executeString<first>(icolumn, vec_to);
else if (which.isArray()) executeArray<first>(from_type, icolumn, vec_to);
else
executeGeneric<first>(icolumn, vec_to);
else executeGeneric<first>(icolumn, vec_to);
}
void executeForArgument(const IDataType * type, const IColumn * column, typename ColumnVector<ToType>::Container & vec_to, bool & is_first) const

View File

@ -0,0 +1,5 @@
14617701568871014978
12913842429399915005
8351543757058688770
12732328028874882204
12371801021764949421 Array(Tuple(UInt8, Array(Tuple(UInt8, Tuple(UInt8, UInt8, Array(Tuple(UInt8, UInt8)))))))

View File

@ -0,0 +1,6 @@
SELECT cityHash64([(1, 'a'), (2, 'b')]);
SELECT cityHash64([(1, 'c'), (2, 'b')]);
SELECT sipHash64([(1, 'a'), (2, 'b')]);
SELECT murmurHash2_64([(1, 'a'), (2, 'b'), (3, 'c')]);
SELECT cityHash64([(1, [(1, (3, 4, [(5, 6), (7, 8)]))]), (2, [])] AS c), toTypeName(c);