cel-python icon indicating copy to clipboard operation
cel-python copied to clipboard

Getting evaluation error for string type, int type comparison with None

Open hraj6056 opened this issue 1 year ago • 1 comments

Got an evaluation error ("found no matching overload for 'relation_eq' applied to '(<class 'celpy.celtypes.StringType'>, <class 'NoneType'>)'", <class 'TypeError'>, ("no such overload: StringType('temp') <class 'celpy.celtypes.StringType'> != None <class 'NoneType'>",))

all_positive = "record.fullname != null"
breaks = celpy.json_to_cel({'record': {'fullname': 'temp', 'overdraftProtection': False} })

ast = env.compile(all_positive)
prgm = env.program(ast)

try:
    result =prgm.evaluate(breaks)
    print(result)
except CELEvalError as ex:
    print('Got an evaluation error', ex)
except TypeError as ex:
    print('Got a type error')

Is there any hack or something to succesfully evaluate this as it is working in this CELPlayground which is built in go.

hraj6056 avatar Nov 10 '23 07:11 hraj6056

I think just needs us to add the additional type comparisons against None, I don't have bandwidth on the moment for this, but pull requests welcome.

kapilt avatar Dec 22 '23 16:12 kapilt