drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul-rogers <...@git.apache.org>
Subject [GitHub] drill pull request #819: DRILL-5419: Calculate return string length for lite...
Date Thu, 27 Apr 2017 16:17:40 GMT
Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/819#discussion_r113605335
  
    --- Diff: common/src/main/java/org/apache/drill/common/types/Types.java ---
    @@ -340,18 +344,18 @@ public static int getJdbcDisplaySize(MajorType type) {
         case INTERVALYEAR:
           return precision > 0
               ? 5 + precision // P..Y12M
    -          : 0; // if precision is not set, return 0 because there's not enough info
    +          : UNDEFINED; // if precision is not set, return 0 because there's not enough
info
    --- End diff --
    
    We actually do know. INTERVALYEAR is stored as a signed 4 byte int, so the maximum number
of months is known. From that, we can estimate the string form:
    
    PxY12M
    
    where x = Integer.MAX_VALUE / 12.
    
    Realistically, assuming a range of +/- 10K years is good enough, so:
    
    P9999Y12M
    
    Is the maximum value. 


---
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