we updated our enumerator to return only the column data object for single column projects, our projectable adapter works for basic queries now, but faced with new problems which I'll send another mail.
Original From:"xiaobo "< guxiaobo1...@qq.com >; Date:2022/3/13 21:59 To:"dev"< dev@calcite.apache.org >; Subject:Re:column data type mismatch problem when projecting tables if we change the sql to "select c1, c2 from js.t1", then test2 passes, and we found that the deduce method CursorFactory returns OBJECT when the resultset has only one column, public static CursorFactory deduce(List<ColumnMetaData> columns, Class resultClazz) { if (columns.size() == 1) { return OBJECT; } if (resultClazz == null) { return ARRAY; } if (resultClazz.isArray()) { return ARRAY; } if (List.class.isAssignableFrom(resultClazz)) { return LIST; } return record(resultClazz, null, columns.stream().map(c -> c.columnName).collect(Collectors.toList())); } we think this is bug, we think method deduce should always determin the CursorFactory type based on class of resultClazz, because our adapters always return a Object[] object even there is only one column. Original From:"xiaobo "< guxiaobo1...@qq.com >; Date:2022/3/13 20:21 To:"dev"< dev@calcite.apache.org >; Subject:column data type mismatch problem when projecting tables Hi, Followed the avro example at https://github.com/masayuki038/calcite-avro-sample, we make a projectable version of our JsonAdapter at https://github.com/guxiaobo/calcite-json-adapter, but the simple test2 method at https://github.com/guxiaobo/calcite-json-adapter/blob/main/src/test/java/org/apache/calcite/adapter/json/test/DynamicDataTest.java failed with data type mismatch problem with message : Running org.apache.calcite.adapter.json.test.DynamicDataTest SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.286 sec <<< FAILURE! test2(org.apache.calcite.adapter.json.test.DynamicDataTest) Time elapsed: 2.222 sec <<< ERROR! java.lang.ClassCastException: class [Ljava.lang.Object; cannot be cast to class java.lang.Long ([Ljava.lang.Object; and java.lang.Long are in module java.base of loader 'bootstrap') at org.apache.calcite.avatica.util.AbstractCursor$LongAccessor.getLong(AbstractCursor.java:562) at org.apache.calcite.avatica.AvaticaResultSet.getLong(AvaticaResultSet.java:261) at org.apache.calcite.adapter.json.test.BaseTest.exeGetLong(BaseTest.java:40) at org.apache.calcite.adapter.json.test.DynamicDataTest.test2(DynamicDataTest.java:107) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75) Results : Tests in error: test2(org.apache.calcite.adapter.json.test.DynamicDataTest): class [Ljava.lang.Object; cannot be cast to class java.lang.Long ([Ljava.lang.Object; and java.lang.Long are in module java.base of loader 'bootstrap') Tests run: 1, Failures: 0, Errors: 1, Skipped: 0 By the way, the v0.0.1 version of our adapter only implements a ScannableTable , and all the testes can run successfully.