首页 > 解决方案 > 数据流作业+大查询

问题描述

我有以下问题:我有一个使用以下方案的大查询:

cpf: string
name: string
greaterOfAge: boolean
foreigner: boolean

我有一个 pub/sub 来发送消息,与一个使用非常简单的 UDF 函数的 DataFlow Job 对齐。仅当用户是外国人时才计算成人的价值:

function transform(inJson) {
  var obj = JSON.parse(inJson);

  var output = {
    "cpf": obj.cpf,
    "nome": obj.nome,
    "greaterOfAge": true,
    "foreigner": true
  }
return output;
}

当我通过我的 PubSub 发布此消息时:

"cpf": "123456–789",
"nome": "Alan Turing",
"age": 20,
"origem": "Inglaterra"

但我收到此错误:

{"errors":[{"debugInfo":"","location":"origem","message":"no such field: origem.","reason":"invalid"}],"index":0}

我使用这篇文章作为参考: https ://inside.contabilizei.com.br/streaming-de-dados-com-google-cloud-dataflow-1cd6aa69bae8

标签: google-bigquerygoogle-cloud-functionsgoogle-cloud-dataflowpublish-subscribe

解决方案


推荐阅读