PTable table = context.getConnection().getPMetaData().getTable(index.getParentName().getString());
int tableOffset = table.getBucketNum() == null ? 0 : 1;
int indexOffset = index.getBucketNum() == null ? 0 : 1;
if (index.getColumns().size()-indexOffset != table.getColumns().size()-tableOffset) {
// We'll end up not using this by the optimizer, so just throw
throw new ColumnNotFoundException(WildcardParseNode.INSTANCE.toString());
}
for (int i = tableOffset; i < table.getColumns().size(); i++) {
PColumn tableColumn = table.getColumns().get(i);
PColumn indexColumn = index.getColumn(IndexUtil.getIndexColumnName(tableColumn));
ColumnRef ref = new ColumnRef(tableRef,indexColumn.getPosition());