Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
9096533
feat: add decimal support to buffer
RaphDal Oct 10, 2025
74f6f62
docs: add decimal in rust examples
RaphDal Oct 10, 2025
3c87c76
docs: improve doc for decimal
RaphDal Oct 10, 2025
2883ea2
fix: restrict visibility of must_escape_unquoted to the crate only
RaphDal Oct 10, 2025
457b77a
fix: improve binary compatibility check
RaphDal Oct 10, 2025
3d8645b
fix: satisfy clippy with feature-gated usage of DECIMAL_BINARY_FORMAT…
RaphDal Oct 10, 2025
139e92d
docs: set diagram comment as text
RaphDal Oct 10, 2025
4bf9bfc
docs: removed unnecessary comment
RaphDal Oct 10, 2025
17f699b
docs: fix comment typo
RaphDal Oct 10, 2025
a583839
docs: fix buffer decimal examples
RaphDal Oct 10, 2025
c7f19af
feat: added support for C and C++
RaphDal Oct 10, 2025
6cc4237
fix: add missing error codes to C and C++ headers
RaphDal Oct 10, 2025
4aa3b14
fix: update type hints to include decimal in python test
RaphDal Oct 10, 2025
fb8ac1e
ci: trigger
RaphDal Oct 10, 2025
2095903
tests: add decimal support to ilp-client-interop-test
RaphDal Oct 13, 2025
984a236
feat: improve cpp decimal integration to cpp
RaphDal Oct 14, 2025
ce0fe17
typo: fix invalid comments
RaphDal Oct 14, 2025
d2ee26c
feat: add protocol version 3
RaphDal Oct 14, 2025
4c4b9af
revert: revert removal of implicit coercion of decimal binary views
RaphDal Oct 14, 2025
4a6a07c
feat: generalize array customization point
RaphDal Oct 14, 2025
cf425b5
typo: remove garbage
RaphDal Oct 14, 2025
2180a9f
docs: remove no longer true comment
RaphDal Oct 14, 2025
14b54eb
feat: improved decimal string validation
RaphDal Oct 15, 2025
fe7cceb
feat: add customization point for decimal
RaphDal Oct 15, 2025
44fe751
fix: accept more characters in decimal serializer for str to allow na…
RaphDal Oct 15, 2025
1b69994
tests: update test to use protocol version 3
RaphDal Oct 15, 2025
36f534e
docs: add decimal to c/cpp docs
RaphDal Oct 15, 2025
b11912a
tests: update rust examples to use protocol version 3
RaphDal Oct 15, 2025
147bab4
feat: add protocol version 3 to supported protocol versions
RaphDal Oct 15, 2025
77520ef
docs: add a simple description about the decimal datatype to ingress
RaphDal Oct 15, 2025
d9ef50d
fix: change port variable type to String for consistency
RaphDal Oct 15, 2025
6d19bd9
fix: change to_array_view_state_impl argument to const reference
RaphDal Oct 15, 2025
f47ee4f
fix: update usage message to line_sender_c_example_decimal_custom
RaphDal Oct 15, 2025
23d51b2
fix: remove unused includes from line_sender_array.hpp
RaphDal Oct 15, 2025
1f889e7
fix: update scale validation in DecimalSerializer to allow negative s…
RaphDal Oct 15, 2025
466b26d
fix: update protocol version to v3 in line_sender tests and header
RaphDal Oct 15, 2025
8dad866
fix: remove unused price_value assignment in line_sender_c_example_de…
RaphDal Oct 15, 2025
de1bba3
fix: update usage message to reflect correct example name in line_sen…
RaphDal Oct 15, 2025
12882be
fix: update price column type and correct table name in protocol_vers…
RaphDal Oct 15, 2025
cf1dd4d
Merge branch 'main' into rd_decimal
RaphDal Oct 15, 2025
f1624df
fix: free line sender buffer after flushing in example files
RaphDal Oct 16, 2025
9d564a8
fix: qualify binary_view with questdb::ingress::decimal namespace
RaphDal Oct 16, 2025
e63da89
fix: update protocol version to 2 in line sender examples
RaphDal Oct 16, 2025
ed83ff2
fix: update protocol version checks to use comparison operators
RaphDal Oct 17, 2025
ed7a984
fix: add PartialOrd to ProtocolVersion
RaphDal Oct 17, 2025
727cf09
fix: rename binary_view to decimal_view in decimal namespace
RaphDal Oct 17, 2025
d730bad
fix: remove supports method from ProtocolVersion implementation
RaphDal Oct 17, 2025
e6140e3
fix: clarify error messages for decimal scale and byte length limits
RaphDal Oct 17, 2025
1ebc6e6
typo: add missing definite article in ingress documentation
RaphDal Oct 17, 2025
0764846
fix: expose decimal_view in line_sender.hpp
RaphDal Oct 17, 2025
e2fa211
fix: cast ProtocolVersion to u8 for comparison in json_tests
RaphDal Oct 17, 2025
3bc2e3a
refactor: split headers
RaphDal Oct 17, 2025
17f2427
fix: improve error message for unsupported client protocol version
RaphDal Oct 17, 2025
af76951
Merge branch 'main' into rd_decimal
RaphDal Oct 17, 2025
9489414
fix: clarify implementation details for DecimalSerializer
RaphDal Oct 17, 2025
ba6744c
fix: correct wording in protocol version documentation for clarity
RaphDal Oct 17, 2025
61f16a7
fix: improve error messages for decimal scale and value length constr…
RaphDal Oct 17, 2025
61ff7ec
fix: correct order of fields in binary serialization format documenta…
RaphDal Oct 17, 2025
59cb32e
Merge branch 'main' into rd_decimal
RaphDal Oct 17, 2025
b2cedfd
fix: handle null data in line_sender_buffer_column_dec function
RaphDal Oct 17, 2025
1ede6d7
fix: remove debug output for protocol version in SenderBuilder
RaphDal Oct 17, 2025
e86a18d
fix: update usage message to include program name in help output
RaphDal Oct 17, 2025
5b17715
fix: use http instead of tcp in decimal examples
RaphDal Oct 17, 2025
76104aa
refactor: replace DecimalSerializer with DecimalView
RaphDal Oct 21, 2025
fec2164
test: add tests for NaN and Infinity decimal representations
RaphDal Oct 21, 2025
dfb9fd4
fix: correct spelling of 'Infinity' in validation comments
RaphDal Oct 21, 2025
23329b0
fix: improve error message for invalid decimal strings
RaphDal Oct 21, 2025
73d9f0d
fix: correct scale type in DecimalView conversion
RaphDal Oct 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ if (QUESTDB_TESTS_AND_EXAMPLES)
compile_example(
line_sender_c_example_from_env
examples/line_sender_c_example_from_env.c)
compile_example(
line_sender_c_example_decimal_binary
examples/concat.c
examples/line_sender_c_example_decimal_binary.c)
compile_example(
line_sender_cpp_example
examples/line_sender_cpp_example.cpp)
Expand Down Expand Up @@ -165,6 +169,12 @@ if (QUESTDB_TESTS_AND_EXAMPLES)
compile_example(
line_sender_cpp_example_from_env
examples/line_sender_cpp_example_from_env.cpp)
compile_example(
line_sender_cpp_example_decimal_custom
examples/line_sender_cpp_example_decimal_custom.cpp)
compile_example(
line_sender_cpp_example_decimal_binary
examples/line_sender_cpp_example_decimal_binary.cpp)

# Include Rust tests as part of the tests run
add_test(
Expand Down
81 changes: 42 additions & 39 deletions cpp_test/test_line_sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,36 +196,39 @@ TEST_CASE("line_sender c api basics")
2.7,
48121.5,
4.3};
CHECK(::line_sender_buffer_column_f64_arr_byte_strides(
buffer,
arr_name,
rank,
shape,
strides,
arr_data.data(),
arr_data.size(),
&err));
CHECK(
::line_sender_buffer_column_f64_arr_byte_strides(
buffer,
arr_name,
rank,
shape,
strides,
arr_data.data(),
arr_data.size(),
&err));

line_sender_column_name arr_name2 = QDB_COLUMN_NAME_LITERAL("a2");
intptr_t elem_strides[] = {6, 2, 1};
CHECK(::line_sender_buffer_column_f64_arr_elem_strides(
buffer,
arr_name2,
rank,
shape,
elem_strides,
arr_data.data(),
arr_data.size(),
&err));
CHECK(
::line_sender_buffer_column_f64_arr_elem_strides(
buffer,
arr_name2,
rank,
shape,
elem_strides,
arr_data.data(),
arr_data.size(),
&err));
line_sender_column_name arr_name3 = QDB_COLUMN_NAME_LITERAL("a3");
CHECK(::line_sender_buffer_column_f64_arr_c_major(
buffer,
arr_name3,
rank,
shape,
arr_data.data(),
arr_data.size(),
&err));
CHECK(
::line_sender_buffer_column_f64_arr_c_major(
buffer,
arr_name3,
rank,
shape,
arr_data.data(),
arr_data.size(),
&err));
CHECK(::line_sender_buffer_at_nanos(buffer, 10000000, &err));
CHECK(server.recv() == 0);
CHECK(::line_sender_buffer_size(buffer) == 383);
Expand Down Expand Up @@ -282,7 +285,7 @@ TEST_CASE("line_sender c++ api basics")
questdb::ingress::protocol::tcp,
std::string("127.0.0.1"),
std::to_string(server.port())};
opts.protocol_version(questdb::ingress::protocol_version::v2);
opts.protocol_version(questdb::ingress::protocol_version::v3);
questdb::ingress::line_sender sender{opts};
CHECK_FALSE(sender.must_close());
server.accept();
Expand Down Expand Up @@ -352,7 +355,7 @@ TEST_CASE("line_sender array vector API")
questdb::ingress::protocol::tcp,
std::string("127.0.0.1"),
std::to_string(server.port())};
opts.protocol_version(questdb::ingress::protocol_version::v2);
opts.protocol_version(questdb::ingress::protocol_version::v3);
questdb::ingress::line_sender sender{opts};
CHECK_FALSE(sender.must_close());
server.accept();
Expand Down Expand Up @@ -396,7 +399,7 @@ TEST_CASE("line_sender array span API")
questdb::ingress::protocol::tcp,
std::string("127.0.0.1"),
std::to_string(server.port())};
opts.protocol_version(questdb::ingress::protocol_version::v2);
opts.protocol_version(questdb::ingress::protocol_version::v3);
questdb::ingress::line_sender sender{opts};
CHECK_FALSE(sender.must_close());
server.accept();
Expand Down Expand Up @@ -443,7 +446,7 @@ TEST_CASE("test multiple lines")
questdb::ingress::test::mock_server server;
std::string conf_str =
"tcp::addr=127.0.0.1:" + std::to_string(server.port()) +
";protocol_version=2;";
";protocol_version=3;";
questdb::ingress::line_sender sender =
questdb::ingress::line_sender::from_conf(conf_str);
CHECK_FALSE(sender.must_close());
Expand Down Expand Up @@ -1061,21 +1064,21 @@ TEST_CASE("Moved View")
TEST_CASE("Empty Buffer")
{
questdb::ingress::line_sender_buffer b1{
questdb::ingress::protocol_version::v2};
questdb::ingress::protocol_version::v3};
CHECK(b1.size() == 0);
questdb::ingress::line_sender_buffer b2{std::move(b1)};
CHECK(b1.size() == 0);
CHECK(b2.size() == 0);
questdb::ingress::line_sender_buffer b3{
questdb::ingress::protocol_version::v2};
questdb::ingress::protocol_version::v3};
b3 = std::move(b2);
CHECK(b2.size() == 0);
CHECK(b3.size() == 0);
questdb::ingress::line_sender_buffer b4{
questdb::ingress::protocol_version::v2};
questdb::ingress::protocol_version::v3};
b4.table("test").symbol("a", "b").at_now();
questdb::ingress::line_sender_buffer b5{
questdb::ingress::protocol_version::v2};
questdb::ingress::protocol_version::v3};
b5 = std::move(b4);
CHECK(b4.size() == 0);
CHECK(b5.size() == 9);
Expand Down Expand Up @@ -1111,19 +1114,19 @@ TEST_CASE("HTTP basics")
questdb::ingress::protocol::http, "127.0.0.1", 1};
questdb::ingress::opts opts1conf = questdb::ingress::opts::from_conf(
"http::addr=127.0.0.1:1;username=user;password=pass;request_timeout="
"5000;retry_timeout=5;protocol_version=2;");
"5000;retry_timeout=5;protocol_version=3;");
questdb::ingress::opts opts2{
questdb::ingress::protocol::https, "localhost", "1"};
questdb::ingress::opts opts2conf = questdb::ingress::opts::from_conf(
"http::addr=127.0.0.1:1;token=token;request_min_throughput=1000;retry_"
"timeout=0;protocol_version=2;");
opts1.protocol_version(questdb::ingress::protocol_version::v2)
"timeout=0;protocol_version=3;");
opts1.protocol_version(questdb::ingress::protocol_version::v3)
.username("user")
.password("pass")
.max_buf_size(1000000)
.request_timeout(5000)
.retry_timeout(5);
opts2.protocol_version(questdb::ingress::protocol_version::v2)
opts2.protocol_version(questdb::ingress::protocol_version::v3)
.token("token")
.request_min_throughput(1000)
.retry_timeout(0);
Expand Down Expand Up @@ -1180,7 +1183,7 @@ TEST_CASE("line sender protocol version v2")
questdb::ingress::protocol::tcp,
std::string("127.0.0.1"),
std::to_string(server.port())};
opts.protocol_version(questdb::ingress::protocol_version::v2);
opts.protocol_version(questdb::ingress::protocol_version::v3);
questdb::ingress::line_sender sender{opts};
CHECK_FALSE(sender.must_close());
server.accept();
Expand Down
8 changes: 7 additions & 1 deletion doc/C.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
- [Array with element strides](../examples/line_sender_c_example_array_elem_strides.c)
- [Array in C-major order](../examples/line_sender_c_example_array_c_major.c)

**Decimal**
- [Decimal in binary format](../examples/line_sender_c_example_decimal_binary.c)

## API Overview

### Header
Expand Down Expand Up @@ -90,7 +93,9 @@ line_sender_utf8 symbol_value = QDB_UTF8_LITERAL("ETH-USD");
if (!line_sender_buffer_symbol(buffer, symbol_name, symbol_value, &err))
goto on_error;

if (!line_sender_buffer_column_f64(buffer, price_name, 2615.54, &err))
line_sender_utf8 price_value = QDB_UTF8_LITERAL("2615.54");
if (!line_sender_buffer_column_dec_str(
buffer, price_name, price_value, &err))
goto on_error;

if (!line_sender_buffer_at_nanos(buffer, line_sender_now_nanos(), &err))
Expand All @@ -101,6 +106,7 @@ if (!line_sender_buffer_at_nanos(buffer, line_sender_now_nanos(), &err))
if (!line_sender_flush(sender, buffer, &err))
goto on_error;

line_sender_buffer_free(buffer);
line_sender_close(sender);
```

Expand Down
6 changes: 5 additions & 1 deletion doc/CPP.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
- [Array in C-major order](../examples/line_sender_cpp_example_array_c_major.cpp)
- [Custom array type integration](../examples/line_sender_cpp_example_array_custom.cpp)

**Decimal**
- [Decimal in binary format](../examples/line_sender_cpp_example_decimal_binary.cpp)
- [Custom decimal type integration](../examples/line_sender_cpp_example_decimal_custom.cpp)

## API Overview

### Header
Expand Down Expand Up @@ -76,7 +80,7 @@ questdb::ingress::line_sender_buffer buffer;
buffer
.table("trades")
.symbol("symbol", "ETH-USD")
.column("price", 2615.54)
.column("price", "2615.54"_decimal)
.at(timestamp_nanos::now());

// To insert more records, call `buffer.table(..)...` again.
Expand Down
7 changes: 5 additions & 2 deletions examples/line_sender_c_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ static bool example(const char* host, const char* port)
line_sender* sender = NULL;
line_sender_buffer* buffer = NULL;
char* conf_str =
concat("tcp::addr=", host, ":", port, ";protocol_version=2;");
concat("tcp::addr=", host, ":", port, ";protocol_version=3;");
if (!conf_str)
{
fprintf(stderr, "Could not concatenate configuration string.\n");
Expand Down Expand Up @@ -51,7 +51,9 @@ static bool example(const char* host, const char* port)
if (!line_sender_buffer_symbol(buffer, side_name, side_value, &err))
goto on_error;

if (!line_sender_buffer_column_f64(buffer, price_name, 2615.54, &err))
line_sender_utf8 price_value = QDB_UTF8_LITERAL("2615.54");
if (!line_sender_buffer_column_dec_str(
buffer, price_name, price_value, &err))
goto on_error;

if (!line_sender_buffer_column_f64(buffer, amount_name, 0.00044, &err))
Expand All @@ -72,6 +74,7 @@ static bool example(const char* host, const char* port)
if (!line_sender_flush(sender, buffer, &err))
goto on_error;

line_sender_buffer_free(buffer);
line_sender_close(sender);

return true;
Expand Down
1 change: 1 addition & 0 deletions examples/line_sender_c_example_array_byte_strides.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ static bool example(const char* host, const char* port)
if (!line_sender_flush(sender, buffer, &err))
goto on_error;

line_sender_buffer_free(buffer);
line_sender_close(sender);
return true;

Expand Down
3 changes: 2 additions & 1 deletion examples/line_sender_c_example_array_c_major.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static bool example(const char* host, const char* port)
line_sender* sender = NULL;
line_sender_buffer* buffer = NULL;
char* conf_str =
concat("tcp::addr=", host, ":", port, ";protocol_version=2;");
concat("tcp::addr=", host, ":", port, ";protocol_version=3;");
if (!conf_str)
{
fprintf(stderr, "Could not concatenate configuration string.\n");
Expand Down Expand Up @@ -79,6 +79,7 @@ static bool example(const char* host, const char* port)
if (!line_sender_flush(sender, buffer, &err))
goto on_error;

line_sender_buffer_free(buffer);
line_sender_close(sender);
return true;

Expand Down
3 changes: 2 additions & 1 deletion examples/line_sender_c_example_array_elem_strides.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static bool example(const char* host, const char* port)
line_sender* sender = NULL;
line_sender_buffer* buffer = NULL;
char* conf_str =
concat("tcp::addr=", host, ":", port, ";protocol_version=2;");
concat("tcp::addr=", host, ":", port, ";protocol_version=3;");
if (!conf_str)
{
fprintf(stderr, "Could not concatenate configuration string.\n");
Expand Down Expand Up @@ -82,6 +82,7 @@ static bool example(const char* host, const char* port)
if (!line_sender_flush(sender, buffer, &err))
goto on_error;

line_sender_buffer_free(buffer);
line_sender_close(sender);
return true;

Expand Down
7 changes: 5 additions & 2 deletions examples/line_sender_c_example_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static bool example(const char* host, const char* port)
":",
port,
";"
"protocol_version=2;"
"protocol_version=3;"
"username=admin;"
"token=5UjEMuA0Pj5pjK8a-fa24dyIf-Es5mYny3oE_Wmus48;"
"token_x=fLKYEaoEb9lrn3nkwLDA-M_xnuFOdSt9y0Z7_vWSHLU;"
Expand Down Expand Up @@ -60,7 +60,9 @@ static bool example(const char* host, const char* port)
if (!line_sender_buffer_symbol(buffer, side_name, side_value, &err))
goto on_error;

if (!line_sender_buffer_column_f64(buffer, price_name, 2615.54, &err))
line_sender_utf8 price_value = QDB_UTF8_LITERAL("2615.54");
if (!line_sender_buffer_column_dec_str(
buffer, price_name, price_value, &err))
goto on_error;

if (!line_sender_buffer_column_f64(buffer, amount_name, 0.00044, &err))
Expand All @@ -81,6 +83,7 @@ static bool example(const char* host, const char* port)
if (!line_sender_flush(sender, buffer, &err))
goto on_error;

line_sender_buffer_free(buffer);
line_sender_close(sender);

return true;
Expand Down
7 changes: 5 additions & 2 deletions examples/line_sender_c_example_auth_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static bool example(const char* host, const char* port)
":",
port,
";"
"protocol_version=2;"
"protocol_version=3;"
"username=admin;"
"token=5UjEMuA0Pj5pjK8a-fa24dyIf-Es5mYny3oE_Wmus48;"
"token_x=fLKYEaoEb9lrn3nkwLDA-M_xnuFOdSt9y0Z7_vWSHLU;"
Expand Down Expand Up @@ -61,7 +61,9 @@ static bool example(const char* host, const char* port)
if (!line_sender_buffer_symbol(buffer, side_name, side_value, &err))
goto on_error;

if (!line_sender_buffer_column_f64(buffer, price_name, 2615.54, &err))
line_sender_utf8 price_value = QDB_UTF8_LITERAL("2615.54");
if (!line_sender_buffer_column_dec_str(
buffer, price_name, price_value, &err))
goto on_error;

if (!line_sender_buffer_column_f64(buffer, amount_name, 0.00044, &err))
Expand All @@ -82,6 +84,7 @@ static bool example(const char* host, const char* port)
if (!line_sender_flush(sender, buffer, &err))
goto on_error;

line_sender_buffer_free(buffer);
line_sender_close(sender);

return true;
Expand Down
Loading
Loading