Exemplo n.º 1
0
    def test_sql_generation(self):
        op = udf.scalar_function(['string'], 'string', name='Tester')
        udf.add_impala_operation(op, 'identity', 'udf_testing')

        def _identity_test(value):
            return op(value).to_expr()
        result = _identity_test('hello world')
        assert result == "SELECT udf_testing.identity('hello world')"
Exemplo n.º 2
0
def scalar_function(inputs, output, name=None):
    """
    Creates and returns an operator class that can be
    passed to add_impala_operation()

    Parameters:
    inputs: list of strings denoting ibis datatypes
    output: string denoting ibis datatype
    name: string (optional). Used internally to track function

    Returns
    -------
    op : operator class to use in construction function
    """
    return udf.scalar_function(inputs, output, name=name)
Exemplo n.º 3
0
 def _udf_registration(self, inputs, output, name):
     op = udf.scalar_function(inputs, output, name=name)
     assert issubclass(op, ValueOp)
     udf.add_impala_operation(op, name, 'ibis_testing')
     return op