Package com.cloudera.cdk.data

Examples of com.cloudera.cdk.data.DatasetWriterException


      FileSystem fs, Path path, DatasetDescriptor descriptor) {
    // ensure the path exists
    try {
      fs.mkdirs(path);
    } catch (IOException ex) {
      throw new DatasetWriterException("Could not create path:" + path, ex);
    }

    final Format format = descriptor.getFormat();
    final Path file = new Path(path, uniqueFilename(descriptor.getFormat()));
View Full Code Here


      }
      avroParquetWriter = new AvroParquetWriter<E>(fileSystem.makeQualified(pathTmp),
          schema, codecName, DEFAULT_BLOCK_SIZE,
          ParquetWriter.DEFAULT_PAGE_SIZE);
    } catch (IOException e) {
      throw new DatasetWriterException("Unable to create writer to path:" + pathTmp, e);
    }

    state = ReaderWriterState.OPEN;
  }
View Full Code Here

      "Attempt to write to a writer in state:%s", state);

    try {
      avroParquetWriter.write(entity);
    } catch (IOException e) {
      throw new DatasetWriterException(
        "Unable to write entity:" + entity + " with writer:" + avroParquetWriter, e);
    }
  }
View Full Code Here

      logger.debug("Closing pathTmp:{}", pathTmp);

      try {
        Closeables.close(avroParquetWriter, false);
      } catch (IOException e) {
        throw new DatasetWriterException(
          "Unable to close writer:" + avroParquetWriter + " to path:" + pathTmp);
      }

      logger.debug("Committing pathTmp:{} to path:{}", pathTmp, path);

      try {
        if (!fileSystem.rename(pathTmp, path)) {
          throw new DatasetWriterException(
            "Failed to move " + pathTmp + " to " + path);
        }
      } catch (IOException e) {
        throw new DatasetWriterException(
          "Internal error while trying to commit path:" + pathTmp, e);
      }

      state = ReaderWriterState.CLOSED;
    }
View Full Code Here

    try {
      out = fileSystem.create(pathTmp, true);
      dataFileWriter.create(schema, out);
    } catch (IOException e) {
      throw new DatasetWriterException("Unable to create writer to path:" + pathTmp, e);
    }

    state = ReaderWriterState.OPEN;
  }
View Full Code Here

      "Attempt to write to a writer in state:%s", state);

    try {
      dataFileWriter.append(entity);
    } catch (IOException e) {
      throw new DatasetWriterException(
        "Unable to write entity:" + entity + " with writer:" + dataFileWriter, e);
    }
  }
View Full Code Here

    try {
      dataFileWriter.flush();
      out.hflush();
    } catch (IOException e) {
      throw new DatasetWriterException(
        "Unable to flush file writer:" + dataFileWriter);
    }
  }
View Full Code Here

      logger.debug("Closing pathTmp:{}", pathTmp);

      try {
        Closeables.close(dataFileWriter, false);
      } catch (IOException e) {
        throw new DatasetWriterException(
          "Unable to close writer:" + dataFileWriter + " to path:" + pathTmp);
      }

      logger.debug("Committing pathTmp:{} to path:{}", pathTmp, path);

      try {
        if (!fileSystem.rename(pathTmp, path)) {
          throw new DatasetWriterException(
            "Failed to move " + pathTmp + " to " + path);
        }
      } catch (IOException e) {
        throw new DatasetWriterException(
          "Internal error while trying to commit path:" + pathTmp, e);
      }

      state = ReaderWriterState.CLOSED;
    }
View Full Code Here

TOP

Related Classes of com.cloudera.cdk.data.DatasetWriterException

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.