org.apache.hadoop.zebra.types
Class SortInfo

java.lang.Object
  extended by org.apache.hadoop.zebra.types.SortInfo

public class SortInfo
extends Object

Sortness related Information


Field Summary
static String DEFAULT_COMPARATOR
           
static String SORTED_COLUMN_DELIMITER
           
 
Method Summary
 boolean equals(String[] sortcolumns, String comparator)
          Check if the two SortInfo objects are equal
 String getComparator()
          Get the comparator name
 String[] getSortColumnNames()
          Get an array of the sorted column names with the first column being the primary sort key, the second column being the secondary sort key, ..., etc.
 ColumnType[] getSortColumnTypes()
          Get an array of zebra types of the sorted columns with the first column being the primary sort key, the second column being the secondary sort key, ..., etc.
 int[] getSortIndices()
          Get an array of column indices in schema of the sorted columns with the first column being the primary sort key, the second column being the secondary sort key, ..., etc.
static SortInfo parse(String sortStr, Schema schema, String comparator)
          Build a SortInfo object from sort column names, schema, and comparator
 int size()
          Get the number of sorted columns
static String toSortString(String[] names)
          Build a string of comma-separated sort column names from an array of sort column names
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_COMPARATOR

public static final String DEFAULT_COMPARATOR
See Also:
Constant Field Values

SORTED_COLUMN_DELIMITER

public static final String SORTED_COLUMN_DELIMITER
See Also:
Constant Field Values
Method Detail

getSortColumnNames

public String[] getSortColumnNames()
Get an array of the sorted column names with the first column being the primary sort key, the second column being the secondary sort key, ..., etc.

Returns:
an array of strings of sorted column names

getSortColumnTypes

public ColumnType[] getSortColumnTypes()
Get an array of zebra types of the sorted columns with the first column being the primary sort key, the second column being the secondary sort key, ..., etc.

Returns:
an array of strings of sorted column names

getSortIndices

public int[] getSortIndices()
Get an array of column indices in schema of the sorted columns with the first column being the primary sort key, the second column being the secondary sort key, ..., etc.

Returns:
an array of strings of sorted column names

size

public int size()
Get the number of sorted columns

Returns:
number of sorted columns

getComparator

public String getComparator()
Get the comparator name

Returns:
comparator name

equals

public boolean equals(String[] sortcolumns,
                      String comparator)
               throws IOException
Check if the two SortInfo objects are equal

Returns:
true if one's sort columns is equal to a leading portion of the other's
Throws:
IOException

parse

public static SortInfo parse(String sortStr,
                             Schema schema,
                             String comparator)
                      throws IOException
Build a SortInfo object from sort column names, schema, and comparator

Parameters:
sortStr - comma-separated sort column names
schema - schema of the Zebra table for the sort columns
comparator - comparator name
Returns:
newly built SortInfo object
Throws:
IOException

toSortString

public static String toSortString(String[] names)
Build a string of comma-separated sort column names from an array of sort column names

Parameters:
names - an array of sort column names
Returns:
a string of comma-separated sort column names


Copyright © ${year} The Apache Software Foundation