Packages

class RelationSQL extends Tabular with Serializable

The RelationSQL class provides an SQL-like API to data stored internally in a Relation object.

Linear Supertypes
Serializable, Tabular, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RelationSQL
  2. Serializable
  3. Tabular
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. 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

  2. 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

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. 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

  9. def exists: Boolean

    Determine whether any rows/tuples exist in 'this' relation.

  10. 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

  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  12. 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

  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. def insert(rows: Row*): Unit

    Insert 'rows' to 'this' relation.

    Insert 'rows' to 'this' relation.

    rows

    the rows to be added to the realtion

  15. 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

  16. 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

  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. 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

  19. 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

  20. 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

  21. 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.

  22. 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

  23. 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

  24. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  25. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  26. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  27. 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

  28. def repr: Relation

    Return the internal representation.

  29. 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

  30. def save(): Unit

    Save 'this' relation in a file using serialization.

  31. 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

  32. 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
    RelationSQLTabular
  33. 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

  34. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  35. 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

  36. 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

  37. 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

  38. 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

  39. 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

  40. 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

  41. def toString(): String
    Definition Classes
    AnyRef → Any
  42. 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

  43. 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

  44. 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

  45. 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

  46. 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

  47. 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

  48. 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

  49. 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

  50. 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

  51. 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

  52. 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

  53. 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

  54. 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

  55. 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

  56. 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

  57. 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

  58. 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

  59. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  60. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  61. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  62. 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)

  63. 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

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from Serializable

Inherited from Tabular

Inherited from AnyRef

Inherited from Any

Ungrouped