orc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omalley <...@git.apache.org>
Subject [GitHub] orc pull request #40: ORC-54: Evolve schemas based on field name rather than...
Date Wed, 06 Jul 2016 18:29:25 GMT
Github user omalley commented on a diff in the pull request:

    https://github.com/apache/orc/pull/40#discussion_r69785443
  
    --- Diff: java/core/src/java/org/apache/orc/impl/SchemaEvolution.java ---
    @@ -85,55 +142,78 @@ void buildMapping(TypeDescription fileType,
         // check the easy case first
         if (fileType.getCategory() == readerType.getCategory()) {
           switch (readerType.getCategory()) {
    -        case BOOLEAN:
    -        case BYTE:
    -        case SHORT:
    -        case INT:
    -        case LONG:
    -        case DOUBLE:
    -        case FLOAT:
    -        case STRING:
    -        case TIMESTAMP:
    -        case BINARY:
    -        case DATE:
    -          // these are always a match
    -          break;
    -        case CHAR:
    -        case VARCHAR:
    -          // HIVE-13648: Look at ORC data type conversion edge cases (CHAR, VARCHAR,
DECIMAL)
    -          isOk = fileType.getMaxLength() == readerType.getMaxLength();
    -          break;
    -        case DECIMAL:
    -          // HIVE-13648: Look at ORC data type conversion edge cases (CHAR, VARCHAR,
DECIMAL)
    -          // TODO we don't enforce scale and precision checks, but probably should
    -          break;
    -        case UNION:
    -        case MAP:
    -        case LIST: {
    -          // these must be an exact match
    -          List<TypeDescription> fileChildren = fileType.getChildren();
    -          List<TypeDescription> readerChildren = readerType.getChildren();
    -          if (fileChildren.size() == readerChildren.size()) {
    -            for(int i=0; i < fileChildren.size(); ++i) {
    -              buildMapping(fileChildren.get(i), readerChildren.get(i));
    -            }
    -          } else {
    -            isOk = false;
    +      case BOOLEAN:
    +      case BYTE:
    +      case SHORT:
    +      case INT:
    +      case LONG:
    +      case DOUBLE:
    +      case FLOAT:
    +      case STRING:
    +      case TIMESTAMP:
    +      case BINARY:
    +      case DATE:
    +        // these are always a match
    +        break;
    +      case CHAR:
    +      case VARCHAR:
    +        // HIVE-13648: Look at ORC data type conversion edge cases (CHAR, VARCHAR, DECIMAL)
    +        isOk = fileType.getMaxLength() == readerType.getMaxLength();
    +        break;
    +      case DECIMAL:
    +        // HIVE-13648: Look at ORC data type conversion edge cases (CHAR, VARCHAR, DECIMAL)
    +        // TODO we don't enforce scale and precision checks, but probably should
    +        break;
    +      case UNION:
    +      case MAP:
    +      case LIST: {
    +        // these must be an exact match
    +        List<TypeDescription> fileChildren = fileType.getChildren();
    +        List<TypeDescription> readerChildren = readerType.getChildren();
    +        if (fileChildren.size() == readerChildren.size()) {
    +          for (int i = 0; i < fileChildren.size(); ++i) {
    +            buildMapping(fileChildren.get(i), readerChildren.get(i), useFieldNames);
    --- End diff --
    
    when you are recursing, useFieldNames should always be true. Prior to HIVE-4243 only the
top level column names were lost. In recursive types the field names were correct.


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