Skip to content
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

Removes sexp and symbol from PType and Datum #1633

Open
wants to merge 1 commit into
base: v1
Choose a base branch
from

Conversation

johnedquinn
Copy link
Member

@johnedquinn johnedquinn commented Oct 28, 2024

Description

  • Removes SEXP, SYMBOL, DECIMAL_ARBITRARY from PType.

Testing

  • All tests passing.
  • For conformance tests, please see the report. The only failing tests are tests that are due to symbol/sexp.

Follow-ups

  • Remove/modify NUMERIC. Do we want to keep NUMERIC as SQL's NUMERIC? We might want to, since it is in the SQL Spec.

License Information

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@johnedquinn johnedquinn force-pushed the v1-remove-ion branch 4 times, most recently from 0ef2c89 to a6b7dd8 Compare November 15, 2024 01:48
@@ -173,7 +172,7 @@ internal class RelOpExclude(
// apply exclusions to subtree
var value = element
// apply collection index exclusions at deeper levels for lists and sexps
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove reference to sexps here

Suggested change
// apply collection index exclusions at deeper levels for lists and sexps
// apply collection index exclusions at deeper levels for lists

}

IonType.STRING -> {
IonType.STRING, IonType.SYMBOL -> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the PartiQLValueIonReader changes, what's the intended behavior for Ion types that we are not representing in PartiQL? Seems like this PR coerces SYMBOL to PartiQL string values and SEXPs to PartiQL list values. Should we give an error instead?

@@ -70,16 +70,17 @@ public enum class PartiQLValueType {
)
public fun toPType(): PType {
return when (this) {
DECIMAL, DECIMAL_ARBITRARY -> PType.decimal()
DECIMAL -> PType.decimal()
DECIMAL_ARBITRARY -> PType.decimal() // TODO: Figure out precision/scale implications.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should decimal_arb also give an error like you do for symbol and sexp?

@@ -89,8 +89,8 @@ internal val Fn_PLUS__DECIMAL_ARBITRARY_DECIMAL_ARBITRARY__DECIMAL_ARBITRARY = F
name = "plus",
returns = PType.decimal(),
parameters = arrayOf(
@Suppress("DEPRECATION") Parameter("lhs", PType.decimal()),
@Suppress("DEPRECATION") Parameter("rhs", PType.decimal()),
Parameter("lhs", PType.decimal()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FN name var for above uses DECIMAL_ARBITRARY, perhaps needs to get changed?

@@ -88,8 +88,8 @@ internal val Fn_LTE__DECIMAL_ARBITRARY_DECIMAL_ARBITRARY__BOOL = Function.static
name = "lte",
returns = PType.bool(),
parameters = arrayOf(
@Suppress("DEPRECATION") Parameter("lhs", PType.decimal()),
@Suppress("DEPRECATION") Parameter("rhs", PType.decimal()),
Parameter("lhs", PType.decimal()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, fn name variable uses DECIMAL_ARB. Perhaps should get changed?

Also applies for

  • lt
  • gt
  • gte
  • between
  • may have some others, so probably need to do a check on Builtins.kt

name = "concat",
returns = PType.string(),
returns = PType.character(256), // TODO: Handle length
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these TODOs for length be handled in this PR or tracked somewhere else?

Comment on lines +39 to +58
PType.time(6), // TODO: Precision
PType.timez(6), // TODO: Precision
)

val allTimeStampPType = setOf(
PType.timestamp(6), // TODO: Precision
PType.timestampz(6), // TODO: Precision
)

val allDateTimePType = allDatePType + allTimePType + allTimeStampPType

val allCharStringPType = setOf(
PType.character(256), // TODO: Length
PType.varchar(256), // TODO: Length
PType.string(),
PType.clob(Int.MAX_VALUE), // TODO: Length
)

val allBinaryPType = setOf(
PType.blob(Int.MAX_VALUE), // TODO: Length
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will these TODOs for precision/length be addressed in this PR or are they tracked in some other issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants