-
Notifications
You must be signed in to change notification settings - Fork 881
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug with negative dimension values
Previously, negative dimension values had an off-by-one bug where the wrong chunk was created for points on chunk borders. This PR fixes that.
- Loading branch information
Showing
7 changed files
with
190 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
\unset ECHO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
\unset ECHO | ||
\o /dev/null | ||
\ir include/create_single_db.sql | ||
\ir include/test_utils.sql | ||
\o | ||
\set ECHO errors | ||
\set VERBOSITY default | ||
|
||
\o /dev/null | ||
|
||
--open | ||
SELECT assert_equal(0::bigint, actual_range_start), assert_equal(10::bigint, actual_range_end) | ||
FROM _timescaledb_internal.dimension_calculate_default_range_open(0,10) AS res(actual_range_start, actual_range_end); | ||
|
||
SELECT assert_equal(0::bigint, actual_range_start), assert_equal(10::bigint, actual_range_end) | ||
FROM _timescaledb_internal.dimension_calculate_default_range_open(9,10) AS res(actual_range_start, actual_range_end); | ||
|
||
SELECT assert_equal(10::bigint, actual_range_start), assert_equal(20::bigint, actual_range_end) | ||
FROM _timescaledb_internal.dimension_calculate_default_range_open(10,10) AS res(actual_range_start, actual_range_end); | ||
|
||
SELECT assert_equal(-10::bigint, actual_range_start), assert_equal(0::bigint, actual_range_end) | ||
FROM _timescaledb_internal.dimension_calculate_default_range_open(-1,10) AS res(actual_range_start, actual_range_end); | ||
|
||
SELECT assert_equal(-10::bigint, actual_range_start), assert_equal(0::bigint, actual_range_end) | ||
FROM _timescaledb_internal.dimension_calculate_default_range_open(-10,10) AS res(actual_range_start, actual_range_end); | ||
|
||
SELECT assert_equal(-20::bigint, actual_range_start), assert_equal(-10::bigint, actual_range_end) | ||
FROM _timescaledb_internal.dimension_calculate_default_range_open(-11,10) AS res(actual_range_start, actual_range_end); | ||
|
||
--closed | ||
SELECT assert_equal(0::bigint, actual_range_start), assert_equal(1073741823::bigint, actual_range_end) | ||
FROM _timescaledb_internal.dimension_calculate_default_range_closed(0,2::smallint) AS res(actual_range_start, actual_range_end); | ||
|
||
SELECT assert_equal(1073741823::bigint, actual_range_start), assert_equal(2147483647::bigint, actual_range_end) | ||
FROM _timescaledb_internal.dimension_calculate_default_range_closed(1073741823,2::smallint) AS res(actual_range_start, actual_range_end); | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
CREATE OR REPLACE FUNCTION assert_true( | ||
val boolean | ||
) | ||
RETURNS VOID LANGUAGE PLPGSQL IMMUTABLE AS | ||
$BODY$ | ||
BEGIN | ||
IF !val THEN | ||
RAISE 'Assert failed'; | ||
END IF; | ||
END | ||
$BODY$; | ||
|
||
|
||
CREATE OR REPLACE FUNCTION assert_equal( | ||
val1 anyelement, | ||
val2 anyelement | ||
) | ||
RETURNS VOID LANGUAGE PLPGSQL IMMUTABLE AS | ||
$BODY$ | ||
BEGIN | ||
IF val1 != val2 THEN | ||
RAISE 'Assert failed'; | ||
END IF; | ||
END | ||
$BODY$; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters