Example #1
0
class Substring(ValueOp):

    input_type = [
        string,
        integer(name='start'),
        integer(name='length', optional=True)
    ]
    output_type = rules.shape_like_arg(0, 'string')
Example #2
0
class BaseConvert(ValueOp):

    input_type = [
        rules.one_of([integer, string]),
        integer(name='from_base'),
        integer(name='to_base')
    ]
    output_type = rules.shape_like_flatargs('string')
Example #3
0
class StringFind(ValueOp):

    input_type = [
        string,
        string(name='substr'),
        integer(name='start', optional=True, default=None),
        integer(name='end', optional=True, default=None)
    ]
    output_type = rules.shape_like_arg(0, 'int64')
Example #4
0
 class MyOp(ops.ValueOp):
     input_type = [
         rules.list_of(
             rules.integer(as_value_expr=custom_as_value_expr),
             name='bar',
         )
     ]
Example #5
0
class ShiftBase(AnalyticOp):

    input_type = [
        rules.array,
        rules.integer(name='offset', optional=True),
        rules.value(name='default', optional=True)
    ]
    output_type = rules.type_of_arg(0)
Example #6
0
class RPad(ValueOp):

    input_type = [
        string,
        integer(name='length'),
        string(name='pad', optional=True)
    ]
    output_type = rules.shape_like_arg(0, 'string')
Example #7
0
class Round(ValueOp):

    input_type = [value, integer(name='digits', optional=True)]

    def output_type(self):
        arg, digits = self.args
        if isinstance(arg, ir.DecimalValue):
            return arg._factory
        elif digits is None:
            return rules.shape_like(arg, 'int64')
        else:
            return rules.shape_like(arg, 'double')
Example #8
0
class RegexExtract(ValueOp):

    input_type = [string, string(name='pattern'), integer(name='index')]
    output_type = rules.shape_like_arg(0, 'string')
Example #9
0
class Repeat(ValueOp):

    input_type = [string, integer(name='times')]
    output_type = rules.shape_like_arg(0, 'string')
Example #10
0
class StrRight(ValueOp):

    input_type = [string, integer(name='nchars')]
    output_type = rules.shape_like_arg(0, 'string')
Example #11
0
    class MyOp(ops.ValueOp):

        input_type = [rules.integer(name='foo', doc=doc)]

        def output_type(self):
            return MyExpr