Add support for the Decimal data type
#52
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The mappings already work for the HTTP engine, although its inserts were limited to
float8, now fixed to use proper numeric formatting.Add the mappings for the binary engine. Use strings to convert between the Postgres and ClickHouse formats to as to avoid differences in their implementations: ClickHouse stores data as
Int32,Int64, orInt128, while Postgres...well, I have no idea what the internals are, but using thenumeric_inandnumeric_outfunctions avoid all issues.Conversion from
Decimalvalues returned from ClickHouse requires converting its internalInt128into a string. The clickhouse-cpp library doesn't provide this functionality, yet, so implement it here.Unfortunately, this approach doesn't work with clickhouse-cpp compiled into a dynamic library, presumably because it doesn't also compile and install the
absldynamic library. So make the build static by default on all platforms for now.Add a test that covers both the HTTP and binary engines.