You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "wangcheng (AK)" <wa...@huawei.com.INVALID> on 2022/04/29 07:58:16 UTC

Help for Fixing TpcdsLatticeSuggesterTest in calcite

Hi,

I'm planning to use the lattice suggester in Calcite with TPC-DS, but the TpcdsLatticeSuggesterTest in Calcite fails in the 1st query. I run the TpcdsLatticeSuggesterTest with Disabled annotation removed.

The error is shown below:
Can't unwrap class org.apache.calcite.sql.SqlDialect from RelOptTableImpl{schema=org.apache.calcite.prepare.CalciteCatalogReader@54fcf62e, names= [tpcds, STORE_RETURNS], table=org.apache.calcite.adapter.tpcds.TpcdsSchema$TpcdsQueryableTable@531cd17a, rowType=RecordType(BIGINT SR_RETURNED_DATE_SK, BIGINT SR_RETURN_TIME_SK, BIGINT SR_ITEM_SK, BIGINT SR_CUSTOMER_SK, BIGINT SR_CDEMO_SK, BIGINT SR_HDEMO_SK, BIGINT SR_ADDR_SK, BIGINT SR_STORE_SK, BIGINT SR_REASON_SK, BIGINT SR_TICKET_NUMBER, INTEGER SR_RETURN_QUANTITY, DECIMAL(7, 2) SR_RETURN_AMT, DECIMAL(7, 2) SR_RETURN_TAX, DECIMAL(7, 2) SR_RETURN_AMT_INC_TAX, DECIMAL(7, 2) SR_FEE, DECIMAL(7, 2) SR_RETURN_SHIP_COST, DECIMAL(7, 2) SR_REFUNDED_CASH, DECIMAL(7, 2) SR_REVERSED_CHARGE, DECIMAL(7, 2) SR_STORE_CREDIT, DECIMAL(7, 2) SR_NET_LOSS)}
java.lang.NullPointerException: Can't unwrap class org.apache.calcite.sql.SqlDialect from RelOptTableImpl{schema=org.apache.calcite.prepare.CalciteCatalogReader@54fcf62e, names= [tpcds, STORE_RETURNS], table=org.apache.calcite.adapter.tpcds.TpcdsSchema$TpcdsQueryableTable@531cd17a, rowType=RecordType(BIGINT SR_RETURNED_DATE_SK, BIGINT SR_RETURN_TIME_SK, BIGINT SR_ITEM_SK, BIGINT SR_CUSTOMER_SK, BIGINT SR_CDEMO_SK, BIGINT SR_HDEMO_SK, BIGINT SR_ADDR_SK, BIGINT SR_STORE_SK, BIGINT SR_REASON_SK, BIGINT SR_TICKET_NUMBER, INTEGER SR_RETURN_QUANTITY, DECIMAL(7, 2) SR_RETURN_AMT, DECIMAL(7, 2) SR_RETURN_TAX, DECIMAL(7, 2) SR_RETURN_AMT_INC_TAX, DECIMAL(7, 2) SR_FEE, DECIMAL(7, 2) SR_RETURN_SHIP_COST, DECIMAL(7, 2) SR_REFUNDED_CASH, DECIMAL(7, 2) SR_REVERSED_CHARGE, DECIMAL(7, 2) SR_STORE_CREDIT, DECIMAL(7, 2) SR_NET_LOSS)}
    at java.util.Objects.requireNonNull(Objects.java:290)
    at org.apache.calcite.schema.Wrapper.unwrapOrThrow(Wrapper.java:39)
    at org.apache.calcite.statistic.QuerySqlStatisticProvider.isForeignKey(QuerySqlStatisticProvider.java:113)
    at org.apache.calcite.statistic.CachingSqlStatisticProvider.lambda$isForeignKey$1(CachingSqlStatisticProvider.java:68)
    at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4876)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3529)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2278)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2155)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2045)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3951)
    at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4871)
    at org.apache.calcite.statistic.CachingSqlStatisticProvider.isForeignKey(CachingSqlStatisticProvider.java:67)
    at org.apache.calcite.materialize.Step.isBackwards(Step.java:108)
    at org.apache.calcite.materialize.LatticeSuggester$Query.stepRef(LatticeSuggester.java:580)
    at org.apache.calcite.materialize.LatticeSuggester.addFrame(LatticeSuggester.java:164)
    at org.apache.calcite.materialize.LatticeSuggester.lambda$addQuery$1(LatticeSuggester.java:143)
    at java.util.ArrayList.forEach(ArrayList.java:1259)
    at org.apache.calcite.materialize.LatticeSuggester.addQuery(LatticeSuggester.java:143)
    at org.apache.calcite.materialize.TpcdsLatticeSuggesterTest$Tester.addQuery(TpcdsLatticeSuggesterTest.java:181)
    at org.apache.calcite.materialize.TpcdsLatticeSuggesterTest.checkFoodMartAll(TpcdsLatticeSuggesterTest.java:88)
    at org.apache.calcite.materialize.TpcdsLatticeSuggesterTest.testTpcdsAllEvolve(TpcdsLatticeSuggesterTest.java:137)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725)
    at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
    at org.junit.jupiter.engine.extension.TimeoutInvocation.proceed(TimeoutInvocation.java:46)
    at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
    at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:214)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:185)
    at java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:189)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1067)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1703)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:172)

Can anyone help me fix this problem?