Skip to content

Commit

Permalink
Fixes #174
Browse files Browse the repository at this point in the history
  • Loading branch information
cnuernber committed Nov 24, 2020
1 parent 029e3c5 commit 4cb1cb3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/uuid_arrow.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/Rscript

library(dplyr)
library(arrow)
library(uuid)

df=data_frame(uuids=rep(UUIDgenerate(), 10))

arrow::write_ipc_stream(df, "test/data/uuid.arrow")
1 change: 1 addition & 0 deletions src/tech/v3/libs/arrow/schema.clj
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
(ft-fn (.getIndexType encoding) encoding)
;;If no encoding is provided then just save the string as text
(ft-fn (ArrowType$Utf8.)))
:uuid (ft-fn (ArrowType$Utf8.))
:text (ft-fn (ArrowType$Utf8.))
:encoded-text (ft-fn (ArrowType$Utf8.))))))

Expand Down
18 changes: 18 additions & 0 deletions test/tech/v3/libs/arrow_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,24 @@
(vec (first (ds/columns inp-data)))))))


(deftest uuid-test
(try
(let [uuid-ds (ds/->dataset "test/data/uuid.parquet"
{:parser-fn {"uuids" :uuid}})
_ (arrow/write-dataset-to-stream! uuid-ds "test-uuid.arrow")
copying-ds (arrow/read-stream-dataset-copying "test-uuid.arrow")
inplace-ds (arrow/read-stream-dataset-inplace "test-uuid.arrow")]
(is (= :text ((comp :datatype meta) (copying-ds "uuids"))))
(is (= :text ((comp :datatype meta) (inplace-ds "uuids"))))
(is (= (vec (copying-ds "uuids"))
(vec (inplace-ds "uuids"))))
(is (= (mapv str (uuid-ds "uuids"))
(mapv str (copying-ds "uuids")))))
(finally
(.delete (java.io.File. "test-uuid.arrow")))))



(comment

(deftest big-arrow-text
Expand Down

0 comments on commit 4cb1cb3

Please sign in to comment.