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

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

Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/978#discussion_r147842797
  
    --- Diff: 
exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/MiniPlanUnitTestBase.java
 ---
    @@ -360,7 +366,7 @@ public T columnsToRead(String ... columnsToRead) {
        */
       public class JsonScanBuilder extends ScanPopBuider<JsonScanBuilder> {
         List<String> jsonBatches = null;
    -    List<String> inputPaths = Collections.EMPTY_LIST;
    +    List<String> inputPaths = Collections.emptyList();
    --- End diff --
    
    This is a subtle point. Using the constant creates the expression:
    
    ```
    public static final List EMPTY_LIST = new EmptyList<>(); // Definition
    List<String> inputPaths = EMPTY_LIST; // Original code
    ```
    
    The above is not type-friendly: we are setting a typed list (`inputPaths`) 
to an untyped constant (`EMPTY_LIST`).
    
    The revised code uses Java's parameterized methods to work around the type 
ambiguity:
    
    ```
    public static final <T> List<T> emptyList() ... // Definition
    List<String> inputPaths = Collections.emptyList(); // Type-safe assignment
    ```
    
    Functionally, the two expressions are identical. But, the original was 
type-unsafe and generated a compiler warning. The new one is type-safe and 
resolves the warning.


> Refactor and simplify the fragment, operator contexts for testing
> -----------------------------------------------------------------
>
>                 Key: DRILL-5842
>                 URL: https://issues.apache.org/jira/browse/DRILL-5842
>             Project: Apache Drill
>          Issue Type: Improvement
>    Affects Versions: 1.12.0
>            Reporter: Paul Rogers
>            Assignee: Paul Rogers
>             Fix For: 1.12.0
>
>
> Drill's execution engine has a "fragment context" that provides state for a 
> fragment as a whole, and an "operator context" which provides state for a 
> single operator. Historically, these have both been concrete classes that 
> make generous references to the Drillbit context, and hence need a full Drill 
> server in order to operate.
> Drill has historically made extensive use of system-level testing: build the 
> entire server and fire queries at it to test each component. Over time, we 
> are augmenting that approach with unit tests: the ability to test each 
> operator (or parts of an operator) in isolation.
> Since each operator requires access to both the operator and fragment 
> context, the fact that the contexts depend on the overall server creates a 
> large barrier to unit testing. An earlier checkin started down the path of 
> defining the contexts as interfaces that can have different run-time and 
> test-time implementations to enable testing.
> This ticket asks to refactor those interfaces: simplifying the operator 
> context and introducing an interface for the fragment context. New code will 
> use these new interfaces, while older code continues to use the concrete 
> implementations. Over time, as operators are enhanced, they can be modified 
> to allow unit-level testing.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to