- 
                Notifications
    
You must be signed in to change notification settings  - Fork 328
 
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededtypesIssues related to the type systemIssues related to the type system
Description
Describe the bug
if you have invalid types for native expressions such as using upper on a list[int], you get a type error during planning stating that the input is not of the correct type.
df = daft.from_pydict({"ints_list": [[1], [1, 2, 3]]})
df = df.select(daft.functions.upper(df["ints_list"]))
df.show()
daft.exceptions.DaftCoreException: DaftError::External Unable to create logical plan node.
Due to: DaftError::TypeError Expects input to 'upper' to be utf8, but received List[Int64]but if you use a udf, the type signature is ignored, and results in a runtime error.
@daft.func
def my_upper(s: str) -> str: # s is actually a list[int] and the type signature is ignored
    return s.upper()
df = df.select(my_upper(df["ints_list"]))
df.show()
daft.exceptions.DaftCoreException: DaftError::ComputeError Error processing some rows:
0: DaftError::PyO3Error AttributeError: 'list' object has no attribute 'upper'To Reproduce
see above
Expected behavior
if i have a function like:
@daft.func
def my_upper(s: str) -> str: ...I'd expect daft to recognize that I expect this to only accept strings and error during planning time instead of failing during execution.
I'd want to get the same error message as you get with the native expressions
Due to: DaftError::TypeError Expects input to 'my_upper' to be utf8, but received List[Int64]Component(s)
Expressions
Additional context
No response
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededtypesIssues related to the type systemIssues related to the type system