Github user jinfengni commented on the issue:

    https://github.com/apache/drill/pull/819
  
    My understanding is Drill would hit a schema change between column with 
type of varchar(5) and varchar(10).  However, the length calculated in this PR 
is from the query metadeta (function parameter, string literal), which will not 
change across different batches. In that sense, we should not see schema change 
exception, just because of varchar length.
    
    The following code shows that varchar(5) is different from varchar(10), 
also different from varchar without setting length. 
    
    ```java
       TypeProtos.MajorType varchar5 = TypeProtos.MajorType.newBuilder()
            .setMinorType(TypeProtos.MinorType.VARCHAR)
            .setMode(TypeProtos.DataMode.OPTIONAL)
            .setPrecision(5)
            .build();
        TypeProtos.MajorType varchar10 = TypeProtos.MajorType.newBuilder()
            .setMinorType(TypeProtos.MinorType.VARCHAR)
            .setMode(TypeProtos.DataMode.OPTIONAL)
            .setPrecision(10)
            .build();
        TypeProtos.MajorType varcharNoLength = TypeProtos.MajorType.newBuilder()
            .setMinorType(TypeProtos.MinorType.VARCHAR)
            .setMode(TypeProtos.DataMode.OPTIONAL)
            .build();
    
        System.out.println(varchar5.equals(varchar10) ? "varchar5 equals 
varchr10" : "varchar5 NOT equals varchr10" );
        System.out.println(varchar5.equals(varcharNoLength) ? "varchar5 equals 
varchrNoLength" : "varchar5 NOT equals varchrNoLength" );
    ```
    
    output:
    ```
    varchar5 NOT equals varchr10
    varchar5 NOT equals varchrNoLength
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to