use of herddb.model.planner.SemiJoinOp in project herddb by diennea.
the class CalcitePlanner method planEnumerableSemiJoin.
private PlannerOp planEnumerableSemiJoin(EnumerableSemiJoin op, RelDataType rowType) {
// please note that EnumerableSemiJoin has a condition field which actually is not useful
PlannerOp left = convertRelNode(op.getLeft(), null, false);
PlannerOp right = convertRelNode(op.getRight(), null, false);
int[] leftKeys = op.getLeftKeys().toIntArray();
int[] rightKeys = op.getRightKeys().toIntArray();
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 SemiJoinOp(fieldNames, columns, leftKeys, left, rightKeys, right);
}
use of herddb.model.planner.SemiJoinOp in project herddb by diennea.
the class CalcitePlanner method planEnumerableHashJoin.
private PlannerOp planEnumerableHashJoin(EnumerableHashJoin op, RelDataType rowType) {
// please note that EnumerableSemiJoin 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;
}
if (op.isSemiJoin()) {
return new SemiJoinOp(fieldNames, columns, leftKeys, left, rightKeys, right);
} else {
return new JoinOp(fieldNames, columns, leftKeys, left, rightKeys, right, generateNullsOnLeft, generateNullsOnRight, false, nonEquiConditions);
}
}
Aggregations