assert (catalog_idx != null);
// Search Key Expressions
List<ColumnRef> index_cols = CatalogUtil.getSortedCatalogItems(catalog_idx.getColumns(), "index");
for (int i = 0, cnt = cast_node.getSearchKeyExpressions().size(); i < cnt; i++) {
AbstractExpression index_exp = cast_node.getSearchKeyExpressions().get(i);
Column catalog_col = index_cols.get(i).getColumn();
if (debug.val)
LOG.debug("[" + i + "] " + catalog_col);
exps.add(CatalogUtil.createTempExpression(catalog_col, index_exp));
if (debug.val)
LOG.debug("Added temp index search key expression:\n" + ExpressionUtil.debug(exps.get(exps.size() - 1)));
} // FOR
// End Expression
if (cast_node.getEndExpression() != null) {
exps.add(cast_node.getEndExpression());
if (debug.val)
LOG.debug("Added scan end expression:\n" + ExpressionUtil.debug(exps.get(exps.size() - 1)));
}
// Post-Scan Expression
if (cast_node.getPredicate() != null) {
exps.add(cast_node.getPredicate());
if (debug.val)
LOG.debug("Added post-scan predicate:\n" + ExpressionUtil.debug(exps.get(exps.size() - 1)));
}
// SeqScanPlanNode
} else if (node instanceof SeqScanPlanNode) {
SeqScanPlanNode cast_node = (SeqScanPlanNode) node;
if (cast_node.getPredicate() != null) {
exps.add(cast_node.getPredicate());
if (debug.val)
LOG.debug("Adding scan node predicate:\n" + ExpressionUtil.debug(exps.get(exps.size() - 1)));
}
// Materialize
} else if (node instanceof MaterializePlanNode) {
// Assume that if we're here, then they want the mappings
// from columns to StmtParameters
assert (tables.size() == 1);
Table catalog_tbl = CollectionUtil.first(tables);
for (int ctr = 0, cnt = node.getOutputColumnGUIDs().size(); ctr < cnt; ctr++) {
int column_guid = node.getOutputColumnGUIDs().get(ctr);
PlanColumn column = PlannerContext.singleton().get(column_guid);
assert (column != null);
Column catalog_col = catalog_tbl.getColumns().get(column.getDisplayName());
assert (catalog_col != null) : "Invalid column name '" + column.getDisplayName() + "' for " + catalog_tbl;
AbstractExpression exp = column.getExpression();
if (exp instanceof ParameterValueExpression) {
StmtParameter catalog_param = catalog_stmt.getParameters().get(((ParameterValueExpression) exp).getParameterId());
cset.add(catalog_col, catalog_param, ExpressionType.COMPARE_EQUAL, catalog_stmt);
} else if (exp instanceof AbstractValueExpression) {
if (debug.val)