Classes | Public Member Functions | Protected Member Functions | List of all members
gov.lbl.fastbit.FastBit Class Reference

A facade for accessing some FastBit functions from java. More...

Classes

class  QueryHandle
 An auxiliary class to hold handles to query objects. More...
 

Public Member Functions

native int add_bytes (String colname, byte[] arr)
 Add values to a values to a byte-valued column. More...
 
native int add_doubles (String colname, double[] arr)
 Add the name column containing double values. More...
 
native int add_floats (String colname, float[] arr)
 Add values to a values to a float-valued column. More...
 
native int add_ints (String colname, int[] arr)
 Add values to a values to a int-valued column. More...
 
native int add_longs (String colname, long[] arr)
 Add values to a values to a long-valued column. More...
 
native int add_shorts (String colname, short[] arr)
 Add values to a values to a short-valued column. More...
 
native int build_index (String dir, String col, String opt)
 Build an index for the named column. More...
 
native int build_indexes (String dir, String opt)
 Build indexes for all columns in the specified directory. More...
 
native QueryHandle build_query (String select, String datadir, String where)
 Build a new query object. More...
 
native int destroy_query (QueryHandle handle)
 Destroy a query object. More...
 
 FastBit (String rcfile)
 Constructor. More...
 
native String get_logfile ()
 Retrieve the name of the log file.
 
native int get_message_level ()
 Return the current message level used by FastBit.
 
native byte[] get_qualified_bytes (QueryHandle handle, String col)
 Retrieve the values of the named column from the rows satisfying the query conditions. More...
 
native double[] get_qualified_doubles (QueryHandle handle, String col)
 Retrieve values as doubles. More...
 
native float[] get_qualified_floats (QueryHandle handle, String col)
 Retrieve values as floats. More...
 
native int[] get_qualified_ints (QueryHandle handle, String col)
 Retrieve values as ints. More...
 
native long[] get_qualified_longs (QueryHandle handle, String col)
 Retrieve values as longs. More...
 
native short[] get_qualified_shorts (QueryHandle handle, String col)
 Retrieve values as shorts. More...
 
native int[] get_result_row_ids (QueryHandle handle)
 Retrieve the ids of rows satisfying the query conditions. More...
 
native int get_result_size (QueryHandle handle)
 Return the number of records/rows satisfying the query conditions. More...
 
native int number_of_columns (String dir)
 Compute the number of columns in the specified directory. More...
 
native int number_of_rows (String dir)
 Compute the number of rows in the specified directory. More...
 
native int purge_index (String dir, String col)
 Remove the index files associated with the specified column.
 
native int purge_indexes (String dir)
 Remove all existing index files. More...
 
native int set_logfile (String filename)
 Change the name of the log file.
 
native int set_message_level (int level)
 Change the message level to the specified value. More...
 
native int write_buffer (String dir)
 Write the buffer to the named directory. More...
 

Protected Member Functions

native void cleanup ()
 Cleanup resources hold by FastBit services. More...
 
void finalize ()
 Perform the final clean up job.
 
native void init (String rcfile)
 Function to initialize required data structure on C++ side. More...
 

Detailed Description

A facade for accessing some FastBit functions from java.

This class exports some functions from ibis::part and ibis::query classes to java. A very small example is available in java/milky.java.

Note
Only a limited number of functions are provided at this time. To inquire about possible extensions, please contact John Wu at <John.Wu at ACM.org>.
An alternative Java Native Interface is available at https://bitbucket.org/olafW/fastbit4java/
Author
John Wu and Aaron Hong

Constructor & Destructor Documentation

gov.lbl.fastbit.FastBit.FastBit ( String  rcfile)
inline

Constructor.

The argument to the constructor can be an empty string.

See also
ibis::init.
init.

References gov.lbl.fastbit.FastBit.init().

Member Function Documentation

native int gov.lbl.fastbit.FastBit.add_bytes ( String  colname,
byte[]  arr 
)

Add values to a values to a byte-valued column.

native int gov.lbl.fastbit.FastBit.add_doubles ( String  colname,
double[]  arr 
)

Add the name column containing double values.

Note that if the target directory contains values already, the type specified here must match exactly.

native int gov.lbl.fastbit.FastBit.add_floats ( String  colname,
float[]  arr 
)

Add values to a values to a float-valued column.

native int gov.lbl.fastbit.FastBit.add_ints ( String  colname,
int[]  arr 
)

Add values to a values to a int-valued column.

native int gov.lbl.fastbit.FastBit.add_longs ( String  colname,
long[]  arr 
)

Add values to a values to a long-valued column.

native int gov.lbl.fastbit.FastBit.add_shorts ( String  colname,
short[]  arr 
)

Add values to a values to a short-valued column.

native int gov.lbl.fastbit.FastBit.build_index ( String  dir,
String  col,
String  opt 
)

Build an index for the named column.

  • dir The name of the directory containing the data partition.
  • col The name of the column to be indexed.
  • opt The indexing option. A blank string can be used to invoke the existing indexing option specified in the existing metadata. See http://sdm.lbl.gov/fastbit/doc/indexSpec.html for more description.
native int gov.lbl.fastbit.FastBit.build_indexes ( String  dir,
String  opt 
)

Build indexes for all columns in the specified directory.

  • dir The name of the directory containing the data partition.
  • opt The indexing option. A blank string can be used to invoke the existing indexing option specified in the existing metadata. See http://sdm.lbl.gov/fastbit/doc/indexSpec.html for more description.
Note
The plaural form of the word index is usually written as indexes in the database community. We follow this convention in naming FastBit functions.
native QueryHandle gov.lbl.fastbit.FastBit.build_query ( String  select,
String  datadir,
String  where 
)

Build a new query object.

The three arguments mirros the three clauses of a simple SQL select statement.

  • select The select clause. May contain a list of column names separated by comas.
  • datadir The name of data directory. Must be the directory containing the data partition. Can only be one directory name.
  • where The where clause. Specify the conditions on the records/rows to be selected. This is basically a set of range conditions joined together by logical operators,
    See also
    ibis::query::setWhereClause.
native void gov.lbl.fastbit.FastBit.cleanup ( )
protected

Cleanup resources hold by FastBit services.

Note
Must be called to reclaim resources taken up on the C++ side of FastBit functions.
It is fine to call this function multiple times.

Referenced by gov.lbl.fastbit.FastBit.finalize().

native int gov.lbl.fastbit.FastBit.destroy_query ( QueryHandle  handle)

Destroy a query object.

Reclaims all resources associated with the query object.

native byte [] gov.lbl.fastbit.FastBit.get_qualified_bytes ( QueryHandle  handle,
String  col 
)

Retrieve the values of the named column from the rows satisfying the query conditions.

If the column has appeared in the select clause in build_query, then the values are guarateed to not contain any null values. If there is no null values to consider, then there is no need to specify anything in the select clause when building the query.

Note
The original data type of the column must be able to fit into bytes in order for this function to succeed, except get_qualified_longs may be invoked on a string-valued column to retrieve the starting positions of the strings satisfying the query conditions.
native double [] gov.lbl.fastbit.FastBit.get_qualified_doubles ( QueryHandle  handle,
String  col 
)

Retrieve values as doubles.

See also
get_qualified_bytes.
native float [] gov.lbl.fastbit.FastBit.get_qualified_floats ( QueryHandle  handle,
String  col 
)

Retrieve values as floats.

See also
get_qualified_bytes.
native int [] gov.lbl.fastbit.FastBit.get_qualified_ints ( QueryHandle  handle,
String  col 
)

Retrieve values as ints.

See also
get_qualified_bytes.
native long [] gov.lbl.fastbit.FastBit.get_qualified_longs ( QueryHandle  handle,
String  col 
)

Retrieve values as longs.

See also
get_qualified_bytes.
Note
The values of any integer-valued column may be retrieved with this function. In addition, one may invoke this function with the name of a string-valued column to retrieve the starting positions (byte offsets) to read the strings from the data file containing the strings. Note that the string values in the data files are null-terminated.
native short [] gov.lbl.fastbit.FastBit.get_qualified_shorts ( QueryHandle  handle,
String  col 
)

Retrieve values as shorts.

See also
get_qualified_bytes.
native int [] gov.lbl.fastbit.FastBit.get_result_row_ids ( QueryHandle  handle)

Retrieve the ids of rows satisfying the query conditions.

native int gov.lbl.fastbit.FastBit.get_result_size ( QueryHandle  handle)

Return the number of records/rows satisfying the query conditions.

native void gov.lbl.fastbit.FastBit.init ( String  rcfile)
protected

Function to initialize required data structure on C++ side.

Note
Must be called in order for initialize required data structures.
May be called multiple times to incorporate information from multiple RC files. It can also be called after calling function cleanup to start a clean instance of FastBit service.

Referenced by gov.lbl.fastbit.FastBit.FastBit().

native int gov.lbl.fastbit.FastBit.number_of_columns ( String  dir)

Compute the number of columns in the specified directory.

native int gov.lbl.fastbit.FastBit.number_of_rows ( String  dir)

Compute the number of rows in the specified directory.

native int gov.lbl.fastbit.FastBit.purge_indexes ( String  dir)

Remove all existing index files.

  • dir The name of the directory containing the data partition.
native int gov.lbl.fastbit.FastBit.set_message_level ( int  level)

Change the message level to the specified value.

The default value is 0. As the message level increases, more message will be printed. Returns the current message level before the change is to take place.

native int gov.lbl.fastbit.FastBit.write_buffer ( String  dir)

Write the buffer to the named directory.

It also flushes the current buffer. All functions calls to various add functions are assumed to be adding to a single FastBit data partition. This set of functions are intended for adding rows to a data partition. Considerable overhead is involved in creating the files when the function write_buffer is invoked, therefore it is not recommended for writing a single row. Additionally, since all data values are stored in a memory buffer, one can not write a large number of records in one shot.


The documentation for this class was generated from the following file:

Make It A Bit Faster
Contact us
Disclaimers
FastBit source code
FastBit mailing list archive