Merge pull request #28904 from azat/higher-order-array-func-consts-fix

Fix higher-order array functions (arrayCompact/arrayDifference/arrayCumSumNonNegative) with consts
This commit is contained in:
alexey-milovidov 2021-09-12 09:04:47 +03:00 committed by GitHub
commit 294f4c897b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 11 additions and 3 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

@ -19,7 +19,6 @@ namespace ErrorCodes
*/
struct ArrayCumSumNonNegativeImpl
{
static bool useDefaultImplementationForConstants() { return true; }
static bool needBoolean() { return false; }
static bool needExpression() { return false; }
static bool needOneArray() { return false; }
@ -100,6 +99,7 @@ struct ArrayCumSumNonNegativeImpl
{
ColumnPtr res;
mapped = mapped->convertToFullColumnIfConst();
if (executeType< UInt8 , UInt64>(mapped, array, res) ||
executeType< UInt16, UInt64>(mapped, array, res) ||
executeType< UInt32, UInt64>(mapped, array, res) ||

View File

@ -20,7 +20,6 @@ namespace ErrorCodes
*/
struct ArrayDifferenceImpl
{
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 ArrayDifferenceImpl
{
ColumnPtr res;
mapped = mapped->convertToFullColumnIfConst();
if (executeType< UInt8 , Int16>(mapped, array, res) ||
executeType< UInt16, Int32>(mapped, array, res) ||
executeType< UInt32, Int64>(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]));

View File

@ -0,0 +1 @@
[0,0]

View File

@ -0,0 +1 @@
SELECT toString(arrayDifference(x->0, [1, 2]));

View File

@ -0,0 +1 @@
SELECT toString(arrayCumSumNonNegative(x->0, [1, 2]));