drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arina-ielchiieva <...@git.apache.org>
Subject [GitHub] drill pull request #819: DRILL-5419: Calculate return string length for lite...
Date Fri, 05 May 2017 12:30:53 GMT
Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/819#discussion_r113908238
  
    --- Diff: common/src/main/java/org/apache/drill/common/types/Types.java ---
    @@ -636,43 +658,63 @@ public static String toString(final MajorType type) {
     
       /**
        * Get the <code>precision</code> of given type.
    -   * @param majorType
    -   * @return
    +   *
    +   * @param majorType major type
    +   * @return precision value
        */
       public static int getPrecision(MajorType majorType) {
    -    MinorType type = majorType.getMinorType();
    -
    -    if (type == MinorType.VARBINARY || type == MinorType.VARCHAR) {
    -      return 65536;
    -    }
    -
         if (majorType.hasPrecision()) {
           return majorType.getPrecision();
         }
     
    -    return 0;
    +    return isScalarStringType(majorType) ? MAX_VARCHAR_LENGTH : UNDEFINED;
       }
     
       /**
        * Get the <code>scale</code> of given type.
    -   * @param majorType
    -   * @return
    +   *
    +   * @param majorType major type
    +   * @return scale value
        */
       public static int getScale(MajorType majorType) {
         if (majorType.hasScale()) {
           return majorType.getScale();
         }
     
    -    return 0;
    +    return UNDEFINED;
       }
     
       /**
    -   * Is the given type column be used in ORDER BY clause?
    -   * @param type
    -   * @return
    +   * Checks if the given type column be used in ORDER BY clause.
    --- End diff --
    
    Done.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message