Default value for optional in SortNode::updateTreeHashImpl

This commit is contained in:
vdimir 2022-12-21 15:02:00 +00:00
parent 09ab5832b1
commit 3b483e513f
No known key found for this signature in database
GPG Key ID: 6EE4CE2BEDC51862
3 changed files with 11 additions and 1 deletions

View File

@ -91,7 +91,8 @@ bool SortNode::isEqualImpl(const IQueryTreeNode & rhs) const
void SortNode::updateTreeHashImpl(HashState & hash_state) const
{
hash_state.update(sort_direction);
hash_state.update(nulls_sort_direction);
/// use some determined value if `nulls_sort_direction` is `nullopt`
hash_state.update(nulls_sort_direction.value_or(sort_direction));
hash_state.update(with_fill);
if (collator)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,8 @@
DROP TABLE IF EXISTS products;
SET allow_experimental_analyzer = 1;
CREATE TABLE products (`price` UInt32) ENGINE = Memory;
INSERT INTO products VALUES (1);
SELECT rank() OVER (ORDER BY price) AS rank FROM products ORDER BY rank;