|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.zebra.schema.Schema
public class Schema
Logical schema of tabular data.
| Nested Class Summary | |
|---|---|
static class |
Schema.ColumnSchema
Column Schema in Schema |
static class |
Schema.ParsedName
Helper class to parse a column name string one section at a time and find the required type for the parsed part. |
| Field Summary | |
|---|---|
static String |
COLUMN_DELIMITER
|
| Constructor Summary | |
|---|---|
Schema()
Constructor - schema for empty schema (zero-column) . |
|
Schema(boolean projection)
Constructor - schema for empty projection/schema (zero-column) . |
|
Schema(Schema.ColumnSchema fs)
|
|
Schema(String schema)
Constructor - create a schema from a string representation. |
|
Schema(String[] columns)
Constructor - create a schema from an array of column names. |
|
Schema(String schema,
boolean projection)
|
|
| Method Summary | |
|---|---|
void |
add(Schema.ColumnSchema f)
add a column |
int |
compareTo(Schema other)
|
boolean |
equals(Object obj)
|
Schema.ColumnSchema |
getColumn(int index)
Get a particular column's schema |
Schema.ColumnSchema |
getColumn(String name)
get a column by name |
int |
getColumnIndex(String name)
Get the index of the column for the input column name. |
String |
getColumnName(int index)
|
String[] |
getColumns()
Get the names of the individual columns. |
Schema.ColumnSchema |
getColumnSchema(Schema.ParsedName pn)
find the most fitting subcolumn containing the name: the parsed name is set after the field name plus any possible separator of '.' or '#'. |
Schema.ColumnSchema |
getColumnSchema(String name)
Get a column's schema |
Schema.ColumnSchema |
getColumnSchemaOnParsedName(Schema.ParsedName pn)
Get a subcolumn's schema and move the name just parsed into the next subtype |
int |
getNumColumns()
Get the number of columns as defined in the schema. |
Schema |
getProjectionSchema(String[] projcols,
HashMap<Schema.ColumnSchema,HashSet<String>> keysmap)
Get a projection's schema |
String[] |
getTypedColumns()
Get the names and types of the individual columns. |
static String |
normalize(String value)
Normalize the schema string. |
static Schema |
parse(String schema)
Parse a schema string and create a schema object. |
void |
readFields(DataInput in)
|
String |
toProjectionString()
return untyped schema string for projection |
String |
toString()
Convert the schema to a String. |
void |
unionSchema(Schema other)
union compatible schemas. |
void |
write(DataOutput out)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String COLUMN_DELIMITER
| Constructor Detail |
|---|
public Schema()
public Schema(boolean projection)
projection - A projection schema or not
public Schema(String schema)
throws ParseException
schema - A string representation of the schema. For this version, the
schema string is simply a comma separated list of column names. Of
course, comma (,) and space characters are illegal in column
names. To maintain forward compatibility, please use only
alpha-numeric characters in column names.
ParseException
public Schema(String schema,
boolean projection)
throws ParseException
ParseException
public Schema(Schema.ColumnSchema fs)
throws ParseException
ParseException
public Schema(String[] columns)
throws ParseException
columns - An array of column names. To maintain forward compatibility,
please use only alpha-numeric characters in column names.
ParseException| Method Detail |
|---|
public void add(Schema.ColumnSchema f)
throws ParseException
f - Column to be added to the schema
ParseExceptionpublic Schema.ColumnSchema getColumn(String name)
public String[] getColumns()
public Schema.ColumnSchema getColumn(int index)
public String getColumnName(int index)
public String[] getTypedColumns()
public int getColumnIndex(String name)
name - input column name.
public int getNumColumns()
public static Schema parse(String schema)
throws ParseException
schema - comma separated schema string.
ParseExceptionpublic String toString()
toString in class Objectpublic static String normalize(String value)
value - the input string representation of the schema.
public int compareTo(Schema other)
compareTo in interface Comparable<Schema>Comparable.compareTo(Object)public boolean equals(Object obj)
equals in class ObjectObject.equals(Object)
public void readFields(DataInput in)
throws IOException
readFields in interface org.apache.hadoop.io.WritableIOExceptionWritable.readFields(DataInput)
public void write(DataOutput out)
throws IOException
write in interface org.apache.hadoop.io.WritableIOExceptionWritable.write(DataOutput)
public Schema getProjectionSchema(String[] projcols,
HashMap<Schema.ColumnSchema,HashSet<String>> keysmap)
throws ParseException
ParseException
public Schema.ColumnSchema getColumnSchema(String name)
throws ParseException
name - column name
ParseException
public Schema.ColumnSchema getColumnSchemaOnParsedName(Schema.ParsedName pn)
throws ParseException
pn - The name of subcolumn to be parsed. On return it contains the
subcolumn at the next level after parsing
ParseException
public Schema.ColumnSchema getColumnSchema(Schema.ParsedName pn)
throws ParseException
pn - The name of subcolumn to be parsed. On return it contains the
subcolumn at the next level after parsing
ParseException
public void unionSchema(Schema other)
throws ParseException
ParseExceptionpublic String toProjectionString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||