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 #877: DRILL-5660: Drill 1.10 queries fail due to Parquet ...
Date Thu, 27 Jul 2017 08:45:15 GMT
Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/877#discussion_r129781397
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/MetadataVersion.java
---
    @@ -0,0 +1,124 @@
    +/*
    + * 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.base.Preconditions;
    +import com.google.common.collect.ComparisonChain;
    +import com.google.common.collect.Lists;
    +import org.apache.drill.common.exceptions.DrillRuntimeException;
    +
    +import java.util.List;
    +import java.util.regex.Matcher;
    +import java.util.regex.Pattern;
    +
    +
    +class MetadataVersion implements Comparable<MetadataVersion> {
    +  /**
    +   * String version starts from 'v' letter<p>
    +   * First group is major metadata version (any number of digits, except a single zero
digit)<p>
    +   * Next character is optional '.' (if minor version is specified)<p>
    +   * Next group is optional, minor metadata version (any number of digits, except a single
zero digit)<p>
    +   * Examples of correct metadata versions: v1, v10, v4.13
    +   */
    +  private static final String FORMAT = "v((?!0)\\d+)\\.?((?!0)\\d+)?";
    +  private static final Pattern PATTERN = Pattern.compile(FORMAT);
    +
    +  private final int major;
    +  private final int minor;
    +
    +  public MetadataVersion(int major, int minor) {
    +    this.major = major;
    +    this.minor = minor;
    +  }
    +
    +  public MetadataVersion(String metadataVersion) {
    +    Matcher matcher = PATTERN.matcher(metadataVersion);
    +    if (!matcher.matches()) {
    +      DrillRuntimeException.format("Could not parse metadata version '%s' using format
'%s'", metadataVersion, FORMAT);
    +    }
    +    this.major = Integer.parseInt(matcher.group(1));
    +    this.minor = matcher.group(2) != null ? Integer.parseInt(matcher.group(2)) : 0;
    +  }
    +
    +  @Override
    +  public boolean equals(Object o) {
    +    if (this == o) return true;
    +    if (!(o instanceof MetadataVersion)) {
    +      return false;
    +    }
    +    MetadataVersion that = (MetadataVersion) o;
    +    return this.major == that.major
    +        && this.minor == that.minor;
    +  }
    +
    +  @Override
    +  public int hashCode() {
    +    int result = major;
    +    result = 31 * result + minor;
    +    return result;
    +  }
    +
    +  @Override
    --- End diff --
    
    Please add Java doc describing how string representation is formed. Basically the part
of information you have in class description but it's more relevant here.


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