public static class Schema.FieldSchema extends Object implements Serializable, Cloneable
Modifier and Type | Field and Description |
---|---|
String |
alias
Alias for this field.
|
String |
canonicalName
Canonical name.
|
static CanonicalNamer |
canonicalNamer
Canonical namer object to generate new canonical names on
request.
|
Schema |
schema
If this is a tuple itself, it can have a schema.
|
byte |
type
Datatype, using codes from
DataType . |
Constructor and Description |
---|
FieldSchema(Schema.FieldSchema fs)
Copy Constructor.
|
FieldSchema(String a,
byte t)
Constructor for any type.
|
FieldSchema(String a,
Schema s)
Constructor for tuple fields.
|
FieldSchema(String a,
Schema s,
byte t)
Constructor for tuple fields.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
castable(Schema.FieldSchema castFs,
Schema.FieldSchema inputFs)
Recursively compare two schemas to check if the input schema
can be cast to the cast schema
|
Schema.FieldSchema |
clone()
Make a deep copy of this FieldSchema and return it.
|
boolean |
equals(Object other)
Two field schemas are equal if types and schemas
are equal in all levels.
|
static boolean |
equals(Schema.FieldSchema fschema,
Schema.FieldSchema fother,
boolean relaxInner,
boolean relaxAlias)
Compare two field schema for equality
|
Schema.FieldSchema |
findFieldSchema(String canonicalName)
Find a field schema instance in this FieldSchema hierarchy (including "this")
that matches the given canonical name.
|
int |
hashCode() |
Schema.FieldSchema |
mergePrefixFieldSchema(Schema.FieldSchema otherFs)
Recursively prefix merge two schemas
|
Schema.FieldSchema |
mergePrefixFieldSchema(Schema.FieldSchema otherFs,
boolean otherTakesAliasPrecedence)
Recursively prefix merge two schemas
|
Schema.FieldSchema |
mergePrefixFieldSchema(Schema.FieldSchema otherFs,
boolean otherTakesAliasPrecedence,
boolean allowMergeableTypes)
Recursively prefix merge two schemas
|
static void |
setFieldSchemaDefaultType(Schema.FieldSchema fs,
byte t)
Recursively set NULL type to the specifid type
|
String |
toString() |
public String alias
public byte type
DataType
.public Schema schema
public String canonicalName
public static final CanonicalNamer canonicalNamer
public FieldSchema(String a, byte t)
a
- Alias, if known. If unknown leave null.t
- Type, using codes from
DataType
.public FieldSchema(String a, Schema s)
a
- Alias, if known. If unknown leave null.s
- Schema of this tuple.public FieldSchema(String a, Schema s, byte t) throws FrontendException
a
- Alias, if known. If unknown leave null.s
- Schema of this tuple.t
- Type, using codes from
DataType
.FrontendException
public FieldSchema(Schema.FieldSchema fs)
fs
- Source FieldSchemapublic boolean equals(Object other)
public static boolean castable(Schema.FieldSchema castFs, Schema.FieldSchema inputFs)
castFs
- schema of the cast operatorinputFs
- schema of the cast inputpublic static boolean equals(Schema.FieldSchema fschema, Schema.FieldSchema fother, boolean relaxInner, boolean relaxAlias)
fschema
- fother
- relaxInner
- If true, we don't check inner tuple schemasrelaxAlias
- If true, we don't check aliasespublic Schema.FieldSchema clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public Schema.FieldSchema mergePrefixFieldSchema(Schema.FieldSchema otherFs) throws SchemaMergeException
otherFs
- the other field schema to be merged withSchemaMergeException
- if they cannot be mergedpublic Schema.FieldSchema mergePrefixFieldSchema(Schema.FieldSchema otherFs, boolean otherTakesAliasPrecedence) throws SchemaMergeException
otherFs
- the other field schema to be merged withotherTakesAliasPrecedence
- true if aliases from the other
field schema take precedenceSchemaMergeException
- if they cannot be mergedpublic Schema.FieldSchema mergePrefixFieldSchema(Schema.FieldSchema otherFs, boolean otherTakesAliasPrecedence, boolean allowMergeableTypes) throws SchemaMergeException
otherFs
- the other field schema to be merged withotherTakesAliasPrecedence
- true if aliases from the other
field schema take precedenceallowMergeableTypes
- true if "mergeable" types should be allowed.
Two types are mergeable if any of the following conditions is true IN THE
BELOW ORDER of checks:
1) if either one has a type null or unknown and other has a type OTHER THAN
null or unknown, the result type will be the latter non null/unknown type
2) If either type is bytearray, then result type will be the other (possibly non BYTEARRAY) type
3) If current type can be cast to the other type, then the result type will be the
other typeSchemaMergeException
- if they cannot be mergedpublic static void setFieldSchemaDefaultType(Schema.FieldSchema fs, byte t)
fs
- the field schema whose NULL type has to be sett
- the specified typepublic Schema.FieldSchema findFieldSchema(String canonicalName)
canonicalName
- canonical nameCopyright © 2007-2017 The Apache Software Foundation