Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
FiV0 committed Jul 14, 2023
1 parent 77f357f commit 043dc6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/xtdb/trie/ArrowHashTrie.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public Branch(int branchVecIdx) {

public Node[] getChildren() {
return IntStream.range(branchVec.getElementStartIndex(branchVecIdx), branchVec.getElementEndIndex(branchVecIdx))
.mapToObj(childIdx -> forIndex(branchElVec.get(childIdx)))
.toArray(Node[]::new);
.mapToObj(childIdx -> branchElVec.isNull(childIdx) ? null : forIndex(branchElVec.get(childIdx)))
.toArray(Node[]::new);
}

@Override
Expand Down
11 changes: 7 additions & 4 deletions src/test/clojure/xtdb/indexer/live_index_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
(deftype LiveTrieRenderer [^ValueVector iid-vec]
LiveTrie$NodeVisitor
(visitBranch [this branch]
(into [] (mapcat #(.accept ^LiveTrie$Node % this)) (.children branch)))
(into [] (mapcat #(some-> ^LiveTrie$Node % (.accept this))) (.children branch)))

(visitLeaf [_ leaf]
(mapv #(vec (.getObject iid-vec %)) (.data leaf))))
Expand All @@ -38,7 +38,7 @@
^:unsychronized-mutable ^int current-page-idx]
ArrowHashTrie$NodeVisitor
(visitBranch [this branch]
(mapcat #(.accept ^ArrowHashTrie$Node % this) (.getChildren branch)))
(mapcat #(some-> ^ArrowHashTrie$Node % (.accept this)) (.getChildren branch)))

(visitLeaf [_ leaf]
;; would be good if ArrowFileReader accepted a page-idx...
Expand All @@ -52,8 +52,11 @@
^ILiveIndex live-index :xtdb.indexer/live-index
^ObjectStore obj-store :xtdb.object-store/memory-object-store} tu/*sys*

iids (let [rnd (Random. 0)]
(repeatedly 12000 #(UUID. (.nextLong rnd) (.nextLong rnd))))
iids (let [uuid (random-uuid)]
(repeat 12000 uuid))

#_(let [rnd (Random. 0)]
(repeatedly 12000 #(UUID. (.nextLong rnd) (.nextLong rnd))))

iid-bytes (->> (sort-by #(.getMostSignificantBits ^UUID %) #(Long/compareUnsigned %1 %2) iids)
(mapv (comp vec util/uuid->bytes)))]
Expand Down

0 comments on commit 043dc6e

Please sign in to comment.