ZetaSQL Sample Using Apache beam

一曲冷凌霜 提交于 2020-01-25 06:46:05

问题


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)


回答1:


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.



来源:https://stackoverflow.com/questions/58390236/zetasql-sample-using-apache-beam

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!