Hi, Finally, the cause is revealed. There's a global (concurrentMap formed) cache in org.apache.calcite.rel.type.RelDataTypeFactoryImpl. The locally used *RelDataType*s will be cached as both the keys and values. For the following two *RelDataType*s,
1. RecordType(BIGINT d, INTEGER e, VARCHAR(65536) f, TIME ATTRIBUTE(ROWTIME) rtime) 2. RecordType(BIGINT d, INTEGER e, VARCHAR(65536) f, TIME ATTRIBUTE(PROCTIME) rtime) they'll get exactly the same digest, RecordType(BIGINT d, INTEGER e, VARCHAR(65536) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary" f, TIMESTAMP(3) NOT NULL rtime) NOT NULL, and thus will be taken as identical. In other words, if the proctime type is already exist in the cache, when we query it with the rowtime type, the proctime type will be mistakenly returned. I think that should not be taken as a bug. However, we still need to pay attention to it. Thanks, Xingcan On Fri, Dec 8, 2017 at 7:25 PM, Xingcan Cui <xingc...@gmail.com> wrote: > Hi all, > > Recently I'm trying to add some tests to > *org.apache.flink.table.api.stream.table.JoinTest*, but encountered a > strange problem. A test case could successfully run in an isolated mode, > but failed (threw an *CannotPlanException* in > *TableEnvironment.runVolcanoPlanner()*) when ran with another test. > > The failed test registers two rowtime tables and performs a left outer > join. > ``` > *val util = streamTestUtil()* > *val left = util.addTable[(Long, Int, String)]('a, 'b, 'c, 'ltime.rowtime)* > *val right = util.addTable[(Long, Int, String)]('d, 'e, 'f, > 'rtime.rowtime) * > *val resultTable = left* > * .leftOuterJoin(* > * right,* > * 'a === 'd && 'lt >= 'rtime - 5.minutes && 'ltime < 'rtime + > 3.seconds)* > * .select('a, 'e, 'ltime)* > ``` > and the company case caused failing registers two proctime tables and > performs a full outer join. > > ``` > *val util = streamTestUtil()* > *val left = util.addTable[(Long, Int, String)]('a, 'b, 'c, > 'ltime.proctime)* > *val right = util.addTable[(Long, Int, String)]('d, 'e, 'f, > 'rtime.proctime)* > *val resultTable = left* > * .fullOuterJoin(right, 'a === 'd && 'ltime >= 'rtime - 1.second && > 'ltime < 'rtime)* > * .select('a, 'e, 'ltime)* > ``` > > I guess there are some conflicts with the *time attributes* between > different test cases since everything got fine when I changed their names > (e.g., *ltime* => *lt* and *rtime* => *rt*) in one test case. Some global > shared variables may be the cause. > > I wonder if anyone could give me some more specific clues about the > problem. IMO, even with identical field names, the test cases should > not interrelate with each other. > > Thanks, > Xingcan > > > > >