class RelationSQL extends Tabular with Serializable
The RelationSQL
class provides an SQL-like API to data stored internally
in a Relation
object.
- Alphabetic
- By Inheritance
- RelationSQL
- Serializable
- Tabular
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new RelationSQL(r: Relation)
Construct a new
RelationSQL
object from an existing relation 'r'.Construct a new
RelationSQL
object from an existing relation 'r'.- r
the existing relation
- new RelationSQL(name: String, colName: ArrayBuffer[String], col: Vector[Vec] = null, key: Int = 0, domain: String = null, fKeys: ArrayBuffer[(String, String, Int)] = null)
- name
the name of the relation
- colName
the names of columns
- col
the Scala Vector of columns making up the columnar relation
- key
the column number for the primary key (< 0 => no primary key)
- domain
an optional string indicating domains for columns (e.g., 'SD' = 'StrNum', 'Double')
- fKeys
an optional sequence of foreign keys - ArrayBuffer (column name, ref table name, ref column position)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def eselect(aggCol: AggColumn*)(cName: String*): RelationSQL
Aggregate/project on the given columns (an extended projection operator that applies aggregate operators to aggregation columns and regular projection to projection columns).
Aggregate/project on the given columns (an extended projection operator that applies aggregate operators to aggregation columns and regular projection to projection columns).
- aggCol
the columns to aggregate on: (aggregate function, new column name, old column name)*
- cName
the other columns to project on
- See also
en.wikipedia.org/wiki/Relational_algebrap
- def exists: Boolean
Determine whether any rows/tuples exist in 'this' relation.
- def generateIndex(reset: Boolean = false): Unit
Generate an index for 'this' relation on its primary key.
Generate an index for 'this' relation on its primary key.
- reset
if reset is true, use old index to build new index; otherwise, create new index
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def groupBy(cName: String*): RelationSQL
Group 'this' relation by the specified column names, returning 'this' relation.
Group 'this' relation by the specified column names, returning 'this' relation.
- cName
the group column names
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def insert(rows: Row*): Unit
Insert 'rows' to 'this' relation.
Insert 'rows' to 'this' relation.
- rows
the rows to be added to the realtion
- def intersect(r2: RelationSQL): RelationSQL
Intersect 'this' relation and 'r2'.
Intersect 'this' relation and 'r2'. Check that the two relations are compatible. Use index to perform intersect operation.
- r2
the other relation
- def intersect2(r2: RelationSQL): RelationSQL
Intersect 'this' relation and 'r2'.
Intersect 'this' relation and 'r2'. Check that the two relations are compatible. Do not use index to finish intersect operation. FIX: should merge 'intersect' and 'intersect2'.
- r2
the other relation
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def join(cName1: ArrayBuffer[String], cName2: ArrayBuffer[String], r2: RelationSQL): RelationSQL
Join 'this' relation and 'r2' by performing an "equi-join".
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.
- 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
- def join(cName1: String, cName2: String, r2: RelationSQL): RelationSQL
Join 'this' relation and 'r2' by performing an "equi-join".
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.
- cName1
the join column name of this relation (e.g., the Foreign Key)
- cName2
the join column name of relation r2 (e.g., the Primary Key)
- r2
the rhs relation in the join operation
- def join(r2: RelationSQL): RelationSQL
Join 'this' relation and 'r2' by performing a "natural-join".
Join 'this' relation and 'r2' by performing a "natural-join".
- r2
the other relation
- def materialize(): Relation
Materialize 'this' relation by copying the inserted rows into the relation.
Materialize 'this' relation by copying the inserted rows into the relation. It needs to be called by the end of the relation construction. FIX - currently wipes out existing rows.
- def minus(r2: RelationSQL): RelationSQL
Take the difference of 'this' relation and 'r2' ('this - r2').
Take the difference of 'this' relation and 'r2' ('this - r2'). Check that the two relations are compatible.
- r2
the other relation
- def minus2(r2: RelationSQL): RelationSQL
Take the difference of 'this' relation and 'r2' ('this - r2').
Take the difference of 'this' relation and 'r2' ('this - r2'). Indexed minus. Check that the two relations are compatible.
- r2
the other relation
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def orderBy(cName: String*): RelationSQL
Order (ascending) the rows in the relation by the selected columns '_cName'.
Order (ascending) the rows in the relation by the selected columns '_cName'. A stable sorting is used to allow sorting on multiple columns.
- cName
the column names that are to be sorted
- def repr: Relation
Return the internal representation.
- def reverseOrderBy(cName: String*): RelationSQL
Order (descending) the rows in the relation by the selected columns '_cName'.
Order (descending) the rows in the relation by the selected columns '_cName'. A stable sorting is used to allow sorting on multiple columns.
- cName
the column names that are to be sorted
- def save(): Unit
Save 'this' relation in a file using serialization.
- def select(cName: String*): RelationSQL
Select the attributes to return in the answer to the query.
Select the attributes to return in the answer to the query.
- cName
the attribute names
- def show(limit: Int = Int.MaxValue): Unit
Show 'this' relation row by row.
Show 'this' relation row by row.
- limit
the limit on the number of rows to display
- Definition Classes
- RelationSQL → Tabular
- def stack(cName1: String, cName2: String): RelationSQL
Stack two columns into one by projecting onto the two columns and taking their union.
Stack two columns into one by projecting onto the two columns and taking their union.
- cName1
the first column name
- cName2
the second column name
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toMatriD(colPos: ArrayBuffer[Int], kind: MatrixKind = DENSE): MatriD
Convert 'this' relation into a matrix of doubles, e.g.,
Convert 'this' relation into a matrix of doubles, e.g.,
in the regression equation: 'xb = y' create matrix 'xy'
- colPos
the column positions to use for the matrix
- kind
the kind of matrix to create
- def toMatriDD(colPos: ArrayBuffer[Int], colPosV: Int, kind: MatrixKind = DENSE): (MatriD, VectorD)
Convert 'this' relation into a matrix of doubles and a vector of doubles.
Convert 'this' relation into a matrix of doubles and a vector of doubles.
in the regression equation: 'xb = y' create matrix 'x' and vector 'y'
- colPos
the column positions to use for the matrix
- colPosV
the column position to use for the vector
- kind
the kind of matrix to create
- def toMatriDI(colPos: ArrayBuffer[Int], colPosV: Int, kind: MatrixKind = DENSE): (MatriD, VectorI)
Convert 'this' relation into a matrix of doubles and a vector of integers.
Convert 'this' relation into a matrix of doubles and a vector of integers.
in the regression equation: 'xb = y' create matrix 'x' and vector 'y'
- colPos
the column positions to use for the matrix
- colPosV
the column position to use for the vector
- kind
the kind of matrix to create
- def toMatriI(colPos: ArrayBuffer[Int], kind: MatrixKind = DENSE): MatriI
Convert 'this' relation into a matrix of integers.
Convert 'this' relation into a matrix of integers.
in the regression equation: 'xb = y' create matrix 'xy'
- colPos
the column positions to use for the matrix
- kind
the kind of matrix to create
- def toMatriI2(colPos: ArrayBuffer[Int] = null, kind: MatrixKind = DENSE): MatriI
Convert 'this' relation into a matrix of integers.
Convert 'this' relation into a matrix of integers. It will convert doubles and strings to integers.
in the regression equation: 'xb = y' create matrix 'xy'
- colPos
the column positions to use for the matrix
- kind
the kind of matrix to create
- def toMatriII(colPos: ArrayBuffer[Int], colPosV: Int, kind: MatrixKind = DENSE): (MatriI, VectorI)
Convert 'this' relation into a matrix of integers and a vector of integers.
Convert 'this' relation into a matrix of integers and a vector of integers.
in the regression equation: 'xb = y' create matrix 'x' and vector 'y'
- colPos
the column positions to use for the matrix
- colPosV
the column position to use for the vector
- kind
the kind of matrix to create
- def toString(): String
- Definition Classes
- AnyRef → Any
- def toVectorC(colName: String): VectorC
Convert the 'colName' column of 'this' relation into a vector of complex numbers.
Convert the 'colName' column of 'this' relation into a vector of complex numbers.
- colName
the column name to use for the vector
- def toVectorC(colPos: Int = 0): VectorC
Convert the 'colPos' column of 'this' relation into a vector of complex numbers.
Convert the 'colPos' column of 'this' relation into a vector of complex numbers.
- colPos
the column position to use for the vector
- def toVectorD(colName: String): VectorD
Convert the 'colName' column of 'this' relation into a vector of doubles.
Convert the 'colName' column of 'this' relation into a vector of doubles.
- colName
the column name to use for the vector
- def toVectorD(colPos: Int = 0): VectorD
Convert the 'colPos' column of 'this' relation into a vector of doubles.
Convert the 'colPos' column of 'this' relation into a vector of doubles.
- colPos
the column position to use for the vector
- def toVectorI(colName: String): VectorI
Convert the 'colName' column of 'this' relation into a vector of integers.
Convert the 'colName' column of 'this' relation into a vector of integers.
- colName
the column name to use for the vector
- def toVectorI(colPos: Int = 0): VectorI
Convert the 'colPos' column of 'this' relation into a vector of integers.
Convert the 'colPos' column of 'this' relation into a vector of integers.
- colPos
the column position to use for the vector
- def toVectorL(colName: String): VectorL
Convert the 'colName' column of 'this' relation into a vector of long integers.
Convert the 'colName' column of 'this' relation into a vector of long integers.
- colName
the column name to use for the vector
- def toVectorL(colPos: Int = 0): VectorL
Convert the 'colPos' column of 'this' relation into a vector of long integers.
Convert the 'colPos' column of 'this' relation into a vector of long integers.
- colPos
the column position to use for the vector
- def toVectorQ(colName: String): VectorQ
Convert the 'colName' column of 'this' relation into a vector of rational numbers.
Convert the 'colName' column of 'this' relation into a vector of rational numbers.
- colName
the column name to use for the vector
- def toVectorQ(colPos: Int = 0): VectorQ
Convert the 'colPos' column of 'this' relation into a vector of rational integers.
Convert the 'colPos' column of 'this' relation into a vector of rational integers.
- colPos
the column position to use for the vector
- def toVectorR(colName: String): VectorR
Convert the 'colName' column of 'this' relation into a vector of real numbers.
Convert the 'colName' column of 'this' relation into a vector of real numbers.
- colName
the column name to use for the vector
- def toVectorR(colPos: Int = 0): VectorR
Convert the 'colPos' column of 'this' relation into a vector of real numbers.
Convert the 'colPos' column of 'this' relation into a vector of real numbers.
- colPos
the column position to use for the vector
- def toVectorS(colName: String): VectorS
Convert the 'colName' column of 'this' relation into a vector of string-num.
Convert the 'colName' column of 'this' relation into a vector of string-num.
- colName
the column name to use for the vector
- def toVectorS(colPos: Int = 0): VectorS
Convert the 'colPos' column of 'this' relation into a vector of string-num.
Convert the 'colPos' column of 'this' relation into a vector of string-num.
- colPos
the column position to use for the vector
- def toVectorT(colName: String): VectorT
Convert the 'colName' column of 'this' relation into a vector of time-num.
Convert the 'colName' column of 'this' relation into a vector of time-num.
- colName
the column name to use for the vector
- def toVectorT(colPos: Int = 0): VectorT
Convert the 'colPos' column of 'this' relation into a vector of time-num.
Convert the 'colPos' column of 'this' relation into a vector of time-num.
- colPos
the column position to use for the vector
- def union(r2: RelationSQL): RelationSQL
Union 'this' relation and 'r2'.
Union 'this' relation and 'r2'. Check that the two relations are compatible. If they are not, return the first 'this' relation.
- r2
the other relation
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def where[T](cName: String, p: (T) => Boolean)(implicit arg0: ClassTag[T]): RelationSQL
The where function filters on a predicate, returning the relation satisfying the predicate (column compare with constant)
The where function filters on a predicate, returning the relation satisfying the predicate (column compare with constant)
- T
the predicate type
- cName
the column name used in predicate
- p
the predicate (T => Boolean)
- def where2[T](p: Predicate[T]*)(implicit arg0: ClassTag[T]): RelationSQL
The where function filters on (multiple) predicates (logic is and), returning the relation satisfying the predicates (column compare with constant)
The where function filters on (multiple) predicates (logic is and), returning the relation satisfying the predicates (column compare with constant)
- T
the predicate type
- p
tuple(1): column name, tuple(2): predicate (T => Boolean)
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated