RelNode relInitial = tester.convertSqlToRel(sql);
assertTrue(relInitial != null);
List<RelMetadataProvider> list = Lists.newArrayList();
DefaultRelMetadataProvider defaultProvider =
new DefaultRelMetadataProvider();
list.add(defaultProvider);
planner.registerMetadataProviders(list);
RelMetadataProvider plannerChain = ChainedRelMetadataProvider.of(list);
relInitial.getCluster().setMetadataProvider(
new CachingRelMetadataProvider(plannerChain, planner));