Skip to content

Commit

Permalink
GH-43183: [C++] Add date to date cast
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko committed Jul 8, 2024
1 parent e8a795b commit c021d4e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cpp/src/arrow/compute/kernels/scalar_cast_temporal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,12 @@ void AddCrossUnitCastNoPreallocate(CastFunction* func) {

std::shared_ptr<CastFunction> GetDate32Cast() {
auto func = std::make_shared<CastFunction>("cast_date32", Type::DATE32);
auto out_ty = date32();
const auto& out_ty = date32();
AddCommonCasts(Type::DATE32, out_ty, func.get());

// date32 -> date32
AddCrossUnitCast<Date32Type>(func.get());

// int32 -> date32
AddZeroCopyCast(Type::INT32, int32(), date32(), func.get());

Expand All @@ -532,9 +535,12 @@ std::shared_ptr<CastFunction> GetDate32Cast() {

std::shared_ptr<CastFunction> GetDate64Cast() {
auto func = std::make_shared<CastFunction>("cast_date64", Type::DATE64);
auto out_ty = date64();
const auto out_ty = date64();
AddCommonCasts(Type::DATE64, out_ty, func.get());

// date64 -> date64
AddCrossUnitCast<Date64Type>(func.get());

// int64 -> date64
AddZeroCopyCast(Type::INT64, int64(), date64(), func.get());

Expand Down

0 comments on commit c021d4e

Please sign in to comment.