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

Add more tests for compression #5420

Merged
merged 1 commit into from Mar 10, 2023
Merged

Add more tests for compression #5420

merged 1 commit into from Mar 10, 2023

Conversation

akuzm
Copy link
Member

@akuzm akuzm commented Mar 9, 2023

Unit tests for different data sequences, and SQL test for float4.

@akuzm akuzm mentioned this pull request Mar 9, 2023
17 tasks
@github-actions
Copy link

github-actions bot commented Mar 9, 2023

@mkindahl, @nikkhils: please review this pull request.

Powered by pull-review

@@ -32,7 +34,7 @@ SELECT
\set DECOMPRESS_REVERSE_CMD _timescaledb_internal.decompress_reverse(c::_timescaledb_internal.compressed_data, NULL::BIGINT)

-- random order
CREATE TABLE base_ints AS SELECT row_number() OVER() as rn, item::bigint FROM (select sub.item from (SELECT generate_series(1, 1000) item) as sub ORDER BY gen_rand_minstd()) sub;
CREATE TABLE base_ints AS SELECT row_number() OVER() as rn, item::bigint FROM (select sub.item from (SELECT generate_series(1, 1000) item) as sub ORDER BY mix(item)) sub;
Copy link
Member Author

@akuzm akuzm Mar 9, 2023

Choose a reason for hiding this comment

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

gen_rand_minstd() had a global state and updated a table on each call. Changing it to a hash function removes the dependency between test cases, and speeds up the test by about 3 seconds (20%).

CREATE OR REPLACE FUNCTION _timescaledb_internal.gorilla_compressor_append(internal, DOUBLE PRECISION)
CREATE OR REPLACE FUNCTION _timescaledb_internal.gorilla_compressor_append(internal, ANYELEMENT)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the function assume that it is a double, won't this break if you allow other elements to be passed?

from tsl_gorilla_compressor_append:

	if (PG_ARGISNULL(1))
		gorilla_compressor_append_null(compressor);
	else
	{
		double next_val = PG_GETARG_FLOAT8(1);
		gorilla_compressor_append_value(compressor, double_get_bits(next_val));
	}

Copy link
Member Author

Choose a reason for hiding this comment

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

I added the missing files I forgot to commit, it should accept all supported types now. Sorry for the confusion.

gorilla_decompression_iterator_from_datum_forward(PointerGetDatum(compressed), FLOAT8OID);
for (DecompressResult r = gorilla_decompression_iterator_try_next_forward(iter); !r.is_done;
r = gorilla_decompression_iterator_try_next_forward(iter))
ArrowArray *bulk_result =
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you missing an include here?

Copy link
Member Author

@akuzm akuzm Mar 9, 2023

Choose a reason for hiding this comment

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

Oh, I missed half the files I wanted to include in this PR, will fix now.

@codecov
Copy link

codecov bot commented Mar 9, 2023

Codecov Report

Merging #5420 (0781a8a) into main (386d31b) will decrease coverage by 0.01%.
The diff coverage is 98.42%.

❗ Current head 0781a8a differs from pull request most recent head 8966ceb. Consider uploading reports for the commit 8966ceb to get more accurate results

@@            Coverage Diff             @@
##             main    #5420      +/-   ##
==========================================
- Coverage   90.68%   90.68%   -0.01%     
==========================================
  Files         226      227       +1     
  Lines       52538    52698     +160     
==========================================
+ Hits        47645    47790     +145     
- Misses       4893     4908      +15     
Impacted Files Coverage Δ
tsl/src/compression/deltadelta.c 94.40% <ø> (ø)
tsl/src/compression/gorilla.c 90.10% <85.71%> (-0.06%) ⬇️
tsl/test/src/test_compression.c 98.62% <100.00%> (+0.37%) ⬆️

... and 26 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@mkindahl mkindahl left a comment

Choose a reason for hiding this comment

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

LGTM


int64 values[1015];
bool nulls[1015];
for (int i = 0; i < 1015; i++)
Copy link
Contributor

Choose a reason for hiding this comment

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

I usually use something like this to avoid making mistakes when I change the sizes of the arrays:

Suggested change
for (int i = 0; i < 1015; i++)
for (int i = 0; i < sizeof(values)/sizeof(*values); i++)

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's just use a define for all of them.

Unit tests for different data sequences, and SQL test for float4.
@akuzm akuzm enabled auto-merge (rebase) March 10, 2023 11:23
@akuzm akuzm merged commit e92d5ba into timescale:main Mar 10, 2023
@akuzm akuzm deleted the comp-test branch March 10, 2023 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants