Пример #1
0
 def __create_args(self,
                   pipe=None,
                   aggregator=None,
                   output_selector=None,
                   assertion_level=None,
                   assertion=None,
                   buffer=None,
                   argument_selector=None):
     args = []
     args.append(pipe.get_assembly())
     if argument_selector:
         args.append(coerce_to_fields(argument_selector))
     if aggregator:
         # for now we assume it's a Cascading aggregator straight
         args.append(_wrap_function(aggregator, CascadingAggregatorWrapper))
         if output_selector:
             args.append(coerce_to_fields(output_selector))
     if assertion_level:
         args.append(assertion_level)
         args.append(assertion)
     if buffer:
         args.append(_wrap_function(buffer, CascadingBufferWrapper))
         if output_selector:
             args.append(coerce_to_fields(output_selector))
     return args
Пример #2
0
 def __create_args(self,
                   group_name=None,
                   pipes=None, group_fields=None, sort_fields=None,
                   reverse_order=None,
                   pipe=None,
                   lhs_pipe=None, rhs_pipe=None):
     # We can use an unnamed parameter only for group_fields
     if self.__args:
         group_fields = coerce_to_fields(self.__args[0])
     args = []
     if group_name:
         args.append(group_name)
     if pipes:
         args.append([p.get_assembly() for p in pipes])
         if group_fields:
             args.append(coerce_to_fields(group_fields))
             if sort_fields:
                 args.append(coerce_to_fields(sort_fields))
                 if reverse_order:
                     args.append(reverse_order)
     elif pipe:
         args.append(pipe.get_assembly())
         if group_fields:
             args.append(coerce_to_fields(group_fields))
             if sort_fields:
                 args.append(coerce_to_fields(sort_fields))
             if reverse_order:
                 args.append(reverse_order)
     elif lhs_pipe:
         args.append(lhs_pipe.get_assembly())
         args.append(rhs_pipe.get_assembly())
         args.append(coerce_to_fields(group_fields))
     return args
Пример #3
0
 def __create_args(self,
                   group_name=None,
                   pipes=None,
                   group_fields=None,
                   declared_fields=None,
                   result_group_fields=None,
                   joiner=None,
                   pipe=None,
                   num_self_joins=None,
                   lhs=None,
                   lhs_group_fields=None,
                   rhs=None,
                   rhs_group_fields=None):
     # We can use an unnamed parameter only for group_fields
     if self.__args:
         group_fields = self.__args[0]
     args = []
     if group_name:
         args.append(str(group_name))
     if lhs:
         args.append(lhs.get_assembly())
         args.append(coerce_to_fields(lhs_group_fields))
         args.append(rhs.get_assembly())
         args.append(coerce_to_fields(rhs_group_fields))
         if declared_fields:
             args.append(coerce_to_fields(declared_fields))
             if result_group_fields:
                 args.append(coerce_to_fields(result_group_fields))
         if joiner:
             args.append(joiner)
     elif pipes:
         args.append([p.get_assembly() for p in pipes])
         if group_fields:
             args.append([coerce_to_fields(f) for f in group_fields])
             if declared_fields:
                 args.append(coerce_to_fields(declared_fields))
                 if result_group_fields:
                     args.append(coerce_to_fields(result_group_fields))
             else:
                 args.append(None)
             if joiner is None:
                 joiner = cascading.pipe.cogroup.InnerJoin()
             args.append(joiner)
     elif pipe:
         args.append(pipe.get_assembly())
         args.append(coerce_to_fields(group_fields))
         args.append(int(num_self_joins))
         if declared_fields:
             args.append(coerce_to_fields(declared_fields))
             if result_group_fields:
                 args.append(coerce_to_fields(result_group_fields))
         if joiner:
             args.append(joiner)
     return args
Пример #4
0
 def __create_args(self,
                   group_name=None,
                   pipes=None, group_fields=None, declared_fields=None,
                   result_group_fields=None, joiner=None,
                   pipe=None, num_self_joins=None,
                   lhs=None, lhs_group_fields=None,
                   rhs=None, rhs_group_fields=None):
     # We can use an unnamed parameter only for group_fields
     if self.__args:
         group_fields = [coerce_to_fields(f) for f in self.__args[0]]
     args = []
     if group_name:
         args.append(str(group_name))
     if lhs:
         args.append(lhs.get_assembly())
         args.append(coerce_to_fields(lhs_group_fields))
         args.append(rhs.get_assembly())
         args.append(coerce_to_fields(rhs_group_fields))
         if declared_fields:
             args.append(coerce_to_fields(declared_fields))
             if result_group_fields:
                 args.append(coerce_to_fields(result_group_fields))
         if joiner:
             args.append(joiner)
     elif pipes:
         args.append([p.get_assembly() for p in pipes])
         if group_fields:
             args.append([coerce_to_fields(f) for f in group_fields])
             if declared_fields:
                 args.append(coerce_to_fields(declared_fields))
                 if result_group_fields:
                     args.append(coerce_to_fields(result_group_fields))
             else:
                 args.append(None)
             if joiner is None:
                 joiner = cascading.pipe.cogroup.InnerJoin()
             args.append(joiner)
     elif pipe:
         args.append(pipe.get_assembly())
         args.append(coerce_to_fields(group_fields))
         args.append(int(num_self_joins))
         if declared_fields:
             args.append(coerce_to_fields(declared_fields))
             if result_group_fields:
                 args.append(coerce_to_fields(result_group_fields))
         if joiner:
             args.append(joiner)
     return args
Пример #5
0
    def __create_args(self,
                      pipe=None,
                      aggregator=None,
                      output_selector=None,
                      assertion_level=None,
                      assertion=None,
                      buffer=None,
                      argument_selector=None):
        if self.__args:
            # If we pass in an unnamed argument, try to determine its type
            if isinstance(self.__args[0], cascading.operation.Aggregator):
                aggregator = self.__args[0]
            else:
                buffer = self.__args[0]
        # Set up some defaults
        if argument_selector is None:
            argument_selector = cascading.tuple.Fields.ALL
        if output_selector is None:
            if aggregator is not None:
                # In the case of aggregators, we want to return both the
                # groupings and the results
                output_selector = cascading.tuple.Fields.ALL
            else:
                output_selector = cascading.tuple.Fields.RESULTS

        args = []
        args.append(pipe.get_assembly())
        if argument_selector is not None:
            args.append(coerce_to_fields(argument_selector))
        if aggregator is not None:
            # for now we assume it's a Cascading aggregator straight
            args.append(wrap_function(aggregator, CascadingAggregatorWrapper))
            if output_selector:
                args.append(coerce_to_fields(output_selector))
        if assertion_level is not None:
            args.append(assertion_level)
            args.append(assertion)
        if buffer is not None:
            args.append(wrap_function(buffer, CascadingBufferWrapper))
            if output_selector:
                args.append(coerce_to_fields(output_selector))
        return args
Пример #6
0
    def __create_args(self,
                      pipe=None,
                      aggregator=None, output_selector=None,
                      assertion_level=None, assertion=None,
                      buffer=None,
                      argument_selector=None):
        if self.__args:
            # If we pass in an unnamed argument, try to determine its type
            if isinstance(self.__args[0], cascading.operation.Aggregator):
                aggregator = self.__args[0]
            else:
                buffer = self.__args[0]
        # Set up some defaults
        if argument_selector is None:
            argument_selector = cascading.tuple.Fields.ALL
        if output_selector is None:
            if aggregator is not None:
                # In the case of aggregators, we want to return both the
                # groupings and the results
                output_selector = cascading.tuple.Fields.ALL
            else:
                output_selector = cascading.tuple.Fields.RESULTS

        args = []
        args.append(pipe.get_assembly())
        if argument_selector is not None:
            args.append(coerce_to_fields(argument_selector))
        if aggregator is not None:
            # for now we assume it's a Cascading aggregator straight
            args.append(wrap_function(aggregator, CascadingAggregatorWrapper))
            if output_selector:
                args.append(coerce_to_fields(output_selector))
        if assertion_level is not None:
            args.append(assertion_level)
            args.append(assertion)
        if buffer is not None:
            args.append(wrap_function(buffer, CascadingBufferWrapper))
            if output_selector:
                args.append(coerce_to_fields(output_selector))
        return args
Пример #7
0
 def __create_args(self,
                   pipe=None,
                   aggregator=None, output_selector=None,
                   assertion_level=None, assertion=None,
                   buffer=None,
                   argument_selector=None):
     args = []
     args.append(pipe.get_assembly())
     if argument_selector:
         args.append(coerce_to_fields(argument_selector))
     if aggregator:
         # for now we assume it's a Cascading aggregator straight
         args.append(_wrap_function(aggregator, CascadingAggregatorWrapper))
         if output_selector:
             args.append(coerce_to_fields(output_selector))
     if assertion_level:
         args.append(assertion_level)
         args.append(assertion)
     if buffer:
         args.append(_wrap_function(buffer, CascadingBufferWrapper))
         if output_selector:
             args.append(coerce_to_fields(output_selector))
     return args
Пример #8
0
 def __create_args(self,
                   group_name=None,
                   pipes=None,
                   group_fields=None,
                   sort_fields=None,
                   reverse_order=None,
                   pipe=None,
                   lhs_pipe=None,
                   rhs_pipe=None):
     # We can use an unnamed parameter only for group_fields
     if self.__args:
         group_fields = self.__args[0]
     args = []
     if group_name:
         args.append(group_name)
     if pipes:
         args.append([p.get_assembly() for p in pipes])
         if group_fields:
             args.append(coerce_to_fields(group_fields))
             if sort_fields:
                 args.append(coerce_to_fields(sort_fields))
                 if reverse_order:
                     args.append(reverse_order)
     elif pipe:
         args.append(pipe.get_assembly())
         if group_fields:
             args.append(coerce_to_fields(group_fields))
             if sort_fields:
                 args.append(coerce_to_fields(sort_fields))
             if reverse_order:
                 args.append(reverse_order)
     elif lhs_pipe:
         args.append(lhs_pipe.get_assembly())
         args.append(rhs_pipe.get_assembly())
         args.append(coerce_to_fields(group_fields))
     return args