Tabnine Logo
ColumnIO
Code IndexAdd Tabnine to your IDE (free)

How to use
ColumnIO
in
org.apache.parquet.io

Best Java code snippets using org.apache.parquet.io.ColumnIO (Showing top 20 results out of 315)

origin: org.lasersonlab.apache.parquet/parquet-column

ColumnIO getParent(int r) {
 if (getRepetitionLevel() == r && getType().isRepetition(Repetition.REPEATED)) {
  return this;
 } else  if (getParent()!=null && getParent().getDefinitionLevel()>=r) {
  return getParent().getParent(r);
 } else {
  throw new InvalidRecordException("no parent("+r+") for "+Arrays.toString(this.getFieldPath()));
 }
}
origin: org.apache.parquet/parquet-column

@Override
void setLevels(int r, int d, String[] fieldPath, int[] indexFieldPath, List<ColumnIO> repetition, List<ColumnIO> path) {
 super.setLevels(r, d, fieldPath, indexFieldPath, repetition, path);
 for (ColumnIO child : this.children) {
  String[] newFieldPath = Arrays.copyOf(fieldPath, fieldPath.length + 1);
  int[] newIndexFieldPath = Arrays.copyOf(indexFieldPath, indexFieldPath.length + 1);
  newFieldPath[fieldPath.length] = child.getType().getName();
  newIndexFieldPath[indexFieldPath.length] = child.getIndex();
  List<ColumnIO> newRepetition;
  if (child.getType().isRepetition(REPEATED)) {
   newRepetition = new ArrayList<ColumnIO>(repetition);
   newRepetition.add(child);
  } else {
   newRepetition = repetition;
  }
  List<ColumnIO> newPath = new ArrayList<ColumnIO>(path);
  newPath.add(child);
  child.setLevels(
    // the type repetition level increases whenever there's a possible repetition
    child.getType().isRepetition(REPEATED) ? r + 1 : r,
    // the type definition level increases whenever a field can be missing (not required)
    !child.getType().isRepetition(REQUIRED) ? d + 1 : d,
    newFieldPath,
    newIndexFieldPath,
    newRepetition,
    newPath
    );
 }
}
origin: org.lasersonlab.apache.parquet/parquet-column

@Override
List<String[]> getColumnNames() {
 ArrayList<String[]> result = new ArrayList<String[]>();
 for (ColumnIO c : children) {
  result.addAll(c.getColumnNames());
 }
 return result;
}
origin: org.apache.parquet/parquet-thrift

 @Override
 public void writeFieldEnd() throws TException {
  recordConsumer.endField(currentType.getName(), currentType.getIndex());
 }
}
origin: org.apache.parquet/parquet-column

private void printState() {
 if (DEBUG) {
  log(currentLevel + ", " + fieldsWritten[currentLevel] + ": " + Arrays.toString(currentColumnIO.getFieldPath()) + " r:" + r[currentLevel]);
  if (r[currentLevel] > currentColumnIO.getRepetitionLevel()) {
   // sanity check
   throw new InvalidRecordException(r[currentLevel] + "(r) > " + currentColumnIO.getRepetitionLevel() + " ( schema r)");
  }
 }
}
origin: prestosql/presto

public static ColumnIO getArrayElementColumn(ColumnIO columnIO)
{
  while (columnIO instanceof GroupColumnIO && !columnIO.getType().isRepetition(REPEATED)) {
    columnIO = ((GroupColumnIO) columnIO).getChild(0);
  }
  /* If array has a standard 3-level structure with middle level repeated group with a single field:
   *  optional group my_list (LIST) {
   *     repeated group element {
   *        required binary str (UTF8);
   *     };
   *  }
   */
  if (columnIO instanceof GroupColumnIO &&
      columnIO.getType().getOriginalType() == null &&
      ((GroupColumnIO) columnIO).getChildrenCount() == 1 &&
      !columnIO.getName().equals("array") &&
      !columnIO.getName().equals(columnIO.getParent().getName() + "_tuple")) {
    return ((GroupColumnIO) columnIO).getChild(0);
  }
  /* Backward-compatibility support for 2-level arrays where a repeated field is not a group:
   *   optional group my_list (LIST) {
   *      repeated int32 element;
   *   }
   */
  return columnIO;
}
origin: org.apache.parquet/parquet-column

void add(ColumnIO child) {
 children.add(child);
 childrenByName.put(child.getType().getName(), child);
 ++ childrenSize;
}
origin: org.lasersonlab.apache.parquet/parquet-column

private void writeNullForMissingFieldsAtCurrentLevel() {
 int currentFieldsCount = ((GroupColumnIO) currentColumnIO).getChildrenCount();
 for (int i = 0; i < currentFieldsCount; i++) {
  if (!fieldsWritten[currentLevel].isWritten(i)) {
   try {
    ColumnIO undefinedField = ((GroupColumnIO) currentColumnIO).getChild(i);
    int d = currentColumnIO.getDefinitionLevel();
    if (DEBUG) log(Arrays.toString(undefinedField.getFieldPath()) + ".writeNull(" + r[currentLevel] + "," + d + ")");
    writeNull(undefinedField, r[currentLevel], d);
   } catch (RuntimeException e) {
    throw new ParquetEncodingException("error while writing nulls for fields of indexes " + i + " . current index: " + fieldsWritten[currentLevel], e);
   }
  }
 }
}
origin: org.apache.parquet/parquet-column

@Override
public void addInteger(int value) {
 if (DEBUG) log("addInt({})", value);
 emptyField = false;
 getColumnWriter().write(value, r[currentLevel], currentColumnIO.getDefinitionLevel());
 setRepetitionLevel();
 if (DEBUG) printState();
}
origin: org.lasersonlab.apache.parquet/parquet-column

@Override
public void endField(String field, int index) {
 if (DEBUG) log("endField({}, {})",field ,index);
 currentColumnIO = currentColumnIO.getParent();
 if (emptyField) {
  throw new ParquetEncodingException("empty fields are illegal, the field should be ommited completely instead");
 }
 fieldsWritten[currentLevel].markWritten(index);
 r[currentLevel] = currentLevel == 0 ? 0 : r[currentLevel - 1];
 if (DEBUG) printState();
}
origin: org.lasersonlab.apache.parquet/parquet-column

PrimitiveColumnIO getLast() {
 return children.get(children.size()-1).getLast();
}
origin: org.apache.parquet/parquet-column

PrimitiveColumnIO getFirst() {
 return children.get(0).getFirst();
}
origin: io.prestosql/presto-parquet

private static int getPathIndex(List<PrimitiveColumnIO> columns, List<String> path)
{
  int maxLevel = path.size();
  int index = -1;
  for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) {
    ColumnIO[] fields = columns.get(columnIndex).getPath();
    if (fields.length <= maxLevel) {
      continue;
    }
    if (fields[maxLevel].getName().equalsIgnoreCase(path.get(maxLevel - 1))) {
      boolean match = true;
      for (int level = 0; level < maxLevel - 1; level++) {
        if (!fields[level + 1].getName().equalsIgnoreCase(path.get(level))) {
          match = false;
        }
      }
      if (match) {
        index = columnIndex;
      }
    }
  }
  return index;
}
origin: org.lasersonlab.apache.parquet/parquet-column

private void setRepetitionLevel() {
 r[currentLevel] = currentColumnIO.getRepetitionLevel();
 if (DEBUG) log("r: {}", r[currentLevel]);
}
origin: io.prestosql/presto-parquet

public static ColumnIO getArrayElementColumn(ColumnIO columnIO)
{
  while (columnIO instanceof GroupColumnIO && !columnIO.getType().isRepetition(REPEATED)) {
    columnIO = ((GroupColumnIO) columnIO).getChild(0);
  }
  /* If array has a standard 3-level structure with middle level repeated group with a single field:
   *  optional group my_list (LIST) {
   *     repeated group element {
   *        required binary str (UTF8);
   *     };
   *  }
   */
  if (columnIO instanceof GroupColumnIO &&
      columnIO.getType().getOriginalType() == null &&
      ((GroupColumnIO) columnIO).getChildrenCount() == 1 &&
      !columnIO.getName().equals("array") &&
      !columnIO.getName().equals(columnIO.getParent().getName() + "_tuple")) {
    return ((GroupColumnIO) columnIO).getChild(0);
  }
  /* Backward-compatibility support for 2-level arrays where a repeated field is not a group:
   *   optional group my_list (LIST) {
   *      repeated int32 element;
   *   }
   */
  return columnIO;
}
origin: org.lasersonlab.apache.parquet/parquet-column

void add(ColumnIO child) {
 children.add(child);
 childrenByName.put(child.getType().getName(), child);
 ++ childrenSize;
}
origin: org.apache.parquet/parquet-thrift

 @Override
 public void end() {
  recordConsumer.endField(key.getName(), key.getIndex());
  currentProtocol = valueProtocol;
 }
});
origin: org.apache.parquet/parquet-column

private void writeNullForMissingFieldsAtCurrentLevel() {
 int currentFieldsCount = ((GroupColumnIO) currentColumnIO).getChildrenCount();
 for (int i = 0; i < currentFieldsCount; i++) {
  if (!fieldsWritten[currentLevel].isWritten(i)) {
   try {
    ColumnIO undefinedField = ((GroupColumnIO) currentColumnIO).getChild(i);
    int d = currentColumnIO.getDefinitionLevel();
    if (DEBUG) log(Arrays.toString(undefinedField.getFieldPath()) + ".writeNull(" + r[currentLevel] + "," + d + ")");
    writeNull(undefinedField, r[currentLevel], d);
   } catch (RuntimeException e) {
    throw new ParquetEncodingException("error while writing nulls for fields of indexes " + i + " . current index: " + fieldsWritten[currentLevel], e);
   }
  }
 }
}
origin: org.apache.parquet/parquet-column

@Override
public void addBoolean(boolean value) {
 if (DEBUG) log("addBoolean({})", value);
 emptyField = false;
 getColumnWriter().write(value, r[currentLevel], currentColumnIO.getDefinitionLevel());
 setRepetitionLevel();
 if (DEBUG) printState();
}
origin: org.lasersonlab.apache.parquet/parquet-column

private void printState() {
 if (DEBUG) {
  log(currentLevel + ", " + fieldsWritten[currentLevel] + ": " + Arrays.toString(currentColumnIO.getFieldPath()) + " r:" + r[currentLevel]);
  if (r[currentLevel] > currentColumnIO.getRepetitionLevel()) {
   // sanity check
   throw new InvalidRecordException(r[currentLevel] + "(r) > " + currentColumnIO.getRepetitionLevel() + " ( schema r)");
  }
 }
}
org.apache.parquet.ioColumnIO

Javadoc

a structure used to serialize deserialize records

Most used methods

  • getType
  • getIndex
  • getParent
  • getColumnNames
  • getDefinitionLevel
  • getFieldPath
  • getFirst
  • getLast
  • getName
  • getRepetitionLevel
  • setDefinitionLevel
  • setFieldPath
  • setDefinitionLevel,
  • setFieldPath,
  • setLevels,
  • setRepetitionLevel

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSystemService (Context)
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (Timer)
  • Menu (java.awt)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • String (java.lang)
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now