-
Notifications
You must be signed in to change notification settings - Fork 63
Partiql eval continue #1370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Partiql eval continue #1370
Changes from all commits
9b2104d
4159f6e
2efa480
b840274
ec1b6bf
7f0c978
72df6b5
94936f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -5,6 +5,8 @@ import org.partiql.planner.internal.ir.Ref | |||||||||||||||||
import org.partiql.planner.internal.typer.toRuntimeTypeOrNull | ||||||||||||||||||
import org.partiql.spi.fn.FnExperimental | ||||||||||||||||||
import org.partiql.spi.fn.FnSignature | ||||||||||||||||||
import org.partiql.types.AnyOfType | ||||||||||||||||||
import org.partiql.types.NullType | ||||||||||||||||||
import org.partiql.types.StaticType | ||||||||||||||||||
import org.partiql.value.PartiQLValueExperimental | ||||||||||||||||||
import org.partiql.value.PartiQLValueType | ||||||||||||||||||
|
@@ -147,7 +149,13 @@ internal object FnResolver { | |||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
private fun buildArgumentPermutations(args: List<StaticType>): List<List<StaticType>> { | ||||||||||||||||||
val flattenedArgs = args.map { it.flatten().allTypes } | ||||||||||||||||||
val flattenedArgs = args.map { | ||||||||||||||||||
if (it is AnyOfType) { | ||||||||||||||||||
it.flatten().allTypes.filter { it !is NullType } | ||||||||||||||||||
} else { | ||||||||||||||||||
it.flatten().allTypes | ||||||||||||||||||
} | ||||||||||||||||||
} | ||||||||||||||||||
Comment on lines
+152
to
+158
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens when the StaticType is AnyType? Would the following suffice?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Intuitively, if the input args is just a I will look into this. |
||||||||||||||||||
return buildArgumentPermutations(flattenedArgs, accumulator = emptyList()) | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,7 +84,12 @@ class EvalExecutor( | |
if (v1.isNull && v2.isNull) { | ||
return true | ||
} | ||
if (v1 == v2) { | ||
// TODO: this comparator is designed for order by | ||
// One of the false result it might produce is that | ||
// it treats MISSING and NULL equally. | ||
// we should move to hash or equals in value class once | ||
// we finished implementing those. | ||
if (comparator.compare(v1, v2) == 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NULL/MISSING according to your other comment would cause problems here, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. We should not use the comparator here, we should have the equals or hash code method implemented in the value class. But the comparator is at the moment the only comparator, specifically when it comes to bag comparison. I think we can leave this line here but add a TODO. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a specific scenario where this was failing? I can see that all of the value impls are data classes with the exception of collections and structs. |
||
return true | ||
} | ||
if (v1.toIon().hashCode() == v2.toIon().hashCode()) { | ||
|
@@ -101,6 +106,7 @@ class EvalExecutor( | |
val parser = PartiQLParser.default() | ||
val planner = PartiQLPlanner.default() | ||
val engine = PartiQLEngine.default() | ||
val comparator = PartiQLValue.comparator() | ||
} | ||
|
||
object Factory : TestExecutor.Factory<PartiQLStatement<*>, PartiQLResult> { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed this earlier today, but IMO the input, if null, should be coerced to a typed null ahead of time. We don't need the check for
inputType == PartiQLValueType.NULL
.We could address the NULL aspect later, though.