【发布时间】:2021-06-10 00:45:37
【问题描述】:
我有一个稍作修改的 AWS Glue 作业,仅更改了读取,作业运行良好,但我的列上的数据类型已更改。我以前有 BigInt,现在我只有 Ints。这会导致依赖于这些文件的 EMR 作业由于架构不匹配而出错。我不确定是什么导致了这个问题,因为映射没有改变,所以如果有人有洞察力,那就是旧代码和新代码:
///OLD
val inputsourceDF = spark.read.format("json").load(inputFilePath)
val inputsource = DynamicFrame(inputsourceDF, glueContext)
///NEW
val inputsource = glueContext.getSourceWithFormat(connectionType = "s3", options = JsonOptions(Map("paths" -> Set(inputFilePath))), format = "json", transformationContext = "inputsource").getDynamicFrame()
///WRITE which did not change
val inputsink = glueContext.getSinkWithFormat(connectionType = "s3", options = JsonOptions(s"""{"path": "$inputOutputFilePath"}"""), transformationContext = "inputdatasink", format = "parquet").writeDynamicFrame(inputdropnullfields.coalesce(inputPartitionCount))
这些是在粘合作业之后爬取文件时创建的表
CREATE EXTERNAL TABLE `input_new`(`id` int)
CREATE EXTERNAL TABLE `input_old`(`id` bigint)
我们添加了此更改,以便我们可以使用书签,我们将不胜感激。
【问题讨论】:
标签: scala aws-glue aws-glue-spark