ak-coram / cl-duckdb

Common Lisp CFFI wrapper around the DuckDB C API
https://github.com/ak-coram/cl-duckdb/blob/main/README.org
MIT License
36 stars 1 forks source link

Find suitable replacement for uuid dependency #22

Closed ak-coram closed 1 year ago

ak-coram commented 1 year ago

Depending on https://github.com/dardoria/uuid/ pulls in ironclad as a transitive dependency, which takes a very long time to compile on ECL (currently timing out the ARM tests). The library is only used for representing UUID values, we should switch to a smaller alternative.

snunez1 commented 1 year ago

This one's a bit more difficult. I did find one: uuid.lisp. I don't know how good the implementation is, but it may be sufficient for this use case?

ak-coram commented 1 year ago

@snunez1: thanks for your input, I think the implementation you found is only for generating random UUIDs and is representing them as strings. I've already implemented a conversion from the low-level DuckDB type to strings (see https://github.com/ak-coram/cl-duckdb/blob/bfa037a5d07f0a75e93e011032cbbbbfea0b50b0/duckdb-api.lisp#L80) via format, but felt that users would be better served if we provided a type that uses a more efficient representation and can be used with an existing UUID library.

I've found this library, but it also depends on ironclad: https://github.com/deterministic-arts/DartsCLUUID

Maybe we should provide our own UUID type and implement a few functions for convenience? Perhaps split that into a separate library?

snunez1 commented 1 year ago

It seems that given the lack of a library for this that is independent of ironclad, that's a good idea. I'll ask our software devs if they have an algorithm or simple implementation handy as a starting point.

Edit: did I misunderstand this. We can generate them, and the problem is an efficient representation? Or, we need to generate them too? If the former, it should be easy with a struct.

ak-coram commented 1 year ago

@snunez1: I'm not sure we need to generate them (DuckDB has SQL functions for that). We should be able to represent them efficiently (not as text) and at least do equality checks and conversion from and to the string representation. Shouldn't be too hard to implement, I'll try to find the time.

ak-coram commented 1 year ago

@snunez1: I've decided to write https://github.com/ak-coram/cl-frugal-uuid

Please let me know what you think. Documentation is still lacking, but it's a very small library so that should be fairly easy to cover.

Do you think we can close this issue for now?

Symbolics commented 1 year ago

Perfect! I just discovered today that version UUID v4 is just a 128 bit random draw from the uniform distribution, and this library was going to be my weekend project, but you beat me to it. Thanks.