forked from pflooky/data-caterer-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdvancedGreatExpectationsPlanRun.scala
39 lines (33 loc) · 1.54 KB
/
AdvancedGreatExpectationsPlanRun.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package io.github.datacatering.plan
import io.github.datacatering.datacaterer.api.PlanRun
import io.github.datacatering.datacaterer.api.model.{DoubleType, IntegerType, TimestampType}
class AdvancedGreatExpectationsPlanRun extends PlanRun {
val greatExpectationsSource = metadataSource.greatExpectations("/opt/app/mount/ge/taxi-expectations.json")
val jsonTask = json("my_json", "/opt/app/data/taxi_json", Map("saveMode" -> "overwrite"))
.schema(
field.name("vendor_id"),
field.name("pickup_datetime").`type`(TimestampType),
field.name("dropoff_datetime").`type`(TimestampType),
field.name("passenger_count").`type`(IntegerType),
field.name("trip_distance").`type`(DoubleType),
field.name("rate_code_id"),
field.name("store_and_fwd_flag"),
field.name("pickup_location_id"),
field.name("dropoff_location_id"),
field.name("payment_type"),
field.name("fare_amount").`type`(DoubleType),
field.name("extra"),
field.name("mta_tax").`type`(DoubleType),
field.name("tip_amount").`type`(DoubleType),
field.name("tolls_amount").`type`(DoubleType),
field.name("improvement_surcharge").`type`(DoubleType),
field.name("total_amount").`type`(DoubleType),
field.name("congestion_surcharge").`type`(DoubleType),
)
.validations(greatExpectationsSource)
.validations(validation.col("trip_distance").lessThan(500))
val conf = configuration
.enableGenerateValidations(true)
.generatedReportsFolderPath("/opt/app/data/report")
execute(conf, jsonTask)
}