Skip to content

Commit

Permalink
Unify row-pickers into one picker
Browse files Browse the repository at this point in the history
  • Loading branch information
FiV0 committed Aug 7, 2023
1 parent 33e74cb commit ba6cfbd
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 477 deletions.
396 changes: 103 additions & 293 deletions core/src/main/clojure/xtdb/operator/scan.clj

Large diffs are not rendered by default.

20 changes: 9 additions & 11 deletions src/test/clojure/xtdb/as_of_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
:xt/valid-from system-time
:xt/valid-to end-of-time-zdt
:xt/system-from system-time
:xt/system-to nil}
:xt/system-to (util/->zdt util/end-of-time)}
:doc-with-app-time {:xt/id :doc-with-app-time,
:xt/valid-from (util/->zdt #inst "2021")
:xt/valid-to end-of-time-zdt
:xt/system-from system-time
:xt/system-to nil}}
:xt/system-to (util/->zdt util/end-of-time)}}
(->> (tu/query-ra '[:scan {:table xt_docs}
[xt/id
xt/valid-from xt/valid-to
Expand All @@ -67,25 +67,23 @@

original-v0-doc {:xt/id :doc, :version 0
:xt/valid-from tt1
:xt/valid-to end-of-time-zdt
:xt/valid-to tt2
:xt/system-from tt1
:xt/system-to tt2}
:xt/system-to end-of-time-zdt}

replaced-v0-doc {:xt/id :doc, :version 0
:xt/valid-from tt1
:xt/valid-to tt2
:xt/system-from tt2
:xt/system-to end-of-time-zdt}
:xt/valid-from tt2
:xt/valid-to end-of-time-zdt
:xt/system-from tt1
:xt/system-to tt2}

v1-doc {:xt/id :doc, :version 1
:xt/valid-from tt2
:xt/valid-to end-of-time-zdt
:xt/system-from tt2
:xt/system-to end-of-time-zdt}]

;; TODO nil system-to #2655
(t/is (= #{(assoc replaced-v0-doc :xt/system-to nil)
(assoc v1-doc :xt/system-to nil)}
(t/is (= #{original-v0-doc v1-doc}
(set (tu/query-ra '[:scan {:table xt_docs}
[xt/id version
xt/valid-from xt/valid-to
Expand Down
6 changes: 3 additions & 3 deletions src/test/clojure/xtdb/indexer_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
:xt/valid-from (util/->zdt tt)
:xt/valid-to (util/->zdt util/end-of-time)
:xt/system-from (util/->zdt tt)
:xt/system-to nil}]
:xt/system-to (util/->zdt util/end-of-time)}]
(tu/query-ra '[:scan {:table xt_docs}
[xt/id version
xt/valid-from, xt/valid-to
Expand All @@ -190,14 +190,14 @@
(let [{tt2 :system-time} (xt/submit-tx node [[:put :xt_docs {:xt/id :foo, :version 1}]]
{:default-all-valid-time? false})]
(t/is (= #{{:xt/id :foo, :version 0,
:xt/valid-from (util/->zdt tt)
:xt/valid-from (util/->zdt tt2)
:xt/valid-to (util/->zdt util/end-of-time)
:xt/system-from (util/->zdt tt)
:xt/system-to (util/->zdt tt2)}
{:xt/id :foo, :version 0,
:xt/valid-from (util/->zdt tt)
:xt/valid-to (util/->zdt tt2)
:xt/system-from (util/->zdt tt2)
:xt/system-from (util/->zdt tt)
:xt/system-to (util/->zdt util/end-of-time)}
{:xt/id :foo, :version 1,
:xt/valid-from (util/->zdt tt2)
Expand Down
2 changes: 1 addition & 1 deletion src/test/clojure/xtdb/operator/scan_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
(t/is (= #{{:xt/valid-from (util/->zdt tt)
:xt/valid-to (util/->zdt util/end-of-time)
:xt/system-from (util/->zdt tt),
:xt/system-to nil}}
:xt/system-to (util/->zdt util/end-of-time)}}
(set (tu/query-ra '[:scan {:table xt_docs}
[xt/valid-from xt/valid-to
xt/system-from xt/system-to]]
Expand Down
3 changes: 2 additions & 1 deletion src/test/clojure/xtdb/operator_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@
(t/is (= #{"tx1" "tx2"}
(q '{xt$system_from (<= xt$system_from ?system-time2)})))

(t/is (= #{"tx1" "tx2"}
;; this test depends on how one cuts rectangles
(t/is (= #{"tx2"} #_#{"tx1" "tx2"}
(q '{xt$system_from (> xt$system_from ?system-time1)})))

(t/is (= #{}
Expand Down
Loading

0 comments on commit ba6cfbd

Please sign in to comment.