drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DRILL-5323) Provide test tools to create, populate and compare row sets
Date Thu, 30 Mar 2017 01:32:41 GMT

    [ https://issues.apache.org/jira/browse/DRILL-5323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15948233#comment-15948233
] 

ASF GitHub Bot commented on DRILL-5323:
---------------------------------------

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

    https://github.com/apache/drill/pull/785#discussion_r108777101
  
    --- Diff: exec/java-exec/src/test/java/org/apache/drill/test/rowSet/RowSetPrinter.java
---
    @@ -0,0 +1,97 @@
    +/*
    + * 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.test.rowSet;
    +
    +import java.io.PrintStream;
    +
    +import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode;
    +import org.apache.drill.test.rowSet.RowSet.RowSetReader;
    +import org.apache.drill.test.rowSet.RowSetSchema.AccessSchema;
    +
    +public class RowSetPrinter {
    +  private RowSet rowSet;
    +
    +  public RowSetPrinter(RowSet rowSet) {
    +    this.rowSet = rowSet;
    +  }
    +
    +  public void print() {
    +    print(System.out);
    +  }
    +
    +  public void print(PrintStream out) {
    +    SelectionVectorMode selectionMode = rowSet.getIndirectionType();
    +    RowSetReader reader = rowSet.reader();
    +    int colCount = reader.width();
    +    printSchema(out, selectionMode);
    +    while (reader.next()) {
    +      printHeader(out, reader, selectionMode);
    +      for (int i = 0; i < colCount; i++) {
    +        if (i > 0) {
    +          out.print(", ");
    +        }
    +        out.print(reader.getAsString(i));
    +      }
    +      out.println();
    +    }
    +  }
    +
    +  private void printSchema(PrintStream out, SelectionVectorMode selectionMode) {
    +    out.print("#");
    +    switch (selectionMode) {
    +    case FOUR_BYTE:
    +      out.print(" (batch #, row #)");
    +      break;
    +    case TWO_BYTE:
    +      out.print(" (row #)");
    +      break;
    +    default:
    +      break;
    +    }
    +    out.print(": ");
    +    AccessSchema schema = rowSet.schema().access();
    +    for (int i = 0; i < schema.count(); i++) {
    +      if (i > 0) {
    --- End diff --
    
    How about _maps_ inside AccessSchema ?


> Provide test tools to create, populate and compare row sets
> -----------------------------------------------------------
>
>                 Key: DRILL-5323
>                 URL: https://issues.apache.org/jira/browse/DRILL-5323
>             Project: Apache Drill
>          Issue Type: Sub-task
>          Components: Tools, Build & Test
>    Affects Versions: 1.11.0
>            Reporter: Paul Rogers
>            Assignee: Paul Rogers
>             Fix For: 1.11.0
>
>
> Operators work with individual row sets. A row set is a collection of records stored
as column vectors. (Drill uses various terms for this concept. A record batch is a row set
with an operator implementation wrapped around it. A vector container is a row set, but with
much functionality left as an exercise for the developer. And so on.)
> To simplify tests, we need a {{TestRowSet}} concept that wraps a {{VectorContainer}}
and provides easy ways to:
> * Define a schema for the row set.
> * Create a set of vectors that implement the schema.
> * Populate the row set with test data via code.
> * Add an SV2 to the row set.
> * Pass the row set to operator components (such as generated code blocks.)
> * Compare the results of the operation with an expected result set.
> * Dispose of the underling direct memory when work is done.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message