String lineitemsPath = (args.length > 5 ? args[5] : "");
String output = (args.length > 6 ? args[6] : "");
// create DataSourceContract for Orders input
FileDataSource orders1 = new FileDataSource(new CsvInputFormat(), orders1Path, "Orders 1");
CsvInputFormat.configureRecordFormat(orders1)
.recordDelimiter('\n')
.fieldDelimiter('|')
.field(LongValue.class, 0) // order id
.field(IntValue.class, 7) // ship prio
.field(StringValue.class, 2, 2) // order status
.field(StringValue.class, 4, 10) // order date
.field(StringValue.class, 5, 8); // order prio
FileDataSource orders2 = new FileDataSource(new CsvInputFormat(), orders2Path, "Orders 2");
CsvInputFormat.configureRecordFormat(orders2)
.recordDelimiter('\n')
.fieldDelimiter('|')
.field(LongValue.class, 0) // order id
.field(IntValue.class, 7) // ship prio
.field(StringValue.class, 2, 2) // order status
.field(StringValue.class, 4, 10) // order date
.field(StringValue.class, 5, 8); // order prio
// create DataSourceContract for LineItems input
FileDataSource lineitems = new FileDataSource(new CsvInputFormat(), lineitemsPath, "LineItems");
CsvInputFormat.configureRecordFormat(lineitems)
.recordDelimiter('\n')
.fieldDelimiter('|')
.field(LongValue.class, 0)
.field(DoubleValue.class, 5);
// create MapOperator for filtering Orders tuples
MapOperator filterO1 = MapOperator.builder(new FilterO())
.name("FilterO")
.input(orders1)
.build();
// filter configuration
filterO1.setParameter(TPCHQuery3.YEAR_FILTER, 1993);
filterO1.setParameter(TPCHQuery3.PRIO_FILTER, "5");
filterO1.getCompilerHints().setFilterFactor(0.05f);
// create MapOperator for filtering Orders tuples
MapOperator filterO2 = MapOperator.builder(new FilterO())
.name("FilterO")
.input(orders2)
.build();
// filter configuration
filterO2.setParameter(TPCHQuery3.YEAR_FILTER, 1993);
filterO2.setParameter(TPCHQuery3.PRIO_FILTER, "5");
// create JoinOperator for joining Orders and LineItems
@SuppressWarnings("unchecked")
JoinOperator joinLiO = JoinOperator.builder(new JoinLiO(), LongValue.class, 0, 0)
.input1(filterO2, filterO1)
.input2(lineitems)
.name("JoinLiO")
.build();
FileDataSource partJoin1 = new FileDataSource(new CsvInputFormat(), partJoin1Path, "Part Join 1");
CsvInputFormat.configureRecordFormat(partJoin1)
.recordDelimiter('\n')
.fieldDelimiter('|')
.field(LongValue.class, 0)
.field(IntValue.class, 1)
.field(DoubleValue.class, 2);
FileDataSource partJoin2 = new FileDataSource(new CsvInputFormat(), partJoin2Path, "Part Join 2");
CsvInputFormat.configureRecordFormat(partJoin2)
.recordDelimiter('\n')
.fieldDelimiter('|')
.field(LongValue.class, 0)
.field(IntValue.class, 1)