You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "yanjing.wang (Jira)" <ji...@apache.org> on 2021/06/08 02:58:00 UTC

[jira] [Commented] (CALCITE-4523) Using any SqlDialect returns java.lang.NoSuchFieldError: EMPTY_CONTEXT

    [ https://issues.apache.org/jira/browse/CALCITE-4523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17359009#comment-17359009 ] 

yanjing.wang commented on CALCITE-4523:
---------------------------------------

I have tested on scala 2.13.4 with sbt and succeeded, I suggest that you start a brand new project so that you can only test calcite dialect without considering other affections.

> Using any SqlDialect returns java.lang.NoSuchFieldError: EMPTY_CONTEXT
> ----------------------------------------------------------------------
>
>                 Key: CALCITE-4523
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4523
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.26.0
>            Reporter: Benjamin Maquet
>            Priority: Blocker
>
> Hello, 
>  I'm facing an issue with Apache Calcite when trying to use the [different SqlDialect available|https://calcite.apache.org/javadocAggregate/org/apache/calcite/sql/SqlDialect.html].
> I am building a Spark-app in Scala using Maven, so in my pom.xml, I define the Calcite dependency as
>  
>   {{<dependency>}}
>  {{<groupId>org.apache.calcite</groupId>}}
>  {{<artifactId>calcite-core</artifactId>}}
>  {{<version>1.26.0</version>}}
>  {{</dependency>}}
>   
> In my scala app, I import the dialect as {{import org.apache.calcite.sql.dialect.\{PrestoSqlDialect, MysqlSqlDialect, SparkSqlDialect}}}
>  Then, when I want to use a dialect, I write {{val dialect = MysqlSqlDialect.DEFAULT}}. But, this returns the error {{java.lang.NoSuchFieldError: EMPTY_CONTEXT}}
> However, when I used {{val dialect = SqlDialect.DatabaseProduct.MYSQL.getDialect}}, it works fine. (However, it does not work for {{SqlDialect.DatabaseProduct.SPARK.getDialect}} either, for example).
> My issue is that I do not want to use the MySqlDialect but rather the Spark and Presto ones. Unfortunately, both of them return the same error {{java.lang.NoSuchFieldError: EMPTY_CONTEXT}}.
> I don't understand what is happening. I am not defining {{EMPTY_CONTEXT}} anywhere in my own code. It is defined in the Calcite code for every dialect, e.g. [here|https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/dialect/MysqlSqlDialect.java#L73] for MySqlDialect.
> Since I'm using the latest version of Apache Calcite (1.26.0), I should be able to use this code. What am I missing?
> Thanks a mil!
>  
> PS: I have also posted this question on StackOverflow: [https://stackoverflow.com/questions/66457177/using-any-sqldialect-in-apache-calcite-returns-java-lang-nosuchfielderror-empty]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)