Github user vdiravka commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1111#discussion_r166669844
  
    --- Diff: 
contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveUtilities.java
 ---
    @@ -507,5 +510,52 @@ public static boolean 
hasHeaderOrFooter(HiveTableWithColumnCache table) {
         int skipFooter = retrieveIntProperty(tableProperties, 
serdeConstants.FOOTER_COUNT, -1);
         return skipHeader > 0 || skipFooter > 0;
       }
    +
    +  /**
    +   * This method checks whether the table is transactional and set 
necessary properties in {@link JobConf}.
    +   * If schema evolution properties aren't set in job conf for the input 
format, method sets the column names
    +   * and types from table/partition properties or storage descriptor.
    +   *
    +   * @param job the job to update
    +   * @param properties table or partition properties
    +   * @param sd storage descriptor
    +   */
    +  public static void verifyAndAddTransactionalProperties(JobConf job, 
Properties properties, StorageDescriptor sd) {
    +
    +    if (AcidUtils.isTablePropertyTransactional(properties)) {
    +      AcidUtils.setTransactionalTableScan(job, true);
    +
    +      // No work is needed, if schema evolution is used
    +      if (Utilities.isSchemaEvolutionEnabled(job, true) && 
job.get(IOConstants.SCHEMA_EVOLUTION_COLUMNS) != null &&
    +          job.get(IOConstants.SCHEMA_EVOLUTION_COLUMNS_TYPES) != null) {
    +        return;
    +      }
    +
    +      String colNames;
    +      String colTypes;
    +
    +      // Try to get get column names and types from table or partition 
properties. If they are absent there, get columns
    +      // data from storage descriptor of the table
    +      if (properties.containsKey(serdeConstants.LIST_COLUMNS) && 
properties.containsKey(serdeConstants.LIST_COLUMN_TYPES)) {
    +        colNames = job.get(serdeConstants.LIST_COLUMNS);
    +        colTypes = job.get(serdeConstants.LIST_COLUMN_TYPES);
    +      } else {
    +        final StringBuilder colNamesBuilder = new StringBuilder();
    --- End diff --
    
    Thank you, it's cleaner.


---

Reply via email to