Exemple #1
0
 ops.StringAscii:
 _string_ascii,
 ops.StringFind:
 _string_find,
 ops.StrRight:
 _string_right,
 ops.Repeat:
 fixed_arity('REPEAT', 2),
 ops.RegexSearch:
 _regex_search,
 ops.RegexExtract:
 _regex_extract,
 ops.RegexReplace:
 _regex_replace,
 ops.GroupConcat:
 _reduction('STRING_AGG'),
 ops.IfNull:
 fixed_arity('IFNULL', 2),
 ops.Cast:
 _cast,
 ops.StructField:
 _struct_field,
 ops.ArrayCollect:
 unary('ARRAY_AGG'),
 ops.ArrayConcat:
 _array_concat,
 ops.ArrayIndex:
 _array_index,
 ops.ArrayLength:
 unary('ARRAY_LENGTH'),
 ops.HLLCardinality:
Exemple #2
0
    ops.RegexExtract: _regex_extract,
    ops.RegexReplace: _regex_replace,

    ops.GroupConcat: fixed_arity('STRING_AGG', 2),

    ops.IfNull: fixed_arity('IFNULL', 2),
    ops.Cast: _cast,

    ops.StructField: _struct_field,

    ops.ArrayCollect: unary('ARRAY_AGG'),
    ops.ArrayConcat: _array_concat,
    ops.ArrayIndex: _array_index,
    ops.ArrayLength: unary('ARRAY_LENGTH'),

    ops.HLLCardinality: _reduction('APPROX_COUNT_DISTINCT'),
    ops.Log: _log,
    ops.Sign: unary('SIGN'),
    ops.Modulus: fixed_arity('MOD', 2),

    ops.Date: unary('DATE'),

    # BigQuery doesn't have these operations built in.
    # ops.ArrayRepeat: _array_repeat,
    # ops.ArraySlice: _array_slice,
    ops.Literal: _literal,
    ops.Arbitrary: _arbitrary,

    ops.TimestampTruncate: _truncate('TIMESTAMP', _timestamp_units),
    ops.DateTruncate: _truncate('DATE', _date_units),
Exemple #3
0
    ops.IfNull:
    fixed_arity('IFNULL', 2),
    ops.Cast:
    _cast,
    ops.StructField:
    _struct_field,
    ops.ArrayCollect:
    unary('ARRAY_AGG'),
    ops.ArrayConcat:
    _array_concat,
    ops.ArrayIndex:
    _array_index,
    ops.ArrayLength:
    unary('ARRAY_LENGTH'),
    ops.HLLCardinality:
    _reduction('APPROX_COUNT_DISTINCT'),
    ops.Log:
    _log,
    ops.Sign:
    unary('SIGN'),
    ops.Modulus:
    fixed_arity('MOD', 2),
    ops.Date:
    unary('DATE'),

    # BigQuery doesn't have these operations built in.
    # ops.ArrayRepeat: _array_repeat,
    # ops.ArraySlice: _array_slice,
    ops.Literal:
    _literal,
    ops.Arbitrary:
Exemple #4
0
_operation_registry = impala_compiler._operation_registry.copy()
_operation_registry.update({
    ops.IsNan:
    unary('isnan'),
    ops.IfNull:
    fixed_arity('ifnull', 2),
    ops.StructField:
    _struct_field,
    ops.MapValueForKey:
    _map_value_for_key,
    ops.ArrayLength:
    unary('size'),
    ops.Round:
    _round,
    ops.HLLCardinality:
    _reduction('approx_count_distinct'),
    ops.StrRight:
    fixed_arity('right', 2),
    ops.StringSplit:
    fixed_arity('SPLIT', 2),
    ops.RegexSearch:
    fixed_arity('rlike', 2),
    ops.StringConcat:
    _string_concat,
    ops.ArrayConcat:
    fixed_arity('concat', 2),
    ops.GroupConcat:
    _group_concat,
    ops.Cast:
    _cast,
    ops.ExtractYear:
Exemple #5
0
 ops.StringAscii: _string_ascii,
 ops.StringFind: _string_find,
 ops.StrRight: _string_right,
 ops.Repeat: fixed_arity('REPEAT', 2),
 ops.RegexSearch: _regex_search,
 ops.RegexExtract: _regex_extract,
 ops.RegexReplace: _regex_replace,
 ops.GroupConcat: fixed_arity('STRING_AGG', 2),
 ops.IfNull: fixed_arity('IFNULL', 2),
 ops.Cast: _cast,
 ops.StructField: _struct_field,
 ops.ArrayCollect: unary('ARRAY_AGG'),
 ops.ArrayConcat: _array_concat,
 ops.ArrayIndex: _array_index,
 ops.ArrayLength: unary('ARRAY_LENGTH'),
 ops.HLLCardinality: _reduction('APPROX_COUNT_DISTINCT'),
 ops.Log: _log,
 ops.Sign: unary('SIGN'),
 ops.Modulus: fixed_arity('MOD', 2),
 ops.Date: unary('DATE'),
 # BigQuery doesn't have these operations built in.
 # ops.ArrayRepeat: _array_repeat,
 # ops.ArraySlice: _array_slice,
 ops.Literal: _literal,
 ops.Arbitrary: _arbitrary,
 ops.TimestampTruncate: _truncate('TIMESTAMP', _timestamp_units),
 ops.DateTruncate: _truncate('DATE', _date_units),
 ops.TimeTruncate: _truncate('TIME', _timestamp_units),
 ops.Time: unary('TIME'),
 ops.TimestampAdd: _timestamp_op(
     'TIMESTAMP_ADD', {'h', 'm', 's', 'ms', 'us'}