Hi Yuval Itzchakov ~ The thread you paste has a different stake trace with your case.
In the pasted thread, the JaninoRelMetadataProvider was missed because we only set it once in a thread local variable, when the RelMetadataQuery was used in a different working thread, the JaninoRelMetadataProvider caused an NPE. For your case, based on the stack trace, this line throws ~ RelMetadataQuery line 114: super(null); But actually this line allows an empty argument and it should not throw. Can you give a re-producecable case here so that we can debug and find more evidence ? Yuval Itzchakov <yuva...@gmail.com> 于2020年12月22日周二 上午1:52写道: > Hi, > > While trying to execute a query via TableEnvironment.sqlQuery in Flink > 1.12, I receive the following exception: > > java.lang.NullPointerException > <init>:114, RelMetadataQuery (org.apache.calcite.rel.metadata) > <clinit>:76, RelMetadataQuery (org.apache.calcite.rel.metadata) > get:39, FlinkRelOptClusterFactory$$anon$1 > (org.apache.flink.table.planner.calcite) > get:38, FlinkRelOptClusterFactory$$anon$1 > (org.apache.flink.table.planner.calcite) > getMetadataQuery:178, RelOptCluster (org.apache.calcite.plan) > create:108, LogicalFilter (org.apache.calcite.rel.logical) > createFilter:344, RelFactories$FilterFactoryImpl > (org.apache.calcite.rel.core) > convertWhere:1042, SqlToRelConverter (org.apache.calcite.sql2rel) > convertSelectImpl:666, SqlToRelConverter (org.apache.calcite.sql2rel) > convertSelect:644, SqlToRelConverter (org.apache.calcite.sql2rel) > convertQueryRecursive:3438, SqlToRelConverter (org.apache.calcite.sql2rel) > convertQuery:570, SqlToRelConverter (org.apache.calcite.sql2rel) > org$apache$flink$table$planner$calcite$FlinkPlannerImpl$$rel:165, > FlinkPlannerImpl (org.apache.flink.table.planner.calcite) > rel:157, FlinkPlannerImpl (org.apache.flink.table.planner.calcite) > toQueryOperation:823, SqlToOperationConverter > (org.apache.flink.table.planner.operations) > convertSqlQuery:795, SqlToOperationConverter > (org.apache.flink.table.planner.operations) > convert:250, SqlToOperationConverter > (org.apache.flink.table.planner.operations) > parse:78, ParserImpl (org.apache.flink.table.planner.delegation) > sqlQuery:639, TableEnvironmentImpl (org.apache.flink.table.api.internal) > $anonfun$translateTemplate$2:476, Foo$ (Foo) > apply:-1, 644680650 (ai.hunters.pipeline.Processors$$$Lambda$1597) > evaluateNow:361, FiberContext (zio.internal) > $anonfun$evaluateLater$1:778, FiberContext (zio.internal) > run:-1, 289594359 (zio.internal.FiberContext$$Lambda$617) > runWorker:1149, ThreadPoolExecutor (java.util.concurrent) > run:624, ThreadPoolExecutor$Worker (java.util.concurrent) > run:748, Thread (java.lang) > > This seems to be coming from the FlinkRelMetadataQuery class attempting to > initialize all handlers: > > [image: image.png] > > This seems to be coming from the calcite shaded JAR > inside "flink-table-planner-blink-1.12" > > Has anyone ran into this issue? I saw a thread in the chinese user group > but I don't understand what's been said there ( > https://www.mail-archive.com/user-zh@flink.apache.org/msg05874.html) > -- > Best Regards, > Yuval Itzchakov. >