pytorch/torcharrow

Access to non-exist column in DF result in very unfriendly error msg

wenleix opened this issue · 0 comments

To reproduce:

import torcharrow as ta
df = ta.DataFrame({"a": [1, 2, 3]})

df["b"]

Output

>>> df["b"]
E20211112 13:52:55.454295 207011328 Exceptions.h:68] /Users/wxie/Code/torcharrow/csrc/velox/velox/velox/type/Type.cpp273getChildIdxindex.has_value()Field not found: bUSERINVALID_ARGUMENT
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/wxie/Code/torcharrow/torcharrow/trace.py", line 98, in wrapped
    res = fn(*args, **kwargs)
  File "/Users/wxie/Code/torcharrow/torcharrow/icolumn.py", line 289, in __getitem__
    return self.get_column(arg)
  File "/Users/wxie/Code/torcharrow/torcharrow/velox_rt/dataframe_cpu.py", line 301, in get_column
    idx = self._data.type().get_child_idx(column)
RuntimeError: Exception: VeloxUserError
Error Source: USER
Error Code: INVALID_ARGUMENT
Reason: Field not found: b
Retriable: False
Expression: index.has_value()
Function: getChildIdx
File: /Users/wxie/Code/torcharrow/csrc/velox/velox/velox/type/Type.cpp
Line: 273
Stack trace:

Looks like we didn't check the existence of a column