src/logicalPlan/source/LogicalPlanBuilder.cc
shared_ptr<ApplyLambda> makeApplyLambdaFromGreaterThan(const GreaterThan& gt) {
    if (gt.leftHandSide.tableId != gt.rightHandSide.tableId)
        throw "cross table comparison not supported by ApplyLambda";  // TupleSpec allows only one
                                                                      // setNameIn in constructor

    string inputTableId = gt.leftHandSide.tableId;

    /*
     * Create an "input" TupleSpec that corresponds the left and right hand sides of gt while
     * preserving order.
     *
     * For example, if the original TCAP assignment was:
     *
     *     D(student, isExamGreater) = C[examAverage] > C[hwAverage] retain student
     *
     * input would be:
     *
     *    setName: "C"
     *    atts: ["examAverage", "hwAverage"]
     */
    TupleSpec input;
    {
        AttList inputColumn;
        inputColumn.appendAttribute(gt.leftHandSide.columnId);
        inputColumn.appendAttribute(gt.rightHandSide.columnId);
        input = TupleSpec(inputTableId, inputColumn);
    }

    /*
     * Create an "output" TupleSpec that corresponds the result of the operation.
     *
     * For example, if the original TCAP assignment was:
     *
     *    D(student, isExamGreater) = C[examAverage] > C[hwAverage] retain student
     *
     * output would be:
     *
     *    setName: "C"
     *    atts: ["student", "isExamGreater"]
     */
    TupleSpec output;
    {
        AttList attributes = makeAttributeList(*gt.columnsToCopyToOutputTable.get());
        attributes.appendAttribute(gt.outputColumn.columnId);
        output = TupleSpec(gt.outputColumn.tableId, attributes);
    }

    /*
     * Create a "projection" TupleSpec that describes which columns are to be copied from the input
     * to the output.
     * (these will be a subset of the output TupleSpec created above)
     *
     * For example, if the original TCAP assignment was:
     *
     *     D(student, isExamGreater) = C[examAverage] > C[hwAverage] retain student
     *
     * output would be:
     *
     *    setName: "C"
     *    atts: ["student"]
     *
     */
    TupleSpec projection;
    {
        AttList attributes = makeAttributeList(*gt.columnsToCopyToOutputTable.get());
        projection = TupleSpec(inputTableId, attributes);
    }

    return make_shared<ApplyLambda>(input, output, projection, gt.executorId);
}
/**
 * Creates a corresponding ApplyLambda from the given GreaterThan:
 *
 * For example, if the given GreaterThan modeled the following TCAP statement:
 *
 *    @exec "executor3"
 *    D(student, isExamGreater) = C[examAverage] > C[hwAverage] retain student
 *
 * the created ApplyLambda would have the following form:
 *
 * input:      ("C", ["examAverage", "hwAverage"])
 * output:     ("D", ["student", "isExamGreater", "hwAverage"])
 * projection: ("C", ["student"])
 * lambdaName: "executor3"
 *
 * The order of the columns in input is guranteed to be first the left hand side column followed by
 * the right.
 * ApplyLambda only supports the left hand column and right hand column coming from the same set, so
 * if the
 * table ids for the left hand side and right hand side don't match this method willl throw a string
 * exception.
 *
 * @param gt the GreaterThan to translate into an ApplyLambda
 * @return and ApplyLambda representatino of gt
 */
Creates a corresponding ApplyLambda from the given GreaterThan:
For example, if the given GreaterThan modeled the following TCAP statement.

@exec "executor3"
D(student, isExamGreater) = C[examAverage] > C[hwAverage] retain student

the created ApplyLambda would have the following form.



The order of the columns in input is guranteed to be first the left hand side column followed by
the right.
ApplyLambda only supports the left hand column and right hand column coming from the same set, so
if the
table ids for the left hand side and right hand side don't match this method willl throw a string
exception.

@param gt the GreaterThan to translate into an ApplyLambda
@return and ApplyLambda representatino of gt
Creates a corresponding ApplyLambda from the given GreaterThan : For example if the given GreaterThan modeled the following TCAP statement . @exec " executor3 " D ( student isExamGreater ) = C [ examAverage ] > C [ hwAverage ] retain student the created ApplyLambda would have the following form . The order of the columns in input is guranteed to be first the left hand side column followed by the right . ApplyLambda only supports the left hand column and right hand column coming from the same set so if the table ids for the left hand side and right hand side don ' t match this method willl throw a string exception . @param gt the GreaterThan to translate into an ApplyLambda @return and ApplyLambda representatino of gt
shared_ptr<ApplyLambda> makeApplyLambdaFromGreaterThan(const GreaterThan& gt) {
    if (gt.leftHandSide.tableId != gt.rightHandSide.tableId)
        throw "cross table comparison not supported by ApplyLambda";  
    string inputTableId = gt.leftHandSide.tableId;
    TupleSpec input;
    {
        AttList inputColumn;
        inputColumn.appendAttribute(gt.leftHandSide.columnId);
        inputColumn.appendAttribute(gt.rightHandSide.columnId);
        input = TupleSpec(inputTableId, inputColumn);
    }
    TupleSpec output;
    {
        AttList attributes = makeAttributeList(*gt.columnsToCopyToOutputTable.get());
        attributes.appendAttribute(gt.outputColumn.columnId);
        output = TupleSpec(gt.outputColumn.tableId, attributes);
    }
    TupleSpec projection;
    {
        AttList attributes = makeAttributeList(*gt.columnsToCopyToOutputTable.get());
        projection = TupleSpec(inputTableId, attributes);
    }
    return make_shared<ApplyLambda>(input, output, projection, gt.executorId);
}
shared_ptr < ApplyLambda > makeApplyLambdaFromGreaterThan ( const GreaterThan & gt ) { if ( gt . leftHandSide . tableId != gt . rightHandSide . tableId ) throw " " ; string inputTableId = gt . leftHandSide . tableId ; TupleSpec input ; { AttList inputColumn ; inputColumn . appendAttribute ( gt . leftHandSide . columnId ) ; inputColumn . appendAttribute ( gt . rightHandSide . columnId ) ; input = TupleSpec ( inputTableId , inputColumn ) ; } TupleSpec output ; { AttList attributes = makeAttributeList ( * gt . columnsToCopyToOutputTable . get ( ) ) ; attributes . appendAttribute ( gt . outputColumn . columnId ) ; output = TupleSpec ( gt . outputColumn . tableId , attributes ) ; } TupleSpec projection ; { AttList attributes = makeAttributeList ( * gt . columnsToCopyToOutputTable . get ( ) ) ; projection = TupleSpec ( inputTableId , attributes ) ; } return make_shared < ApplyLambda > ( input , output , projection , gt . executorId ) ; }
Creates a corresponding ApplyLambda from the given GreaterThan:
 For example, if the given GreaterThan modeled the following TCAP statement:
Creates a corresponding ApplyLambda from the given GreaterThan : For example if the given GreaterThan modeled the following TCAP statement :
// TupleSpec allows only one // setNameIn in constructor /*
     * Create an "input" TupleSpec that corresponds the left and right hand sides of gt while
     * preserving order.
     *
     * For example, if the original TCAP assignment was:
     *
     *     D(student, isExamGreater) = C[examAverage] > C[hwAverage] retain student
     *
     * input would be:
     *
     *    setName: "C"
     *    atts: ["examAverage", "hwAverage"]
     */ /*
     * Create an "output" TupleSpec that corresponds the result of the operation.
     *
     * For example, if the original TCAP assignment was:
     *
     *    D(student, isExamGreater) = C[examAverage] > C[hwAverage] retain student
     *
     * output would be:
     *
     *    setName: "C"
     *    atts: ["student", "isExamGreater"]
     */ /*
     * Create a "projection" TupleSpec that describes which columns are to be copied from the input
     * to the output.
     * (these will be a subset of the output TupleSpec created above)
     *
     * For example, if the original TCAP assignment was:
     *
     *     D(student, isExamGreater) = C[examAverage] > C[hwAverage] retain student
     *
     * output would be:
     *
     *    setName: "C"
     *    atts: ["student"]
     *
     */