PNixx / clickhouse-activerecord

A Ruby database ActiveRecord driver for ClickHouse
MIT License
202 stars 100 forks source link

Add Array support to Map #158

Closed julienbourdeau closed 1 month ago

julienbourdeau commented 3 months ago

The latest version added support for Map (Thank you @danielwestendorf!)

At Lago, we forked this gem to add support for map but never took the time to open a PR with our change (sorry!). I'm updating our code to use the gem as much as possible. Our implementation was slightly different but very close.

The big missing feature is support for arrays inside maps like { key: [1, 2, 3] }, which I'm adding in this PR.

We'll be running it in production this week and we'll let you know how it goes.

What do you think @danielwestendorf ? Did you get to work with maps of arrays.

danielwestendorf commented 1 month ago

Non-primitive types in maps isn’t something we’ve played with.

This implementation does feel like an awkward API in the ActiveRecord sense, however, I don’t have a great alternative to suggest. I wonder if any other AR adapters have tackled this problem and if we can take inspiration from their api implementation?

julienbourdeau commented 1 month ago

Thank you for your feedback @danielwestendorf. If you're able to point what makes you feel awkward about the API, I'm happy to try to improve it 🙏