Fix SIGSEGV for arrayCompact() with consts

arrayCompact() implements useDefaultImplementationForConstants() but it
is a no-op for FunctionArrayMapped, fix this.

CI report [1]:

  [1]: https://clickhouse-test-reports.s3.yandex.net/28890/baac2e561cfb05bc174f0bd25571e607d19c7463/fuzzer_asan/report.html#fail1
This commit is contained in:
Azat Khuzhin 2021-09-11 22:28:46 +03:00
parent 648d561242
commit 3c75844a79
3 changed files with 5 additions and 1 deletions

View File

@ -16,7 +16,6 @@ namespace ErrorCodes
struct ArrayCompactImpl
{
static bool useDefaultImplementationForConstants() { return true; }
static bool needBoolean() { return false; }
static bool needExpression() { return false; }
static bool needOneArray() { return false; }
@ -129,6 +128,7 @@ struct ArrayCompactImpl
{
ColumnPtr res;
mapped = mapped->convertToFullColumnIfConst();
if (!(executeType< UInt8 >(mapped, array, res) ||
executeType< UInt16>(mapped, array, res) ||
executeType< UInt32>(mapped, array, res) ||

View File

@ -7,3 +7,5 @@
[1,2,1]
[2,1]
[1,2,3,4,5]
[0]
[0]

View File

@ -7,3 +7,5 @@ select arrayCompact([1,1,2]);
select arrayCompact([1,2,1]);
select arrayCompact([2,1,1]);
select arrayCompact([1,2,2,3,3,3,4,4,4,4,5,5,5,5,5]);
SELECT arrayCompact(x->0, [NULL]);
SELECT toString(arrayCompact(x->0, [NULL]));