pitrou commented on code in PR #39785:
URL: https://github.com/apache/arrow/pull/39785#discussion_r1466680548


##########
cpp/src/gandiva/tests/in_expr_test.cc:
##########
@@ -161,17 +161,6 @@ TEST_F(TestIn, TestInDouble) {
 
   // prepare input record batch
   auto in_batch = arrow::RecordBatch::Make(schema, num_records, {array0, 
array1});
-

Review Comment:
   Why are you removing the checks below? Is this an error?



##########
cpp/src/gandiva/tests/in_expr_test.cc:
##########
@@ -208,16 +193,33 @@ TEST_F(TestIn, TestInDecimal) {
   // prepare input record batch
   auto in_batch = arrow::RecordBatch::Make(schema, num_records, {array0});
 
-  std::shared_ptr<SelectionVector> selection_vector;
-  status = SelectionVector::MakeInt16(num_records, pool_, &selection_vector);
+  {
+    std::shared_ptr<Filter> filter;
+    auto status = Filter::Make(schema, condition, TestConfiguration(), 
&filter);
+    EXPECT_TRUE(status.ok());
+    std::shared_ptr<SelectionVector> selection_vector;
+    status = SelectionVector::MakeInt16(num_records, pool_, &selection_vector);
+    EXPECT_TRUE(status.ok());
+
+    // Evaluate expression
+    status = filter->Evaluate(*in_batch, selection_vector);
+    EXPECT_TRUE(status.ok());
+
+    // Validate results
+    EXPECT_ARROW_ARRAY_EQUALS(exp, selection_vector->ToArray());
+  }
+
+  std::shared_ptr<Filter> new_filter;

Review Comment:
   Can you please add a comment explaining why you're adding this?



##########
cpp/src/gandiva/tests/in_expr_test.cc:
##########
@@ -208,16 +193,33 @@ TEST_F(TestIn, TestInDecimal) {
   // prepare input record batch
   auto in_batch = arrow::RecordBatch::Make(schema, num_records, {array0});
 
-  std::shared_ptr<SelectionVector> selection_vector;
-  status = SelectionVector::MakeInt16(num_records, pool_, &selection_vector);
+  {
+    std::shared_ptr<Filter> filter;
+    auto status = Filter::Make(schema, condition, TestConfiguration(), 
&filter);
+    EXPECT_TRUE(status.ok());
+    std::shared_ptr<SelectionVector> selection_vector;
+    status = SelectionVector::MakeInt16(num_records, pool_, &selection_vector);
+    EXPECT_TRUE(status.ok());
+
+    // Evaluate expression
+    status = filter->Evaluate(*in_batch, selection_vector);
+    EXPECT_TRUE(status.ok());
+
+    // Validate results
+    EXPECT_ARROW_ARRAY_EQUALS(exp, selection_vector->ToArray());
+  }
+
+  std::shared_ptr<Filter> new_filter;
+  auto status = Filter::Make(schema, condition, TestConfiguration(), 
&new_filter);
   EXPECT_TRUE(status.ok());
+  EXPECT_TRUE(new_filter->GetBuiltFromCache());
 
-  // Evaluate expression
-  status = filter->Evaluate(*in_batch, selection_vector);
+  std::shared_ptr<SelectionVector> selection_vector_new;
+  status = SelectionVector::MakeInt16(num_records, pool_, 
&selection_vector_new);
   EXPECT_TRUE(status.ok());
 
-  // Validate results
-  EXPECT_ARROW_ARRAY_EQUALS(exp, selection_vector->ToArray());
+  status = new_filter->Evaluate(*in_batch, selection_vector_new);
+  EXPECT_TRUE(status.ok());

Review Comment:
   Ok, but can you also check the results?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to