Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
skylee03 committed Oct 28, 2023
1 parent 8d1b95d commit 3767995
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions test/zero_one/geni/data_sources_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
(g/dtypes dummy-df) => {:coord "ArrayType(DoubleType,true)"
:prop "MapType(StringType,StringType,true)"
:rooms (str "StructType("
"StructField(rooms,LongType,true), "
"StructField(rooms,LongType,true),"
"StructField(bathroom,DoubleType,true))")})
(fact "correct direct schema option"
(-> (g/read-parquet!
Expand All @@ -46,7 +46,7 @@
g/dtypes) => {:coord "ArrayType(LongType,true)"
:prop "MapType(StringType,StringType,true)"
:rooms (str "StructType("
"StructField(rooms,IntegerType,true), "
"StructField(rooms,IntegerType,true),"
"StructField(bathroom,FloatType,true))")})
(fact "correct data-oriented schema option"
(-> (g/read-parquet!
Expand All @@ -57,7 +57,7 @@
g/dtypes) => {:coord "ArrayType(ShortType,true)"
:prop "MapType(StringType,StringType,true)"
:rooms (str "StructType("
"StructField(rooms,FloatType,true), "
"StructField(rooms,FloatType,true),"
"StructField(bathroom,LongType,true))")})))

(facts "On binary data" :binary
Expand Down
10 changes: 5 additions & 5 deletions test/zero_one/geni/dataset_creation_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@
[(g/row (g/row 27 42))
(g/row (g/row 57 18))]
{:coord {:x :int :y :int}}))
=> {:coord "StructType(StructField(x,IntegerType,true), StructField(y,IntegerType,true))"})
=> {:coord "StructType(StructField(x,IntegerType,true),StructField(y,IntegerType,true))"})
(fact "of struct array fields"
(g/dtypes
(g/create-dataframe
@tr/spark
[(g/row [(g/row 27 42)])
(g/row [(g/row 57 18)])]
{:coords [{:x :int :y :int}]}))
=> {:coords "ArrayType(StructType(StructField(x,IntegerType,true), StructField(y,IntegerType,true)),true)"}))
=> {:coords "ArrayType(StructType(StructField(x,IntegerType,true),StructField(y,IntegerType,true)),true)"}))

(facts "On building blocks"
(fact "can instantiate vectors"
Expand Down Expand Up @@ -266,7 +266,7 @@
(instance? Dataset dataset) => true
(g/column-names dataset) => ["a" "b"]
(g/dtypes dataset) => {:a "LongType"
:b "StructType(StructField(z,ArrayType(StringType,true),true), StructField(y,BooleanType,true))"}))
:b "StructType(StructField(z,ArrayType(StringType,true),true),StructField(y,BooleanType,true))"}))
(fact "should create the right schema for list of maps"
(let [dataset (g/table->dataset
@tr/spark
Expand All @@ -276,7 +276,7 @@
(instance? Dataset dataset) => true
(g/column-names dataset) => ["a" "b"]
(g/dtypes dataset) => {:a "LongType"
:b "ArrayType(StructType(StructField(z,LongType,true), StructField(y,DoubleType,true)),true)"}))
:b "ArrayType(StructType(StructField(z,LongType,true),StructField(y,DoubleType,true)),true)"}))
(fact "should create the right schema for list of list of maps"
(let [dataset (g/table->dataset
@tr/spark
Expand All @@ -286,7 +286,7 @@
(instance? Dataset dataset) => true
(g/column-names dataset) => ["a" "b"]
(g/dtypes dataset) => {:a "LongType"
:b "ArrayType(ArrayType(StructType(StructField(z,LongType,true), StructField(y,BooleanType,true)),true),true)"})))
:b "ArrayType(ArrayType(StructType(StructField(z,LongType,true),StructField(y,BooleanType,true)),true),true)"})))

(facts "On spark range"
(fact "should create simple datasets"
Expand Down
2 changes: 1 addition & 1 deletion test/zero_one/geni/rdd_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
(rdd/resources) => {}
(rdd/spark-home) => (System/getenv "SPARK_HOME")
(rdd/sc) => (partial instance? SparkContext)
(rdd/version) => "3.1.1"))
(rdd/version) => "3.3.3"))

(facts "On repartitioning" :rdd
(fact "partition-by works"
Expand Down
8 changes: 4 additions & 4 deletions test/zero_one/geni/sql_functions_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
:to-2 (g/to-json (g/struct {:time (g/to-timestamp (g/lit "2015-08-26") "yyyy-MM-dd")})
{:timestampFormat "dd/MM/yyyy"})})
g/collect
first) => {:schema-1 "ARRAY<STRUCT<`col`: BIGINT>>"
:schema-2 "ARRAY<STRUCT<`col`: BIGINT>>"
first) => {:schema-1 "ARRAY<STRUCT<col: BIGINT>>"
:schema-2 "ARRAY<STRUCT<col: BIGINT>>"
:from-1 {:a 1 :b 0.8}
:from-2 {:time (Timestamp. 1440547200000)}
:to-1 "{\"a\":1,\"b\":2}"
Expand All @@ -44,8 +44,8 @@
:to-2 (g/to-csv (g/struct {:time (g/to-timestamp (g/lit "2015-08-26") "yyyy-MM-dd")})
{:timestampFormat "dd/MM/yyyy"})})
g/collect
first) => {:schema-1 "STRUCT<`_c0`: INT, `_c1`: STRING>"
:schema-2 "STRUCT<`_c0`: INT, `_c1`: STRING>"
first) => {:schema-1 "STRUCT<_c0: INT, _c1: STRING>"
:schema-2 "STRUCT<_c0: INT, _c1: STRING>"
:from-1 {:a 1 :b 0.8}
:from-2 {:time (Timestamp. 1440547200000)}
:to-1 "1,2"
Expand Down

0 comments on commit 3767995

Please sign in to comment.