2015-10-03 21:58:01 +00:00
|
|
|
#! /bin/bash
|
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# timeslice('blah')
|
|
|
|
run_cap_test ./drive_sql "select timeslice('2015-08-07 12:01:00', 'blah')"
|
2021-06-18 16:04:53 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# before 12pm
|
|
|
|
run_cap_test ./drive_sql "select timeslice('2015-08-07 12:01:00', 'before fri')"
|
2021-06-18 16:04:53 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# not before 12pm
|
|
|
|
run_cap_test ./drive_sql "select timeslice('2015-08-07 11:59:00', 'after fri')"
|
2021-06-18 16:04:53 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# not before 12pm
|
|
|
|
run_cap_test ./drive_sql "select timeslice('2015-08-07 11:59:00', 'fri')"
|
2021-06-18 16:04:53 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# before 12pm
|
|
|
|
run_cap_test ./drive_sql "select timeslice('2015-08-07 12:01:00', 'before 12pm')"
|
2021-06-18 16:04:53 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# not before 12pm
|
|
|
|
run_cap_test ./drive_sql "select timeslice('2015-08-07 11:59:00', 'before 12pm')"
|
2021-06-18 16:04:53 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# after 12pm
|
|
|
|
run_cap_test ./drive_sql "select timeslice('2015-08-07 12:01:00', 'after 12pm')"
|
2021-06-18 16:04:53 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# not after 12pm
|
|
|
|
run_cap_test ./drive_sql "select timeslice('2015-08-07 11:59:00', 'after 12pm')"
|
2021-06-18 16:04:53 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# timeslice()
|
|
|
|
run_cap_test ./drive_sql "select timeslice()"
|
2021-06-18 16:04:53 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# timeslice('2015-02-01T05:10:00')
|
|
|
|
run_cap_test ./drive_sql "select timeslice('2015-02-01T05:10:00')"
|
2021-06-18 16:04:53 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# timeslice empty
|
|
|
|
run_cap_test ./drive_sql "select timeslice('', '')"
|
2021-06-18 16:04:53 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# timeslice abs
|
|
|
|
run_cap_test ./drive_sql "select timeslice('2015-08-07 12:01:00', '8 am')"
|
2021-06-18 16:04:53 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# timeslice abs
|
|
|
|
run_cap_test ./drive_sql "select timeslice('2015-08-07 08:00:33', '8 am')"
|
2021-03-21 15:53:21 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# timeslice abs
|
|
|
|
run_cap_test ./drive_sql "select timeslice('2015-08-07 08:01:33', '8 am')"
|
2021-03-21 15:53:21 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# timeslice(null, null)
|
|
|
|
run_cap_test ./drive_sql "select timeslice(null, null)"
|
2021-03-21 15:53:21 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# timeslice(null)
|
|
|
|
run_cap_test ./drive_sql "select timeslice(null)"
|
2021-03-21 15:53:21 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# 100ms slice
|
|
|
|
run_cap_test ./drive_sql "select timeslice(1616300753.333, '100ms')"
|
2015-10-03 21:58:01 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# timeslice 5m
|
|
|
|
run_cap_test ./drive_sql "select timeslice('2015-08-07 12:01:00', '5m')"
|
2015-10-03 21:58:01 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# timeslice 1d
|
|
|
|
run_cap_test ./drive_sql "select timeslice('2015-08-07 12:01:00', '1d')"
|
2015-10-03 21:58:01 +00:00
|
|
|
|
|
|
|
# XXX This is wrong...
|
2022-04-30 20:05:42 +00:00
|
|
|
# timeslice 1 month
|
|
|
|
run_cap_test ./drive_sql "select timeslice('2015-08-07 12:01:00', '1 month')"
|
2017-03-31 14:01:11 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# timeslice ms
|
|
|
|
run_cap_test ./drive_sql "select timediff('2017-01-02T05:00:00.100', '2017-01-02T05:00:00.000')"
|
2017-03-31 14:01:11 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# timeslice day
|
|
|
|
run_cap_test ./drive_sql "select timediff('today', 'yesterday')"
|
2017-03-31 14:01:11 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# timeslice day
|
|
|
|
run_cap_test ./drive_sql "select timediff('foo', 'yesterday')"
|
2023-09-06 04:54:49 +00:00
|
|
|
|
|
|
|
run_cap_test ./drive_sql "SELECT timezone('America/Los_Angeles', '2022-03-02T10:00')"
|
|
|
|
|
|
|
|
run_cap_test ./drive_sql "SELECT timezone('America/Los_Angeles', '2022-03-02T10:20:30.400-0700')"
|
|
|
|
|
|
|
|
run_cap_test ./drive_sql "SELECT timezone('America/Los_Angeles', '2022-04-02T10:20:30.400-0700')"
|
|
|
|
|
|
|
|
run_cap_test ./drive_sql "SELECT timezone('America/New_York', '2022-03-02T10:20:30.400-0700')"
|
|
|
|
|
|
|
|
run_cap_test ./drive_sql "SELECT timezone('UTC', '2022-03-02T10:20:30.400-0700')"
|
|
|
|
|
|
|
|
run_cap_test ${lnav_test} -nN -c ";SELECT timezone('bad-zone', '2022-03-02T10:20:30.400-0700')"
|
|
|
|
|
|
|
|
run_cap_test ${lnav_test} -nN -c ";SELECT timezone('UTC', '2022-03-02T10:20:30.400bad')"
|