0

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)

BackBenChers
  • 304
  • 2
  • 15
  • Hello! What's your OS? ZetaSQL does not work on Mac and very old version of Linux. – Rui Wang Oct 28 '19 at 16:50
  • Hi, @RuiWang Since Apache Beam is Unified Framework its does not matter. I want to use ZetaSQL Planner instead of Calcite in Beam SQL Code. Since Like for Calcite we have an Example similary is there any ref. for ZetaSQL Planner. – BackBenChers Oct 29 '19 at 16:57
  • I am commenting for your specific exception because I suspect it is related to your OS. Beam is as unified framework but your exception looks from its dependency: ZetaSQL parser. – Rui Wang Oct 29 '19 at 20:36
  • 1
    If you change to a newer version of linux I think your code snippet should work. – Rui Wang Oct 29 '19 at 22:18
  • @BackBenChers, would you mind to let us know if the suggestion made by Rui Wang worked for you? Thanks! – Albert Albesa Nov 22 '19 at 11:01
  • @AlbertAlbesa Sorry for Delayed Response but yes I tried Rui Solution and it worked. – BackBenChers Nov 22 '19 at 11:21
  • Cool! Could you please then @RuiWang post your proposal as an answer? That way it can be registered as a solution! – Albert Albesa Nov 22 '19 at 13:49
  • Glad it worked. Post my comment as an answer. – Rui Wang Nov 22 '19 at 21:28

1 Answers1

1

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.

Rui Wang
  • 789
  • 6
  • 11