use of org.apache.calcite.rel.core.JoinInfo in project herddb by diennea.
the class CalcitePlanner method planEnumerableJoin.
private PlannerOp planEnumerableJoin(EnumerableHashJoin op, RelDataType rowType) {
// please note that EnumerableJoin has a condition field which actually is not useful
PlannerOp left = convertRelNode(op.getLeft(), null, false, false);
PlannerOp right = convertRelNode(op.getRight(), null, false, false);
final JoinInfo analyzeCondition = op.analyzeCondition();
int[] leftKeys = analyzeCondition.leftKeys.toIntArray();
int[] rightKeys = analyzeCondition.rightKeys.toIntArray();
boolean generateNullsOnLeft = op.getJoinType().generatesNullsOnLeft();
boolean generateNullsOnRight = op.getJoinType().generatesNullsOnRight();
List<CompiledSQLExpression> nonEquiConditions = convertJoinNonEquiConditions(analyzeCondition);
final RelDataType _rowType = rowType == null ? op.getRowType() : rowType;
List<RelDataTypeField> fieldList = _rowType.getFieldList();
Column[] columns = new Column[fieldList.size()];
String[] fieldNames = new String[columns.length];
int i = 0;
for (RelDataTypeField field : fieldList) {
Column col = Column.column(field.getName().toLowerCase(), convertToHerdType(field.getType()));
fieldNames[i] = col.name;
columns[i++] = col;
}
return new JoinOp(fieldNames, columns, leftKeys, left, rightKeys, right, generateNullsOnLeft, generateNullsOnRight, false, nonEquiConditions);
}
Aggregations