def test_create_udf(self): func = api.wrap_udf('/foo/bar.so', self.inputs, self.output, so_symbol='testFunc', name=self.name) stmt = ddl.CreateUDF(func) result = stmt.compile() expected = ("CREATE FUNCTION `test_name`(string, string) " "returns bigint " "location '/foo/bar.so' symbol='testFunc'") assert result == expected
def test_create_udf_type_conversions(self): inputs = ['string', 'int8', 'int16', 'int32'] func = api.wrap_udf('/foo/bar.so', inputs, self.output, so_symbol='testFunc', name=self.name) stmt = ddl.CreateUDF(func) # stmt = ddl.CreateFunction('/foo/bar.so', 'testFunc', # , # self.output, self.name) result = stmt.compile() expected = ("CREATE FUNCTION `test_name`(string, tinyint, " "smallint, int) returns bigint " "location '/foo/bar.so' symbol='testFunc'") assert result == expected