
from numba.ext.impala import udf, IntVal, FunctionContext

@udf(IntVal(FunctionContext, IntVal, IntVal))
def add_udf(context, arg1, arg2):
    if arg1.is_null or arg2.is_null:
        return IntVal.null
    return IntVal(arg1.val + arg2.val)

# Simply print the module IR
print(add_udf.llvm_module)



from numba.ext.impala import (udf, IntVal, FunctionContext, BooleanVal,
                              DoubleVal, TinyIntVal)

@udf(IntVal(FunctionContext, IntVal, IntVal))
def add_udf(context, arg1, arg2):
    if arg1.is_null or arg2.is_null:
        return IntVal.null
    return IntVal(arg1.val + arg2.val)

# Simply print the module IR
print(add_udf.llvm_module)


@udf(BooleanVal(FunctionContext, DoubleVal, TinyIntVal))
def exercise_double_tinyint_bool(context, arg1, arg2):
    if arg1.is_null or arg2.is_null:
        return BooleanVal.null

    lt = arg1.val < arg2.val
    return BooleanVal(lt)


print(exercise_double_tinyint_bool.llvm_module)

Add simple test to exercise DoubleVal, TinyIntVal and BooleanVal
Add simple test to exercise DoubleVal, TinyIntVal and BooleanVal

  
- from numba.ext.impala import udf, IntVal, FunctionContext
+ from numba.ext.impala import (udf, IntVal, FunctionContext, BooleanVal,
+                               DoubleVal, TinyIntVal)
  
  @udf(IntVal(FunctionContext, IntVal, IntVal))
  def add_udf(context, arg1, arg2):
      if arg1.is_null or arg2.is_null:
          return IntVal.null
      return IntVal(arg1.val + arg2.val)
  
  # Simply print the module IR
  print(add_udf.llvm_module)
  
  
+ @udf(BooleanVal(FunctionContext, DoubleVal, TinyIntVal))
+ def exercise_double_tinyint_bool(context, arg1, arg2):
+     if arg1.is_null or arg2.is_null:
+         return BooleanVal.null
+ 
+     lt = arg1.val < arg2.val
+     return BooleanVal(lt)
+ 
+ 
+ print(exercise_double_tinyint_bool.llvm_module)
+ 
Add simple test to exercise DoubleVal, TinyIntVal and BooleanVal
## Code Before:

from numba.ext.impala import udf, IntVal, FunctionContext

@udf(IntVal(FunctionContext, IntVal, IntVal))
def add_udf(context, arg1, arg2):
    if arg1.is_null or arg2.is_null:
        return IntVal.null
    return IntVal(arg1.val + arg2.val)

# Simply print the module IR
print(add_udf.llvm_module)


## Instruction:
Add simple test to exercise DoubleVal, TinyIntVal and BooleanVal
## Code After:

from numba.ext.impala import (udf, IntVal, FunctionContext, BooleanVal,
                              DoubleVal, TinyIntVal)

@udf(IntVal(FunctionContext, IntVal, IntVal))
def add_udf(context, arg1, arg2):
    if arg1.is_null or arg2.is_null:
        return IntVal.null
    return IntVal(arg1.val + arg2.val)

# Simply print the module IR
print(add_udf.llvm_module)


@udf(BooleanVal(FunctionContext, DoubleVal, TinyIntVal))
def exercise_double_tinyint_bool(context, arg1, arg2):
    if arg1.is_null or arg2.is_null:
        return BooleanVal.null

    lt = arg1.val < arg2.val
    return BooleanVal(lt)


print(exercise_double_tinyint_bool.llvm_module)
