facebookincubator / velox

A C++ vectorized database acceleration library aimed to optimizing query engines and data processing systems.
https://velox-lib.io/
Apache License 2.0
3.42k stars 1.12k forks source link

Aggregate Fuzzer Bug : Different error messages for ApproxPercentileAggregate #3369

Open kgpai opened 1 year ago

kgpai commented 1 year ago

Bug description

See logs for bug information. AggregationFuzzer fails because of 2 different types of errors reported. Link to logs : https://app.circleci.com/pipelines/github/facebookincubator/velox/16928/workflows/7bb4cee1-d4d4-4822-8236-0ee4bb1d7f03/jobs/105478/steps

System information

Generated by CI.

Relevant logs

I1126 03:37:47.496503  7341 AggregationFuzzer.cpp:541] ==============================> Done with iteration 2091
I1126 03:37:47.496537  7341 AggregationFuzzer.cpp:481] ==============================> Started iteration 2092 (seed: 2275077291)
I1126 03:37:47.501103  7341 AggregationFuzzer.cpp:561] Executing query plan: 
-- Aggregation[SINGLE [g0, g1, g2, g3] a0 := approx_percentile(ROW["c0"],ROW["c1"],ROW["c2"])] -> g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE, a0:ARRAY<DOUBLE>
  -- Values[1000 rows in 10 vectors] -> c0:DOUBLE, c1:BIGINT, c2:ARRAY<DOUBLE>, g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE
E1126 03:37:47.502164 157401 Exceptions.h:68] Line: ../../velox/functions/prestosql/aggregates/ApproxPercentileAggregate.cpp:488, Function:checkSetPercentile, Expression: len > 0 (0 vs. 0) Percentile cannot be empty, Source: USER, ErrorCode: INVALID_ARGUMENT
I1126 03:37:47.522941  7341 AggregationFuzzer.cpp:170] Testing plan #0
I1126 03:37:47.522966  7341 AggregationFuzzer.cpp:561] Executing query plan: 
-- Aggregation[FINAL [g0, g1, g2, g3] a0 := approx_percentile("a0")] -> g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE, a0:ARRAY<DOUBLE>
  -- Aggregation[PARTIAL [g0, g1, g2, g3] a0 := approx_percentile(ROW["c0"],ROW["c1"],ROW["c2"])] -> g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE, a0:ROW<"":ARRAY<DOUBLE>,"":BOOLEAN,"":DOUBLE,"":INTEGER,"":BIGINT,"":DOUBLE,"":DOUBLE,"":ARRAY<DOUBLE>,"":ARRAY<INTEGER>>
    -- Values[1000 rows in 10 vectors] -> c0:DOUBLE, c1:BIGINT, c2:ARRAY<DOUBLE>, g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE
E1126 03:37:47.524264 157402 Exceptions.h:68] Line: ../../velox/functions/prestosql/aggregates/ApproxPercentileAggregate.cpp:488, Function:checkSetPercentile, Expression: len > 0 (0 vs. 0) Percentile cannot be empty, Source: USER, ErrorCode: INVALID_ARGUMENT
I1126 03:37:47.524616  7341 AggregationFuzzer.cpp:173] Testing plan #0 with spilling
I1126 03:37:47.524631  7341 AggregationFuzzer.cpp:561] Executing query plan: 
-- Aggregation[FINAL [g0, g1, g2, g3] a0 := approx_percentile("a0")] -> g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE, a0:ARRAY<DOUBLE>
  -- Aggregation[PARTIAL [g0, g1, g2, g3] a0 := approx_percentile(ROW["c0"],ROW["c1"],ROW["c2"])] -> g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE, a0:ROW<"":ARRAY<DOUBLE>,"":BOOLEAN,"":DOUBLE,"":INTEGER,"":BIGINT,"":DOUBLE,"":DOUBLE,"":ARRAY<DOUBLE>,"":ARRAY<INTEGER>>
    -- Values[1000 rows in 10 vectors] -> c0:DOUBLE, c1:BIGINT, c2:ARRAY<DOUBLE>, g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE
E1126 03:37:47.526010 157403 Exceptions.h:68] Line: ../../velox/functions/prestosql/aggregates/ApproxPercentileAggregate.cpp:488, Function:checkSetPercentile, Expression: len > 0 (0 vs. 0) Percentile cannot be empty, Source: USER, ErrorCode: INVALID_ARGUMENT
I1126 03:37:47.526428  7341 AggregationFuzzer.cpp:170] Testing plan #1
I1126 03:37:47.526444  7341 AggregationFuzzer.cpp:561] Executing query plan: 
-- Aggregation[FINAL [g0, g1, g2, g3] a0 := approx_percentile("a0")] -> g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE, a0:ARRAY<DOUBLE>
  -- Aggregation[INTERMEDIATE [g0, g1, g2, g3] a0 := approx_percentile("a0")] -> g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE, a0:ROW<"":ARRAY<DOUBLE>,"":BOOLEAN,"":DOUBLE,"":INTEGER,"":BIGINT,"":DOUBLE,"":DOUBLE,"":ARRAY<DOUBLE>,"":ARRAY<INTEGER>>
    -- Aggregation[PARTIAL [g0, g1, g2, g3] a0 := approx_percentile(ROW["c0"],ROW["c1"],ROW["c2"])] -> g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE, a0:ROW<"":ARRAY<DOUBLE>,"":BOOLEAN,"":DOUBLE,"":INTEGER,"":BIGINT,"":DOUBLE,"":DOUBLE,"":ARRAY<DOUBLE>,"":ARRAY<INTEGER>>
      -- Values[1000 rows in 10 vectors] -> c0:DOUBLE, c1:BIGINT, c2:ARRAY<DOUBLE>, g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE
E1126 03:37:47.527714 157404 Exceptions.h:68] Line: ../../velox/functions/prestosql/aggregates/ApproxPercentileAggregate.cpp:488, Function:checkSetPercentile, Expression: len > 0 (0 vs. 0) Percentile cannot be empty, Source: USER, ErrorCode: INVALID_ARGUMENT
I1126 03:37:47.528033  7341 AggregationFuzzer.cpp:173] Testing plan #1 with spilling
I1126 03:37:47.528049  7341 AggregationFuzzer.cpp:561] Executing query plan: 
-- Aggregation[FINAL [g0, g1, g2, g3] a0 := approx_percentile("a0")] -> g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE, a0:ARRAY<DOUBLE>
  -- Aggregation[INTERMEDIATE [g0, g1, g2, g3] a0 := approx_percentile("a0")] -> g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE, a0:ROW<"":ARRAY<DOUBLE>,"":BOOLEAN,"":DOUBLE,"":INTEGER,"":BIGINT,"":DOUBLE,"":DOUBLE,"":ARRAY<DOUBLE>,"":ARRAY<INTEGER>>
    -- Aggregation[PARTIAL [g0, g1, g2, g3] a0 := approx_percentile(ROW["c0"],ROW["c1"],ROW["c2"])] -> g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE, a0:ROW<"":ARRAY<DOUBLE>,"":BOOLEAN,"":DOUBLE,"":INTEGER,"":BIGINT,"":DOUBLE,"":DOUBLE,"":ARRAY<DOUBLE>,"":ARRAY<INTEGER>>
      -- Values[1000 rows in 10 vectors] -> c0:DOUBLE, c1:BIGINT, c2:ARRAY<DOUBLE>, g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE
E1126 03:37:47.529397 157405 Exceptions.h:68] Line: ../../velox/functions/prestosql/aggregates/ApproxPercentileAggregate.cpp:488, Function:checkSetPercentile, Expression: len > 0 (0 vs. 0) Percentile cannot be empty, Source: USER, ErrorCode: INVALID_ARGUMENT
I1126 03:37:47.529760  7341 AggregationFuzzer.cpp:170] Testing plan #2
I1126 03:37:47.529773  7341 AggregationFuzzer.cpp:561] Executing query plan: 
-- Aggregation[FINAL [g0, g1, g2, g3] a0 := approx_percentile("a0")] -> g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE, a0:ARRAY<DOUBLE>
  -- LocalPartition[REPARTITION] -> g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE, a0:ROW<"":ARRAY<DOUBLE>,"":BOOLEAN,"":DOUBLE,"":INTEGER,"":BIGINT,"":DOUBLE,"":DOUBLE,"":ARRAY<DOUBLE>,"":ARRAY<INTEGER>>
    -- Aggregation[PARTIAL [g0, g1, g2, g3] a0 := approx_percentile(ROW["c0"],ROW["c1"],ROW["c2"])] -> g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE, a0:ROW<"":ARRAY<DOUBLE>,"":BOOLEAN,"":DOUBLE,"":INTEGER,"":BIGINT,"":DOUBLE,"":DOUBLE,"":ARRAY<DOUBLE>,"":ARRAY<INTEGER>>
      -- Values[300 rows in 3 vectors] -> c0:DOUBLE, c1:BIGINT, c2:ARRAY<DOUBLE>, g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE
    -- Aggregation[PARTIAL [g0, g1, g2, g3] a0 := approx_percentile(ROW["c0"],ROW["c1"],ROW["c2"])] -> g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE, a0:ROW<"":ARRAY<DOUBLE>,"":BOOLEAN,"":DOUBLE,"":INTEGER,"":BIGINT,"":DOUBLE,"":DOUBLE,"":ARRAY<DOUBLE>,"":ARRAY<INTEGER>>
      -- Values[300 rows in 3 vectors] -> c0:DOUBLE, c1:BIGINT, c2:ARRAY<DOUBLE>, g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE
    -- Aggregation[PARTIAL [g0, g1, g2, g3] a0 := approx_percentile(ROW["c0"],ROW["c1"],ROW["c2"])] -> g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE, a0:ROW<"":ARRAY<DOUBLE>,"":BOOLEAN,"":DOUBLE,"":INTEGER,"":BIGINT,"":DOUBLE,"":DOUBLE,"":ARRAY<DOUBLE>,"":ARRAY<INTEGER>>
      -- Values[200 rows in 2 vectors] -> c0:DOUBLE, c1:BIGINT, c2:ARRAY<DOUBLE>, g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE
    -- Aggregation[PARTIAL [g0, g1, g2, g3] a0 := approx_percentile(ROW["c0"],ROW["c1"],ROW["c2"])] -> g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE, a0:ROW<"":ARRAY<DOUBLE>,"":BOOLEAN,"":DOUBLE,"":INTEGER,"":BIGINT,"":DOUBLE,"":DOUBLE,"":ARRAY<DOUBLE>,"":ARRAY<INTEGER>>
      -- Values[200 rows in 2 vectors] -> c0:DOUBLE, c1:BIGINT, c2:ARRAY<DOUBLE>, g0:SMALLINT, g1:DOUBLE, g2:INTEGER, g3:DOUBLE
E1126 03:37:47.532706 157408 Exceptions.h:68] Line: ../../velox/functions/prestosql/aggregates/ApproxPercentileAggregate.cpp:488, Function:checkSetPercentile, Expression: len > 0 (0 vs. 0) Percentile cannot be empty, Source: USER, ErrorCode: INVALID_ARGUMENT
E1126 03:37:47.532716 157409 Exceptions.h:68] Line: ../../velox/functions/prestosql/aggregates/ApproxPercentileAggregate.cpp:457, Function:checkSetPercentile, Expression: decoded.isConstantMapping() Percentile argument must be constant for all input rows, Source: USER, ErrorCode: INVALID_ARGUMENT
E1126 03:37:47.532745 157411 Exceptions.h:68] Line: ../../velox/functions/prestosql/aggregates/ApproxPercentileAggregate.cpp:457, Function:checkSetPercentile, Expression: decoded.isConstantMapping() Percentile argument must be constant for all input rows, Source: USER, ErrorCode: INVALID_ARGUMENT
E1126 03:37:47.532766 157410 Exceptions.h:68] Line: ../../velox/functions/prestosql/aggregates/ApproxPercentileAggregate.cpp:457, Function:checkSetPercentile, Expression: decoded.isConstantMapping() Percentile argument must be constant for all input rows, Source: USER, ErrorCode: INVALID_ARGUMENT
W1126 03:37:47.533154  7341 FuzzerToolkit.cpp:112] Two different VeloxExceptions were thrown:
    (0 vs. 0) Percentile cannot be empty
and
    Percentile argument must be constant for all input rows
Yuhta commented 1 year ago

This is not a bug in function because we require constant encoding for the parameter. Will be fixed in fuzzer side once #3159 is finished.

In the meantime we can skip them again if it becomes too noisy.

kgpai commented 1 year ago

@Yuhta Yes its not a bug in function, but a bug in fuzzer as mentioned in the bug description :) , because 2 different errors are reported.