Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid RowConverter for multi group by #12269

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jayzhan211
Copy link
Contributor

@jayzhan211 jayzhan211 commented Aug 31, 2024

Which issue does this PR close?

Closes #.

Rationale for this change

To avoid Row converter in multi group by clause, we add equality check for group values Array.

We can see a improvement on group by query (much more for string types). The downside is that this is type-specific design unlike Rows that covers all the types

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

Benchmark

Query after 37 is removed since DateTime is not supported

┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃       main ┃  row-group ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 0     │     0.40ms │     0.48ms │  1.19x slower │
│ QQuery 1     │    43.92ms │    46.27ms │  1.05x slower │
│ QQuery 2     │    76.59ms │    76.90ms │     no change │
│ QQuery 3     │    63.93ms │    67.31ms │  1.05x slower │
│ QQuery 4     │   447.49ms │   426.92ms │     no change │
│ QQuery 5     │   704.75ms │   680.61ms │     no change │
│ QQuery 6     │    36.18ms │    35.58ms │     no change │
│ QQuery 7     │    37.50ms │    36.56ms │     no change │
│ QQuery 8     │   687.91ms │   599.47ms │ +1.15x faster │
│ QQuery 9     │   654.23ms │   615.37ms │ +1.06x faster │
│ QQuery 10    │   204.86ms │   175.98ms │ +1.16x faster │
│ QQuery 11    │   237.91ms │   195.13ms │ +1.22x faster │
│ QQuery 12    │   758.26ms │   695.74ms │ +1.09x faster │
│ QQuery 13    │  1011.35ms │   885.85ms │ +1.14x faster │
│ QQuery 14    │   980.44ms │   883.32ms │ +1.11x faster │
│ QQuery 15    │   544.60ms │   468.27ms │ +1.16x faster │
│ QQuery 16    │  1751.52ms │  1318.86ms │ +1.33x faster │
│ QQuery 17    │  1530.76ms │  1311.78ms │ +1.17x faster │
│ QQuery 18    │  3702.09ms │  4322.81ms │  1.17x slower │
│ QQuery 19    │    53.09ms │    52.30ms │     no change │
│ QQuery 20    │  1535.97ms │  1475.38ms │     no change │
│ QQuery 21    │  1830.57ms │  1747.03ms │     no change │
│ QQuery 22    │  4105.92ms │  3851.14ms │ +1.07x faster │
│ QQuery 23    │  8317.37ms │  8089.16ms │     no change │
│ QQuery 24    │   498.14ms │   479.31ms │     no change │
│ QQuery 25    │   506.65ms │   491.19ms │     no change │
│ QQuery 26    │   571.42ms │   544.09ms │     no change │
│ QQuery 27    │  1323.25ms │  1325.59ms │     no change │
│ QQuery 28    │ 10284.17ms │ 10243.26ms │     no change │
│ QQuery 29    │   404.45ms │   441.24ms │  1.09x slower │
│ QQuery 30    │   837.55ms │   847.60ms │     no change │
│ QQuery 31    │   829.55ms │   779.72ms │ +1.06x faster │
│ QQuery 32    │  4698.41ms │  3555.64ms │ +1.32x faster │
│ QQuery 33    │  4180.51ms │  4229.86ms │     no change │
│ QQuery 34    │  4055.17ms │  3981.71ms │     no change │
│ QQuery 35    │  1015.82ms │  1195.95ms │  1.18x slower │
│ QQuery 36    │   143.36ms │   154.85ms │  1.08x slower │
│ QQuery 37    │    99.73ms │   105.03ms │  1.05x slower │
└──────────────┴────────────┴────────────┴───────────────┘

@github-actions github-actions bot added physical-expr Physical Expressions sqllogictest SQL Logic Tests (.slt) labels Aug 31, 2024
@jayzhan211
Copy link
Contributor Author

jayzhan211 commented Sep 2, 2024

@alamb The approach in this PR is to replace RowConverter and check the equality of the group by values by accessing the certain row and iterate all the group by expressions. The downside is that we need to have type-specific implementation but we could see it outperform Rows by eliminating the cost of Rows append and push. Also, this doesn't make sense to upstream to Arrow for me, it is group by specific implementation, so we need to maintain this in Datafusion. Would like an early feedback on this approach!

I'm thinking of support only primitive, string, datetime those non-nested type. For other less common nested types maybe we just fallback to Rows.

}

impl<T: ArrowPrimitiveType> ArrayEq for PrimitiveGroupValueBuilder<T> {
fn equal_to(&self, lhs_row: usize, array: &ArrayRef, rhs_row: usize) -> bool {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

equal_to and append_val are two core functions.

equal_to is to compare the incoming row with the row in group value builder
append_val is to add row into group value builder

@alamb
Copy link
Contributor

alamb commented Sep 2, 2024

Thanks @jayzhan211 -- I will try and review this over the next day or two

(I am catching up from being out last week and I am not back full time until this Thursday)

}

for (i, group_val) in group_values_v2.iter().enumerate() {
if !compare_equal(group_val.as_ref(), *group_idx, &cols[i], row) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is called in a loop, this can be optimized/specialized for certain cases like: do the arrays have any nulls or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get it how could I further optimize the loop based on nulls 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea would be change compare_equal to take advantage of cases when, for example, it was known the values couldn't be null (so checking Option isn't needed)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, indeed 👍

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TLDR is I think this is a really neat idea @jayzhan211 -- in essence it seems to me this PR basically changes from Row comparison to Column by column comparison.

The theory with using RowCoverter at first I believe is that:

  1. It handled all possible types and combinations
  2. The theory was that time spent creating the Row would be paid back by faster comparisons by avoiding dynamic dispatch.

Your benchmark numbers seem to show different results 👌

I thought about how the performance could be so good and I suppose it does make sense because for most aggregate queries, many of the rows will go into an existing group -- so the cost of copying the input, just to find it isn't needed is outweighted

Also, this doesn't make sense to upstream to Arrow for me, it is group by specific implementation, so we need to maintain this in Datafusion. Would like an early feedback on this approach!

I looked at this and I think we could potentially reuse a lot of what is upstream in arrow-rs 's builders. I left comments

I am running the clickbench benchmarks to see if I can confirm the results. If so, I suggest we try and reuse the builders from arrow-rs as much as possible and see how elegant we can make this PR.

But all in all, really nicely done 👏

let mut group_values_v2 = self
.group_values_v2
.take()
.expect("Can not emit from empty rows");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a neat optimization as well -- as it saves a copy of the intermediate group values 👍

// }
// }

pub struct ByteGroupValueBuilderNaive<O>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to my comment above, this looks very similar to the GenericBinaryBuilder in arrow -- it would be great if we could simply reuse that instead of a significant amount of copying 🤔

fn build(self: Box<Self>) -> ArrayRef;
}

pub struct PrimitiveGroupValueBuilder<T: ArrowPrimitiveType>(Vec<Option<T::Native>>);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very similar to PrimitiveBuilder in arrow-rs to me https://docs.rs/arrow/latest/arrow/array/struct.PrimitiveBuilder.html (though I think PrimitiveBuilder is likely faster / handles nulls better)

I wonder if you could implement ArrayEq for PrimitiveBuilder using the methods like https://docs.rs/arrow/latest/arrow/array/struct.PrimitiveBuilder.html#method.values_slice

If so I think you would have a very compelling PR here

}

for (i, group_val) in group_values_v2.iter().enumerate() {
if !compare_equal(group_val.as_ref(), *group_idx, &cols[i], row) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea would be change compare_equal to take advantage of cases when, for example, it was known the values couldn't be null (so checking Option isn't needed)

@@ -35,9 +35,4 @@ SELECT "URL", COUNT(*) AS c FROM hits GROUP BY "URL" ORDER BY c DESC LIMIT 10;
SELECT 1, "URL", COUNT(*) AS c FROM hits GROUP BY 1, "URL" ORDER BY c DESC LIMIT 10;
SELECT "ClientIP", "ClientIP" - 1, "ClientIP" - 2, "ClientIP" - 3, COUNT(*) AS c FROM hits GROUP BY "ClientIP", "ClientIP" - 1, "ClientIP" - 2, "ClientIP" - 3 ORDER BY c DESC LIMIT 10;
SELECT "URL", COUNT(*) AS PageViews FROM hits WHERE "CounterID" = 62 AND "EventDate"::INT::DATE >= '2013-07-01' AND "EventDate"::INT::DATE <= '2013-07-31' AND "DontCountHits" = 0 AND "IsRefresh" = 0 AND "URL" <> '' GROUP BY "URL" ORDER BY PageViews DESC LIMIT 10;
SELECT "Title", COUNT(*) AS PageViews FROM hits WHERE "CounterID" = 62 AND "EventDate"::INT::DATE >= '2013-07-01' AND "EventDate"::INT::DATE <= '2013-07-31' AND "DontCountHits" = 0 AND "IsRefresh" = 0 AND "Title" <> '' GROUP BY "Title" ORDER BY PageViews DESC LIMIT 10;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these queries removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I haven't implement DateTime builder, so couldn't pass the test

@alamb
Copy link
Contributor

alamb commented Sep 9, 2024

TLDR is I ran the benchmarks and it does appear to make a measurable performance improvement on several queries 👍

++ BENCH_BRANCH_NAME=row-group
++ ./bench.sh compare main_base row-group
Comparing main_base and row-group
--------------------
Benchmark clickbench_1.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃  main_base ┃  row-group ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 0     │     0.69ms │     0.70ms │     no change │
│ QQuery 1     │    68.87ms │    69.04ms │     no change │
│ QQuery 2     │   122.40ms │   122.39ms │     no change │
│ QQuery 3     │   129.14ms │   129.84ms │     no change │
│ QQuery 4     │   958.71ms │   950.60ms │     no change │
│ QQuery 5     │  1072.42ms │  1065.00ms │     no change │
│ QQuery 6     │    64.15ms │    65.46ms │     no change │
│ QQuery 7     │    72.57ms │    72.23ms │     no change │
│ QQuery 8     │  1427.25ms │  1352.90ms │ +1.05x faster │
│ QQuery 9     │  1328.70ms │  1333.45ms │     no change │
│ QQuery 10    │   444.86ms │   435.72ms │     no change │
│ QQuery 11    │   493.91ms │   475.07ms │     no change │
│ QQuery 12    │  1158.46ms │  1154.09ms │     no change │
│ QQuery 13    │  2124.34ms │  1776.44ms │ +1.20x faster │
│ QQuery 14    │  1607.17ms │  1306.73ms │ +1.23x faster │
│ QQuery 15    │  1078.30ms │  1062.72ms │     no change │
│ QQuery 16    │  2885.78ms │  2525.19ms │ +1.14x faster │
│ QQuery 17    │  2799.52ms │  2470.93ms │ +1.13x faster │
│ QQuery 18    │  5575.63ms │  5524.24ms │     no change │
│ QQuery 19    │   119.57ms │   118.24ms │     no change │
│ QQuery 20    │  1656.36ms │  1675.11ms │     no change │
│ QQuery 21    │  2014.67ms │  2028.74ms │     no change │
│ QQuery 22    │  4849.99ms │  4824.94ms │     no change │
│ QQuery 23    │ 11274.06ms │ 11309.82ms │     no change │
│ QQuery 24    │   761.95ms │   754.26ms │     no change │
│ QQuery 25    │   667.54ms │   668.69ms │     no change │
│ QQuery 26    │   821.70ms │   839.38ms │     no change │
│ QQuery 27    │  2467.71ms │  2493.84ms │     no change │
│ QQuery 28    │ 15737.24ms │ 15634.42ms │     no change │
│ QQuery 29    │   560.78ms │   551.43ms │     no change │
│ QQuery 30    │  1296.29ms │  1242.39ms │     no change │
│ QQuery 31    │  1318.14ms │  1291.30ms │     no change │
│ QQuery 32    │  4569.20ms │  4241.25ms │ +1.08x faster │
│ QQuery 33    │  5020.91ms │  5031.03ms │     no change │
│ QQuery 34    │  5014.64ms │  4965.98ms │     no change │
│ QQuery 35    │  1818.84ms │  1850.31ms │     no change │
│ QQuery 36    │   316.76ms │   302.74ms │     no change │
│ QQuery 37    │   217.15ms │   219.32ms │     no change │
│ QQuery 38    │   188.03ms │   191.14ms │     no change │
│ QQuery 39    │  1039.10ms │   788.09ms │ +1.32x faster │
│ QQuery 40    │    86.06ms │    83.63ms │     no change │
│ QQuery 41    │    77.68ms │    79.76ms │     no change │
│ QQuery 42    │    97.39ms │    91.99ms │ +1.06x faster │
└──────────────┴────────────┴────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary        ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (main_base)   │ 85404.65ms │
│ Total Time (row-group)   │ 83170.54ms │
│ Average Time (main_base) │  1986.15ms │
│ Average Time (row-group) │  1934.20ms │
│ Queries Faster           │          8 │
│ Queries Slower           │          0 │
│ Queries with No Change   │         35 │
└──────────────────────────┴────────────┘
--------------------
Benchmark clickbench_extended.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Query        ┃ main_base ┃ row-group ┃    Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━┩
│ QQuery 0     │ 2652.87ms │ 2682.38ms │ no change │
│ QQuery 1     │  793.53ms │  794.12ms │ no change │
│ QQuery 2     │ 1576.90ms │ 1609.73ms │ no change │
│ QQuery 3     │  705.29ms │  718.99ms │ no change │
└──────────────┴───────────┴───────────┴───────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Benchmark Summary        ┃           ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ Total Time (main_base)   │ 5728.58ms │
│ Total Time (row-group)   │ 5805.22ms │
│ Average Time (main_base) │ 1432.15ms │
│ Average Time (row-group) │ 1451.31ms │
│ Queries Faster           │         0 │
│ Queries Slower           │         0 │
│ Queries with No Change   │         4 │
└──────────────────────────┴───────────┘
--------------------
Benchmark clickbench_partitioned.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃  main_base ┃  row-group ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 0     │     2.29ms │     2.27ms │     no change │
│ QQuery 1     │    38.05ms │    37.76ms │     no change │
│ QQuery 2     │    93.47ms │    93.56ms │     no change │
│ QQuery 3     │    98.55ms │    96.67ms │     no change │
│ QQuery 4     │   902.00ms │   910.55ms │     no change │
│ QQuery 5     │   937.33ms │   936.86ms │     no change │
│ QQuery 6     │    34.33ms │    33.78ms │     no change │
│ QQuery 7     │    40.59ms │    39.35ms │     no change │
│ QQuery 8     │  1368.30ms │  1296.26ms │ +1.06x faster │
│ QQuery 9     │  1293.07ms │  1273.53ms │     no change │
│ QQuery 10    │   339.78ms │   331.25ms │     no change │
│ QQuery 11    │   375.98ms │   381.26ms │     no change │
│ QQuery 12    │  1025.16ms │  1034.74ms │     no change │
│ QQuery 13    │  1811.09ms │  1792.68ms │     no change │
│ QQuery 14    │  1453.37ms │  1448.76ms │     no change │
│ QQuery 15    │  1012.38ms │  1012.83ms │     no change │
│ QQuery 16    │  2746.71ms │  2728.55ms │     no change │
│ QQuery 17    │  2719.38ms │  2632.64ms │     no change │
│ QQuery 18    │  5524.24ms │  5525.66ms │     no change │
│ QQuery 19    │    92.83ms │    90.08ms │     no change │
│ QQuery 20    │  1752.39ms │  1751.25ms │     no change │
│ QQuery 21    │  1946.27ms │  1981.08ms │     no change │
│ QQuery 22    │  4974.66ms │  5049.46ms │     no change │
│ QQuery 23    │  9841.76ms │  9781.88ms │     no change │
│ QQuery 24    │   549.84ms │   559.25ms │     no change │
│ QQuery 25    │   467.91ms │   475.16ms │     no change │
│ QQuery 26    │   631.52ms │   617.63ms │     no change │
│ QQuery 27    │  2445.52ms │  2463.11ms │     no change │
│ QQuery 28    │ 14923.62ms │ 15024.79ms │     no change │
│ QQuery 29    │   530.70ms │   523.81ms │     no change │
│ QQuery 30    │  1106.49ms │  1060.93ms │     no change │
│ QQuery 31    │  1140.91ms │  1090.09ms │     no change │
│ QQuery 32    │  4550.65ms │  4133.54ms │ +1.10x faster │
│ QQuery 33    │  4929.55ms │  4922.02ms │     no change │
│ QQuery 34    │  4789.55ms │  4834.44ms │     no change │
│ QQuery 35    │  1753.55ms │  1829.42ms │     no change │
│ QQuery 36    │   283.39ms │   267.52ms │ +1.06x faster │
│ QQuery 37    │   120.66ms │   122.89ms │     no change │
│ QQuery 38    │   141.70ms │   136.39ms │     no change │
│ QQuery 39    │   897.86ms │   918.07ms │     no change │
│ QQuery 40    │    58.14ms │    61.45ms │  1.06x slower │
│ QQuery 41    │    48.73ms │    48.17ms │     no change │
│ QQuery 42    │    66.33ms │    63.97ms │     no change │
└──────────────┴────────────┴────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary        ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (main_base)   │ 79860.62ms │
│ Total Time (row-group)   │ 79415.32ms │
│ Average Time (main_base) │  1857.22ms │
│ Average Time (row-group) │  1846.87ms │
│ Queries Faster           │          3 │
│ Queries Slower           │          1 │
│ Queries with No Change   │         39 │

@jayzhan211
Copy link
Contributor Author

┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃       main ┃  row-group ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 0     │     0.53ms │     0.41ms │ +1.31x faster │
│ QQuery 1     │    49.01ms │    41.52ms │ +1.18x faster │
│ QQuery 2     │    88.41ms │    79.98ms │ +1.11x faster │
│ QQuery 3     │    71.89ms │    73.76ms │     no change │
│ QQuery 4     │   475.98ms │   435.24ms │ +1.09x faster │
│ QQuery 5     │   715.67ms │   689.91ms │     no change │
│ QQuery 6     │    36.87ms │    38.72ms │  1.05x slower │
│ QQuery 7     │    42.85ms │    44.72ms │     no change │
│ QQuery 8     │   767.47ms │   682.42ms │ +1.12x faster │
│ QQuery 9     │   698.12ms │   687.16ms │     no change │
│ QQuery 10    │   214.09ms │   202.99ms │ +1.05x faster │
│ QQuery 11    │   233.88ms │   227.44ms │     no change │
│ QQuery 12    │   765.70ms │   763.87ms │     no change │
│ QQuery 13    │  1105.55ms │   967.40ms │ +1.14x faster │
│ QQuery 14    │  1087.28ms │   904.65ms │ +1.20x faster │
│ QQuery 15    │   538.36ms │   528.94ms │     no change │
│ QQuery 16    │  1707.60ms │  1418.83ms │ +1.20x faster │
│ QQuery 17    │  1580.22ms │  1281.82ms │ +1.23x faster │
│ QQuery 18    │  4503.70ms │  4718.10ms │     no change │
│ QQuery 19    │    58.30ms │    68.69ms │  1.18x slower │
│ QQuery 20    │  1015.23ms │  1086.18ms │  1.07x slower │
│ QQuery 21    │  1306.73ms │  1345.37ms │     no change │
│ QQuery 22    │  3515.27ms │  3727.30ms │  1.06x slower │
│ QQuery 23    │  8564.19ms │  8835.99ms │     no change │
│ QQuery 24    │   509.14ms │   524.45ms │     no change │
│ QQuery 25    │   506.78ms │   517.49ms │     no change │
│ QQuery 26    │   586.24ms │   566.43ms │     no change │
│ QQuery 27    │  1418.28ms │  1498.42ms │  1.06x slower │
│ QQuery 28    │ 10867.59ms │ 11017.18ms │     no change │
│ QQuery 29    │   410.02ms │   419.97ms │     no change │
│ QQuery 30    │   865.76ms │   820.34ms │ +1.06x faster │
│ QQuery 31    │   779.85ms │   776.05ms │     no change │
│ QQuery 32    │  4989.34ms │  3710.45ms │ +1.34x faster │
│ QQuery 33    │  5195.54ms │  5364.02ms │     no change │
│ QQuery 34    │  4955.46ms │  5048.30ms │     no change │
│ QQuery 35    │  1082.95ms │  1171.24ms │  1.08x slower │
│ QQuery 36    │   143.30ms │   144.68ms │     no change │
│ QQuery 37    │    99.65ms │   108.31ms │  1.09x slower │
│ QQuery 38    │   104.12ms │   108.27ms │     no change │
│ QQuery 39    │   383.56ms │   321.16ms │ +1.19x faster │
│ QQuery 40    │    37.12ms │    36.89ms │     no change │
│ QQuery 41    │    34.16ms │    33.11ms │     no change │
│ QQuery 42    │    42.21ms │    41.49ms │     no change │
└──────────────┴────────────┴────────────┴───────────────┘

Signed-off-by: jayzhan211 <[email protected]>
@jayzhan211
Copy link
Contributor Author

@alamb I found FirstN mode is non-trivial If I switch to Arrow's Builder instead of Vec what I had done before. Is it reasonable to implement takeN logic in Arrow's Builder upstream?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
physical-expr Physical Expressions sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants