Table

scalation.database.table.Table
See theTable companion class
object Table

The Table companion object provides factory methods for creating tables. Supported domains/data-types are 'D'ouble, 'I'nt, 'L'ong, 'S'tring, and 'T'imeNum. Note 'X' is for Long String (a formatting issue).

Attributes

Companion
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Table.type

Members list

Value members

Concrete methods

def apply(name: String, schema: String, domain_: String, key: String): Table

Create a table given convenient string specifications.

Create a table given convenient string specifications.

Value parameters

domain_

the domains/data-types for attributes ('D', 'I', 'L', 'S', 'X', 'T')

key

the attributes forming the primary key

name

the name of the table

schema

the attributes for the table

Attributes

def apply(name: String, tab: Table): Table

Create a new empty table with the same schema as an existing table.

Create a new empty table with the same schema as an existing table.

Value parameters

name

the name of the new table

tab

the existing table

Attributes

def avg(colj: Array[ValueType]): ValueType

Return the average of all the elements for a numeric column or 0 otherwise.

Return the average of all the elements for a numeric column or 0 otherwise.

Value parameters

colj

the given column

Attributes

def count(colj: Array[ValueType]): ValueType

Return the total number of elements in a column.

Return the total number of elements in a column.

Value parameters

colj

the given column

Attributes

def countd(colj: Array[ValueType]): ValueType

Return the number of distinct elements in a column.

Return the number of distinct elements in a column.

Value parameters

colj

the given column

Attributes

def exist(name: String): Boolean

Return whether the given table file exists in STORE_DIR.

Return whether the given table file exists in STORE_DIR.

Value parameters

name

the name of table.

Attributes

def fromMatrix(x: MatrixD, name: String, schema: Schema, key: String): Table

Create a table from a matrix of doubles.

Create a table from a matrix of doubles.

Value parameters

key

the attributes forming the primary key

name

the name of the table

schema

the attribute/column names

x

the matrix containing the data

Attributes

See also

the toMatrix mathod

def load(fileName: String, name: String, domain_: String, key: String, pos: Array[Int], sep: String): Table

Read the table with the given name into memory loading its columns with data from the CSV file named fileName. The attribute names are read from the FIRST LINE.

Read the table with the given name into memory loading its columns with data from the CSV file named fileName. The attribute names are read from the FIRST LINE.

Value parameters

domain_

the domains/data-types (as one string) for attributes ('D', 'I', 'L', 'S', 'X', 'T')

fileName

the file name (or file-path) of the data file

key

the attributes forming the primary key

name

the name of the table

pos_

the sequence of column positions in the input file to be used (null => select all)

sep

the element separation string/regex (e.g., "," ";" " +")

Attributes

def load(fileName: String, name: String, domain: Domain, key: String, pos_: Array[Int], sep: String): Table

Read the table with the given name into memory loading its columns with data from the CSV file named fileName. The attribute names are read from the FIRST LINE.

Read the table with the given name into memory loading its columns with data from the CSV file named fileName. The attribute names are read from the FIRST LINE.

Value parameters

domain

the domains/data-types for attributes ('D', 'I', 'L', 'S', 'X', 'T')

fileName

the file name (or file-path) of the data file

key

the attributes forming the primary key

name

the name of the table

pos_

the sequence of column positions in the input file to be used (null => select all)

sep

the element separation string/regex (e.g., "," ";" " +")

Attributes

See also

scalation.readFileIntoArray

def load(fileName: String, name: String, numCol: Int, key: String): Table

Read the table with the given name into memory loading its columns with data from the CSV file named fileName. The attribute names are read from the FIRST LINE. Use a short-cut (not reliable) to determines the column domains, by applying the 'tuple2type' method to the SECOND LINE. Note: safer to pull a row without missing or zero values from the middle of the dataset

Read the table with the given name into memory loading its columns with data from the CSV file named fileName. The attribute names are read from the FIRST LINE. Use a short-cut (not reliable) to determines the column domains, by applying the 'tuple2type' method to the SECOND LINE. Note: safer to pull a row without missing or zero values from the middle of the dataset

Value parameters

fileName

the file name (or file-path) of the data file

key

the attributes forming the primary key

mumCol

the number of columns

name

the name of the table

Attributes

See also

tableTest3

scalation.readFileIntoArray

def load(name: String): Table

LOAD/Read the table with the given name into memory using serialization.

LOAD/Read the table with the given name into memory using serialization.

Value parameters

name

the name of the table to load

Attributes

See also

save in Table class.

def load(fileName: String, name: String): Table

LOAD/Read the table with the given name into memory from a JSON file.

LOAD/Read the table with the given name into memory from a JSON file.

Value parameters

fileName

the file name of the JSON file

name

the name of the table to load

Attributes

def makeTuple(token: Array[String], domain: Domain, pos: Array[Int]): Tuple

Make a tuple from an array of token strings, converting each each token according the corresponding domain specification. Use only the tokens in the array at the pos positions.

Make a tuple from an array of token strings, converting each each token according the corresponding domain specification. Use only the tokens in the array at the pos positions.

Value parameters

domain

the domains/data-types for attributes ('D', 'I', 'L', 'S', 'X', 'T')

pos

the positions in the token array to be used, e.g., Array (0, 2)

token

the array of token strings, e.g., Array ("5.0", "12", "Smith")

Attributes

def max(colj: Array[ValueType]): ValueType

Return the maximum value of all the elements in a column.

Return the maximum value of all the elements in a column.

Value parameters

colj

the given column

Attributes

def min(colj: Array[ValueType]): ValueType

Return the minimum value of all the elements in a column.

Return the minimum value of all the elements in a column.

Value parameters

colj

the given column

Attributes

def setFullPath(fullPath: Boolean): Unit

Set the full-path flag to the value of parameter fullPath.

Set the full-path flag to the value of parameter fullPath.

Value parameters

fullPath

flag indicating whether full or relative paths should be used

Attributes

def setLimit(lim: Int): Unit

Set the limit on the number of lines to read to lim.

Set the limit on the number of lines to read to lim.

Value parameters

lim

the limit on the number of lines to read (<= 0 => unlimited)

Attributes

def stats(cname: String, colj: Array[ValueType]): Array[ValueType]

Return basic statistics on the given column corresponding to SQL's aggregate functions: count, countd, min, max, sum, avg.

Return basic statistics on the given column corresponding to SQL's aggregate functions: count, countd, min, max, sum, avg.

Value parameters

cname

the given column name

colj

the given column

Attributes

def sum(colj: Array[ValueType]): ValueType

Return the sum of all the elements for a numeric column or 0 otherwise.

Return the sum of all the elements for a numeric column or 0 otherwise.

Value parameters

colj

the given column

Attributes

def tuple2type(tup: Array[String]): Domain

Given an array of strings (e.g., read from a file) with unknown domains, return the data-types (domains) by the lexical form of the strings.

Given an array of strings (e.g., read from a file) with unknown domains, return the data-types (domains) by the lexical form of the strings.

Value parameters

tup

the type un-differentiated tuple as an array of strings

Attributes

See also

scalation.typeOfStr (in ValueType.scala) Caveat: may not be reliable since a column of doubles may start: 5, 7, 9.2, ...

def π(x: String)(r: Table): Table
def σ(condition: String)(r: Table): Table
def σ(predicate: Predicate)(r: Table): Table