Skip to content

Parse ORE indexes as JSON arrays of hex-encoded strings #90

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

Merged
merged 2 commits into from
Feb 26, 2025

Conversation

CDThomas
Copy link
Contributor

@CDThomas CDThomas commented Feb 25, 2025

This change updates cs_ore_64_8_v1 to parse ORE indexes (the 'o' field) as JSON arrays of hex-encoded strings (instead of casting from the Postgres text format).

The corresponding change for encoding ORE indexes as JSON arrays of hex-encoded strings has already been merged in Proxy.

This is similar to some of the changes in #86, but we're parsing into the composite types for ORE indexes instead of into a plain bytea[]. Parsing into the composite type allows for ordering with an operator class on the output from cs_ore_64_8_v1.

This change updates `cs_ore_64_8_v1` to parse ORE indexes (the
`'o'` field) as JSON arrays of hex-encoded strings (instead of casting
from the Postgres text format).

The corresponding change for encoding ORE indexes as JSON arrays
of hex-encoded stings has already been merged in Proxy.

This is similar to some of the changes in
#86, but
we're parsing into the composite types for ORE indexes instead of
into a plain `bytea[]`. Parsing into the composite type allows for
ordering with an operator class on the output from `cs_ore_64_8_v1`.
@CDThomas CDThomas force-pushed the feat/parse-ore-as-json-array branch from bb15856 to e3e291e Compare February 25, 2025 04:40
@CDThomas CDThomas marked this pull request as ready for review February 25, 2025 04:42
Copy link
Contributor

@tobyhede tobyhede left a comment

Choose a reason for hiding this comment

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

I like it.
Preserves the array semantics, which is much more portable.
Might be worth a comment explaining jsonb_array_to_ore_64_8_v1 as I am sure I will forget what that does in about 30s.

DECLARE
terms_arr ore_64_8_v1_term[];
BEGIN
IF jsonb_typeof(val) = 'null' THEN
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL

@CDThomas CDThomas merged commit 9caa151 into main Feb 26, 2025
4 checks passed
@CDThomas CDThomas deleted the feat/parse-ore-as-json-array branch February 26, 2025 05:29
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