Skip to content

Conversation

@alistairjevans
Copy link

@alistairjevans alistairjevans commented Jul 14, 2025

Having the case-insensitive JSONExtract variants makes it easier to search unstructured/loosely-structured data in a performant manner.

We can take advantage of the simdjson function at_key_case_insensitive (internally it does an iteration over keys with a case-insensitive strncasecmp). Compatibility function added for rapidjson.

This won't do full multi-byte-encoding-aware case-insensitive comparisons on JSON keys, but I'd add explicit UTF8 variants if those were really needed (not sure they're needed for JSON keys).

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Users can now do case-insensitive JSON key lookups using JSONExtractCaseInsensitive (and other variants of JSONExtract).

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@alistairjevans alistairjevans changed the title Add case_insensitive JSONExtract variants Add CaseInsensitive JSONExtract variants Jul 14, 2025
@alistairjevans alistairjevans requested a review from adikus July 14, 2025 10:19
Copy link

@adikus adikus left a comment

Choose a reason for hiding this comment

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

🚀

SELECT JSONExtractArrayRawCaseInsensitive('{"Items": [1, 2, 3]}', 'ITEMS') = ['1', '2', '3']
```

### JSONExtractKeysAndValuesRawCaseInsensitive {#jsonextractkeysandvaluesrawcaseinsensitive}
Copy link

Choose a reason for hiding this comment

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

Does it make a difference for these extract functions to be case insensitive as well?

Copy link
Author

Choose a reason for hiding this comment

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

I basically went for any JSONExtract function that accepted a path.

Copy link

Choose a reason for hiding this comment

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

Ah ok, somehow missed that this accepts a path as well 🙈

@alistairjevans
Copy link
Author

Closed in favour of the Clickhouse upstream PR.

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.

3 participants