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

Don't drop annotations in source data #1093

Open
dlurton opened this issue May 22, 2023 · 3 comments
Open

Don't drop annotations in source data #1093

dlurton opened this issue May 22, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@dlurton
Copy link
Member

dlurton commented May 22, 2023

See also this similar issue in PartiQL-Rust: partiql/partiql-lang-rust#371

Description

PartiQL drops all annotations in source data, but it shouldn't. Annotations include important context needed for downstream applications to know how to process the query results. In effect, PartiQL is corrupting the data that's fed into it. This will likely become a big issue for my team's PartiQL product in the next few months.

To Reproduce

Welcome to the PartiQL shell!
Typing mode: LEGACY
Using version: 0.9.2-f3b92a82
PartiQL> select * from `[ { foo: { bar: some_annotation::42 } } ]`
   | 
===' from source
<<
  {
    'foo': {
      'bar': 42 
    }
  }
>>
--- 
OK!

As shown above, the value 42 is missing the annotation.

Expected Behavior

The result of the query above should be:

<<
  {
    'foo': {
      'bar': some_annotation::42 
    }
  }
>>
@RCHowell
Copy link
Contributor

RCHowell commented May 24, 2023

PartiQL drops all annotations in source data, but it shouldn't.

The PartiQL Specification does not include annotations in the data model; meaning the expected result isn't a valid PartiQL Value (Page 5, Figure 1).

<<
  {
    'foo': {
      'bar': some_annotation::42 
    }
  }
>>

We have had a similar ask to add annotations to the data model, but we will need to do the necessary specification work before extending the data model.

@RCHowell RCHowell added enhancement New feature or request and removed bug Something isn't working labels May 24, 2023
@dlurton
Copy link
Member Author

dlurton commented May 24, 2023

A paragraph or two below figure 1 it also states:

PartiQL’s data model extends SQL to Ion’s type system to cover schema-less and nested data.

Which I have always taken to mean that PartiQL's type system is a proper superset of Ion's, thus, anything you can represent in Ion can also be represented in PartiQL values. (But not necessarily the inverse.) Hence why I filed this issue.

@RCHowell
Copy link
Contributor

As discussed offline, PartiQL cannot be a super-set of Ion without annotation tokens on values. This will require an RFC for spec additions and clarifications, then the feature work to support it.

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

No branches or pull requests

2 participants