diff --git a/cadc-dali/src/main/java/ca/nrc/cadc/dali/tables/parquet/DynamicSchemaGenerator.java b/cadc-dali/src/main/java/ca/nrc/cadc/dali/tables/parquet/DynamicSchemaGenerator.java index 34b59f47..e2a23a18 100644 --- a/cadc-dali/src/main/java/ca/nrc/cadc/dali/tables/parquet/DynamicSchemaGenerator.java +++ b/cadc-dali/src/main/java/ca/nrc/cadc/dali/tables/parquet/DynamicSchemaGenerator.java @@ -18,21 +18,20 @@ public static Schema generateSchema(List voFields) { List fields = new ArrayList<>(); try { int columnCount = voFields.size(); - log.debug("Resultset Metadata Column count = " + columnCount); + log.debug("VOTable Column count = " + columnCount); for (VOTableField voField : voFields) { String columnName = voField.getName(); Schema.Field field = new Schema.Field(columnName.replaceAll("\"", ""), getAvroFieldType(voField.getDatatype()), null, null); fields.add(field); } - log.debug("Schema.Field count = " + fields.size()); + log.debug("Avro Schema.Field count = " + fields.size()); } catch (Exception e) { - log.debug("Failure while retriving metadata from ResultSet", e); - throw new RuntimeException("Failure while retriving metadata from ResultSet : " + e.getMessage(), e); + log.debug("Failure while creating Avro Schema from VOTable", e); + throw new RuntimeException("Failure while creating Avro Schema from VOTable : " + e.getMessage(), e); } // Define the Avro record schema with the fields - //TODO: Provide meaningful name, namespace and documentation - Schema schema = Schema.createRecord("DynamicRecord", null, null, Boolean.FALSE); + Schema schema = Schema.createRecord("Record", null, null, Boolean.FALSE); schema.setFields(fields); log.debug("Schema Generated Successfully : " + schema); return schema; diff --git a/cadc-dali/src/main/java/ca/nrc/cadc/dali/tables/parquet/ParquetWriter.java b/cadc-dali/src/main/java/ca/nrc/cadc/dali/tables/parquet/ParquetWriter.java index 1a461ea7..283faa3e 100644 --- a/cadc-dali/src/main/java/ca/nrc/cadc/dali/tables/parquet/ParquetWriter.java +++ b/cadc-dali/src/main/java/ca/nrc/cadc/dali/tables/parquet/ParquetWriter.java @@ -54,14 +54,14 @@ public void setFormatFactory(FormatFactory ff) { } @Override - public void write(VOTableDocument tm, OutputStream out) throws IOException { - write(tm, out, Long.MAX_VALUE); + public void write(VOTableDocument voTableDocument, OutputStream out) throws IOException { + write(voTableDocument, out, Long.MAX_VALUE); } @Override - public void write(VOTableDocument resultSet, OutputStream out, Long maxRec) throws IOException { + public void write(VOTableDocument voTableDocument, OutputStream out, Long maxRec) throws IOException { log.debug("ParquetWriter Write service called. MaxRec = " + maxRec); - for (VOTableResource resource : resultSet.getResources()) { + for (VOTableResource resource : voTableDocument.getResources()) { Schema schema = DynamicSchemaGenerator.generateSchema(resource.getTable().getFields()); OutputFile outputFile = outputFileFromStream(out); @@ -102,12 +102,12 @@ public void write(VOTableDocument resultSet, OutputStream out, Long maxRec) thro } @Override - public void write(VOTableDocument tm, Writer out) { + public void write(VOTableDocument voTableDocument, Writer out) { throw new UnsupportedOperationException("This method for Parquet Writer is not supported."); } @Override - public void write(VOTableDocument resultSet, Writer out, Long maxRec) { + public void write(VOTableDocument voTableDocument, Writer out, Long maxRec) { throw new UnsupportedOperationException("This method for Parquet Writer is not supported."); }