private RexNode convertCastForFIdx(RexCall condition, IndexDescriptor index, IndexCallContext context, RelNode origScan) { if (index == null) { return condition; } FunctionalIndexInfo functionInfo = index.getFunctionalInfo(); if (!functionInfo.hasFunctional()) { return condition; } // The functional index has a different row-type than the original scan. Use the index row-type when // converting the condition RelDataType newRowType = FunctionalIndexHelper.rewriteFunctionalRowType(origScan, context, functionInfo); RexBuilder builder = origScan.getCluster().getRexBuilder(); return FunctionalIndexHelper.convertConditionForIndexScan(condition, origScan, newRowType, builder, functionInfo); }
/** * * @param inputIndex * @param functionInfo functional index information that may impact rewrite * @return */ private RexNode rewriteFunctionalCondition(RexNode inputIndex, RelDataType newRowType, FunctionalIndexInfo functionInfo) { if (!functionInfo.hasFunctional()) { return inputIndex; } return FunctionalIndexHelper.convertConditionForIndexScan(inputIndex, origScan, newRowType, builder, functionInfo); }
private RexNode convertCastForFIdx(RexCall condition, IndexDescriptor index, IndexCallContext context, RelNode origScan) { if (index == null) { return condition; } FunctionalIndexInfo functionInfo = index.getFunctionalInfo(); if (!functionInfo.hasFunctional()) { return condition; } // The functional index has a different row-type than the original scan. Use the index row-type when // converting the condition RelDataType newRowType = FunctionalIndexHelper.rewriteFunctionalRowType(origScan, context, functionInfo); RexBuilder builder = origScan.getCluster().getRexBuilder(); return FunctionalIndexHelper.convertConditionForIndexScan(condition, origScan, newRowType, builder, functionInfo); }
origScan.getTraitSet().plus(Prel.DRILL_PHYSICAL).plus(partition), indexScan, indexScanRowType, origScan.getTable()); FilterPrel indexFilterPrel = new FilterPrel(indexScanPrel.getCluster(), indexScanPrel.getTraitSet(), indexScanPrel, FunctionalIndexHelper.convertConditionForIndexScan(condition, origScan, indexScanRowType, builder, functionInfo));
RexNode convertedIndexCondition = FunctionalIndexHelper.convertConditionForIndexScan(indexCondition, origScan, indexScanRowType, builder, functionInfo); FilterPrel rightIndexFilterPrel = new FilterPrel(indexScanPrel.getCluster(), indexScanPrel.getTraitSet(),