Skip to content

Commit

Permalink
Merge remote-tracking branch 'akuzm/hash-serialized' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
akuzm committed Feb 19, 2025
2 parents 0db5a43 + 18f2586 commit 832a080
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ serialized_key_hashing_get_key(BatchHashingParams params, int row, void *restric
*valid = true;

const struct umash_fp fp = umash_fprint(params.policy->hashing.umash_params,
/* seed = */ -1ull,
/* seed = */ ~0ULL,
serialized_key_storage,
num_bytes);
*hash_table_key = umash_fingerprint_get_key(fp);
Expand Down
36 changes: 15 additions & 21 deletions tsl/test/expected/hypercore_vectoragg.out
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,11 @@ select location, count(*) from aggdata where location=1 group by location;
--
-- Test ordering/grouping on segmentby, orderby columns
--
-- This grouping is currently NOT supported by VectorAgg
--
set timescaledb.enable_vectorized_aggregation=true;
explain (verbose, costs off)
select time, device, sum(temp) from aggdata where device is not null group by time, device order by time, device limit 10;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------
Limit
Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, (sum(_hyper_1_1_chunk.temp))
-> Sort
Expand All @@ -330,9 +328,9 @@ select time, device, sum(temp) from aggdata where device is not null group by ti
Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, sum(_hyper_1_1_chunk.temp)
Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device
-> Append
-> Partial HashAggregate
Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, PARTIAL sum(_hyper_1_1_chunk.temp)
Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device
-> Custom Scan (VectorAgg)
Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, (PARTIAL sum(_hyper_1_1_chunk.temp))
Grouping Policy: hashed with serialized key
-> Custom Scan (ColumnarScan) on _timescaledb_internal._hyper_1_1_chunk
Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp
Filter: (_hyper_1_1_chunk.device IS NOT NULL)
Expand All @@ -344,7 +342,6 @@ select time, device, sum(temp) from aggdata where device is not null group by ti
Filter: (_hyper_1_2_chunk.device IS NOT NULL)
(21 rows)

set timescaledb.debug_require_vector_agg to 'forbid';
select time, device, sum(temp) from aggdata where device is not null group by time, device order by time, device limit 10;
time | device | sum
------------------------------+--------+-----
Expand All @@ -355,11 +352,10 @@ select time, device, sum(temp) from aggdata where device is not null group by ti
(4 rows)

set timecaledb.enable_vectorized_aggregation=false;
reset timescaledb.debug_require_vector_agg;
explain (verbose, costs off)
select time, device, sum(temp) from aggdata where device is not null group by time, device order by time, device limit 10;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------
Limit
Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, (sum(_hyper_1_1_chunk.temp))
-> Sort
Expand All @@ -369,9 +365,9 @@ select time, device, sum(temp) from aggdata where device is not null group by ti
Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, sum(_hyper_1_1_chunk.temp)
Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device
-> Append
-> Partial HashAggregate
Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, PARTIAL sum(_hyper_1_1_chunk.temp)
Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device
-> Custom Scan (VectorAgg)
Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, (PARTIAL sum(_hyper_1_1_chunk.temp))
Grouping Policy: hashed with serialized key
-> Custom Scan (ColumnarScan) on _timescaledb_internal._hyper_1_1_chunk
Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp
Filter: (_hyper_1_1_chunk.device IS NOT NULL)
Expand All @@ -395,8 +391,8 @@ select time, device, sum(temp) from aggdata where device is not null group by ti
set timescaledb.enable_vectorized_aggregation=true;
explain (verbose, costs off)
select time, device, sum(temp) filter (where device is not null) from aggdata group by time, device order by time, device desc limit 10;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit
Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, (sum(_hyper_1_1_chunk.temp) FILTER (WHERE (_hyper_1_1_chunk.device IS NOT NULL)))
-> Sort
Expand All @@ -406,9 +402,9 @@ select time, device, sum(temp) filter (where device is not null) from aggdata gr
Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, sum(_hyper_1_1_chunk.temp) FILTER (WHERE (_hyper_1_1_chunk.device IS NOT NULL))
Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device
-> Append
-> Partial HashAggregate
Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, PARTIAL sum(_hyper_1_1_chunk.temp) FILTER (WHERE (_hyper_1_1_chunk.device IS NOT NULL))
Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device
-> Custom Scan (VectorAgg)
Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, (PARTIAL sum(_hyper_1_1_chunk.temp) FILTER (WHERE (_hyper_1_1_chunk.device IS NOT NULL)))
Grouping Policy: hashed with serialized key
-> Custom Scan (ColumnarScan) on _timescaledb_internal._hyper_1_1_chunk
Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp
-> Partial HashAggregate
Expand All @@ -418,7 +414,6 @@ select time, device, sum(temp) filter (where device is not null) from aggdata gr
Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp
(19 rows)

set timescaledb.debug_require_vector_agg to 'forbid';
select time, device, sum(temp) filter (where device is not null) from aggdata group by time, device order by time, device desc limit 10;
time | device | sum
------------------------------+--------+-----
Expand All @@ -430,7 +425,6 @@ select time, device, sum(temp) filter (where device is not null) from aggdata gr
(5 rows)

set timescaledb.enable_vectorized_aggregation=false;
reset timescaledb.debug_require_vector_agg;
explain (verbose, costs off)
select time, device, sum(temp) filter (where device is not null) from aggdata group by time, device order by time, device desc limit 10;
QUERY PLAN
Expand Down
6 changes: 0 additions & 6 deletions tsl/test/sql/hypercore_vectoragg.sql
Original file line number Diff line number Diff line change
Expand Up @@ -110,28 +110,22 @@ select location, count(*) from aggdata where location=1 group by location;
--
-- Test ordering/grouping on segmentby, orderby columns
--
-- This grouping is currently NOT supported by VectorAgg
--
set timescaledb.enable_vectorized_aggregation=true;
explain (verbose, costs off)
select time, device, sum(temp) from aggdata where device is not null group by time, device order by time, device limit 10;
set timescaledb.debug_require_vector_agg to 'forbid';
select time, device, sum(temp) from aggdata where device is not null group by time, device order by time, device limit 10;

set timecaledb.enable_vectorized_aggregation=false;
reset timescaledb.debug_require_vector_agg;
explain (verbose, costs off)
select time, device, sum(temp) from aggdata where device is not null group by time, device order by time, device limit 10;
select time, device, sum(temp) from aggdata where device is not null group by time, device order by time, device limit 10;

set timescaledb.enable_vectorized_aggregation=true;
explain (verbose, costs off)
select time, device, sum(temp) filter (where device is not null) from aggdata group by time, device order by time, device desc limit 10;
set timescaledb.debug_require_vector_agg to 'forbid';
select time, device, sum(temp) filter (where device is not null) from aggdata group by time, device order by time, device desc limit 10;

set timescaledb.enable_vectorized_aggregation=false;
reset timescaledb.debug_require_vector_agg;
explain (verbose, costs off)
select time, device, sum(temp) filter (where device is not null) from aggdata group by time, device order by time, device desc limit 10;
select time, device, sum(temp) filter (where device is not null) from aggdata group by time, device order by time, device desc limit 10;
Expand Down

0 comments on commit 832a080

Please sign in to comment.