[ 
https://issues.apache.org/jira/browse/CALCITE-4523?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Hyde closed CALCITE-4523.
--------------------------------
    Fix Version/s: 1.26.0
       Resolution: Not A Problem

[~bmaquet], That explains it. Thank you for closing the loop: it will help 
people who may hit this issue in future. I am going to close this case as "Not 
a problem" because it's not something we can fix.

For anyone else who hits this problem, I suggest the following workaround. When 
you include Spark (via Maven or Gradle dependencies or whatever), be sure to 
exclude the version of Calcite that Spark depends upon.

> 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
>             Fix For: 1.26.0
>
>
> 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)

Reply via email to