使用Apache Beam的ZetaSQL示例 [英] ZetaSQL Sample Using Apache beam

查看:330
本文介绍了使用Apache Beam的ZetaSQL示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Apache Beam Framework(2.17.0-SNAPSHOT)中使用ZetaSQL时遇到问题.在查看了Apache梁的文档后,我找不到ZetaSQL的任何示例.

我尝试添加计划器: options.setPlannerName("org.apache.beam.sdk.extensions.sql.zetasql.ZetaSQLQueryPlanner");

但是仍然存在问题,下面添加了摘录以寻求帮助.

    ```
    String sql =
                    "SELECT CAST (1243 as INT64), "
                        + "CAST ('2018-09-15 12:59:59.000000+00' as TIMESTAMP), "
                        + "CAST ('string' as STRING);";

      ZetaSQLQueryPlanner zetaSQLQueryPlanner = new ZetaSQLQueryPlanner();
            BeamRelNode beamRelNode = zetaSQLQueryPlanner.convertToBeamRel(sql);
            PCollection<Row> stream = BeamSqlRelUtils.toPCollection(p, beamRelNode);
    p.run();

我了解我们需要以下代码段,但未能创建配置 Frameworks.newConfigBuilder()

在运行代码时,我发现以下异常:

    Exception in thread "main" java.util.ServiceConfigurationError: com.google.zetasql.ClientChannelProvider: Provider com.google.zetasql.JniChannelProvider could not be instantiated
        at java.util.ServiceLoader.fail(Unknown Source)
        at java.util.ServiceLoader.access$100(Unknown Source)
        at java.util.ServiceLoader$LazyIterator.nextService(Unknown Source)


解决方案

更新:自2020年6月23日起,Mac OS上也支持Beam ZetaSQL(并非所有版本,但至少是最新版本)!

====

我认为这与您的操作系统有关. Beam是一个统一的框架,但是您的例外情况是从其依赖项开始的:ZetaSQL解析器.如果您更改为较新版本的linux,我认为您的代码段应该可以使用.

I am Facing Issues while Using ZetaSQL in Apache beam Framework (2.17.0-SNAPSHOT). After Going through documentation of the apache beam I am not able to find any sample for ZetaSQL.

I tried to add the Planner: options.setPlannerName("org.apache.beam.sdk.extensions.sql.zetasql.ZetaSQLQueryPlanner");

But Still Facing Issue, Snippet is added below for help.

    ```
    String sql =
                    "SELECT CAST (1243 as INT64), "
                        + "CAST ('2018-09-15 12:59:59.000000+00' as TIMESTAMP), "
                        + "CAST ('string' as STRING);";

      ZetaSQLQueryPlanner zetaSQLQueryPlanner = new ZetaSQLQueryPlanner();
            BeamRelNode beamRelNode = zetaSQLQueryPlanner.convertToBeamRel(sql);
            PCollection<Row> stream = BeamSqlRelUtils.toPCollection(p, beamRelNode);
    p.run();

I Understand we need the below Snippet but failed to create the config Frameworks.newConfigBuilder()

and while Running Code I found below Exceptions:

    Exception in thread "main" java.util.ServiceConfigurationError: com.google.zetasql.ClientChannelProvider: Provider com.google.zetasql.JniChannelProvider could not be instantiated
        at java.util.ServiceLoader.fail(Unknown Source)
        at java.util.ServiceLoader.access$100(Unknown Source)
        at java.util.ServiceLoader$LazyIterator.nextService(Unknown Source)


解决方案

Update: as of 06/23/2020, Beam ZetaSQL is supported on Mac OS as well (not all versions but at least most recent ones)!

====

I think it is related to your OS. Beam is as unified framework but your exception looks from its dependency: ZetaSQL parser. If you change to a newer version of linux I think your code snippet should work.

这篇关于使用Apache Beam的ZetaSQL示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆