projjal commented on code in PR #13446:
URL: https://github.com/apache/arrow/pull/13446#discussion_r941374071
##########
cpp/src/gandiva/engine.cc:
##########
@@ -112,9 +113,20 @@ void Engine::InitOnce() {
}
ARROW_LOG(INFO) << "Detected CPU Name : " << cpu_name.str();
ARROW_LOG(INFO) << "Detected CPU Features:" << cpu_attrs_str;
+
+ std::string engine_str = cpu_name.str();
+ engine_str += cpu_attrs_str;
+ engine_str_ = strdup(engine_str.c_str());
Review Comment:
Why would that be so?
##########
cpp/src/gandiva/engine.cc:
##########
@@ -112,9 +113,20 @@ void Engine::InitOnce() {
}
ARROW_LOG(INFO) << "Detected CPU Name : " << cpu_name.str();
ARROW_LOG(INFO) << "Detected CPU Features:" << cpu_attrs_str;
+
+ std::string cpu_details = cpu_name.str();
+ cpu_details += cpu_attrs_str;
+ cpu_details_ = strdup(cpu_details.c_str());
+
llvm_init = true;
}
+char* Engine::getCPUDetails() {
Review Comment:
Capitalise the function name. Also a better name would be GetCpuIdentifier()
##########
java/gandiva/src/test/java/org/apache/arrow/gandiva/evaluator/ProjectorTest.java:
##########
@@ -2599,4 +2599,33 @@ public void testInitCap() throws Exception {
releaseRecordBatch(batch);
releaseValueVectors(output);
}
+
+ public class DummySecondaryCache implements JavaSecondaryCacheInterface {
+ public BufferResult getSecondaryCache(long addrKey, long sizeKey) {
+ return null;
+ }
+
+ public void setSecondaryCache(long addrKey, long sizeKey, long addrValue,
long sizeValue) {
+ }
+ }
+
+ @Test
+ public void testSecondaryCache() throws GandivaException {
+ Field a = Field.nullable("a", int32);
+ Field b = Field.nullable("b", int32);
+ List<Field> args = Lists.newArrayList(a, b);
+
+ Field retType = Field.nullable("c", int32);
+ ExpressionTree root = TreeBuilder.makeExpression("add", args, retType);
+
+ List<ExpressionTree> exprs = Lists.newArrayList(root);
+
+ Schema schema = new Schema(args);
+
+ DummySecondaryCache secondaryCache = new DummySecondaryCache();
+
+ Projector eval = Projector.make(schema, exprs,
Review Comment:
Verify that the DummySecondaryCache Get And Set methods are called by
setting boolean flags.
Also add the evaluation and result checking for completeness sake
##########
cpp/src/gandiva/engine.cc:
##########
@@ -112,9 +113,20 @@ void Engine::InitOnce() {
}
ARROW_LOG(INFO) << "Detected CPU Name : " << cpu_name.str();
ARROW_LOG(INFO) << "Detected CPU Features:" << cpu_attrs_str;
+
+ std::string cpu_details = cpu_name.str();
+ cpu_details += cpu_attrs_str;
+ cpu_details_ = strdup(cpu_details.c_str());
+
llvm_init = true;
}
+char* Engine::getCPUDetails() {
+ DCHECK_EQ(llvm_init, true);
Review Comment:
You can add a static string variable inside this method
--
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]