You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by xiaobo <gu...@qq.com.INVALID> on 2022/02/11 10:09:32 UTC

cannot be cast to class org.apache.calcite.runtime.FlatLists$ComparableList error

Hi,
Our testing code failed with the following error, can you help with it:


Error while executing SQL "select count(1) 
from p.PRH_PA01
": class com.xsmartware.pbcm.sdk.pbc2p.PRH_PA01 cannot be cast to class org.apache.calcite.runtime.FlatLists$ComparableList (com.xsmartware.pbcm.sdk.pbc2p.PRH_PA01 and org.apache.calcite.runtime.FlatLists$ComparableList are in unnamed module of loader 'app')
&nbsp;&nbsp; &nbsp;at com.xsmartware.javatest.pbc2p.CalciteBaseVarGenerator.generateVariable(CalciteBaseVarGenerator.java:61)
&nbsp;&nbsp; &nbsp;at com.xsmartware.javatest.pbc2p.PBC2PTestRunner.test1(PBC2PTestRunner.java:68)
&nbsp;&nbsp; &nbsp;at com.xsmartware.javatest.pbc2p.PBC2PTestRunner.run(PBC2PTestRunner.java:54)
&nbsp;&nbsp; &nbsp;at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:758)
&nbsp;&nbsp; &nbsp;at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:748)
&nbsp;&nbsp; &nbsp;at org.springframework.boot.SpringApplication.run(SpringApplication.java:309)
&nbsp;&nbsp; &nbsp;at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
&nbsp;&nbsp; &nbsp;at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290)
&nbsp;&nbsp; &nbsp;at com.xsmartware.javatest.JavaTestApplication.main(JavaTestApplication.java:9)
Caused by: java.sql.SQLException: Error while executing SQL "select count(1) 
from p.PRH_PA01
": class com.xsmartware.pbcm.sdk.pbc2p.PRH_PA01 cannot be cast to class org.apache.calcite.runtime.FlatLists$ComparableList (com.xsmartware.pbcm.sdk.pbc2p.PRH_PA01 and org.apache.calcite.runtime.FlatLists$ComparableList are in unnamed module of loader 'app')
&nbsp;&nbsp; &nbsp;at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227)
&nbsp;&nbsp; &nbsp;at com.xsmartware.common.util.SQLUtil.exeGetLong(SQLUtil.java:42)
&nbsp;&nbsp; &nbsp;at com.xsmartware.javatest.pbc2p.CalciteBaseVarGenerator.generateVariable(CalciteBaseVarGenerator.java:39)
&nbsp;&nbsp; &nbsp;... 8 more
Caused by: java.lang.ClassCastException: class com.xsmartware.pbcm.sdk.pbc2p.PRH_PA01 cannot be cast to class org.apache.calcite.runtime.FlatLists$ComparableList (com.xsmartware.pbcm.sdk.pbc2p.PRH_PA01 and org.apache.calcite.runtime.FlatLists$ComparableList are in unnamed module of loader 'app')
&nbsp;&nbsp; &nbsp;at Baz$1.apply(Unknown Source)
&nbsp;&nbsp; &nbsp;at Baz$1.apply(Unknown Source)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory$AccumulatorAdderSeq.apply(BasicAggregateLambdaFactory.java:81)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.linq4j.EnumerableDefaults.aggregate(EnumerableDefaults.java:133)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.linq4j.DefaultEnumerable.aggregate(DefaultEnumerable.java:107)
&nbsp;&nbsp; &nbsp;at Baz.bind(Unknown Source)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:363)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:338)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:578)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:569)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:184)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:64)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:43)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.avatica.AvaticaConnection$1.execute(AvaticaConnection.java:666)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:638)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:674)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
&nbsp;&nbsp; &nbsp;... 11 more


we use ReflectiveSchema with the following&nbsp; target class:


public class PBC2PCalCiteSchema { &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp; &nbsp;public PRH_PA01[]&nbsp;&nbsp;&nbsp; PRH_PA01 = {};
&nbsp;&nbsp; &nbsp;public PRH_PA01CH[]&nbsp; PRH_PA01CH = {};
&nbsp;&nbsp; &nbsp;public PIM_PB01A[]&nbsp;&nbsp; PIM_PB01A= {};
&nbsp;&nbsp; &nbsp;public PIM_PB01B[]&nbsp;&nbsp; PIM_PB01B= {};
&nbsp;&nbsp; &nbsp;public PMM_PB02[]&nbsp;&nbsp;&nbsp; PMM_PB02= {};
&nbsp;&nbsp; &nbsp;public PRM_PB03[]&nbsp;&nbsp;&nbsp; PRM_PB03= {};
&nbsp;&nbsp; &nbsp;public POM_PB04[]&nbsp;&nbsp;&nbsp; POM_PB04= {};
&nbsp;&nbsp; &nbsp;public PSM[] &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; PSM= {};
&nbsp;&nbsp; &nbsp;public PSM_FACTORS[] PSM_FACTORS= {};
&nbsp;&nbsp; &nbsp;public PCO_PC02[]&nbsp;&nbsp;&nbsp; PCO_PC02= {};
&nbsp;&nbsp; &nbsp;public PCO_PC02AH[]&nbsp; PCO_PC02AH= {};
&nbsp;&nbsp; &nbsp;public PCO_PC02BH[]&nbsp; PCO_PC02BH= {};
&nbsp;&nbsp; &nbsp;public PCO_PC02DH[]&nbsp; PCO_PC02DH= {};
&nbsp;&nbsp; &nbsp;public PCO_PC02KH[]&nbsp; PCO_PC02KH= {};
&nbsp;&nbsp; &nbsp;public PNO_PC03[]&nbsp;&nbsp;&nbsp; PNO_PC03= {};
&nbsp;&nbsp; &nbsp;public PNO_PC030H[]&nbsp; PNO_PC030H= {};
&nbsp;&nbsp; &nbsp;public PPO_PC04[]&nbsp;&nbsp;&nbsp; PPO_PC04= {};
&nbsp;&nbsp; &nbsp;public PPO_PC040H[]&nbsp; PPO_PC040H= {};
&nbsp;&nbsp; &nbsp;public PQO_PC05[]&nbsp;&nbsp;&nbsp; PQO_PC05= {};
&nbsp;&nbsp; &nbsp;public PDA_PD01[]&nbsp;&nbsp;&nbsp; PDA_PD01= {};
&nbsp;&nbsp; &nbsp;public PDA_PD01DH[]&nbsp; PDA_PD01DH= {};
&nbsp;&nbsp; &nbsp;public PDA_PD01EH[]&nbsp; PDA_PD01EH= {};
&nbsp;&nbsp; &nbsp;public PDA_PD01FH[]&nbsp; PDA_PD01FH= {};
&nbsp;&nbsp; &nbsp;public PDA_PD01GH[]&nbsp; PDA_PD01GH= {};
&nbsp;&nbsp; &nbsp;public PDA_PD01HH[]&nbsp; PDA_PD01HH= {};
&nbsp;&nbsp; &nbsp;public PDA_PD01ZH[]&nbsp; PDA_PD01ZH= {};
&nbsp;&nbsp; &nbsp;public PCA_PD02[]&nbsp;&nbsp;&nbsp; PCA_PD02= {};
&nbsp;&nbsp; &nbsp;public PCA_PD02CH[]&nbsp; PCA_PD02CH= {};
&nbsp;&nbsp; &nbsp;public PCA_PD02DH[]&nbsp; PCA_PD02DH= {};
&nbsp;&nbsp; &nbsp;public PCA_PD02ZH[]&nbsp; PCA_PD02ZH= {};
&nbsp;&nbsp; &nbsp;public PCR_PD03[]&nbsp;&nbsp;&nbsp; PCR_PD03= {};
&nbsp;&nbsp; &nbsp;public PCR_PD03ZH[]&nbsp; PCR_PD03ZH= {};
&nbsp;&nbsp; &nbsp;public PND_PE01[]&nbsp;&nbsp;&nbsp; PND_PE01= {};
&nbsp;&nbsp; &nbsp;public PND_PE01ZH[]&nbsp; PND_PE01ZH= {};
&nbsp;&nbsp; &nbsp;public POT_PF01[]&nbsp;&nbsp;&nbsp; POT_PF01= {};
&nbsp;&nbsp; &nbsp;public POT_PF01ZH[]&nbsp; POT_PF01ZH= {};
&nbsp;&nbsp; &nbsp;public PCJ_PF02[]&nbsp;&nbsp;&nbsp; PCJ_PF02= {};
&nbsp;&nbsp; &nbsp;public PCJ_PF02ZH[]&nbsp; PCJ_PF02ZH= {};
&nbsp;&nbsp; &nbsp;public PCE_PF03[]&nbsp;&nbsp;&nbsp; PCE_PF03= {};
&nbsp;&nbsp; &nbsp;public PCE_PF03ZH[]&nbsp; PCE_PF03ZH= {};
&nbsp;&nbsp; &nbsp;public PAP_PF04[]&nbsp;&nbsp;&nbsp; PAP_PF04= {};
&nbsp;&nbsp; &nbsp;public PAP_PF04ZH[]&nbsp; PAP_PF04ZH= {};
&nbsp;&nbsp; &nbsp;public PHF_PF05[]&nbsp;&nbsp;&nbsp; PHF_PF05= {};
&nbsp;&nbsp; &nbsp;public PHF_PF05ZH[]&nbsp; PHF_PF05ZH= {};
&nbsp;&nbsp; &nbsp;public PBS_PF06[]&nbsp;&nbsp;&nbsp; PBS_PF06= {};
&nbsp;&nbsp; &nbsp;public PBS_PF06ZH[]&nbsp; PBS_PF06ZH= {};
&nbsp;&nbsp; &nbsp;public PPQ_PF07[]&nbsp;&nbsp;&nbsp; PPQ_PF07= {};
&nbsp;&nbsp; &nbsp;public PPQ_PF07ZH[]&nbsp; PPQ_PF07ZH= {};
&nbsp;&nbsp; &nbsp;public PAH_PF08[]&nbsp;&nbsp;&nbsp; PAH_PF08= {};
&nbsp;&nbsp; &nbsp;public PAH_PF08ZH[]&nbsp; PAH_PF08ZH= {};
&nbsp;&nbsp; &nbsp;public POS_PG01[]&nbsp;&nbsp;&nbsp; POS_PG01= {};
&nbsp;&nbsp; &nbsp;public POS_PG010H[]&nbsp; POS_PG010H= {};
&nbsp;&nbsp; &nbsp;public POQ_PH01[]&nbsp;&nbsp;&nbsp; POQ_PH01= {};
&nbsp;&nbsp;&nbsp; }

Re: 回复:cannot be cast to class org.apache.calcite.runtime.FlatLists$ComparableList error

Posted by Ruben Q L <ru...@gmail.com>.
Hello,

per ReflectiveSchema javadoc [1]:
"Implementation of {@link org.apache.calcite.schema.Schema} that exposes
the public fields and methods in a Java object."

[1]
https://github.com/apache/calcite/blob/812e3e98eae518cf85cd1b6b7f055fb96784a423/core/src/main/java/org/apache/calcite/adapter/java/ReflectiveSchema.java#L71


On Sat, Feb 12, 2022 at 1:54 AM xiaobo <gu...@qq.com.invalid> wrote:

> Sorry for the HTML escape characters, I rewrite the problem as following:
>
>  SQL select count(a.PA01AI01) from p.PRH_PA01 as a
> failed with :
> Caused by: java.sql.SQLException: Error while executing SQL "select
> count(a.PA01AI01) from p.PRH_PA01 as a
> ": From line 1, column 16 to line 1, column 23: Column 'PA01AI01' not
> found in table 'a'
>
> to resolve the problem we must make the table fields of the target Java
> class as public, is this a rule for ReflectiveSchema?

Re: 回复:cannot be cast to class org.apache.calcite.runtime.FlatLists$ComparableList error

Posted by xiaobo <gu...@qq.com.INVALID>.
Sorry for the HTML escape characters, I rewrite the problem as following:

 SQL select count(a.PA01AI01) from p.PRH_PA01 as a
failed with :
Caused by: java.sql.SQLException: Error while executing SQL "select count(a.PA01AI01) from p.PRH_PA01 as a
": From line 1, column 16 to line 1, column 23: Column 'PA01AI01' not found in table 'a'

to resolve the problem we must make the table fields of the target Java class as public, is this a rule for ReflectiveSchema?

回复:cannot be cast to class org.apache.calcite.runtime.FlatLists$ComparableList error

Posted by xiaobo <gu...@qq.com.INVALID>.
the first filed's java class is as following, and SQL 



select count(a.PA01AI01) from p.PRH_PA01 as a


failed with :


Caused by: java.sql.SQLException: Error while executing SQL "select count(a.PA01AI01) from p.PRH_PA01 as a
": From line 1, column 16 to line 1, column 23: Column 'PA01AI01' not found in table 'a'






public class PRH_PA01 {
&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp; &nbsp;String&nbsp;&nbsp;&nbsp; PA01AI01;
&nbsp;&nbsp; &nbsp;Date&nbsp;&nbsp;&nbsp; PA01AR01;
&nbsp;&nbsp; &nbsp;String&nbsp;&nbsp;&nbsp; PA01BQ01;
&nbsp;&nbsp; &nbsp;String&nbsp;&nbsp;&nbsp; PA01BD01;
&nbsp;&nbsp; &nbsp;String&nbsp;&nbsp;&nbsp; PA01BI01;
&nbsp;&nbsp; &nbsp;String&nbsp;&nbsp;&nbsp; PA01BI02;
&nbsp;&nbsp; &nbsp;String&nbsp; PA01BD02;
&nbsp;&nbsp; &nbsp;Long&nbsp;&nbsp;&nbsp; PA01CS01 ;
&nbsp;&nbsp; &nbsp;String&nbsp; PA01DQ01 ;
&nbsp;&nbsp; &nbsp;String&nbsp;&nbsp;&nbsp; PA01DQ02 ;
&nbsp;&nbsp; &nbsp;Date&nbsp;&nbsp;&nbsp; PA01DR01;
&nbsp;&nbsp; &nbsp;Date&nbsp;&nbsp;&nbsp; PA01DR02 ;
&nbsp;&nbsp; &nbsp;Long&nbsp;&nbsp;&nbsp; PA01ES01;
&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp; &nbsp;List<PRH_PA01CH&gt; PRH_PA01CH;

&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp; &nbsp;public String getPA01AI01() {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return PA01AI01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public void setPA01AI01(String pA01AI01) {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; PA01AI01 = pA01AI01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public Date getPA01AR01() {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return PA01AR01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public void setPA01AR01(Date pA01AR01) {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; PA01AR01 = pA01AR01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public String getPA01BQ01() {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return PA01BQ01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public void setPA01BQ01(String pA01BQ01) {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; PA01BQ01 = pA01BQ01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public String getPA01BD01() {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return PA01BD01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public void setPA01BD01(String pA01BD01) {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; PA01BD01 = pA01BD01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public String getPA01BI01() {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return PA01BI01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public void setPA01BI01(String pA01BI01) {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; PA01BI01 = pA01BI01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public String getPA01BI02() {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return PA01BI02;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public void setPA01BI02(String pA01BI02) {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; PA01BI02 = pA01BI02;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public String getPA01BD02() {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return PA01BD02;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public void setPA01BD02(String pA01BD02) {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; PA01BD02 = pA01BD02;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public Long getPA01CS01() {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return PA01CS01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public void setPA01CS01(Long pA01CS01) {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; PA01CS01 = pA01CS01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public String getPA01DQ01() {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return PA01DQ01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public void setPA01DQ01(String pA01DQ01) {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; PA01DQ01 = pA01DQ01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public String getPA01DQ02() {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return PA01DQ02;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public void setPA01DQ02(String pA01DQ02) {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; PA01DQ02 = pA01DQ02;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public Date getPA01DR01() {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return PA01DR01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public void setPA01DR01(Date pA01DR01) {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; PA01DR01 = pA01DR01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public Date getPA01DR02() {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return PA01DR02;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public void setPA01DR02(Date pA01DR02) {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; PA01DR02 = pA01DR02;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public Long getPA01ES01() {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return PA01ES01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public void setPA01ES01(Long pA01ES01) {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; PA01ES01 = pA01ES01;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp; &nbsp;public List<PRH_PA01CH&gt; getPRH_PA01CH() {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return PRH_PA01CH;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;public void setPRH_PA01CH(List<PRH_PA01CH&gt; pRH_PA01CH) {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; PRH_PA01CH = pRH_PA01CH;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;
}






------------------&nbsp;原始邮件&nbsp;------------------
发件人:                                                                                                                        "xiaobo "                                                                                    <guxiaobo1982@qq.com&gt;;
发送时间:&nbsp;2022年2月11日(星期五) 晚上6:09
收件人:&nbsp;"dev"<dev@calcite.apache.org&gt;;

主题:&nbsp;cannot be cast to class org.apache.calcite.runtime.FlatLists$ComparableList error



Hi,
Our testing code failed with the following error, can you help with it:


Error while executing SQL "select count(1) 
from p.PRH_PA01
": class com.xsmartware.pbcm.sdk.pbc2p.PRH_PA01 cannot be cast to class org.apache.calcite.runtime.FlatLists$ComparableList (com.xsmartware.pbcm.sdk.pbc2p.PRH_PA01 and org.apache.calcite.runtime.FlatLists$ComparableList are in unnamed module of loader 'app')
&nbsp;&nbsp; &nbsp;at com.xsmartware.javatest.pbc2p.CalciteBaseVarGenerator.generateVariable(CalciteBaseVarGenerator.java:61)
&nbsp;&nbsp; &nbsp;at com.xsmartware.javatest.pbc2p.PBC2PTestRunner.test1(PBC2PTestRunner.java:68)
&nbsp;&nbsp; &nbsp;at com.xsmartware.javatest.pbc2p.PBC2PTestRunner.run(PBC2PTestRunner.java:54)
&nbsp;&nbsp; &nbsp;at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:758)
&nbsp;&nbsp; &nbsp;at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:748)
&nbsp;&nbsp; &nbsp;at org.springframework.boot.SpringApplication.run(SpringApplication.java:309)
&nbsp;&nbsp; &nbsp;at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
&nbsp;&nbsp; &nbsp;at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290)
&nbsp;&nbsp; &nbsp;at com.xsmartware.javatest.JavaTestApplication.main(JavaTestApplication.java:9)
Caused by: java.sql.SQLException: Error while executing SQL "select count(1) 
from p.PRH_PA01
": class com.xsmartware.pbcm.sdk.pbc2p.PRH_PA01 cannot be cast to class org.apache.calcite.runtime.FlatLists$ComparableList (com.xsmartware.pbcm.sdk.pbc2p.PRH_PA01 and org.apache.calcite.runtime.FlatLists$ComparableList are in unnamed module of loader 'app')
&nbsp;&nbsp; &nbsp;at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227)
&nbsp;&nbsp; &nbsp;at com.xsmartware.common.util.SQLUtil.exeGetLong(SQLUtil.java:42)
&nbsp;&nbsp; &nbsp;at com.xsmartware.javatest.pbc2p.CalciteBaseVarGenerator.generateVariable(CalciteBaseVarGenerator.java:39)
&nbsp;&nbsp; &nbsp;... 8 more
Caused by: java.lang.ClassCastException: class com.xsmartware.pbcm.sdk.pbc2p.PRH_PA01 cannot be cast to class org.apache.calcite.runtime.FlatLists$ComparableList (com.xsmartware.pbcm.sdk.pbc2p.PRH_PA01 and org.apache.calcite.runtime.FlatLists$ComparableList are in unnamed module of loader 'app')
&nbsp;&nbsp; &nbsp;at Baz$1.apply(Unknown Source)
&nbsp;&nbsp; &nbsp;at Baz$1.apply(Unknown Source)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory$AccumulatorAdderSeq.apply(BasicAggregateLambdaFactory.java:81)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.linq4j.EnumerableDefaults.aggregate(EnumerableDefaults.java:133)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.linq4j.DefaultEnumerable.aggregate(DefaultEnumerable.java:107)
&nbsp;&nbsp; &nbsp;at Baz.bind(Unknown Source)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:363)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:338)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:578)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:569)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:184)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:64)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:43)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.avatica.AvaticaConnection$1.execute(AvaticaConnection.java:666)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:638)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:674)
&nbsp;&nbsp; &nbsp;at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
&nbsp;&nbsp; &nbsp;... 11 more


we use ReflectiveSchema with the following&nbsp; target class:


public class PBC2PCalCiteSchema { &nbsp; &nbsp; 
&nbsp;&nbsp; &nbsp;public PRH_PA01[]&nbsp; &nbsp; PRH_PA01 = {};
&nbsp;&nbsp; &nbsp;public PRH_PA01CH[]&nbsp; PRH_PA01CH = {};
&nbsp;&nbsp; &nbsp;public PIM_PB01A[] &nbsp; PIM_PB01A= {};
&nbsp;&nbsp; &nbsp;public PIM_PB01B[] &nbsp; PIM_PB01B= {};
&nbsp;&nbsp; &nbsp;public PMM_PB02[]&nbsp; &nbsp; PMM_PB02= {};
&nbsp;&nbsp; &nbsp;public PRM_PB03[]&nbsp; &nbsp; PRM_PB03= {};
&nbsp;&nbsp; &nbsp;public POM_PB04[]&nbsp; &nbsp; POM_PB04= {};
&nbsp;&nbsp; &nbsp;public PSM[] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PSM= {};
&nbsp;&nbsp; &nbsp;public PSM_FACTORS[] PSM_FACTORS= {};
&nbsp;&nbsp; &nbsp;public PCO_PC02[]&nbsp; &nbsp; PCO_PC02= {};
&nbsp;&nbsp; &nbsp;public PCO_PC02AH[]&nbsp; PCO_PC02AH= {};
&nbsp;&nbsp; &nbsp;public PCO_PC02BH[]&nbsp; PCO_PC02BH= {};
&nbsp;&nbsp; &nbsp;public PCO_PC02DH[]&nbsp; PCO_PC02DH= {};
&nbsp;&nbsp; &nbsp;public PCO_PC02KH[]&nbsp; PCO_PC02KH= {};
&nbsp;&nbsp; &nbsp;public PNO_PC03[]&nbsp; &nbsp; PNO_PC03= {};
&nbsp;&nbsp; &nbsp;public PNO_PC030H[]&nbsp; PNO_PC030H= {};
&nbsp;&nbsp; &nbsp;public PPO_PC04[]&nbsp; &nbsp; PPO_PC04= {};
&nbsp;&nbsp; &nbsp;public PPO_PC040H[]&nbsp; PPO_PC040H= {};
&nbsp;&nbsp; &nbsp;public PQO_PC05[]&nbsp; &nbsp; PQO_PC05= {};
&nbsp;&nbsp; &nbsp;public PDA_PD01[]&nbsp; &nbsp; PDA_PD01= {};
&nbsp;&nbsp; &nbsp;public PDA_PD01DH[]&nbsp; PDA_PD01DH= {};
&nbsp;&nbsp; &nbsp;public PDA_PD01EH[]&nbsp; PDA_PD01EH= {};
&nbsp;&nbsp; &nbsp;public PDA_PD01FH[]&nbsp; PDA_PD01FH= {};
&nbsp;&nbsp; &nbsp;public PDA_PD01GH[]&nbsp; PDA_PD01GH= {};
&nbsp;&nbsp; &nbsp;public PDA_PD01HH[]&nbsp; PDA_PD01HH= {};
&nbsp;&nbsp; &nbsp;public PDA_PD01ZH[]&nbsp; PDA_PD01ZH= {};
&nbsp;&nbsp; &nbsp;public PCA_PD02[]&nbsp; &nbsp; PCA_PD02= {};
&nbsp;&nbsp; &nbsp;public PCA_PD02CH[]&nbsp; PCA_PD02CH= {};
&nbsp;&nbsp; &nbsp;public PCA_PD02DH[]&nbsp; PCA_PD02DH= {};
&nbsp;&nbsp; &nbsp;public PCA_PD02ZH[]&nbsp; PCA_PD02ZH= {};
&nbsp;&nbsp; &nbsp;public PCR_PD03[]&nbsp; &nbsp; PCR_PD03= {};
&nbsp;&nbsp; &nbsp;public PCR_PD03ZH[]&nbsp; PCR_PD03ZH= {};
&nbsp;&nbsp; &nbsp;public PND_PE01[]&nbsp; &nbsp; PND_PE01= {};
&nbsp;&nbsp; &nbsp;public PND_PE01ZH[]&nbsp; PND_PE01ZH= {};
&nbsp;&nbsp; &nbsp;public POT_PF01[]&nbsp; &nbsp; POT_PF01= {};
&nbsp;&nbsp; &nbsp;public POT_PF01ZH[]&nbsp; POT_PF01ZH= {};
&nbsp;&nbsp; &nbsp;public PCJ_PF02[]&nbsp; &nbsp; PCJ_PF02= {};
&nbsp;&nbsp; &nbsp;public PCJ_PF02ZH[]&nbsp; PCJ_PF02ZH= {};
&nbsp;&nbsp; &nbsp;public PCE_PF03[]&nbsp; &nbsp; PCE_PF03= {};
&nbsp;&nbsp; &nbsp;public PCE_PF03ZH[]&nbsp; PCE_PF03ZH= {};
&nbsp;&nbsp; &nbsp;public PAP_PF04[]&nbsp; &nbsp; PAP_PF04= {};
&nbsp;&nbsp; &nbsp;public PAP_PF04ZH[]&nbsp; PAP_PF04ZH= {};
&nbsp;&nbsp; &nbsp;public PHF_PF05[]&nbsp; &nbsp; PHF_PF05= {};
&nbsp;&nbsp; &nbsp;public PHF_PF05ZH[]&nbsp; PHF_PF05ZH= {};
&nbsp;&nbsp; &nbsp;public PBS_PF06[]&nbsp; &nbsp; PBS_PF06= {};
&nbsp;&nbsp; &nbsp;public PBS_PF06ZH[]&nbsp; PBS_PF06ZH= {};
&nbsp;&nbsp; &nbsp;public PPQ_PF07[]&nbsp; &nbsp; PPQ_PF07= {};
&nbsp;&nbsp; &nbsp;public PPQ_PF07ZH[]&nbsp; PPQ_PF07ZH= {};
&nbsp;&nbsp; &nbsp;public PAH_PF08[]&nbsp; &nbsp; PAH_PF08= {};
&nbsp;&nbsp; &nbsp;public PAH_PF08ZH[]&nbsp; PAH_PF08ZH= {};
&nbsp;&nbsp; &nbsp;public POS_PG01[]&nbsp; &nbsp; POS_PG01= {};
&nbsp;&nbsp; &nbsp;public POS_PG010H[]&nbsp; POS_PG010H= {};
&nbsp;&nbsp; &nbsp;public POQ_PH01[]&nbsp; &nbsp; POQ_PH01= {};
&nbsp; &nbsp; }