You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Benchao Li (Jira)" <ji...@apache.org> on 2023/12/06 16:15:00 UTC

[jira] [Commented] (CALCITE-6048) 'CIRCULAR REFERENCE' exception is throwed in ServerTest#testTruncateTable method

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

Benchao Li commented on CALCITE-6048:
-------------------------------------

I think I have figured out the reason behind this, in [ReflectUtil|https://github.com/apache/calcite/blob/d3ab0bc8e4d4c9ebc0fc4e33ce478d276f5d11e4/core/src/main/java/org/apache/calcite/util/ReflectUtil.java#L450-L464], there is indeed a multi-threading issue:

{code:java}
        Method method = map.get(key);
        if (method == null) {
          if (map.containsKey(key)) { // The problem happens when another thread put a non null object, but here we'll return null.
            // We already looked for the method and found nothing.
          } else {
            method =
                ReflectUtil.lookupVisitMethod(
                    visitorClass,
                    visiteeClass,
                    visitMethodName,
                    additionalParameterTypes);
            map.put(key, method);
          }
        }
        return method;
{code}

I'll open a PR to fix this.


> 'CIRCULAR REFERENCE' exception is throwed in ServerTest#testTruncateTable method
> --------------------------------------------------------------------------------
>
>                 Key: CALCITE-6048
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6048
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: LakeShen
>            Priority: Major
>         Attachments: image-2023-10-12-19-24-44-297.png
>
>
> When I submit my pr,and there is a pipeline job's exception,the exception stack is :
> {code:java}
> java.sql.SQLException: Error while executing SQL "create table t (i int not null)": Method not found: execute([class org.apache.calcite.sql.SqlNode, interface org.apache.calcite.jdbc.CalcitePrepare$Context])
>         at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
>         at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
>         at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:164)
>         at org.apache.calcite.avatica.AvaticaStatement.execute(AvaticaStatement.java:218)
>         at org.apache.calcite.test.ServerTest.testTruncateTable(ServerTest.java:283)
>         Next exception 1: [CIRCULAR REFERENCE SQLException]
>         Next exception 2: java.lang.IllegalArgumentException: Method not found: execute([class org.apache.calcite.sql.SqlNode, interface org.apache.calcite.jdbc.CalcitePrepare$Context])
>             at org.apache.calcite.util.ReflectUtil$2.lookupMethod(ReflectUtil.java:565)
>             at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:529)
>             at org.apache.calcite.server.DdlExecutorImpl.executeDdl(DdlExecutorImpl.java:41)
>             at org.apache.calcite.prepare.CalcitePrepareImpl.executeDdl(CalcitePrepareImpl.java:372)
>             at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:653)
>             at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:519)
>             at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:487)
>             at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:236)
>             at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:702)
>             at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:677)
>             at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:157)
>             ... 2 more
>         Caused by: [CIRCULAR REFERENCE IllegalArgumentException] {code}
> The complete exception could see:
> !image-2023-10-12-19-24-44-297.png|width=1222,height=559!
> This looks like a multithreading Bug, but I'm not sure.
> The pipeline job link:https://ci-builds.apache.org/blue/organizations/jenkins/Calcite%2FCalcite-sonar/detail/PR-3465/1/pipeline/



--
This message was sent by Atlassian Jira
(v8.20.10#820010)