You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by pi song <pi...@gmail.com> on 2008/04/21 15:17:15 UTC

Schema Merging?

Dear Alan,

As I'm waiting for more Logical Operators, I have implemented more helper
methods for schema merging. There is no spec for this so I'm not sure if
this is what you want.

In the attached patch:-

*Schema.merge(Schema other, boolean otherTakesAliasPrecedence)   *
is used for recursively merging schemas.
*Schema.equals(Schema schema, Schema other, boolean relaxInner, boolean
relaxAlias)*             is used for recursively comparing schemas.
*Schema.mergeType(byte type1, byte
type2)
*is where the type promotion logic lives in

I also added a new equal method for FieldSchema because I think this line in
the existing equal() "if (schema != fs.schema) return false;" looks wrong!!
I'm willing to add a lot more unit tests if this is what you want.

Pi