techascent / tech.ml.dataset

A Clojure high performance data processing system
Eclipse Public License 1.0
680 stars 35 forks source link

`print-all` is busted #346

Closed harold closed 1 year ago

harold commented 1 year ago
user> (tech.v3.dataset/->dataset [{:a 1}])
_unnamed [1 1]:

| :a |
|---:|
|  1 |
user> (tech.v3.dataset/print-all (tech.v3.dataset/->dataset [{:a 1}]))
Error printing return value at ham-fisted.impl/eval10376$fn (impl.clj:289).
Item is not iterable: class clojure.lang.Keyword

I think the assumption here that everything is a long is suspect, but perhaps I'm misunderstanding.

https://github.com/techascent/tech.ml.dataset/blob/7006f01241e4c5cc6b0754eda6ea8dc265d5541b/src/tech/v3/dataset/print.clj#L214-L219

harold commented 1 year ago

Added a failing test:

$ ./scripts/run-tests 

...

Testing tech.v3.dataset-test

ERROR in (print-all-test) (impl.clj:289)
expected: (> (count (with-out-str (println (ds/print-all ds)))) 1000)
09:37:09.412 [main] WARN tech.v3.dataset.missing - Column has no values and strategy (:value) is dependent upon existing values
  actual: java.lang.RuntimeException: Item is not iterable: class clojure.lang.Keyword
 at ham_fisted.impl$eval2066$fn__2070.invoke (impl.clj:289)
    ham_fisted.protocols$eval1019$fn__1031$G__1010__1036.invoke (protocols.clj:11)
    ham_fisted.lazy_noncaching$filter.invokeStatic (lazy_noncaching.clj:223)
    ham_fisted.lazy_noncaching$filter.invoke (lazy_noncaching.clj:213)
    tech.v3.dataset.print$dataset_data__GT_str.invokeStatic (print.clj:215)
    tech.v3.dataset.print$dataset_data__GT_str.invoke (print.clj:95)
    tech.v3.dataset.print$dataset__GT_str.invokeStatic (print.clj:321)
    tech.v3.dataset.print$dataset__GT_str.invoke (print.clj:306)
    tech.v3.dataset.print$dataset__GT_str.invokeStatic (print.clj:323)
    tech.v3.dataset.print$dataset__GT_str.invoke (print.clj:306)
    tech.v3.dataset.impl.dataset.Dataset.toString (dataset.clj:416)
    tech.v3.dataset.impl.dataset$eval14072$fn__14073.invoke (dataset.clj:490)
    clojure.lang.MultiFn.invoke (MultiFn.java:234)
    clojure.core$pr_on.invokeStatic (core.clj:3675)
    clojure.core$pr.invokeStatic (core.clj:3678)
    clojure.core$pr.invoke (core.clj:3678)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$prn.invokeStatic (core.clj:3715)
    clojure.core$prn.doInvoke (core.clj:3715)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$println.invokeStatic (core.clj:3734)
    clojure.core$println.doInvoke (core.clj:3734)
    clojure.lang.RestFn.invoke (RestFn.java:408)
    tech.v3.dataset_test$fn__55918$fn__55936.invoke (dataset_test.clj:1575)
    tech.v3.dataset_test$fn__55918.invokeStatic (dataset_test.clj:1575)
    tech.v3.dataset_test/fn (dataset_test.clj:1571)
...
harold commented 1 year ago

:clap: