-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for PERMISSIVE vs STRICT
- Loading branch information
1 parent
101c19b
commit 7155cb8
Showing
20 changed files
with
864 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...l-eval/src/main/kotlin/org/partiql/eval/internal/operator/rel/RelScanIndexedPermissive.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.partiql.eval.internal.operator.rel | ||
|
||
import org.partiql.eval.internal.Record | ||
import org.partiql.eval.internal.operator.Operator | ||
import org.partiql.value.BagValue | ||
import org.partiql.value.CollectionValue | ||
import org.partiql.value.PartiQLValue | ||
import org.partiql.value.PartiQLValueExperimental | ||
import org.partiql.value.int64Value | ||
import org.partiql.value.missingValue | ||
|
||
@OptIn(PartiQLValueExperimental::class) | ||
internal class RelScanIndexedPermissive( | ||
private val expr: Operator.Expr | ||
) : Operator.Relation { | ||
|
||
private lateinit var iterator: Iterator<PartiQLValue> | ||
private var index: Long = 0 | ||
private var isIndexable: Boolean = true | ||
|
||
override fun open() { | ||
val r = expr.eval(Record.empty) | ||
index = 0 | ||
iterator = when (r) { | ||
is BagValue<*> -> { | ||
isIndexable = false | ||
r.iterator() | ||
} | ||
is CollectionValue<*> -> r.iterator() | ||
else -> { | ||
isIndexable = false | ||
iterator { yield(r) } | ||
} | ||
} | ||
} | ||
|
||
override fun next(): Record? { | ||
if (!iterator.hasNext()) { | ||
return null | ||
} | ||
val v = iterator.next() | ||
return when (isIndexable) { | ||
true -> { | ||
val i = index | ||
index += 1 | ||
Record.of(v, int64Value(i)) | ||
} | ||
false -> Record.of(v, missingValue()) | ||
} | ||
} | ||
|
||
override fun close() {} | ||
} |
32 changes: 32 additions & 0 deletions
32
partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rel/RelScanPermissive.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.partiql.eval.internal.operator.rel | ||
|
||
import org.partiql.eval.internal.Record | ||
import org.partiql.eval.internal.operator.Operator | ||
import org.partiql.value.CollectionValue | ||
import org.partiql.value.PartiQLValueExperimental | ||
|
||
@OptIn(PartiQLValueExperimental::class) | ||
internal class RelScanPermissive( | ||
private val expr: Operator.Expr | ||
) : Operator.Relation { | ||
|
||
private lateinit var records: Iterator<Record> | ||
|
||
override fun open() { | ||
val r = expr.eval(Record.empty) | ||
records = when (r) { | ||
is CollectionValue<*> -> r.map { Record.of(it) }.iterator() | ||
else -> iterator { yield(Record.of(r)) } | ||
} | ||
} | ||
|
||
override fun next(): Record? { | ||
return if (records.hasNext()) { | ||
records.next() | ||
} else { | ||
null | ||
} | ||
} | ||
|
||
override fun close() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.