use of org.apache.beam.sdk.extensions.sql.impl.SqlConversionException in project beam by apache.
the class ZetaSQLQueryPlanner method convertToBeamRelInternal.
private BeamRelNode convertToBeamRelInternal(String sql, QueryParameters queryParams) {
RelRoot root = plannerImpl.rel(sql, queryParams);
RelTraitSet desiredTraits = root.rel.getTraitSet().replace(BeamLogicalConvention.INSTANCE).replace(root.collation).simplify();
// beam physical plan
root.rel.getCluster().setMetadataProvider(ChainedRelMetadataProvider.of(org.apache.beam.vendor.calcite.v1_28_0.com.google.common.collect.ImmutableList.of(NonCumulativeCostImpl.SOURCE, RelMdNodeStats.SOURCE, root.rel.getCluster().getMetadataProvider())));
root.rel.getCluster().setMetadataQuerySupplier(BeamRelMetadataQuery::instance);
RelMetadataQuery.THREAD_PROVIDERS.set(JaninoRelMetadataProvider.of(root.rel.getCluster().getMetadataProvider()));
root.rel.getCluster().invalidateMetadataQuery();
try {
BeamRelNode beamRelNode = (BeamRelNode) plannerImpl.transform(0, desiredTraits, root.rel);
LOG.info("BEAMPlan>\n" + RelOptUtil.toString(beamRelNode));
return beamRelNode;
} catch (RelOptPlanner.CannotPlanException e) {
throw new SqlConversionException("Failed to produce plan for query " + sql, e);
}
}
Aggregations