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

GH-459: Add Variant logical type annotation #460

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

gene-db
Copy link
Contributor

@gene-db gene-db commented Oct 19, 2024

Rationale for this change

Add a variant logical type.

What changes are included in this PR?

Additions to the types thrift definition, and the description of the logical type. The actual Variant spec documents are unchanged, and will be addressed later in a separate PR.

Closes #459


* The top level must be a group annotated with `VARIANT` that contains a
`binary` field named `metadata`, and a `binary` field named `value`.
* Additional fields which start with `_` (underscore) can be ignored.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this needed? None of the other types allow writing columns that should be ignored.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was desired in case there were some additional (but redundant) metadata or values we might store, and still allow it to be a valid Variant value (group).

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that we want to add ignored columns. If we need to update the spec because something is missing, we should just do that directly instead of working around it with unspecified columns that only work in certain proprietary cases.

LogicalTypes.md Outdated Show resolved Hide resolved
LogicalTypes.md Outdated Show resolved Hide resolved
VariantEncoding.md Outdated Show resolved Hide resolved
/**
* Embedded Variant logical type annotation
*/
struct VariantType {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Contributor Author

@gene-db gene-db left a comment

Choose a reason for hiding this comment

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

@rdblue Thanks! I updated the PR.

LogicalTypes.md Outdated Show resolved Hide resolved

* The top level must be a group annotated with `VARIANT` that contains a
`binary` field named `metadata`, and a `binary` field named `value`.
* Additional fields which start with `_` (underscore) can be ignored.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was desired in case there were some additional (but redundant) metadata or values we might store, and still allow it to be a valid Variant value (group).

LogicalTypes.md Outdated Show resolved Hide resolved
VariantEncoding.md Outdated Show resolved Hide resolved
@gene-db gene-db requested a review from rdblue October 22, 2024 15:45
### VARIANT

`VARIANT` is used for a Variant value. It must annotate a group. The group must
contain a `binary` field named `metadata`, and a `binary` field named `value`.
Copy link
Member

Choose a reason for hiding this comment

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

We have been using BYTE_ARRAY instead of binary in this doc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, you're right. The type is BYTE_ARRAY in thrift but binary in actual type definitions.

I think that binary is more clear, but we should mention that they are synonyms at a minimum. How about this?

The group must contain a field named metadata and a field named value. Both fields must have type binary, which is also called BYTE_ARRAY in the Parquet thrift definition.

@rdblue
Copy link
Contributor

rdblue commented Oct 23, 2024

This looks close to me. I think we just need to fix two things:

  1. The use of binary vs BYTE_ARRAY that @wgtmac pointed out
  2. The addition of ignored fields starting with _

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.

Add Variant logical type annotation
3 participants