drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DRILL-5533) Fix flag assignment in FunctionInitializer.checkInit() method
Date Wed, 24 May 2017 08:22:04 GMT

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

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

Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/843#discussion_r118186352
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/ImportGrabber.java
---
    @@ -63,9 +62,21 @@ public void traverseStaticImportOnDemandDeclaration(StaticImportOnDemandDeclarat
     
       }
     
    -  public static List<String> getMethods(Java.CompilationUnit cu){
    -    ImportGrabber visitor = new ImportGrabber();
    -    cu.getPackageMemberTypeDeclarations()[0].accept(visitor.finder.comprehensiveVisitor());
    +  /**
    +   * Creates list of imports that are present in compilation unit.
    +   * For example:
    +   * [import io.netty.buffer.DrillBuf;, import org.apache.drill.exec.expr.DrillSimpleFunc;]
    +   *
    +   * @param compilationUnit compilation unit
    +   * @return list of imports
    +   */
    +  public static List<String> getImports(Java.CompilationUnit compilationUnit){
    --- End diff --
    
    When writing code for UDFs, we recommend users to use the fully qualified class names
instead of imports.
    What if we enhance our UDFs generation code to use imports from function class? This way,
fully qualified class names usage won't be required. Since I thought it could be used for
future enhancement, I have left `ImportGrabber`.


> Fix flag assignment in FunctionInitializer.checkInit() method
> -------------------------------------------------------------
>
>                 Key: DRILL-5533
>                 URL: https://issues.apache.org/jira/browse/DRILL-5533
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.10.0
>            Reporter: Arina Ielchiieva
>            Assignee: Arina Ielchiieva
>            Priority: Minor
>
> FunctionInitializer.checkInit() method uses DCL to ensure that function body is loaded
only once. But flag parameter is never updated and all threads are entering synchronized block.
> Also FunctionInitializer.getImports() always returns empty list.
> https://github.com/apache/drill/blob/3e8b01d5b0d3013e3811913f0fd6028b22c1ac3f/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java
> Changes:
> 1. Fix DCL in FunctionInitializer.checkInit() method (update flag parameter  when function
body is loaded).
> 2. Fix ImportGrabber.getImports() method to return list with imports.
> 3. Add unit tests for FunctionInitializer.
> 4. Minor refactoring (rename methods, add javadoc).



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message