我正在尝试将avro文件从谷歌存储加载到大查询表但面临这些问题 . 我遵循的步骤如下 .

  • 在spark中创建一个数据框 .

  • 通过将这些数据写入avro来存储这些数据 .

dataframe.write.avro( “路径”)

  • 将这些数据加载到谷歌存储中 .

  • 尝试使用以下命令将数据加载到google bigquery中

bq --nosync load --autodetect --source_format AVRO datasettest.testtable gs://test/avrodebug/*.avro

此命令导致出现此错误 .

读取数据时出错,错误消息:Apache Avro库无法读取带有以下错误的数据:无法解析:"long" with "int"

所以我甚至尝试通过指定架构来使用此命令 . bq --nosync load --source_format AVRO datasettest.testtable gs://test/avrodebug/*.avro C1:STRING,C2:STRING,C3:STRING,C4:STRING,C5:STRING,C6:INTEGER,C7:INTEGER ,C8:INTEGER,C9:STRING,C10:STRING,C11:STRING

这里我只有C6,C7和C8具有整数值 . 即使这也给出了相同的先前错误 .

Is there any reason why i am getting error for long to int instead of long to INTEGER

Please let me know is there any way to load these data by casting it.