xtdb

nivekuil 2024-05-10T01:30:11.183309Z

I might be missing something obvious: how do you filter for documents that were inserted within a particular time interval?

nivekuil 2024-05-10T19:24:23.144619Z

why does xt/system-time behave differently from xt/system-from here?

nivekuil 2024-05-10T19:25:24.554919Z

-time returns no results while -from does. and -time seems to work with strictly-contains while -from does not, saying strictly_contains? not applicable to types struct and timestamp-tz

nivekuil 2024-05-10T19:28:21.888259Z

-time also works with succeeds? while -from does not, maybe the plumbing just isn't there to cast it to the right type?

nivekuil 2024-05-10T19:29:40.497899Z

I think it's just broken actually, since the same query returns no results with -time with both precedes and succeeds (but would return results without that condition entirely)

jarohen 2024-05-12T09:06:49.061749Z

system-time is the period of system-from to system-to (unbounded in this case), so by using system-time you're heading into https://docs.xtdb.com/reference/main/stdlib/temporal.html#_periods territory. in the case of contains, your from/to doesn't contain that whole system-time period, so it'll filter it out

jarohen 2024-05-12T09:10:05.181759Z

contains is one of the few (IIRC it may even be the only) period predicates that accept period/instant - all the others only accept period/period

jarohen 2024-05-10T06:15:21.892379Z

would WHERE PERIOD(<from>, <to>) CONTAINS xt$system_from work for you?

jarohen 2024-05-10T06:17:13.486949Z

sorry, (contains? (period #inst "<from>" #inst "<to>") xt/system-from)

nivekuil 2024-05-14T20:19:52.748589Z

thanks, that clears it up. so -time means period, the others mean instant

👌 1