Scala 无框架反序列化.map函数拒绝运行
我使用Typelevel无框架库将强类型数据集引入到一些遗留代码中,这些代码以前使用它时没有任何问题。我正在使用0.4.1版本的无框架,使用Spark 2.2,并在EMR上运行代码,与Hive DB交互。我尝试运行此代码,但在TypedDataset上运行Scala 无框架反序列化.map函数拒绝运行,scala,apache-spark,amazon-emr,frameless,Scala,Apache Spark,Amazon Emr,Frameless,我使用Typelevel无框架库将强类型数据集引入到一些遗留代码中,这些代码以前使用它时没有任何问题。我正在使用0.4.1版本的无框架,使用Spark 2.2,并在EMR上运行代码,与Hive DB交互。我尝试运行此代码,但在TypedDataset上运行反序列化.map似乎没有执行,并通过将数据集中的数据全部设置为null使其无效。我认为编码器有问题,但同一块中的过滤器功能似乎运行良好: def generate( combinedDS: TypedDataset[MyDataClas
反序列化.map
似乎没有执行,并通过将数据集中的数据全部设置为null使其无效。我认为编码器有问题,但同一块中的过滤器
功能似乎运行良好:
def generate(
combinedDS: TypedDataset[MyDataClass],
isControl: Boolean
): TypedDataset[MyMappedDataClass] = {
val filteredCombinedDS = combinedDS.filter(combinedDS('is_control) === isControl)
println(s"After filter count: ${filteredCombinedDS.count().run()}") // count is 1000
println("after the combined: ")
filteredCombinedDS.show(6).run() // runs fine, shows valid rows/columns with data present
val resultDS = filteredCombinedDS.deserialized.map { row =>
throw new Exception(s"Error out on the first row, show me the row: ${row}") // never occurs
// ... simple 1 to 1 mappings extract some fields in MyDataClass to a MyMappedDataClass
//it returns the same numbers of rows that filteredCombinedDS has
// but all rows/columns are just filled with nulls
MyMappedDataClass(
row.is_control,
row.customerId,
// etc...
)
}
println(s"Count after map: ${resultDS.count().run()}") // count is 1000
resultDS.show(6).run() // runs, shows schema of MyMappedDataClass, but all rows/columns have 'null' values
resultDS
}
有人知道是什么导致map
函数跳过运行吗?我甚至试图强制在map
函数本身中抛出一个异常,只是为了证明它没有运行。什么会导致地图的部分被掩盖