我有一个scala胶水作业,需要进行以下步骤进行贴图。
val applymapping1 = datasource0.applyMapping(mappings = Seq(("seqnum", "long", "seqnum", "long")), caseSensitive = false, transformationContext = "applymapping1")
但是,我想在“ seqnum”,“ long”,“ seqnum”,“ long”的地方传递一个变量,当我尝试时,我不断收到错误提示
Found String, Required Seq[Product].
有人知道如何解决此问题吗?
答案 0 :(得分:0)
当您将字符串作为mapping
而不是Seq
传递字符串时发生错误:
val applymapping1 = datasource0.applyMapping(
mappings = "<string>",
caseSensitive = false,
transformationContext = "applymapping1"
)
但是,在您提供的代码中,它看起来不错并且对我有用:
val applymapping1 = datasource0.applyMapping(
mappings = Seq(("seqnum", "long", "seqnum", "long")),
caseSensitive = false,
transformationContext = "applymapping1"
)
请确保您完全运行此脚本。
更新
可以通过将映射提取到变量中然后在applyMapping
中使用它来完成此操作:
val mapping1 = ("seqnum", "long", "seqnum", "long")
val applymapping1 = datasource0.applyMapping(
mappings = Seq(mapping1),
caseSensitive = false,
transformationContext = "applymapping1"
)