@@ -1139,15 +1139,19 @@ TEST_F(TestProjector, TestCastVarbinaryFunction) {
11391139 // output fields
11401140 auto res_int4 = field (" res_int4" , arrow::int32 ());
11411141 auto res_int8 = field (" res_int8" , arrow::int64 ());
1142+ auto res_float4 = field (" res_float4" , arrow::float32 ());
1143+ auto res_float8 = field (" res_float8" , arrow::float64 ());
11421144
11431145 // Build expression
11441146 auto cast_expr_int4 = TreeExprBuilder::MakeExpression (" castINT" , {field0}, res_int4);
11451147 auto cast_expr_int8 = TreeExprBuilder::MakeExpression (" castBIGINT" , {field0}, res_int8);
1148+ auto cast_expr_float4 = TreeExprBuilder::MakeExpression (" castFLOAT4" , {field0}, res_float4);
1149+ auto cast_expr_float8 = TreeExprBuilder::MakeExpression (" castFLOAT8" , {field0}, res_float8);
11461150
11471151 std::shared_ptr<Projector> projector;
11481152
1149- // {cast_expr_int4, cast_expr_int8}
1150- auto status = Projector::Make (schema, {cast_expr_int4, cast_expr_int8},
1153+ // {cast_expr_float4, cast_expr_float8, cast_expr_int4, cast_expr_int8}
1154+ auto status = Projector::Make (schema, {cast_expr_int4, cast_expr_int8, cast_expr_float4, cast_expr_float8 },
11511155 TestConfiguration (), &projector);
11521156 EXPECT_TRUE (status.ok ());
11531157
@@ -1156,14 +1160,18 @@ TEST_F(TestProjector, TestCastVarbinaryFunction) {
11561160
11571161 // Last validity is false and the cast functions throw error when input is empty. Should
11581162 // not be evaluated due to addition of NativeFunction::kCanReturnErrors
1159- auto array0 = MakeArrowArrayBinary ({" 25 " , " -7FFFFFFF " , " 7FFFFFFF " , " 4" },
1163+ auto array0 = MakeArrowArrayBinary ({" 37 " , " -99999 " , " 99999 " , " 4" },
11601164 {true , true , true , false });
11611165 auto in_batch = arrow::RecordBatch::Make (schema, num_records, {array0});
11621166
11631167 auto out_int4 =
1164- MakeArrowArrayInt32 ({37 , INT32_MIN + 1 , INT32_MAX , 0 }, {true , true , true , false });
1168+ MakeArrowArrayInt32 ({37 , - 99999 , 99999 , 0 }, {true , true , true , false });
11651169 auto out_int8 =
1166- MakeArrowArrayInt64 ({37 , INT32_MIN + 1 , INT32_MAX , 0 }, {true , true , true , false });
1170+ MakeArrowArrayInt64 ({37 , -99999 , 99999 , 0 }, {true , true , true , false });
1171+ auto out_float4 =
1172+ MakeArrowArrayFloat32 ({37 , -99999 , 99999 , 0 }, {true , true , true , false });
1173+ auto out_float8 =
1174+ MakeArrowArrayFloat64 ({37 , -99999 , 99999 , 0 }, {true , true , true , false });
11671175
11681176 arrow::ArrayVector outputs;
11691177
@@ -1173,6 +1181,8 @@ TEST_F(TestProjector, TestCastVarbinaryFunction) {
11731181
11741182 EXPECT_ARROW_ARRAY_EQUALS (out_int4, outputs.at (0 ));
11751183 EXPECT_ARROW_ARRAY_EQUALS (out_int8, outputs.at (1 ));
1184+ EXPECT_ARROW_ARRAY_EQUALS (out_float4, outputs.at (2 ));
1185+ EXPECT_ARROW_ARRAY_EQUALS (out_float8, outputs.at (3 ));
11761186}
11771187
11781188TEST_F (TestProjector, TestToDate) {
0 commit comments