Commits

Wes McKinney authored de2edc8d591
ARROW-1156: [C++/Python] Expand casting API, add UnaryKernel callable. Use Cast in appropriate places when converting from pandas cc @cloud-fan With this patch we now try to cast to indicated type on ingest of objects from pandas: ``` In [3]: arr = np.array([None] * 5) In [4]: pa.Array.from_pandas(arr) Out[4]: <pyarrow.lib.NullArray object at 0x7f6cf1485d18> [ NA, NA, NA, NA, NA ] In [5]: pa.Array.from_pandas(arr, type=pa.int32()) Out[5]: <pyarrow.lib.Int32Array object at 0x7f6cf1485d68> [ NA, NA, NA, NA, NA ] ``` I also added zero-copy casts from integers of the right size to each of the date and time types. Includes refactoring for ARROW-1481. Author: Wes McKinney <wes.mckinney@twosigma.com> Closes #1063 from wesm/ARROW-1156 and squashes the following commits: 166d1a50 [Wes McKinney] iwyu 34f5c9d1 [Wes McKinney] Harden default cast options, fix unsafe Python case 1d07b756 [Wes McKinney] Add some basic casting unit tests in Python c1b45709 [Wes McKinney] Expose arrow::compute::Cast in Python as Array.cast. Still need to write tests a9a04c9c [Wes McKinney] UnaryKernel::Call returns Status for now for simplicity. Support pre-allocated memory 8903709b [Wes McKinney] Implement casts from null to numbers. Try to cast for types where we do not have an inference rule when converting from arrays of Python objects a22dd20a [Wes McKinney] Add test to assert zero copy for compatible integer to date/time a14b83f7 [Wes McKinney] Create callable CastKernel object. Add zero-copy cast rules for date/time types