Relation

scalation.database.relation.Relation
See theRelation companion object
class Relation(name: String, schema: Schema, domain: Domain, key: Schema, var col: Vector[Vectr], var fKeys: ArrayBuffer[(String, String, Int)]) extends Tabular[Relation], Serializable

Value parameters

col

the Scala Vector of columns making up the columnar relation

domain

an optional string indicating domains for columns, e.g., Array ('S', 'D')

fKeys

an optional sequence of foreign keys - VEC (column name, ref table name, ref column position)

key

the column number for the primary key (< 0 => no primary key)

name

the name of the relation

schema

the names of columns

Attributes

Companion
object
Graph
Supertypes
trait Tabular[Relation]
trait Serializable
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def !=(cv: (String, ValueType)): Relation
def <(cv: (String, ValueType)): Relation
def <=(cv: (String, ValueType)): Relation
def ==(cv: (String, ValueType)): Relation

Return the relation whose rows are equal to value in the column with the given name.

Return the relation whose rows are equal to value in the column with the given name.

Value parameters

cv

the (column-name, value) pair, e.g., ("time", 5.00)

Attributes

def >(cv: (String, ValueType)): Relation
def >=(cv: (String, ValueType)): Relation
def add(tuple: Row): Relation

Add a tuple to this relation as a new row using col2 as a temp col to improve performance. After a batch of adds, call materialize.

Add a tuple to this relation as a new row using col2 as a temp col to improve performance. After a batch of adds, call materialize.

Value parameters

tuple

an aggregation of columns values (new row)

Attributes

def add(t: Tuple): Relation

ADD (insert) tuple t into this table checking to make sure the domains are correct. Also, checks referential integrity for any foreign keys in the tuple. Return true iff the tuple passes the type check and reference check.

ADD (insert) tuple t into this table checking to make sure the domains are correct. Also, checks referential integrity for any foreign keys in the tuple. Return true iff the tuple passes the type check and reference check.

Value parameters

t

the tuple to be inserted

Attributes

def addLinkage(fkey: String, refTab: Relation): Unit

Add LINKAGE for this tabale to refTab by adding a FOREIGN KEY CONSTRAINT x to this table specifying the foreign key attribute fkey and the table it references refTab. Caveat: a foreign key may not be composite.

Add LINKAGE for this tabale to refTab by adding a FOREIGN KEY CONSTRAINT x to this table specifying the foreign key attribute fkey and the table it references refTab. Caveat: a foreign key may not be composite.

Value parameters

fkey

the foreign key attribute

refTab

the table being referenced (to its primary key)

Attributes

def addm(tuple: Row): Relation

Add a tuple to this relation as a new row, materialize and return updated table. May call for last tuple in a batch of tuples to add

Add a tuple to this relation as a new row, materialize and return updated table. May call for last tuple in a batch of tuples to add

Value parameters

tuple

an aggregation of columns values (new row)

Attributes

def aggregate(g_atr: String, f_as: (AggFunction, String)*): Relation

Assuming this table has been grouped by attribute g_atr, create a table where the first column is g_atr and the rest are AGGREGATE FUNCTIONs applied to their corresponding attributes.

Assuming this table has been grouped by attribute g_atr, create a table where the first column is g_atr and the rest are AGGREGATE FUNCTIONs applied to their corresponding attributes.

Value parameters

f_as

the aggregate function and the attribute to apply it to (as varargs)

g_atr

the attribute the table has been grouped on

Attributes

def apply(rng: Range): Relation

Return the table restricted to the given range of rows.

Return the table restricted to the given range of rows.

Value parameters

rng

the given range of rows

Attributes

def apply(pos: IndexedSeq[Int]): Relation

Return the table restricted to the given collection of rows.

Return the table restricted to the given collection of rows.

Value parameters

pos

the given collection of rows

Attributes

def assign(col_j: Vectr, i: Int, newVal: ValueType): Unit

Assign the value newVal to column/vector c at index position i.

Assign the value newVal to column/vector c at index position i.

Value parameters

c

the name of the column/vector to be assigned

i

the index position to be assigned

newVal

the value used for assignment

Attributes

def avg(cName: String): Double

Return the mean of the values in column cName.

Return the mean of the values in column cName.

Value parameters

cName

the column name

Attributes

def colEmpty: Boolean

Determine whether all of the columns in the relation are empty.

Determine whether all of the columns in the relation are empty.

Attributes

def column(cName: String): Vectr

Return the column in the relation with column name cName.

Return the column in the relation with column name cName.

Value parameters

cName

column name used to retrieve the column vector

Attributes

def columns: Vector[Vectr]

Return all of the columns in the relation.

Return all of the columns in the relation.

Attributes

infix def contains(tuple: Row): Boolean

Determine whether this relation contains a row matching the given tuple.

Determine whether this relation contains a row matching the given tuple.

Value parameters

tuple

an aggregation of columns values (potential row)

Attributes

def contains(u: Tuple): Boolean

Return whether this table contains tuple u.

Return whether this table contains tuple u.

Value parameters

u

the tuple to look for

Attributes

def count(cName: String): Int

Return the number of values in column cName.

Return the number of values in column cName.

Value parameters

cName

the column name

Attributes

def create_index(reset: Boolean): Unit

The create_index method helps, e.g., the popTable, methods to generate an index for the table.

The create_index method helps, e.g., the popTable, methods to generate an index for the table.

Value parameters

reset

if reset is true, use old index to build new index; otherwise, create new index

Attributes

def delete(p: Predicate): Boolean

Delete the rows from this relation that satisfy the predicate.

Delete the rows from this relation that satisfy the predicate.

Value parameters

p

the predicate

Attributes

infix def divide(r2: Relation): Relation

DIVIDE this table by table r2. Requires a tuple in the quotient part of this table to be paired with all tuples in table r2.

DIVIDE this table by table r2. Requires a tuple in the quotient part of this table to be paired with all tuples in table r2.

Value parameters

r2

the second table

Attributes

def drop_index(): Unit

DROP the primary INDEX that maps the primary key to the tuple containing it. FIX - clear other indices

DROP the primary INDEX that maps the primary key to the tuple containing it. FIX - clear other indices

Attributes

def exists: Boolean

Determine whether any rows/tuples exist in this relation.

Determine whether any rows/tuples exist in this relation.

Attributes

def getPkey(i: Int): KeyType

Return the i-th primary key.

Return the i-th primary key.

Value parameters

i

the index in the tuples/row index

Attributes

def groupBy(cName: String): Relation

Group this relation by the specified column name, returning this relation. Each value in column cName will be mapped to a vector of row numbers containing the value, e.g., * { (a, A), (b, C), (a, T) } makes map a -> (0, 2), b -> (1).

Group this relation by the specified column name, returning this relation. Each value in column cName will be mapped to a vector of row numbers containing the value, e.g., * { (a, A), (b, C), (a, T) } makes map a -> (0, 2), b -> (1).

Value parameters

cName

the group column name

Attributes

infix def intersect(r2: Relation): Relation

Intersect this relation and r2. Check that the two relations are compatible. Slower and only to be used if there is no index.

Intersect this relation and r2. Check that the two relations are compatible. Slower and only to be used if there is no index.

Value parameters

r2

the second relation

Attributes

infix def intersect2(r2: Relation): Relation

Intersect this relation and r2. Check that the two relations are compatible. Use index to finish intersect operation.

Intersect this relation and r2. Check that the two relations are compatible. Use index to finish intersect operation.

Value parameters

r2

the second relation

Attributes

def join(cName1: Schema, cName2: Schema, r2: Relation): Relation

Join this relation and r2 by performing an "equi-join". Rows from both relations are compared requiring cName1 values to equal cName2 values. Disambiguate column names by appending "2" to the end of any duplicate column name.

Join this relation and r2 by performing an "equi-join". Rows from both relations are compared requiring cName1 values to equal cName2 values. Disambiguate column names by appending "2" to the end of any duplicate column name.

Value parameters

cName1

the join column names of this relation (e.g., the Foreign Key)

cName2

the join column names of relation r2 (e.g., the Primary Key)

r2

the rhs relation in the join operation

Attributes

def join(ref: (String, Relation)): Relation

Compute the EQUI-JOIN via the INDEX of this table and the referenced table keeping concatenated tuples that are equal on the primary key and foreign key attributes. Caveat: Requires the foreign key table to be first [ fkey_table join ((fkey, pkey_table) ]. Usage: deposit join (("cname", customer))

Compute the EQUI-JOIN via the INDEX of this table and the referenced table keeping concatenated tuples that are equal on the primary key and foreign key attributes. Caveat: Requires the foreign key table to be first [ fkey_table join ((fkey, pkey_table) ]. Usage: deposit join (("cname", customer))

Value parameters

ref

the foreign key reference (foreign key attribute, referenced table)

Attributes

infix def join(r2: Relation): Relation

Join this relation and r2 by performing a "natural-join". Rows from both relations are compared requiring cName values to be equal.

Join this relation and r2 by performing a "natural-join". Rows from both relations are compared requiring cName values to be equal.

Value parameters

r2

the rhs relation in the join operation

Attributes

The theta join, handle the predicates in where are connect by "and" (where a....and b....).

The theta join, handle the predicates in where are connect by "and" (where a....and b....).

Value parameters

p

the rest of theta join predicates (r1 cName, r2 cName, predicates to compare these two column)

p0

the first theta join predicate (r1 cName, r2 cName, predicate to compare these two column)

r2

the second relation

Attributes

def join(predicate: Predicate2, r2: Relation): Relation

JOIN this table and r2 keeping concatenated tuples that satisfy the predicate. Caveat: Assumes both keys are needed for the new key (depending on the predicate both may not be required).

JOIN this table and r2 keeping concatenated tuples that satisfy the predicate. Caveat: Assumes both keys are needed for the new key (depending on the predicate both may not be required).

Value parameters

predicate

the join predicate to be satisfied

r2

the second table

Attributes

def join(condition: String, r2: Relation): Relation

Compute the THETA-JOIN of this table and r2 keeping concatenated tuples that satisfy the given simple (3 token) condition.

Compute the THETA-JOIN of this table and r2 keeping concatenated tuples that satisfy the given simple (3 token) condition.

Value parameters

condition

the simple condition "a1 op a2"

r2

the second table

Attributes

def joinindex(cName1: Schema, cName2: Schema, r2: Relation): Relation

Join this relation and r2 by performing an "equi-join", use index to join

Join this relation and r2 by performing an "equi-join", use index to join

Value parameters

cName1

the join column names of this relation (e.g., the Foreign Key)

cName2

the join column names of relation r2 (e.g., the Primary Key)

r2

the rhs relation in the join operation

Attributes

def leftJoin(cName1: String, cName2: String, r2: Relation): Relation

Join this relation and r2 by performing an "left-join". Rows from both relations are compared requiring cName1 values to equal cName2 values. Disambiguate column names by appending "2" to the end of any duplicate column name. All rows from the left table are maintained with missing values indicators used where needed.

Join this relation and r2 by performing an "left-join". Rows from both relations are compared requiring cName1 values to equal cName2 values. Disambiguate column names by appending "2" to the end of any duplicate column name. All rows from the left table are maintained with missing values indicators used where needed.

Value parameters

cName1

the join column names of this relation (e.g., the Foreign Key)

cName2

the join column names of relation r2 (e.g., the Primary Key)

r2

the rhs relation in the join operation

Attributes

def leftJoin(x: Schema, y: Schema, r2: Relation): Relation

Compute the LEFT-EQUI-JOIN of this table and r2 keeping concatenated tuples that are equal on specified attributes. Also, keep all tuples in the left table padding the missing attributes with null.

Compute the LEFT-EQUI-JOIN of this table and r2 keeping concatenated tuples that are equal on specified attributes. Also, keep all tuples in the left table padding the missing attributes with null.

Value parameters

r2

the second table

x

the subschema/attributes for the left/first/this table

y

the subschema/attributes for the right/second table

Attributes

def leftJoin(cp1: Int, cp2: Int, r2: Relation): Relation

Join this relation and r2 by performing a "left join". Rows from both relations are compared requiring cp1 values to equal cp2 values. This method returns all the rows from this relation, and the matched rows from relation r2. It adds a null tuples for the unmatched rows of relation r2 FIX: It requires relations this and r2 to be sorted on column cp1 and cp2 resp., as it uses Sort-Merge join

Join this relation and r2 by performing a "left join". Rows from both relations are compared requiring cp1 values to equal cp2 values. This method returns all the rows from this relation, and the matched rows from relation r2. It adds a null tuples for the unmatched rows of relation r2 FIX: It requires relations this and r2 to be sorted on column cp1 and cp2 resp., as it uses Sort-Merge join

Value parameters

cp1

the position of the join column of this relation

cp2

the position of the join column of r2 relation

r2

the rhs relation in the join operation

Attributes

def leftJoinApx(thres: Double)(cName1: String, cName2: String, r2: Relation): Relation

Join this relation and r2 by performing an "approximate left-join". Rows from both relations are compared requiring cName1 values to apprximately equal cName2 values. Disambiguate column names by appending "2" to the end of any duplicate column name. All rows from the left table are maintained with missing values indicators used where needed.

Join this relation and r2 by performing an "approximate left-join". Rows from both relations are compared requiring cName1 values to apprximately equal cName2 values. Disambiguate column names by appending "2" to the end of any duplicate column name. All rows from the left table are maintained with missing values indicators used where needed.

Value parameters

cName1

the join column names of this relation (e.g., the Foreign Key)

cName2

the join column names of relation r2 (e.g., the Primary Key)

r2

the rhs relation in the join operation

thres

the approximate equality threshold

Attributes

def leftJoinApx(cp1: Int, cp2: Int, r2: Relation): Relation

Join this relation and r2 by performing a "left join". Rows from both relations are compared requiring cp1 values to approximately equal cp2 values. This method returns all the rows from this relation, and the matched rows from relation r2. It adds a null tuples for the unmatched rows of relation r2 FIX: It requires relations this and r2 to be sorted on column cp1 and cp2 resp., as it uses Sort-Merge join

Join this relation and r2 by performing a "left join". Rows from both relations are compared requiring cp1 values to approximately equal cp2 values. This method returns all the rows from this relation, and the matched rows from relation r2. It adds a null tuples for the unmatched rows of relation r2 FIX: It requires relations this and r2 to be sorted on column cp1 and cp2 resp., as it uses Sort-Merge join

Value parameters

cp1

the position of the join column of this relation

cp2

the position of the join column of r2 relation

r2

the rhs relation in the join operation

Attributes

Materialize the relation by copying the temporary col2 into col. It needs to be called by the end of the relation construction.

Materialize the relation by copying the temporary col2 into col. It needs to be called by the end of the relation construction.

Attributes

def max(cName: String): ValueType

Return the maximum value in column cName.

Return the maximum value in column cName.

Value parameters

cName

the column name

Attributes

def mean(cName: String): Double
def min(cName: String): ValueType

Return the minimum value in column cName.

Return the minimum value in column cName.

Value parameters

cName

the column name

Attributes

infix def minus(r2: Relation): Relation

Take the difference of this relation and r2 (this - r2). Check that the two relations are compatible.

Take the difference of this relation and r2 (this - r2). Check that the two relations are compatible.

Value parameters

r2

the second relation

Attributes

infix def minus2(r2: Relation): Relation

Take the difference of this relation and r2 (this - r2). Check that the two relations are compatible. Indexed based minus.

Take the difference of this relation and r2 (this - r2). Check that the two relations are compatible. Indexed based minus.

Value parameters

r2

the second relation

Attributes

def orderBy(_cName: String*): Relation

Order (ascending) the rows in the relation by the selected columns _cName. A stable sorting is used to allow sorting on multiple columns.

Order (ascending) the rows in the relation by the selected columns _cName. A stable sorting is used to allow sorting on multiple columns.

Value parameters

_cName

the column names that are to be sorted

Attributes

def orderByDesc(_cName: String*): Relation

Order (descending) the rows in the relation by the selected columns _cName. A stable sorting is used to allow sorting on multiple columns.

Order (descending) the rows in the relation by the selected columns _cName. A stable sorting is used to allow sorting on multiple columns.

Value parameters

_cName

the column names that are to be sorted

Attributes

infix def product(r2: Relation): Relation

Compute the Cartesian product of this relation and r2 (this × r2).

Compute the Cartesian product of this relation and r2 (this × r2).

Value parameters

r2

the second relation

Attributes

Project onto the columns with the given column names.

Project onto the columns with the given column names.

Value parameters

cName

the names of the columns to project onto

Attributes

def project(cPos: IndexedSeq[Int]): Relation

Project onto the columns with the given column positions.

Project onto the columns with the given column positions.

Value parameters

cPos

the positions of the columns to project onto

Attributes

def referenceCheck(t: Tuple): Boolean

Check that all the foreign keys values in tuple t satisfy their REFERENTIAL INTEGRITY CONSTRAINTS.

Check that all the foreign keys values in tuple t satisfy their REFERENTIAL INTEGRITY CONSTRAINTS.

Value parameters

t

the tuple being checked for referential integrity

Attributes

def rename(newName: String): Relation

Rename this table, returning a shallow copy of this table.

Rename this table, returning a shallow copy of this table.

Value parameters

newName

the new name for the table.

Attributes

def rightJoin(cp1: Int, cp2: Int, r2: Relation): Relation

Join this relation and r2 by performing a "right join". Rows from both relations are compared requiring cp1 values to equal cp2 values. This method returns all the rows from this relation, and the matched rows from relation r2. It adds a null tuples for the unmatched rows of relation r2

Join this relation and r2 by performing a "right join". Rows from both relations are compared requiring cp1 values to equal cp2 values. This method returns all the rows from this relation, and the matched rows from relation r2. It adds a null tuples for the unmatched rows of relation r2

Value parameters

cp1

the position of the join column of this relation

cp2

the position of the join column of r2 relation

r2

the rhs relation in the join operation

Attributes

def row(sos: ArrayBuffer[String], dom: Domain): Row

Create a row by pulling values from an array of strings and converting elements to their appropriate types.

Create a row by pulling values from an array of strings and converting elements to their appropriate types.

Value parameters

_typ

the string of corresponding types, e.g., Array ('S', 'D', 'I')

sos

the sequence of strings holding the values

Attributes

def row(i: Int): Row

Create a row by pulling values from all columns at position i.

Create a row by pulling values from all columns at position i.

Value parameters

i

the i'th position

Attributes

def rows: Int

Return the size in terms of number of rows in the relation.

Return the size in terms of number of rows in the relation.

Attributes

def sameOn(t: Row, u: Row, tp: IndexedSeq[Int], up: IndexedSeq[Int]): Boolean

Determine whether t and u are the same on column positions tp and up.

Determine whether t and u are the same on column positions tp and up.

Value parameters

t

the first row/tuple

tp

the column positions for row/tuple t

u

the second row/tuple

up

the column positions for row/tuple u

Attributes

def save(): Unit

Save this relation in a file using serialization.

Save this relation in a file using serialization.

Attributes

def select(cName: String, apred: APredicate): Relation

Select elements from column cName in this relation that satisfy the atomic predicate apred.

Select elements from column cName in this relation that satisfy the atomic predicate apred.

Value parameters

apred

the predicate (Boolean function) to be satisfied

cName

the name of the column used for selection

Attributes

def select(predicate: Predicate): Relation

SELECT the tuples in this table that satisfy the predicate.

SELECT the tuples in this table that satisfy the predicate.

Value parameters

predicate

the predicate (Boolean function) to be satisfied

Attributes

def select(condition: String): Relation

SELECT the tuples in this table that satisfy the given simple (3 token) condition.

SELECT the tuples in this table that satisfy the given simple (3 token) condition.

Value parameters

condition

the simple condition string "a1 op a2" to be satisfied, where a1 is attribute, op is comparison operator, a2 is attribute or value

Attributes

def select(pkey: KeyType): Relation

SELECT via the INDEX the tuple with the given primary key value pkey. Returns an empty table if the primary index has not been created.

SELECT via the INDEX the tuple with the given primary key value pkey. Returns an empty table if the primary index has not been created.

Value parameters

pkey

the primary key value

Attributes

def selproject(cName: String, p: APredicate): Relation

Select elements from column cName in this relation that satisfy the predicate p and project onto that column.

Select elements from column cName in this relation that satisfy the predicate p and project onto that column.

Value parameters

cName

the name of the column used for selection

p

the predicate (Boolean function) to be satisfied

Attributes

def show(rng: Range): Unit

Show this relation row by row. Handles extended width strings.

Show this relation row by row. Handles extended width strings.

Value parameters

rng

the range of rows to show/display

Attributes

def show0(rng: Range): Unit

Show this relation row by row with Fixed witdh columns.

Show this relation row by row with Fixed witdh columns.

Value parameters

rng

the renage of rows to show/display

Attributes

def show_foreign_keys(): Unit

Show this relation's foreign keys.

Show this relation's foreign keys.

Attributes

def show_index(): Unit

SHOW/print this relation's primary index.

SHOW/print this relation's primary index.

Attributes

Return the basic statistics for each column of this table.

Return the basic statistics for each column of this table.

Attributes

def sum(cName: String): ValueType

Return the sum of the values in column cName.

Return the sum of the values in column cName.

Value parameters

cName

the column name

Attributes

def toMap(keyColPos: ArrayBuffer[Int], valColPos: Int): Map[ArrayBuffer[ValueType], ValueType]

Convert the given columns within this relation to a map: keyColPos -> valColPos.

Convert the given columns within this relation to a map: keyColPos -> valColPos.

Value parameters

keyColPos

the key column positions

valColPos

the value column positions

Attributes

def toMatrix(cols: Array[Int]): MatrixD

Convert this relation into a matrix of doubles, e.g., in the regression equation: xb = y create matrix xy. It will convert strings to doubles.

Convert this relation into a matrix of doubles, e.g., in the regression equation: xb = y create matrix xy. It will convert strings to doubles.

Value parameters

cols

the column positions to use for forming the matrix

Attributes

def toMatrixV(colPos: Array[Int], colPosV: Int): (MatrixD, VectorD)

Convert this relation into a matrix of doubles and a vector of doubles, e.g., in the regression equation: xb = y create matrix x and vector y.

Convert this relation into a matrix of doubles and a vector of doubles, e.g., in the regression equation: xb = y create matrix x and vector y.

Value parameters

colPos

the column positions to use for the matrix

colPosV

the column position to use for the vector

Attributes

override def toString: String

Convert this relation into a string column by column.

Convert this relation into a string column by column.

Attributes

Definition Classes
Any
def toVectorD(colj: Int): VectorD

Convert the colj column of this relation into a vector of doubles, etc.

Convert the colj column of this relation into a vector of doubles, etc.

Value parameters

colj

the column position to use for the vector

Attributes

def toVectorI(colj: Int): VectorI
def toVectorL(colj: Int): VectorL
def toVectorS(colj: Int): VectorS
def toVectorT(colj: Int): VectorT
infix def union(r2: Relation): Relation

Union this relation and r2. Check that the two relations are compatible. If they are not, return the first this relation.

Union this relation and r2. Check that the two relations are compatible. If they are not, return the first this relation.

Value parameters

r2

the second relation

Attributes

infix def unionAll(r2: Relation): Relation

Union all (dups allowed) this relation and r2. Check that the two relations are compatible. If they are not, return the first this relation.

Union all (dups allowed) this relation and r2. Check that the two relations are compatible. If they are not, return the first this relation.

Value parameters

r2

the second relation

Attributes

def update(cName: String, newVal: ValueType, matchVal: ValueType): Boolean

Update the column named cName using newVal for elements with value matchStr.

Update the column named cName using newVal for elements with value matchStr.

Value parameters

cName

the name of the column to be updated

matchVal

the value to be matched to elements

newVal

the value used to assign updated values

Attributes

def update(cName: String, func: ValueType => ValueType, matchVal: ValueType): Boolean

Update the column named cName using function func for elements with value matchVal.

Update the column named cName using function func for elements with value matchVal.

Value parameters

cName

the name of the column to be updated

func

the function used to assign updated values

matchVal

the value to be matched to elements

Attributes

def variance(cName: String): Double

Return the variance of the values in column cName.

Return the variance of the values in column cName.

Value parameters

cName

the column name

Attributes

def writeCSV(fileName: String): Unit

Write this relation into a CSV file with each row written to a line.

Write this relation into a CSV file with each row written to a line.

Value parameters

fileName

the file name of the data file

Attributes

def writeJSON(fileName: String): Unit

Write this relation into a JSON file.

Write this relation into a JSON file.

Value parameters

fileName

the file name of the data file

Attributes

Inherited methods

def +=(v: ValueType*): Relation

Attributes

Inherited from:
Tabular
inline def -(r2: Relation): Relation

Attributes

Inherited from:
Tabular
inline def /(r2: Relation): Relation

Attributes

Inherited from:
Tabular
def add(v: ValueType*): Relation

Attributes

Inherited from:
Tabular
def colIndices: Range

Return the range of columns numbers for the table.

Return the range of columns numbers for the table.

Attributes

Inherited from:
Tabular
def cols: Int

Return the size in terms of number of columns in the table.

Return the size in terms of number of columns in the table.

Attributes

Inherited from:
Tabular
inline def dims: (Int, Int)

Return the cardinality (number of tuples) and arity (number of attributes).

Return the cardinality (number of tuples) and arity (number of attributes).

Attributes

Inherited from:
Tabular
def incompatible(r2: Relation): Boolean

Determine whether this table and r2 are incompatible by having differing domains.

Determine whether this table and r2 are incompatible by having differing domains.

Value parameters

r2

the second table

Attributes

Inherited from:
Tabular
def indices: Range

Return the range of row numbers for the table.

Return the range of row numbers for the table.

Attributes

Inherited from:
Tabular
inline def join(x: String, y: String, r2: Relation): Relation

Attributes

Inherited from:
Tabular
infix def leftJoin(r2: Relation): Relation

Compute the LEFT-JOIN of this table and r2 keeping concatenated tuples that are equal on specified attributes. Also, keep all tuples in the left table padding the missing attributes with null.

Compute the LEFT-JOIN of this table and r2 keeping concatenated tuples that are equal on specified attributes. Also, keep all tuples in the left table padding the missing attributes with null.

Value parameters

r2

the second table

Attributes

Inherited from:
Tabular
def nullTuple(domain: Domain): Tuple

Create a tuple with missing values for each column according to the given domains. This method is used by leftJoin.

Create a tuple with missing values for each column according to the given domains. This method is used by leftJoin.

Value parameters

domain

the domains of the table for which a null tuple is required

Attributes

Inherited from:
Tabular
inline def project(x: String): Relation

Attributes

Inherited from:
Tabular
def pull(cp: IndexedSeq[Int]): Domain

Pull the domains out of this table for the attributes in subschema column positions cp.

Pull the domains out of this table for the attributes in subschema column positions cp.

Value parameters

cp

the subschema/attribute column positions to be collected

Attributes

Inherited from:
Tabular
def pull(x: Schema): Domain

Pull the domains out of this table for the attributes in subschema x.

Pull the domains out of this table for the attributes in subschema x.

Value parameters

x

the subschema/attributes to be collected

Attributes

Inherited from:
Tabular
def pull(t: Tuple, a: String): ValueType

Pull a value out of tuple t for attribute a.

Pull a value out of tuple t for attribute a.

Value parameters

a

the attribute to be collected

t

the given tuple to pull value out of

Attributes

Inherited from:
Tabular
def pull(t: Row, cp: IndexedSeq[Int]): Row

Pull the values out of row t for the attributes in subschema column positions cp.

Pull the values out of row t for the attributes in subschema column positions cp.

Value parameters

cp

the subschema/attribute column positions to be collected

t

the given row to pull values out of

Attributes

Inherited from:
Tabular
def pull(t: Row, x: Schema): Row

Pull the values out of row t for the attributes in subschema x.

Pull the values out of row t for the attributes in subschema x.

Value parameters

t

the given row to pull values out of

x

the subschema/attributes to be collected

Attributes

Inherited from:
Tabular
def pull(t: Tuple, cp: IndexedSeq[Int]): Tuple

Pull the values out of tuple t for the attributes in subschema column positions cp.

Pull the values out of tuple t for the attributes in subschema column positions cp.

Value parameters

cp

the subschema/attribute column positions to be collected

t

the given tuple to pull values out of

Attributes

Inherited from:
Tabular
def pull(t: Tuple, x: Schema): Tuple

Pull the values out of tuple t for the attributes in subschema x.

Pull the values out of tuple t for the attributes in subschema x.

Value parameters

t

the given tuple to pull values out of

x

the subschema/attributes to be collected

Attributes

Inherited from:
Tabular

Compute the RIGHT-JOIN of this table and r2 keeping concatenated tuples that are equal on specified attributes. Also, keep all tuples in the right table padding the missing attributes with null.

Compute the RIGHT-JOIN of this table and r2 keeping concatenated tuples that are equal on specified attributes. Also, keep all tuples in the right table padding the missing attributes with null.

Value parameters

r2

the second table

Attributes

Inherited from:
Tabular

Compute the RIGHT-EQUI-JOIN of this table and r2 keeping concatenated tuples that are equal on specified attributes. Also, keep all tuples in the right table padding the missing attributes with null.

Compute the RIGHT-EQUI-JOIN of this table and r2 keeping concatenated tuples that are equal on specified attributes. Also, keep all tuples in the right table padding the missing attributes with null.

Value parameters

r2

the second table

x

the subschema/attributes for the left/first/this table

y

the subschema/attributes for the right/second table

Attributes

Inherited from:
Tabular
def showT(tups: ArrayBuffer[Tuple]): String

Convert the tuples in tups into a string, e.g., for displaying a collection of tuples.

Convert the tuples in tups into a string, e.g., for displaying a collection of tuples.

Value parameters

tups

the tuples to be converted to a string

Attributes

Inherited from:
Tabular
def typeCheck(t: Tuple): Boolean

Check the size of the tuple (number of elements) as well as the type of each value to ensure it is from the right domain (satisfies the DOMAIN CONSTRAINTS).

Check the size of the tuple (number of elements) as well as the type of each value to ensure it is from the right domain (satisfies the DOMAIN CONSTRAINTS).

Value parameters

t

the tuple to be type checked

Attributes

Inherited from:
Tabular
inline def ×(r2: Relation): Relation

Attributes

Inherited from:
Tabular
inline def γ(ag: String): Relation

Attributes

Inherited from:
Tabular
inline def π(cPos: IndexedSeq[Int]): Relation

Attributes

Inherited from:
Tabular
inline def π(x: String): Relation

Attributes

Inherited from:
Tabular
inline def ρ(newName: String): Relation

Attributes

Inherited from:
Tabular
inline def σ(pkey: KeyType): Relation

Attributes

Inherited from:
Tabular
inline def σ(condition: String): Relation

Attributes

Inherited from:
Tabular
inline def σ(predicate: Predicate): Relation

Attributes

Inherited from:
Tabular
inline def σ(a: String, apred: APredicate): Relation

Attributes

Inherited from:
Tabular
inline def σπ(a: String, apred: APredicate): Relation

Attributes

Inherited from:
Tabular
inline def (ag: String, f_as: (AggFunction, String)*): Relation

Attributes

Inherited from:
Tabular
inline def (x: String*): Relation

Attributes

Inherited from:
Tabular
inline def (x: String*): Relation

Attributes

Inherited from:
Tabular
inline def (r2: Relation): Relation

Attributes

Inherited from:
Tabular
inline def (r2: Relation): Relation

Attributes

Inherited from:
Tabular
inline def (r2: Relation): Relation

Attributes

Inherited from:
Tabular
inline def (fkey: (String, Relation)): Relation

Attributes

Inherited from:
Tabular
inline def (x: String, y: String, r2: Relation): Relation

Attributes

Inherited from:
Tabular
inline def (condition: String, r2: Relation): Relation

Attributes

Inherited from:
Tabular
inline def (predicate: Predicate2, r2: Relation): Relation

Attributes

Inherited from:
Tabular
inline def (r2: Relation): Relation

Attributes

Inherited from:
Tabular
inline def (x: Schema, y: Schema, r2: Relation): Relation

Attributes

Inherited from:
Tabular
inline def (r2: Relation): Relation

Attributes

Inherited from:
Tabular
inline def (x: Schema, y: Schema, r2: Relation): Relation

Attributes

Inherited from:
Tabular

Concrete fields

var col: Vector[Vectr]
var fKeys: ArrayBuffer[(String, String, Int)]

Inherited fields

val on: Map[String, Int]

Attributes

Inherited from:
Tabular