com.splout.db.hadoop
Class TableSpec

java.lang.Object
  extended by com.splout.db.hadoop.TableSpec
All Implemented Interfaces:
java.io.Serializable

public class TableSpec
extends java.lang.Object
implements java.io.Serializable

Simple immutable bean that specifies the Pangool Schema of a Splout Table and the Fields that need to be indexed and how it is partitioned. It is part of a Table bean. It is also used by TupleSQLite4JavaOutputFormat.

See Also:
Serialized Form

Nested Class Summary
static class TableSpec.FieldIndex
          A database index made up by one or more Pangool Fields.
 
Constructor Summary
TableSpec(com.datasalt.pangool.io.Schema schema, com.datasalt.pangool.io.Schema.Field partitionField)
          Simple TableSpec constructor that creates one TableSpec for a schema with a single partition field that is also indexed.
TableSpec(com.datasalt.pangool.io.Schema schema, com.datasalt.pangool.io.Schema.Field[] partitionFields, TableSpec.FieldIndex[] indexes, java.lang.String[] initialSQL, java.lang.String[] preInsertsSQL, java.lang.String[] postInsertsSQL, java.lang.String[] finalSQL, com.datasalt.pangool.tuplemr.OrderBy insertionOrderBy)
          Creates a Table specification.
TableSpec(com.datasalt.pangool.io.Schema schema, java.lang.String partitionByJavaScript, TableSpec.FieldIndex[] indexes, java.lang.String[] initialSQL, java.lang.String[] preInsertsSQL, java.lang.String[] postInsertsSQL, java.lang.String[] finalSQL, com.datasalt.pangool.tuplemr.OrderBy insertionOrderBy)
          Creates a Table specification.
 
Method Summary
 java.lang.String[] getFinalSQL()
           
 TableSpec.FieldIndex[] getIndexes()
           
 java.lang.String[] getInitialSQL()
           
 com.datasalt.pangool.tuplemr.OrderBy getInsertionOrderBy()
           
 java.lang.String getPartitionByJavaScript()
           
 com.datasalt.pangool.io.Schema.Field[] getPartitionFields()
           
 java.lang.String[] getPostInsertsSQL()
           
 java.lang.String[] getPreInsertsSQL()
           
 com.datasalt.pangool.io.Schema getSchema()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableSpec

public TableSpec(com.datasalt.pangool.io.Schema schema,
                 com.datasalt.pangool.io.Schema.Field partitionField)
Simple TableSpec constructor that creates one TableSpec for a schema with a single partition field that is also indexed. Warning: an index is created automatically for the partition field.


TableSpec

public TableSpec(com.datasalt.pangool.io.Schema schema,
                 com.datasalt.pangool.io.Schema.Field[] partitionFields,
                 TableSpec.FieldIndex[] indexes,
                 java.lang.String[] initialSQL,
                 java.lang.String[] preInsertsSQL,
                 java.lang.String[] postInsertsSQL,
                 java.lang.String[] finalSQL,
                 com.datasalt.pangool.tuplemr.OrderBy insertionOrderBy)
Creates a Table specification.

Parameters:
schema - The schema that defines the table
partitionFields - fields to partition the table by
indexes - The indexes that mus be created
initialSQL - SQL statements that will be executed at the start of the process, just after some default PRAGMA statements and just before the CREATE TABLE statements.
preInsertsSQL - SQL statements that will be executed just after the CREATE TABLE statements but just before the INSERT statements used to insert data.
postInsertsSQL - SQL statements that will be executed just after all data is inserted but just before the CREATE INDEX statements.
finalSQL - SQL statements that will be executed al the end of the process, just after the CREATE INDEX statements.
insertionOrderBy - The order in which data is inserted in the database. That is very important because affect data locality and some queries could go faster or very slow depending on the order the data is stored. Usually, data should be sorted in the same order than the main index that you will use for queries. As a common rule, sort data in the proper order to answer the most important queries of your system.

TableSpec

public TableSpec(com.datasalt.pangool.io.Schema schema,
                 java.lang.String partitionByJavaScript,
                 TableSpec.FieldIndex[] indexes,
                 java.lang.String[] initialSQL,
                 java.lang.String[] preInsertsSQL,
                 java.lang.String[] postInsertsSQL,
                 java.lang.String[] finalSQL,
                 com.datasalt.pangool.tuplemr.OrderBy insertionOrderBy)
Creates a Table specification.

Parameters:
schema - The schema that defines the table
partitionByJavaScript - JavaScript function that applies to rows and returns a key that must be used to partition.
indexes - The indexes that mus be created
initialSQL - SQL statements that will be executed at the start of the process, just after some default PRAGMA statements and just before the CREATE TABLE statements.
preInsertsSQL - SQL statements that will be executed just after the CREATE TABLE statements but just before the INSERT statements used to insert data.
postInsertsSQL - SQL statements that will be executed just after all data is inserted but just before the CREATE INDEX statements.
finalSQL - SQL statements that will be executed al the end of the process, just after the CREATE INDEX statements.
insertionOrderBy - The order in which data is inserted in the database. That is very important because affect data locality and some queries could go faster or very slow depending on the order the data is stored. Usually, data should be sorted in the same order than the main index that you will use for queries. As a common rule, sort data in the proper order to answer the most important queries of your system.
Method Detail

getSchema

public com.datasalt.pangool.io.Schema getSchema()

getIndexes

public TableSpec.FieldIndex[] getIndexes()

getPartitionFields

public com.datasalt.pangool.io.Schema.Field[] getPartitionFields()

getPartitionByJavaScript

public java.lang.String getPartitionByJavaScript()

getPostInsertsSQL

public java.lang.String[] getPostInsertsSQL()

getInitialSQL

public java.lang.String[] getInitialSQL()

getFinalSQL

public java.lang.String[] getFinalSQL()

getPreInsertsSQL

public java.lang.String[] getPreInsertsSQL()

getInsertionOrderBy

public com.datasalt.pangool.tuplemr.OrderBy getInsertionOrderBy()


Copyright © 2012-2013 Datasalt Systems S.L.. All Rights Reserved.