private SubplanPattern createSubplanPattern() { final OperatorPattern<MapOperator<Record, Record>> operatorPattern = new OperatorPattern<>( "projection", new MapOperator<>(null, Record.class, Record.class), false ) .withAdditionalTest(op -> op.getFunctionDescriptor() instanceof ProjectionDescriptor) .withAdditionalTest(op -> op.getNumInputs() == 1); // No broadcasts. return SubplanPattern.createSingleton(operatorPattern); }
/** * Creates a new instance that projects the given fields of {@link Record}s. * * @param fieldNames the field names for the projected fields * @return the new instance */ public static MapOperator<Record, Record> createProjection( RecordType inputType, String... fieldNames) { return new MapOperator<>(ProjectionDescriptor.createForRecords(inputType, fieldNames)); }
MapOperator<Tuple2<Long, Long>, Tuple2<Long, Long>> forward = new MapOperator<>( t -> t, ReflectionUtils.specify(Tuple2.class), ReflectionUtils.specify(Tuple2.class) ); forward.at(epoch); forward.setName(String.format("%s (forward)", operatorBaseName)); vertexExtractor.at(epoch); vertexExtractor.setName(String.format("%s (extract vertices)", operatorBaseName)); forward.connectTo(0, vertexExtractor, 0); MapOperator<Tuple2<Long, Long>, Tuple2<Long, long[]>> adjacencyPreparator = new MapOperator<>( t -> new Tuple2<>(t.field0, new long[]{t.field1}), ReflectionUtils.specify(Tuple2.class), ReflectionUtils.specify(Tuple2.class) ); adjacencyPreparator.at(epoch); adjacencyPreparator.setName(String.format("%s (prepare adjacencies)", operatorBaseName)); forward.connectTo(0, adjacencyPreparator, 0); 0.5d, 1, false, longs -> Math.round(longs[0] * NUM_VERTICES_PER_EDGE) )); adjacencyPreparator.connectTo(0, adjacencyCreator, 0); MapOperator<Long, Tuple2<Long, Float>> initializeRanks = new MapOperator<>( new RankInitializer(), Long.class, ReflectionUtils.specify(Tuple2.class) ); initializeRanks.at(epoch); initializeRanks.setName(String.format("%s (initialize ranks)", operatorBaseName));
loopOperator.setName(repeatOperator.getName()); final MapOperator<Integer, Integer> increment = new MapOperator<>( i -> i + 1, Integer.class, Integer.class ); increment.setName(String.format("%s (inc)", repeatOperator.getName())); increment.connectTo(0, loopOperator, LoopOperator.ITERATION_CONVERGENCE_INPUT_INDEX);
/** * Copies an instance (exclusive of broadcasts). * * @param that that should be copied */ public MapOperator(MapOperator<InputType, OutputType> that) { super(that); this.functionDescriptor = that.getFunctionDescriptor(); }
private SubplanPattern createSubplanPattern() { final OperatorPattern operatorPattern = new OperatorPattern( "map", new MapOperator<>(null, DataSetType.none(), DataSetType.none()), false ); return SubplanPattern.createSingleton(operatorPattern); }
private SubplanPattern createSubplanPattern() { OperatorPattern<MapOperator<Record, Record>> operatorPattern = new OperatorPattern<>( "projection", new MapOperator<>( null, DataSetType.createDefault(Record.class), DataSetType.createDefault(Record.class) ), false ) .withAdditionalTest(op -> op.getFunctionDescriptor() instanceof ProjectionDescriptor) .withAdditionalTest(op -> op.getNumInputs() == 1); // No broadcasts. return SubplanPattern.createSingleton(operatorPattern); }
private SubplanPattern createSubplanPattern() { final OperatorPattern operatorPattern = new OperatorPattern( "map", new MapOperator<>(null, DataSetType.none(), DataSetType.none()), false); return SubplanPattern.createSingleton(operatorPattern); }
/** * Creates a new instance that projects the given fields. * * @param fieldNames the field names for the projected fields * @return the new instance */ public static <Input, Output> MapOperator<Input, Output> createProjection( Class<Input> inputClass, Class<Output> outputClass, String... fieldNames) { return new MapOperator<>(new ProjectionDescriptor<>(inputClass, outputClass, fieldNames)); }