Skip to content

Commit

Permalink
Implementing review feedback. apache#4
Browse files Browse the repository at this point in the history
  • Loading branch information
rok committed Jun 8, 2021
1 parent 8dfe6c2 commit bff8640
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cpp/src/arrow/compute/kernels/scalar_temporal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ inline std::vector<int64_t> get_iso_calendar(int64_t arg) {
}
return {static_cast<int64_t>(static_cast<int32_t>(y)),
static_cast<int64_t>(trunc<weeks>(t - start).count() + 1),
static_cast<int64_t>(weekday(ymd).iso_encoding())};
static_cast<int64_t>(weekday(ymd).iso_encoding() - 1)};
}

// ----------------------------------------------------------------------
Expand Down
32 changes: 16 additions & 16 deletions cpp/src/arrow/compute/kernels/scalar_temporal_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,23 @@ TEST(ScalarTemporalTest, TestTemporalComponentExtraction) {
auto iso_week = "[1, 9, 52, 20, null, 1, 1, 1, 53, 53, 53, 1, 52, 52, 52, 1, 52]";
auto iso_calendar =
ArrayFromJSON(iso_calendar_type,
R"([{"iso_year": 1970, "iso_week": 1, "day_of_week": 4},
{"iso_year": 2000, "iso_week": 9, "day_of_week": 2},
{"iso_year": 1898, "iso_week": 52, "day_of_week": 7},
{"iso_year": 2033, "iso_week": 20, "day_of_week": 3},
R"([{"iso_year": 1970, "iso_week": 1, "day_of_week": 3},
{"iso_year": 2000, "iso_week": 9, "day_of_week": 1},
{"iso_year": 1898, "iso_week": 52, "day_of_week": 6},
{"iso_year": 2033, "iso_week": 20, "day_of_week": 2},
null,
{"iso_year": 2020, "iso_week": 1, "day_of_week": 3},
{"iso_year": 2020, "iso_week": 1, "day_of_week": 2},
{"iso_year": 2020, "iso_week": 1, "day_of_week": 1},
{"iso_year": 2020, "iso_week": 1, "day_of_week": 0},
{"iso_year": 2009, "iso_week": 53, "day_of_week": 3},
{"iso_year": 2009, "iso_week": 53, "day_of_week": 4},
{"iso_year": 2009, "iso_week": 53, "day_of_week": 5},
{"iso_year": 2009, "iso_week": 53, "day_of_week": 7},
{"iso_year": 2010, "iso_week": 1, "day_of_week": 1},
{"iso_year": 2005, "iso_week": 52, "day_of_week": 7},
{"iso_year": 2009, "iso_week": 53, "day_of_week": 6},
{"iso_year": 2010, "iso_week": 1, "day_of_week": 0},
{"iso_year": 2005, "iso_week": 52, "day_of_week": 6},
{"iso_year": 2008, "iso_week": 52, "day_of_week": 7},
{"iso_year": 2009, "iso_week": 1, "day_of_week": 1},
{"iso_year": 2011, "iso_week": 52, "day_of_week": 7}])");
{"iso_year": 2005, "iso_week": 52, "day_of_week": 5},
{"iso_year": 2008, "iso_week": 52, "day_of_week": 6},
{"iso_year": 2009, "iso_week": 1, "day_of_week": 0},
{"iso_year": 2011, "iso_week": 52, "day_of_week": 6}])");
auto quarter = "[1, 1, 1, 2, null, 1, 4, 4, 4, 1, 1, 1, 1, 4, 4, 4, 1]";
auto hour = "[0, 23, 0, 3, null, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 1]";
auto minute = "[0, 23, 59, 33, null, 5, 10, 15, 20, 25, 30, 35, 40, 45, 0, 0, 2]";
Expand Down Expand Up @@ -120,10 +120,10 @@ TEST(ScalarTemporalTest, TestTemporalComponentExtractionWithDifferentUnits) {
auto iso_week = "[1, 9, 52, 20, null]";
auto iso_calendar =
ArrayFromJSON(iso_calendar_type,
R"([{"iso_year": 1970, "iso_week": 1, "day_of_week": 4},
{"iso_year": 2000, "iso_week": 9, "day_of_week": 2},
{"iso_year": 1898, "iso_week": 52, "day_of_week": 7},
{"iso_year": 2033, "iso_week": 20, "day_of_week": 3}, null])");
R"([{"iso_year": 1970, "iso_week": 1, "day_of_week": 3},
{"iso_year": 2000, "iso_week": 9, "day_of_week": 1},
{"iso_year": 1898, "iso_week": 52, "day_of_week": 6},
{"iso_year": 2033, "iso_week": 20, "day_of_week": 2}, null])");
auto quarter = "[1, 1, 1, 2, null]";
auto hour = "[0, 23, 0, 3, null]";
auto minute = "[0, 23, 59, 33, null]";
Expand Down

0 comments on commit bff8640

Please sign in to comment.