Skip to content

Commit

Permalink
Fix checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
jvictorhuguenin committed Jul 16, 2021
1 parent 6f1f87d commit f52655f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
20 changes: 12 additions & 8 deletions cpp/src/gandiva/function_registry_datetime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,23 @@ std::vector<NativeFunction> GetDateTimeFunctionRegistry() {
NativeFunction("castNULLABLEBIGINT", {}, DataTypeVector{month_interval()}, int64(),
kResultNullIfNull, "castNULLABLEBIGINT_yearinterval"),

NativeFunction("castNULLABLEINTERVALYEAR", {"castINTERVALYEAR"}, DataTypeVector{int32()}, month_interval(),
kResultNullIfNull, "castNULLABLEINTERVALYEAR_int32",
NativeFunction("castNULLABLEINTERVALYEAR", {"castINTERVALYEAR"},
DataTypeVector{int32()}, month_interval(), kResultNullIfNull,
"castNULLABLEINTERVALYEAR_int32",
NativeFunction::kNeedsContext | NativeFunction::kCanReturnErrors),

NativeFunction("castNULLABLEINTERVALYEAR", {"castINTERVALYEAR"}, DataTypeVector{int64()}, month_interval(),
kResultNullIfNull, "castNULLABLEINTERVALYEAR_int64",
NativeFunction("castNULLABLEINTERVALYEAR", {"castINTERVALYEAR"},
DataTypeVector{int64()}, month_interval(), kResultNullIfNull,
"castNULLABLEINTERVALYEAR_int64",
NativeFunction::kNeedsContext | NativeFunction::kCanReturnErrors),

NativeFunction("castNULLABLEINTERVALDAY", {"castINTERVALDAY"}, DataTypeVector{int32()}, day_time_interval(),
kResultNullIfNull, "castNULLABLEINTERVALDAY_int32"),
NativeFunction("castNULLABLEINTERVALDAY", {"castINTERVALDAY"},
DataTypeVector{int32()}, day_time_interval(), kResultNullIfNull,
"castNULLABLEINTERVALDAY_int32"),

NativeFunction("castNULLABLEINTERVALDAY", {"castINTERVALDAY"}, DataTypeVector{int64()}, day_time_interval(),
kResultNullIfNull, "castNULLABLEINTERVALDAY_int64"),
NativeFunction("castNULLABLEINTERVALDAY", {"castINTERVALDAY"},
DataTypeVector{int64()}, day_time_interval(), kResultNullIfNull,
"castNULLABLEINTERVALDAY_int64"),

NativeFunction("extractDay", {}, DataTypeVector{day_time_interval()}, int64(),
kResultNullIfNull, "extractDay_daytimeinterval"),
Expand Down
14 changes: 7 additions & 7 deletions cpp/src/gandiva/tests/projector_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1478,25 +1478,25 @@ TEST_F(TestProjector, TestCastNullableIntYearInterval) {
auto res_int64 = field("res", arrow::int64());

// Build expression
auto cast_expr_int32 = TreeExprBuilder::MakeExpression("castNULLABLEINT", {field1}, res_int32);
auto cast_expr_int64 = TreeExprBuilder::MakeExpression("castNULLABLEBIGINT", {field1}, res_int64);
auto cast_expr_int32 =
TreeExprBuilder::MakeExpression("castNULLABLEINT", {field1}, res_int32);
auto cast_expr_int64 =
TreeExprBuilder::MakeExpression("castNULLABLEBIGINT", {field1}, res_int64);

std::shared_ptr<Projector> projector;

// {cast_expr_int32, cast_expr_int64, cast_expr_day_interval,
// cast_expr_year_interval}
auto status = Projector::Make(
schema, {cast_expr_int32, cast_expr_int64},
TestConfiguration(), &projector);
auto status = Projector::Make(schema, {cast_expr_int32, cast_expr_int64},
TestConfiguration(), &projector);
EXPECT_TRUE(status.ok());

// Create a row-batch with some sample data
int num_records = 4;

// Last validity is false and the cast functions throw error when input is empty. Should
// not be evaluated due to addition of NativeFunction::kCanReturnErrors
auto array0 =
MakeArrowArrayInt32({12, -24, -0, 0}, {true, true, true, false});
auto array0 = MakeArrowArrayInt32({12, -24, -0, 0}, {true, true, true, false});
auto in_batch = arrow::RecordBatch::Make(schema, num_records, {array0});

auto out_int32 = MakeArrowArrayInt32({1, -2, -0, 0}, {true, true, true, false});
Expand Down

0 comments on commit f52655f

Please sign in to comment.