Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/877#discussion_r131101557
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/MetadataVersions.java
 ---
    @@ -0,0 +1,86 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + * <p/>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p/>
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill.exec.store.parquet;
    +
    +import com.google.common.collect.ImmutableSortedSet;
    +import org.apache.drill.common.exceptions.DrillRuntimeException;
    +
    +import java.util.NavigableSet;
    +
    +/**
    + * Supported metadata versions.
    + * <p>
    + * String metadata version consists of the following characters:<br>
    + * optional "v" letter,<br>
    + * major metadata version (any number of digits),<br>
    + * optional "." delimiter (used if minor metadata version is 
specified),<br>
    + * minor metadata version (one digit number)
    + * <p>
    + * Note: keep them synchronized with {@link 
Metadata.ParquetTableMetadataBase} versions
    + */
    +public class MetadataVersions {
    +  /**
    +   * Version 1: Introduces parquet file metadata caching.<br>
    +   * See DRILL-2743
    +   */
    +  public static final String V1 = "v1";
    +  /**
    +   * Version 2: Metadata cache file size is reduced.<br>
    +   * See DRILL-4053
    +   */
    +  public static final String V2 = "v2";
    +  /**
    +   * Version 3: Difference between v3 and v2 : min/max, type_length, 
precision, scale, repetitionLevel, definitionLevel.<br>
    +   * Filter pushdown for Parquet is implemented. <br>
    +   * See DRILL-1950
    +   */
    +  public static final String V3 = "v3";
    +  /**
    +   * Version 3.1: Absolute paths of files and directories are replaced 
with relative ones. Metadata version value
    +   * doesn't contain `v` letter<br>
    +   * See DRILL-3867, DRILL-5660
    +   */
    +  public static final String V3_1 = "3.1";
    +
    +  /**
    +   * Helper method to parse string metadata version into float.
    +   *
    +   * @param stringVersion text metadata version
    +   * @return parsed Float metadata version
    +   */
    +  public static Float parseStringMetadataVersion(String stringVersion) {
    +    try {
    +      if (stringVersion.contains(".") && 
stringVersion.split("\\.")[1].length() != 1) {
    +        throw new DrillRuntimeException("Minor metadata version shouldn't 
be greater than 9 or contain more than one digit");
    +      }
    +      return stringVersion.charAt(0) == 'v' ? 
Float.valueOf(stringVersion.substring(1)) : Float.valueOf(stringVersion);
    +    } catch (Exception e) {
    +      throw new DrillRuntimeException(String.format("Could not parse 
metadata version '%s'", stringVersion), e);
    +    }
    +  }
    +
    +  /**
    +   * All historical versions of the Drill metadata cache files
    +   */
    +  public static final NavigableSet<Float> SUPPORTED_VERSIONS = 
ImmutableSortedSet.of(
    --- End diff --
    
    You can use `SortedSet`, more abstract implementation.


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