Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[invalidator] fix topic error from date insert #659

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion server/src/instant/db/model/triple.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
[instant.util.string :refer [multiline->single-line]]
[instant.util.tracer :as tracer])
(:import
(java.util UUID)))
(java.util UUID)
(java.time Instant)))

;; (XXX): Currently we allow value to be nil
;; In the future, we may want to _retract_ the triple if the value is nil
Expand Down Expand Up @@ -706,3 +707,9 @@
(inc i)))))))
(tracer/add-data! {:attributes {:total-count @row-count}})
{:row-count @row-count})))

(defn parse-date-value [x]
(cond (string? x)
(Instant/parse x)
(number? x)
(Instant/ofEpochMilli x)))
10 changes: 7 additions & 3 deletions server/src/instant/reactive/invalidator.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
[instant.reactive.store :as rs]
[instant.util.async :as ua]
[instant.util.json :refer [<-json]]
[instant.util.tracer :as tracer])
[instant.util.tracer :as tracer]
[instant.db.model.triple :as triple-model])
(:import (java.util UUID)))

(declare wal-opts)
Expand Down Expand Up @@ -43,10 +44,13 @@
e (UUID/fromString (:entity_id m))
a (UUID/fromString (:attr_id m))
v-parsed (<-json (:value m))
v (if (:eav m)
v (cond
(:eav m)
(UUID/fromString v-parsed)
(= (:checked_data_type m) "date")
(triple-model/parse-date-value v-parsed)
:else
v-parsed)

ks (->> #{:ea :eav :av :ave :vae}
(filter m))]
(map (fn [k] [k #{e} #{a} #{v}])
Expand Down
Loading