private static FieldSchema union(FieldSchema mergedFieldSchema, FieldSchema newFieldSchema) { if (!mergedFieldSchema.alias.equals(newFieldSchema.alias) || mergedFieldSchema.type != newFieldSchema.type) { throw new IncompatibleSchemaModificationException("Incompatible Pig schema change: " + mergedFieldSchema + " can not accept"); } try { return new FieldSchema(mergedFieldSchema.alias, union(mergedFieldSchema.schema, newFieldSchema.schema), mergedFieldSchema.type); } catch (FrontendException e) { throw new SchemaConversionException(e); } }
private static FieldSchema union(FieldSchema mergedFieldSchema, FieldSchema newFieldSchema) { if(!mergedFieldSchema.alias.equals(newFieldSchema.alias) || mergedFieldSchema.type != newFieldSchema.type) { throw new IncompatibleSchemaModificationException("Incompatible Pig schema change: " + mergedFieldSchema + " can not accept"); } try { return new FieldSchema(mergedFieldSchema.alias, union(mergedFieldSchema.schema, newFieldSchema.schema), mergedFieldSchema.type); } catch (FrontendException e) { throw new SchemaConversionException(e); } }
@Override protected Type union(Type toMerge, boolean strict) { if (toMerge.isPrimitive()) { throw new IncompatibleSchemaModificationException("can not merge primitive type " + toMerge + " into group type " + this); } return new GroupType(toMerge.getRepetition(), getName(), mergeFields(toMerge.asGroupType())); }
Type fieldToMerge = toMerge.getType(type.getName()); if (fieldToMerge.getRepetition().isMoreRestrictiveThan(type.getRepetition())) { throw new IncompatibleSchemaModificationException("repetition constraint is more restrictive: can not merge type " + fieldToMerge + " into " + type);
@Override protected Type union(Type toMerge, boolean strict) { if (!toMerge.isPrimitive() || (strict && !primitive.equals(toMerge.asPrimitiveType().getPrimitiveTypeName()))) { throw new IncompatibleSchemaModificationException("can not merge type " + toMerge + " into " + this); } Types.PrimitiveBuilder<PrimitiveType> builder = Types.primitive( primitive, toMerge.getRepetition()); if (PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY == primitive) { builder.length(length); } return builder.named(getName()); } }