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

ClassCastException on column-cast when "NaN" is present #229

Closed
hjrnunes opened this issue Apr 9, 2021 · 1 comment
Closed

ClassCastException on column-cast when "NaN" is present #229

hjrnunes opened this issue Apr 9, 2021 · 1 comment

Comments

@hjrnunes
Copy link

hjrnunes commented Apr 9, 2021

Following test passes fine:

(deftest column-cast-test-cce-ok
  (let [ds (ds/->dataset {:col1 [1 2 3 "NONE"]} {:parser-fn :string})]
    (is (= [1.0 2.0 3.0]
           (->> (ds/column-cast ds :col1 [:float64 :relaxed?])
                (#(ds/column % :col1))
                (take 3)
                (vec))))))

This one fails:

(deftest column-cast-test-cce-fail
  (let [ds (ds/->dataset {:col1 [1 2 3 "NaN"]} {:parser-fn :string})]
    (is (= [1.0 2.0 3.0]
           (->> (ds/column-cast ds :col1 [:float64 :relaxed?])
                (#(ds/column % :col1))
                (take 3)
                (vec))))))

with

java.lang.ClassCastException: class clojure.lang.Keyword cannot be cast to class java.lang.Number (clojure.lang.Keyword is in unnamed module of loader 'app'; java.lang.Number is in module java.base of loader 'bootstrap')
 at clojure.lang.RT.doubleCast (RT.java:1356)
    tech.v3.datatype.DoubleBuffer.writeObject (DoubleBuffer.java:46)
    tech.v3.datatype.list.ListImpl.addObject (list.clj:123)
    tech.v3.dataset.io.column_parsers.FixedTypeParser.add_value_BANG_ (column_parsers.clj:212)
    tech.v3.dataset.column$parse_column.invokeStatic (column.clj:137)
...

The Keyword is :tech.ml.dataset.parse/missing

As far as I can see, this is specific to "NaN" e.g. "NAN" works.

@hjrnunes
Copy link
Author

hjrnunes commented Apr 9, 2021

Test passes on 4.02

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant