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
- Serializable
- Tabular
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
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: Seq[String], col: Vector[Vec], key: Int = 0, domain: String = null, fKeys: Seq[(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 - Seq (column name, ref table name, ref column position)
Value Members
-
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
intersect(r2: RelationSQL): RelationSQL
Intersect 'this' relation and 'r2'.
Intersect 'this' relation and 'r2'. Check that the two relations are compatible. Use index to finish intersect operation.
- r2
the other relation
-
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
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
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
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
-
def
where[T](p: Predicate[T]*)(implicit arg0: ClassTag[T]): RelationSQL
The where function filters on predicates (logic is and), returning the relation satisfying the predicates (column compare with constant)
The where function filters on 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)