public static class Schema.FieldSchema
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
java.lang.String |
alias
Alias for this field.
|
java.lang.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(java.lang.String a,
byte t)
Constructor for any type.
|
FieldSchema(java.lang.String a,
Schema s)
Constructor for tuple fields.
|
FieldSchema(java.lang.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(java.lang.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(java.lang.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
|
java.lang.String |
toString() |
public java.lang.String alias
public byte type
DataType
.public Schema schema
public java.lang.String canonicalName
public static final CanonicalNamer canonicalNamer
public FieldSchema(java.lang.String a, byte t)
a
- Alias, if known. If unknown leave null.t
- Type, using codes from
DataType
.public FieldSchema(java.lang.String a, Schema s)
a
- Alias, if known. If unknown leave null.s
- Schema of this tuple.public FieldSchema(java.lang.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(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
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 java.lang.String toString()
toString
in class java.lang.Object
public Schema.FieldSchema clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.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(java.lang.String canonicalName)
canonicalName
- canonical nameCopyright © 2007-2017 The Apache Software Foundation