// TODO: If inner input has rows of unexpected types, (not of innerType), should an IncompatibleRowException be thrown?
@Test
public void testProductAfterIndexScanOfRoot()
{
Operator flattenCO =
flatten_HKeyOrdered(
filter_Default(
branchLookup_Default(
ancestorLookup_Default(
indexScan_Default(customerNameIndexRowType, false),
coi,
customerNameIndexRowType,
Collections.singleton(customerRowType),
InputPreservationOption.DISCARD_INPUT),
coi,
customerRowType,
orderRowType,
InputPreservationOption.KEEP_INPUT),
removeDescendentTypes(orderRowType)),
customerRowType,
orderRowType,
INNER_JOIN);
Operator flattenCA =
flatten_HKeyOrdered(
branchLookup_Nested(coi, flattenCO.rowType(), customerRowType, null, list(addressRowType), InputPreservationOption.KEEP_INPUT, 0, lookaheadQuantum()),
customerRowType,
addressRowType,
INNER_JOIN);
Operator product = product_Nested(flattenCA, flattenCO.rowType(), null, flattenCA.rowType(), 0);
RowType coaRowType = product.rowType();
checkRowTypeFields(null, coaRowType,
MNumeric.INT.instance(false),
MString.VARCHAR.instance(20, true),
MNumeric.INT.instance(false),
MNumeric.INT.instance(true),
MString.VARCHAR.instance(20, true),
MNumeric.INT.instance(false),
MNumeric.INT.instance(true),
MString.VARCHAR.instance(100, true));
Operator plan = map_NestedLoops(flattenCO, product, 0, pipelineMap(), 1);
Cursor cursor = cursor(plan, queryContext, queryBindings);
Row[] expected = new Row[]{
row(coaRowType, 2L, "foundation", 200L, 2L, "david", 2000L, 2L, "222 2000 st"),
row(coaRowType, 2L, "foundation", 201L, 2L, "david", 2000L, 2L, "222 2000 st"),
row(coaRowType, 3L, "matrix", 300L, 3L, "tom", 3000L, 3L, "333 3000 st"),