private boolean buildAndCheckCollation(IndexProperties indexProps) {
IndexDescriptor indexDesc = indexProps.getIndexDesc();
FunctionalIndexInfo functionInfo = indexDesc.getFunctionalInfo();
RelCollation inputCollation;
ScanPrel indexScanPrel =
IndexPlanUtils.buildCoveringIndexScan(indexContext.getScan(), indexDesc.getIndexGroupScan(), indexContext, indexDesc);
inputCollation = indexScanPrel.getTraitSet().getTrait(RelCollationTraitDef.INSTANCE);
if (indexContext.hasLowerProject()) {
inputCollation =
IndexPlanUtils.buildCollationProject(indexContext.getLowerProject().getProjects(), null,
indexContext.getScan(), functionInfo,indexContext);
}
if (indexContext.hasUpperProject()) {
inputCollation =
IndexPlanUtils.buildCollationProject(indexContext.getUpperProject().getProjects(), indexContext.getLowerProject(),
indexContext.getScan(), functionInfo, indexContext);
}
if ((inputCollation != null) &&
(inputCollation.satisfies(indexContext.getCollation()))) {
return true;
}
return false;
}