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 #832: DRILL-5504: Vector validator to diagnose offset vec...
Date Thu, 18 May 2017 22:59:47 GMT
Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/832#discussion_r117361619
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/validate/BatchValidator.java
---
    @@ -0,0 +1,205 @@
    +/*
    + * 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
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * 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.physical.impl.validate;
    +
    +import java.util.ArrayList;
    +import java.util.List;
    +
    +import org.apache.drill.exec.record.SimpleVectorWrapper;
    +import org.apache.drill.exec.record.VectorAccessible;
    +import org.apache.drill.exec.record.VectorWrapper;
    +import org.apache.drill.exec.vector.BaseDataValueVector;
    +import org.apache.drill.exec.vector.FixedWidthVector;
    +import org.apache.drill.exec.vector.NullableVarCharVector;
    +import org.apache.drill.exec.vector.NullableVector;
    +import org.apache.drill.exec.vector.RepeatedVarCharVector;
    +import org.apache.drill.exec.vector.UInt4Vector;
    +import org.apache.drill.exec.vector.ValueVector;
    +import org.apache.drill.exec.vector.VarCharVector;
    +import org.apache.drill.exec.vector.VariableWidthVector;
    +import org.apache.drill.exec.vector.complex.BaseRepeatedValueVector;
    +import org.apache.drill.exec.vector.complex.RepeatedFixedWidthVectorLike;
    +
    +
    +/**
    + * Validate a batch of value vectors. It is not possible to validate the
    + * data, but we can validate the structure, especially offset vectors.
    + * Only handles single (non-hyper) vectors at present. Current form is
    + * self-contained. Better checks can be done by moving checks inside
    + * vectors or by exposing more metadata from vectors.
    + */
    +
    +public class BatchValidator {
    +  private static final org.slf4j.Logger logger =
    +      org.slf4j.LoggerFactory.getLogger(BatchValidator.class);
    +
    +  public static final int MAX_ERRORS = 100;
    +
    +  private final int rowCount;
    +  private final VectorAccessible batch;
    +  private final List<String> errorList;
    +  private int errorCount;
    +
    +  public BatchValidator(VectorAccessible batch) {
    +    rowCount = batch.getRecordCount();
    +    this.batch = batch;
    +    errorList = null;
    +  }
    +
    +  public BatchValidator(VectorAccessible batch, boolean captureErrors) {
    +    rowCount = batch.getRecordCount();
    +    this.batch = batch;
    +    if (captureErrors) {
    +      errorList = new ArrayList<>();
    +    } else {
    +      errorList = null;
    +    }
    +  }
    +
    +  public void validate() {
    --- End diff --
    
    Great idea! Added a config option that forces vector validation. Add the following to
the pom.xml file in the Surefire options:
    
    {code}
    -Ddrill.exec.debug.validate_vectors=true
    {code}
    
    Will try this out and enable the checks as a different JIRA ticket and PR.


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