Skip to content

Commit

Permalink
functions/time: add test for overflow interval case
Browse files Browse the repository at this point in the history
  • Loading branch information
naoa committed Jul 11, 2017
1 parent 899ec44 commit c81d72a
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
plugin_register functions/time
[[0,0.0,0.0],true]
table_create Timestamps TABLE_PAT_KEY Time
[[0,0.0,0.0],true]
load --table Timestamps
[
{"_key": "2016-04-30 23:59:59.999999"},
{"_key": "2016-05-01 00:00:00.000000"},
{"_key": "2016-05-01 00:00:00.000001"},
{"_key": "2016-06-30 23:59:59.999999"},
{"_key": "2016-07-01 00:00:00.000000"},
{"_key": "2016-07-01 00:00:00.000001"}
]
[[0,0.0,0.0],6]
select Timestamps --sortby _id --limit -1 --output_columns '_key, time_classify_month(_key, 4294967296)'
[
[
[
-22,
0.0,
0.0
],
"time_classify_month(): the second argument must not be zero: <4294967296>"
],
[
[
[
6
],
[
[
"_key",
"Time"
],
[
"time_classify_month",
null
]
],
[
1462060799.999999,
"time_classify_month(): the second argument must not be zero: <4294967296>"
],
[
1462060800.0,
"time_classify_month(): the second argument must not be zero: <4294967296>"
],
[
1462060800.000001,
"time_classify_month(): the second argument must not be zero: <4294967296>"
],
[
1467331199.999999,
"time_classify_month(): the second argument must not be zero: <4294967296>"
],
[
1467331200.0,
"time_classify_month(): the second argument must not be zero: <4294967296>"
],
[
1467331200.000001,
"time_classify_month(): the second argument must not be zero: <4294967296>"
]
]
]
]
#|e| time_classify_month(): the second argument must not be zero: <4294967296>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
plugin_register functions/time

table_create Timestamps TABLE_PAT_KEY Time

load --table Timestamps
[
{"_key": "2016-04-30 23:59:59.999999"},
{"_key": "2016-05-01 00:00:00.000000"},
{"_key": "2016-05-01 00:00:00.000001"},
{"_key": "2016-06-30 23:59:59.999999"},
{"_key": "2016-07-01 00:00:00.000000"},
{"_key": "2016-07-01 00:00:00.000001"}
]

select Timestamps \
--sortby _id \
--limit -1 \
--output_columns '_key, time_classify_month(_key, 4294967296)'

0 comments on commit c81d72a

Please sign in to comment.