Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

172
Vistas
Convert JSON to ORC using orc-tools

I am trying to convert JSON file using the orc tools jar mentioned on

https://orc.apache.org/docs/tools.html#java-orc-tools

I have imported this in my pom.xml

<dependency>
    <groupId>org.apache.orc</groupId>
    <artifactId>orc-tools</artifactId>
    <version>1.3.1</version>
</dependency>

However, after the import, I am unable to see/import the class org.apache.orc.tools.json.JsonSchemaFinder which is used to infer the schema from JSON files.

Example using the above class can be seen in this commit. https://github.com/apache/orc/pull/95/commits/2ee0be7e60e7ca77f574110ba1babfa2a8e93f3f

Am I using the wrong jar here?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

This is scheduled to release in 1.4.0 version of ORC. Current version 1.3.x doesnt include these features.

You can still get the ORC git branch, copy out the org.apache.orc.tools.convert and org.apache.orc.tools.json to your repo and use these features. Alternatively, you can also make a jar from the ORC repo and use it too.

public static void main(Configuration conf,
                       String[] args) throws IOException, ParseException {
 CommandLine opts = parseOptions(args);
 TypeDescription schema;
 if (opts.hasOption('s')) {
   schema = TypeDescription.fromString(opts.getOptionValue('s'));
 } else {
   schema = computeSchema(opts.getArgs());
 }
 String outFilename = opts.hasOption('o')
     ? opts.getOptionValue('o') : "output.orc";
 Writer writer = OrcFile.createWriter(new Path(outFilename),
     OrcFile.writerOptions(conf).setSchema(schema));
 VectorizedRowBatch batch = schema.createRowBatch();
 for (String file: opts.getArgs()) {
   System.err.println("Processing " + file);
   RecordReader reader = new JsonReader(new Path(file), schema, conf);
   while (reader.nextBatch(batch)) {
     writer.addRowBatch(batch);
   }
   reader.close();
 }
 writer.close();
}
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda