private void advancePastComma(String errMsg) throws IOException { skipWhitespace(); expectChar(',', errMsg); skipWhitespace(); }
/** * Parse the given JSON representation, as returned by {@link #toString()} into a Schema object. * * @param schemaJson the json representation of the schema * @return the json representation parsed into a schema object * @throws IOException if there was an exception parsing the schema */ public static Schema parseJson(String schemaJson) throws IOException { return SCHEMA_TYPE_ADAPTER.fromJson(schemaJson); }
/** * Read from the source to create the target type with target schema. * * @param source the source from which to read the object * @param sourceSchema the write schema of the object * @return the object of given type and schema * @throws IOException if there was some exception reading the object */ public TO read(FROM source, Schema sourceSchema) throws IOException { return read(source, sourceSchema, schema, type); }
public IntegerStore(String name, KeyValueTable kvTable) throws UnsupportedTypeException { super(name, kvTable, new TypeRepresentation(Integer.class), new ReflectionSchemaGenerator().generate(Integer.class)); }
ArtifactInspector(CConfiguration cConf, ArtifactClassLoaderFactory artifactClassLoaderFactory) { this.cConf = cConf; this.artifactClassLoaderFactory = artifactClassLoaderFactory; this.schemaGenerator = new ReflectionSchemaGenerator(false); }
@Override public <T> DatumReader<T> create(TypeToken<T> type, Schema schema) { return new ReflectionDatumReader<>(schema, type); } }
public ObjectStoreDataset(String name, KeyValueTable kvTable, TypeRepresentation typeRep, Schema schema, @Nullable ClassLoader classLoader) { super(name, kvTable); this.kvTable = kvTable; this.typeRep = typeRep; this.typeRep.setClassLoader(classLoader); this.schema = schema; this.datumWriter = new ReflectionDatumWriter<>(this.schema); }
@Override public Type getOwnerType() { return this.enclosingType == null ? null : this.enclosingType.toType(); } } // TypeRepresentation
@Override protected Object readNull(Row row) throws IOException { advanceField(); return null; }
private <T> TypeToken<DatumWriter<T>> getInterfaceType(TypeToken<T> type) { return new TypeToken<DatumWriter<T>>() { }.where(new TypeParameter<T>() { }, type); }
private <T> TypeToken<T[]> getArrayType(TypeToken<T> type) { return new TypeToken<T[]>() { }.where(new TypeParameter<T>() { }, type); }
/** * @return the represented Type. Note that for a parametrized type, we can just return this, * because it implements the ParametrizedType interface. */ public Type toType() { if (this.isClass) { return this.getRawType(); } else { return this; } }
@Override protected void writeNull(Put put) throws IOException { nextField(); }
@Override public <T> DatumReader<T> create(TypeToken<T> type, Schema schema) { return new ReflectionDatumReader<>(schema, type); } }
public ObjectStoreDataset(String name, KeyValueTable kvTable, TypeRepresentation typeRep, Schema schema, @Nullable ClassLoader classLoader) { super(name, kvTable); this.kvTable = kvTable; this.typeRep = typeRep; this.typeRep.setClassLoader(classLoader); this.schema = schema; this.datumWriter = new ReflectionDatumWriter<>(this.schema); }
private void advancePastComma(String errMsg) throws IOException { skipWhitespace(); expectChar(',', errMsg); skipWhitespace(); }
/** * Parse the given json representation of a schema object contained in a reader into a schema object. * * @param reader the reader for reading the json representation of a schema * @return the parsed schema object * @throws IOException if there was an exception parsing the schema */ public static Schema parseJson(Reader reader) throws IOException { return SCHEMA_TYPE_ADAPTER.fromJson(reader); }
/** * Read from the source to create the target type with target schema. * * @param source the source from which to read the object * @param sourceSchema the write schema of the object * @return the object of given type and schema * @throws IOException if there was some exception reading the object */ public TO read(FROM source, Schema sourceSchema) throws IOException { return read(source, sourceSchema, schema, type); }
@Override protected Object readNull(Row row) throws IOException { advanceField(); return null; }
/** * Parse the given JSON representation, as returned by {@link #toString()} into a Schema object. * * @param schemaJson the json representation of the schema * @return the json representation parsed into a schema object * @throws IOException if there was an exception parsing the schema */ public static Schema parseJson(String schemaJson) throws IOException { return SCHEMA_TYPE_ADAPTER.fromJson(schemaJson); }