/** * Gets the registered writer schemas associated with the provided cell specification. * * @param spec containing registered schemas. * @return the set of writer schemas registered for the provided cell. * Null if validation is disabled. * @throws IOException if there is an error looking up schemas. */ private static Set<Schema> getRegisteredWriters(final CellSpec spec) throws IOException { final List<AvroSchema> writerSchemas = spec.getCellSchema().getWriters(); if (writerSchemas == null) { return null; } final AvroSchemaResolver resolver = new SchemaTableAvroResolver(spec.getSchemaTable()); return Sets.newHashSet(Collections2.transform(writerSchemas, resolver)); }
/** * Get the Avro Schema for a given column marked FINAL in a given layout. This will either be * defined INLINE as a Schema JSON or it will be the only writer schema in the layout 1.3+ * Avro writers field. * * @param layout table layout from which to get the Schema for the given column. * @param column column for which to get the Schema. * @return Avro Schema of the given column. * @throws NoSuchColumnException in case the column does not exist. */ private static Schema getSchemaForFinalColumn(FijiTableLayout layout, FijiColumnName column) throws NoSuchColumnException { final List<AvroSchema> writers = layout.getCellSchema(column).getWriters(); if (null == writers) { return new Schema.Parser().parse(layout.getCellSchema(column).getValue()); } else { Preconditions.checkState(writers.size() == 1, "FINAL columns must have exactly one writer schema, found: " + writers); return new SchemaTableAvroResolver(layout.getSchemaTable()).apply(writers.get(0)); } }
readerSchemaIDs.addAll(cellSchema.getReaders()); if (cellSchema.getWriters() != null) { writerSchemaIDs.addAll(cellSchema.getWriters()); readerSchemaIDs.addAll(refCellSchema.getReaders()); if (refCellSchema.getWriters() != null) { writerSchemaIDs.addAll(refCellSchema.getWriters());
cellSchema.setReaders(Lists.<AvroSchema>newArrayList()); if (cellSchema.getWriters() == null) { cellSchema.setWriters(Lists.<AvroSchema>newArrayList()); normalizeAvroSchemaCollection(cellSchema.getWriters(), options); normalizeAvroSchemaCollection(cellSchema.getWritten(), options);