def _udf_creation_to_op(self, name, symbol, inputs, output): udf_info = udf.wrap_udf(self.udf_ll, inputs, output, symbol, name) self.temp_functions.append((name, inputs)) self.con.create_udf(udf_info, database=self.test_data_db) op = udf_info.to_operation() udf.add_operation(op, name, self.test_data_db) assert self.con.exists_udf(name, self.test_data_db) return op
def test_sql_generation(self): op = udf.scalar_function(['string'], 'string', name='Tester') udf.add_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')"
def test_sql_generation(self): op = udf.scalar_function(["string"], "string", name="Tester") udf.add_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')"
def test_sql_generation_from_infoclass(self): udf_info = udf.UDFCreator('test.so', ['string'], 'string', 'info_test') repr(udf_info) op = udf_info.to_operation() udf.add_operation(op, 'info_test', 'udf_testing') assert op in _operation_registry def _infoclass_test(value): return op(value).to_expr() result = _infoclass_test('hello world') assert result == "SELECT udf_testing.info_test('hello world')"
def test_sql_generation_from_infoclass(self): udf_info = udf.UDFCreator("test.so", ["string"], "string", "info_test") repr(udf_info) op = udf_info.to_operation() udf.add_operation(op, "info_test", "udf_testing") assert op in _operation_registry def _infoclass_test(value): return op(value).to_expr() result = _infoclass_test("hello world") assert result == "SELECT udf_testing.info_test('hello world')"
def _udf_registration(self, inputs, output, name): op = udf.scalar_function(inputs, output, name=name) assert issubclass(op, ValueOp) udf.add_operation(op, name, "ibis_testing") return op
def _udf_registration(self, inputs, output, name): op = udf.scalar_function(inputs, output, name=name) assert issubclass(op, ValueOp) udf.add_operation(op, name, 'ibis_testing') return op