Skip to content

Commit

Permalink
Merge pull request #1633 from johnedquinn/v1-remove-ion
Browse files Browse the repository at this point in the history
Removes SEXP, SYMBOL, and DECIMAL_ARBITRARY from PType and Datum
  • Loading branch information
johnedquinn authored Nov 18, 2024
2 parents bfce6b2 + d9715e4 commit 10f93bd
Show file tree
Hide file tree
Showing 88 changed files with 792 additions and 3,060 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ internal class StandardCompiler(strategies: List<Strategy>) : PartiQLCompiler {
// Compile the candidates
val candidates = Array(functions.size) {
val fn = functions[it]
val fnArity = fn.parameters.size
val fnArity = fn.getParameters().size
if (arity == -1) {
// set first
arity = fnArity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ internal object ValueUtility {
*/
fun Datum.getText(): String {
return when (this.type.kind) {
PType.Kind.STRING, PType.Kind.SYMBOL, PType.Kind.CHAR -> this.string
PType.Kind.STRING, PType.Kind.CHAR -> this.string
else -> throw TypeCheckException("Expected text, but received ${this.type}.")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ internal class RelOpExclude(
*/
private fun Datum.exclude(exclusions: List<Exclusion.Item>): Datum = when (this.type.kind) {
PType.Kind.ROW, PType.Kind.STRUCT -> this.structExclude(exclusions)
PType.Kind.BAG, PType.Kind.ARRAY, PType.Kind.SEXP -> this.collExclude(exclusions)
PType.Kind.BAG, PType.Kind.ARRAY -> this.collExclude(exclusions)
else -> this
}

Expand Down Expand Up @@ -134,13 +134,12 @@ internal class RelOpExclude(

/**
* Returns a [PartiQLValue] created from an iterable of [coll]. Requires [type] to be a collection type
* (i.e. [PartiQLValueType.LIST], [PartiQLValueType.BAG], or [PartiQLValueType.SEXP]).
* (i.e. [PartiQLValueType.LIST] or [PartiQLValueType.BAG].).
*/
private fun newCollValue(type: PType, coll: Iterable<Datum>): Datum {
return when (type.kind) {
PType.Kind.ARRAY -> Datum.array(coll)
PType.Kind.BAG -> Datum.bag(coll)
PType.Kind.SEXP -> Datum.sexp(coll)
else -> error("Collection type required")
}
}
Expand Down Expand Up @@ -172,13 +171,13 @@ internal class RelOpExclude(
}
// apply exclusions to subtree
var value = element
// apply collection index exclusions at deeper levels for lists and sexps
if (type.kind == PType.Kind.ARRAY || type.kind == PType.Kind.SEXP) {
// apply collection index exclusions at deeper levels for lists
if (type.kind == PType.Kind.ARRAY) {
branches.getCollIndex(i)?.let {
value = value.exclude(it.getItems())
}
}
// apply collection wildcard exclusions at deeper levels for lists, bags, and sexps
// apply collection wildcard exclusions at deeper levels for lists and bags
branches.getCollWildcard()?.let {
value = value.exclude(it.getItems())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal class RelOpIterate(
close()
throw TypeCheckException()
}
PType.Kind.ARRAY, PType.Kind.SEXP -> r.iterator()
PType.Kind.ARRAY -> r.iterator()
else -> {
close()
throw TypeCheckException()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal class RelOpIteratePermissive(
isIndexable = false
r.iterator()
}
PType.Kind.ARRAY, PType.Kind.SEXP -> r.iterator()
PType.Kind.ARRAY -> r.iterator()
else -> {
isIndexable = false
iterator { yield(r) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal class RelOpScan(
override fun open(env: Environment) {
val r = expr.eval(env.push(Row()))
records = when (r.type.kind) {
PType.Kind.ARRAY, PType.Kind.BAG, PType.Kind.SEXP -> RecordValueIterator(r.iterator())
PType.Kind.ARRAY, PType.Kind.BAG -> RecordValueIterator(r.iterator())
else -> {
close()
throw TypeCheckException("Unexpected type for scan: ${r.type}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal class RelOpScanPermissive(
override fun open(env: Environment) {
val r = expr.eval(env.push(Row()))
records = when (r.type.kind) {
PType.Kind.BAG, PType.Kind.ARRAY, PType.Kind.SEXP -> RecordValueIterator(r.iterator())
PType.Kind.BAG, PType.Kind.ARRAY -> RecordValueIterator(r.iterator())
else -> iterator { yield(Row(arrayOf(r))) }
}
}
Expand Down
Loading

0 comments on commit 10f93bd

Please sign in to comment.