[ 
https://issues.apache.org/jira/browse/DRILL-6763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16641576#comment-16641576
 ] 

ASF GitHub Bot commented on DRILL-6763:
---------------------------------------

vvysotskyi commented on a change in pull request #1481: DRILL-6763: Codegen 
optimization of SQL functions with constant values
URL: https://github.com/apache/drill/pull/1481#discussion_r223295251
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/CodeGenMemberInjector.java
 ##########
 @@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.physical.impl.common;
+
+import com.sun.codemodel.JMethod;
+import io.netty.buffer.DrillBuf;
+import org.apache.drill.exec.expr.ClassGenerator;
+import org.apache.drill.exec.expr.holders.ValueHolder;
+import org.apache.drill.exec.ops.FragmentContext;
+import org.apache.drill.shaded.guava.com.google.common.base.Function;
+
+import java.lang.reflect.Method;
+import java.util.Map;
+
+public class CodeGenMemberInjector {
+
+  public static void injectMembers(ClassGenerator<?> cg, Object instance, 
FragmentContext context) {
 
 Review comment:
   Please add Javadocs.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Codegen optimization of SQL functions with constant values
> ----------------------------------------------------------
>
>                 Key: DRILL-6763
>                 URL: https://issues.apache.org/jira/browse/DRILL-6763
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Execution - Codegen
>    Affects Versions: 1.14.0
>            Reporter: shuifeng lu
>            Assignee: shuifeng lu
>            Priority: Major
>             Fix For: 1.15.0
>
>         Attachments: Query1.java, Query2.java, code_compare.png, 
> compilation_time.png
>
>
> Codegen class compilation takes tens to hundreds of milliseconds, a class 
> cache is hit when generifiedCode of code generator is exactly the same.
>  It works fine when UDF only takes columns or symbols, but not efficient when 
> one or more parameters in UDF is always distinct from the other.
>  Take face recognition for example, the face images are almost distinct from 
> each other according to lighting, facial expressions and details.
>  It is important to reduce redundant class compilation especially for those 
> low latency queries.
>  Cache miss rate and metaspace gc can also be reduced by eliminating the 
> redundant classes.
> Here is the query to get the persons whose last name is Brunner and hire from 
> 1st Jan 1990:
>  SELECT full_name, hire_date FROM cp.`employee.json` where last_name = 
> 'Brunner' and hire_date >= '1990-01-01 00:00:00.0';
>  Now get the persons whose last name is Bernard and hire from 1st Jan 1990.
>  SELECT full_name, hire_date FROM cp.`employee.json` where last_name = 
> 'Bernard' and hire_date >= '1990-01-01 00:00:00.0';
> Figure !compilation_time.png! shows the compilation time of the generated 
> code by the above query in FilterRecordBatch on my laptop
>  Figure !code_compare.png!  shows the only difference of the generated code 
> from the attachments is the last_name value at line 156.
>  It is straightforward that the redundant class compilation can be eliminated 
> by making the string12 as a member of the class and set the value when the 
> instance is created



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to