Package org.apache.hadoop.hive.ql.io.orc

Examples of org.apache.hadoop.hive.ql.io.orc.Writer


        this.counter = counter;
    }

    @Override
    public void write(T model) throws IOException {
        Writer writer = prepare();
        writer.addRow(model);

        // not sure
        counter.add(1);
    }
View Full Code Here


        // not sure
        counter.add(1);
    }

    private Writer prepare() throws IOException {
        Writer writer = currentWriter;
        if (writer == null) {
            if (LOG.isInfoEnabled()) {
                LOG.info(MessageFormat.format(
                        "Creating ORCFile ({0}): {1}",
                        descriptor.getDataModelClass().getSimpleName(),
View Full Code Here

    synchronized (TestVectorizedORCReader.class) {
      inspector = ObjectInspectorFactory.getReflectionObjectInspector(
          recordClass, ObjectInspectorFactory.ObjectInspectorOptions.JAVA);
    }

    Writer writer = OrcFile.createWriter(
        fs,
        outputPath,
        conf,
        inspector,
        100000,
        CompressionKind.ZLIB,
        10000,
        10000);

    try {
      Constructor[] constructors = recordClass.getConstructors();

      if (constructors.length != 1) {
        throw new UnsupportedOperationException(
            "The provided recordClass must have exactly one constructor.");
      }

      BatchDataDistribution[] dataDist = BatchDataDistribution.values();
      Class[] columns = constructors[0].getParameterTypes();
      for (int i = 0; i < dataDist.length * 3; i++) {
        Object[][] rows = new Object[columns.length][VectorizedRowBatch.DEFAULT_SIZE];
        for (int c = 0; c < columns.length; c++) {
          if (!TYPE_TO_BATCH_GEN_MAP.containsKey(columns[c])) {
            throw new UnsupportedOperationException("No batch generator defined for type "
                + columns[c].getName());
          }
          rows[c] = TYPE_TO_BATCH_GEN_MAP.get(
              columns[c]).generateBatch(dataDist[(i + c) % dataDist.length]);
        }

        for (int r = 0; r < VectorizedRowBatch.DEFAULT_SIZE; r++) {
          Object[] row = new Object[columns.length];
          for (int c = 0; c < columns.length; c++) {
            row[c] = rows[c][r];
          }
          writer.addRow(
              constructors[0].newInstance(row));
        }
      }
    } finally {
      writer.close();
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.ql.io.orc.Writer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.