如何由于Apache Beam Java SDK中的错误而找到被拒绝的文件

发布于 2025-02-04 07:31:53 字数 131 浏览 7 评论 0原文

我有要处理的相同类型文件的n我将提供通配符输入模式(c:\\ users \\*\\*\\*)。 因此,现在我如何找到文件名和记录,这些文件名和记录已被拒绝在Java中的BigQuery时。

I Have N number of same type files to be processed and I will be giving a wildcard input pattern(C:\\users\\*\\*).
So now how do I find the file name and record ,that has been rejected while uploading to bigquery in java.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

三寸金莲 2025-02-11 07:31:53

我猜BQ将您传递到管道而不到本地的临时位置路径(老实说不确定)。

在我的情况下,使用Python,我曾经以GCS存储桶的形式将TMP位置传递给我,当我显示错误时,它们通常显示包含命令行日志中拒绝错误的日志文件的名称。

然后我使用gsutil cp命令将其复制到我的本地计算机并阅读

I guess BQ writes to the temp location path that you pass to your pipeline and not to local [honestly not sure about this].

In my case, with python, I used to pass tmp location as GCS bucket, and when I error is show, they usually shows the name of the log file that contains the rejected errors in the command line logs.

And then I use gsutil cp command to copy it to my local computer and read it

傾旎 2025-02-11 07:31:53

BigQuery I/O(Java and Python SDK)支持致死模式:

Java

result
      .getFailedInsertsWithErr()
      .apply(
          MapElements.into(TypeDescriptors.strings())
              .via(
                  x -> {
                    System.out.println(" The table was " + x.getTable());
                    System.out.println(" The row was " + x.getRow());
                    System.out.println(" The error was " + x.getError());
                    return "";
                  }));

Python

errors = (
  result['FailedRows']
  | 'PrintErrors' >>
  beam.FlatMap(lambda err: print("Error Found {}".format(err))))

BigQuery I/O (Java and Python SDK) supports deadletter pattern: https://beam.apache.org/documentation/patterns/bigqueryio/.

Java

result
      .getFailedInsertsWithErr()
      .apply(
          MapElements.into(TypeDescriptors.strings())
              .via(
                  x -> {
                    System.out.println(" The table was " + x.getTable());
                    System.out.println(" The row was " + x.getRow());
                    System.out.println(" The error was " + x.getError());
                    return "";
                  }));

Python

errors = (
  result['FailedRows']
  | 'PrintErrors' >>
  beam.FlatMap(lambda err: print("Error Found {}".format(err))))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文