本文整理汇总了Java中org.apache.avro.Schema.Field.doc方法的典型用法代码示例。如果您正苦于以下问题:Java Field.doc方法的具体用法?Java Field.doc怎么用?Java Field.doc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.avro.Schema.Field
的用法示例。
在下文中一共展示了Field.doc方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addExtras
import org.apache.avro.Schema.Field; //导入方法依赖的package包/类
private void addExtras(Field field) {
List<Entry<String, String>> extras = new ArrayList<>(3);
String dflt = defaultFor(field);
if (dflt != null) {
extras.add(new AbstractMap.SimpleEntry<String, String>("default", dflt));
}
String doc = field.doc();
if (doc != null) {
extras.add(new AbstractMap.SimpleEntry<String, String>("doc", doc));
}
String size = childIntNodeAsString(field, "size");
if (size!= null) {
extras.add(new AbstractMap.SimpleEntry<String, String>("size", size));
}
appendAsData(extras);
}
示例2: getRecordSchemaWithDirtySupport
import org.apache.avro.Schema.Field; //导入方法依赖的package包/类
private static Schema getRecordSchemaWithDirtySupport(Schema originalSchema, Map<Schema,Schema> queue) throws IOException {
if (originalSchema.getType() != Type.RECORD) {
throw new IOException("Gora only supports record schemas.");
}
List<Field> originalFields = originalSchema.getFields();
/* make sure the schema doesn't contain the field __g__dirty */
for (Field field : originalFields) {
if (GORA_RESERVED_NAMES.contains(field.name())) {
throw new IOException(
"Gora schemas cannot contain the field name " + field.name());
}
}
Schema newSchema = Schema.createRecord(originalSchema.getName(),
originalSchema.getDoc(), originalSchema.getNamespace(),
originalSchema.isError());
queue.put(originalSchema, newSchema);
List<Field> newFields = new ArrayList<>();
byte[] defaultDirtyBytesValue = new byte[getNumberOfBytesNeededForDirtyBits(originalSchema)];
Arrays.fill(defaultDirtyBytesValue, (byte) 0);
JsonNode defaultDirtyJsonValue = JsonNodeFactory.instance
.binaryNode(defaultDirtyBytesValue);
Field dirtyBits = new Field(DIRTY_BYTES_FIELD_NAME,
Schema.create(Type.BYTES),
"Bytes used to represent weather or not a field is dirty.",
defaultDirtyJsonValue);
newFields.add(dirtyBits);
for (Field originalField : originalFields) {
// recursively add dirty support
Field newField = new Field(originalField.name(),
getSchemaWithDirtySupport(originalField.schema(),queue),
originalField.doc(), originalField.defaultValue(),
originalField.order());
newFields.add(newField);
}
newSchema.setFields(newFields);
return newSchema;
}
示例3: getKeySchema
import org.apache.avro.Schema.Field; //导入方法依赖的package包/类
private Optional<Schema> getKeySchema(Field field) {
switch (field.schema().getType()) {
case RECORD:
return getKeySchemaFromRecord(field.schema());
default:
if (field.doc() != null && field.doc().toLowerCase().endsWith(SCHEMA_DEDUP_FIELD_ANNOTATOR)) {
return Optional.of(field.schema());
} else {
return Optional.absent();
}
}
}
示例4: getSchemaFieldsList
import org.apache.avro.Schema.Field; //导入方法依赖的package包/类
public static List<Field> getSchemaFieldsList(Schema schema) {
List<Field> result = new ArrayList<>();
for (Field f : schema.getFields()) {
Field nf = new Field(f.name(), f.schema(), f.doc(), f.defaultVal());
nf.getObjectProps().putAll(f.getObjectProps());
for (Map.Entry<String, Object> entry : f.getObjectProps().entrySet()) {
nf.addProp(entry.getKey(), entry.getValue());
}
result.add(nf);
}
return result;
}
示例5: generateNewField
import org.apache.avro.Schema.Field; //导入方法依赖的package包/类
public static Field generateNewField(Field origin) {
Schema.Field field = new Schema.Field(origin.name(), origin.schema(), origin.doc(), origin.defaultVal(), origin.order());
field.getObjectProps().putAll(origin.getObjectProps());
for (Map.Entry<String, Object> entry : origin.getObjectProps().entrySet()) {
field.addProp(entry.getKey(), entry.getValue());
}
return field;
}
示例6: getMigratedField
import org.apache.avro.Schema.Field; //导入方法依赖的package包/类
private Field getMigratedField(Field origin, Schema expectedSchema, String expectedDIType) {
Field expectedField = new Schema.Field(origin.name(), expectedSchema, origin.doc(), origin.defaultVal(), origin.order());
for (Map.Entry<String, Object> entry : origin.getObjectProps().entrySet()) {
if ("di.column.talendType".equals(entry.getKey())) {
expectedField.addProp("di.column.talendType", expectedDIType);
} else {
expectedField.addProp(entry.getKey(), entry.getValue());
}
}
return expectedField;
}