Fix: DISTINCT in order with zero values in non-sorted columns

This commit is contained in:
Igor Nikonov 2023-05-07 21:09:03 +00:00
parent df8c930be3
commit 68fcc39292
3 changed files with 23 additions and 0 deletions

View File

@ -88,6 +88,9 @@ public:
{
++this->version;
this->m_size = 0;
/// clear ZeroValueStorage
this->clearHasZero();
}
};
@ -108,6 +111,9 @@ public:
{
++this->version;
this->m_size = 0;
/// clear ZeroValueStorage
this->clearHasZero();
}
};

View File

@ -0,0 +1,15 @@
set optimize_distinct_in_order=1;
DROP TABLE IF EXISTS test;
CREATE TABLE test
(
`c1` String,
`c2` String
)
ENGINE = MergeTree
ORDER BY c1;
INSERT INTO test(c1, c2) VALUES ('1', ''), ('2', '');
SELECT DISTINCT c2, c1 FROM test FORMAT TSV;