-
Notifications
You must be signed in to change notification settings - Fork 78
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
ClassCastException when presenting tech.v3.dataset
#677
Comments
This seems to be a smaller repro of what's going wrong: (def ds
(let [ds (tech.v3.dataset/mapseq-parser)]
(doseq [x (for [i (range 100)]
{:x i
:y (java.time.Instant/now)})]
(ds x))
(ds)))
(into [] (take 3) (:x ds)) ;; works
(into [] (take 3) (:y ds)) ;; throws ClassCastException I don't know enough about |
Maybe the reduce from |
Here is a more minimal repro, and a workaround: user> (require '[tech.v3.dataset :as ds])
nil
user> (import 'java.time.Instant)
java.time.Instant
user> (def ds (ds/->dataset {:x (range 5) :y (repeatedly 5 #(java.time.Instant/now))}))
#'user/ds
user> ds
_unnamed [5 2]:
| :x | :y |
|---:|-----------------------------|
| 0 | 2024-08-29T15:54:57.987431Z |
| 1 | 2024-08-29T15:54:57.988432Z |
| 2 | 2024-08-29T15:54:57.988455Z |
| 3 | 2024-08-29T15:54:57.988458Z |
| 4 | 2024-08-29T15:54:57.988461Z |
user> (take 3 (:x ds))
(0 1 2)
user> (take 3 (:y ds))
(#object[java.time.Instant 0xf3f2e65 "2024-08-29T15:54:57.987431Z"]
#object[java.time.Instant 0x10dd3c7 "2024-08-29T15:54:57.988432Z"]
#object[java.time.Instant 0x1ff353ba "2024-08-29T15:54:57.988455Z"])
user> (into [] (take 3) (:x ds))
[0 1 2]
user> (into [] (take 3) (:y ds))
Execution error (ClassCastException) at user/eval59642 (form-init362550846257869959.clj:43).
class clojure.lang.Reduced cannot be cast to class clojure.lang.ITransientCollection (clojure.lang.Reduced and clojure.lang.ITransientCollection are in unnamed module of loader 'app')
user> (into [] (take 3) (vec (:y ds)))
[#object[java.time.Instant 0x6e058d1e "2024-08-29T15:54:57.987431Z"]
#object[java.time.Instant 0x6bb8eb57 "2024-08-29T15:54:57.988432Z"]
#object[java.time.Instant 0x59e0600a "2024-08-29T15:54:57.988455Z"]] You can log this in https://github.com/techascent/tech.ml.dataset if you'd like. |
Thanks @harold, I've opened the attached issue using your smaller repro. |
👍 - nice, thanks! Could be a good bug. |
full repro at https://github.com/pieterbreed/clerk-dataset-repro by @pieterbreed
Also reported on Clojurians slack https://clojurians.slack.com/archives/C035GRLJEP8/p1724429010102259
The text was updated successfully, but these errors were encountered: