Skip to content

Commit 36ad066

Browse files
authored
Improve docs for the array column (#106)
1 parent a524303 commit 36ad066

File tree

4 files changed

+38
-27
lines changed

4 files changed

+38
-27
lines changed

ci/run_all_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def main():
3838
build_dir.glob(f'**/test_line_sender{exe_suffix}')))
3939
build_cxx20_dir = pathlib.Path('build_CXX20')
4040
test_line_sender_path_CXX20 = next(iter(
41-
build_cxx20_dir.glob(f'**/test_line_sender{exe_suffix}')))
41+
build_cxx20_dir.glob(f'**/test_line_sender{exe_suffix}')))
4242

4343
system_test_path = pathlib.Path('system_test') / 'test.py'
4444
#qdb_v = '8.2.3' # The version of QuestDB we'll test against.
@@ -55,7 +55,7 @@ def main():
5555
run_cmd(str(test_line_sender_path))
5656
run_cmd(str(test_line_sender_path_CXX20))
5757
#run_cmd('python3', str(system_test_path), 'run', '--versions', qdb_v, '-v')
58-
run_cmd('python3', str(system_test_path), 'run', '--repo', './questdb_nd_arr', '-v')
58+
run_cmd('python3', str(system_test_path), 'run', '--repo', './questdb', '-v')
5959

6060

6161
if __name__ == '__main__':

ci/run_tests_pipeline.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ stages:
5656
displayName: "Build Rust examples"
5757
############################# temp for test begin #####################
5858
- script: |
59-
git clone -b nd_arr --depth 1 https://github.com/questdb/questdb.git ./questdb_nd_arr
59+
git clone --depth 1 https://github.com/questdb/questdb.git ./questdb
6060
displayName: git clone questdb
6161
- task: Maven@3
6262
displayName: "Compile QuestDB"
6363
inputs:
64-
mavenPOMFile: 'questdb_nd_arr/pom.xml'
65-
jdkVersionOption: '1.11'
64+
mavenPOMFile: "questdb/pom.xml"
65+
jdkVersionOption: "1.11"
6666
options: "-DskipTests -Pbuild-web-console"
6767
############################# temp for test end #####################
6868
- script: python3 ci/run_all_tests.py
@@ -126,7 +126,7 @@ stages:
126126
submodules: false
127127
- template: compile.yaml
128128
- script: |
129-
git clone -b nd_arr --depth 1 https://github.com/questdb/questdb.git
129+
git clone --depth 1 https://github.com/questdb/questdb.git
130130
displayName: git clone questdb
131131
- task: Maven@3
132132
displayName: "Compile QuestDB"

include/questdb/ingress/line_sender.h

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ typedef enum line_sender_error_code
7878
/** Bad configuration. */
7979
line_sender_error_config_error,
8080

81-
/** Currently, only arrays with a maximum 32 dimensions are supported. */
81+
/** QuestDB supports arrays of up to 32 dimensions. */
8282
line_sender_error_array_large_dim,
8383

8484
/** ArrayView internal error, such as failure to get the size of a valid
@@ -413,6 +413,7 @@ line_sender_buffer_view line_sender_buffer_peek(
413413

414414
/**
415415
* Start recording a new row for the given table.
416+
*
416417
* @param[in] buffer Line buffer object.
417418
* @param[in] name Table name.
418419
*/
@@ -425,6 +426,7 @@ bool line_sender_buffer_table(
425426
/**
426427
* Record a symbol value for the given column.
427428
* Make sure you record all the symbol columns before any other column type.
429+
*
428430
* @param[in] buffer Line buffer object.
429431
* @param[in] name Column name.
430432
* @param[in] value Column value.
@@ -440,6 +442,7 @@ bool line_sender_buffer_symbol(
440442

441443
/**
442444
* Record a boolean value for the given column.
445+
*
443446
* @param[in] buffer Line buffer object.
444447
* @param[in] name Column name.
445448
* @param[in] value Column value.
@@ -455,6 +458,7 @@ bool line_sender_buffer_column_bool(
455458

456459
/**
457460
* Record an integer value for the given column.
461+
*
458462
* @param[in] buffer Line buffer object.
459463
* @param[in] name Column name.
460464
* @param[in] value Column value.
@@ -470,6 +474,7 @@ bool line_sender_buffer_column_i64(
470474

471475
/**
472476
* Record a floating-point value for the given column.
477+
*
473478
* @param[in] buffer Line buffer object.
474479
* @param[in] name Column name.
475480
* @param[in] value Column value.
@@ -485,6 +490,7 @@ bool line_sender_buffer_column_f64(
485490

486491
/**
487492
* Record a string value for the given column.
493+
*
488494
* @param[in] buffer Line buffer object.
489495
* @param[in] name Column name.
490496
* @param[in] value Column value.
@@ -499,19 +505,19 @@ bool line_sender_buffer_column_str(
499505
line_sender_error** err_out);
500506

501507
/**
502-
* Record a multidimensional array of double for the given column.
508+
* Record a multidimensional array of `double` values for the given column.
503509
*
504-
* This API uses BYTE-LEVEL STRIDES where the stride values represent the
505-
* number of bytes between consecutive elements along each dimension.
510+
* The values in the `strides` parameter represent the number of bytes
511+
* between consecutive elements along each dimension.
506512
*
507513
* @param[in] buffer Line buffer object.
508514
* @param[in] name Column name.
509515
* @param[in] rank Number of dimensions of the array.
510516
* @param[in] shape Array of dimension sizes (length = `rank`).
511-
* Each element must be a positive integer.
512-
* @param[in] strides Array strides.
513-
* @param[in] data_buffer First array element data.
514-
* @param[in] data_buffer_len Bytes length of the array data.
517+
* Each element must be a positive integer.
518+
* @param[in] strides Array strides, in the unit of bytes. Strides can be negative.
519+
* @param[in] data_buffer Array data, laid out according to the provided shape and strides.
520+
* @param[in] data_buffer_len Length of the array data block in bytes.
515521
* @param[out] err_out Set to an error object on failure (if non-NULL).
516522
* @return true on success, false on error.
517523
*/
@@ -527,19 +533,19 @@ bool line_sender_buffer_column_f64_arr_byte_strides(
527533
line_sender_error** err_out);
528534

529535
/**
530-
* Record a multidimensional array of double for the given column.
536+
* Record a multidimensional array of `double` values for the given column.
531537
*
532-
* This function uses ELEMENT-LEVEL STRIDES where the stride values represent
533-
* the number of elements between consecutive elements along each dimension.
538+
* The values in the `strides` parameter represent the number of elements
539+
* between consecutive elements along each dimension.
534540
*
535541
* @param[in] buffer Line buffer object.
536542
* @param[in] name Column name.
537543
* @param[in] rank Number of dimensions of the array.
538544
* @param[in] shape Array of dimension sizes (length = `rank`).
539545
* Each element must be a positive integer.
540-
* @param[in] strides Array strides.
541-
* @param[in] data_buffer First array element data.
542-
* @param[in] data_buffer_len Bytes length of the array data.
546+
* @param[in] strides Array strides, in the unit of elements. Strides can be negative.
547+
* @param[in] data_buffer Array data, laid out according to the provided shape and strides.
548+
* @param[in] data_buffer_len Length of the array data block in bytes.
543549
* @param[out] err_out Set to an error object on failure (if non-NULL).
544550
* @return true on success, false on error.
545551
*/
@@ -556,6 +562,7 @@ bool line_sender_buffer_column_f64_arr_elem_strides(
556562

557563
/**
558564
* Record a nanosecond timestamp value for the given column.
565+
*
559566
* @param[in] buffer Line buffer object.
560567
* @param[in] name Column name.
561568
* @param[in] nanos The timestamp in nanoseconds since the Unix epoch.
@@ -571,6 +578,7 @@ bool line_sender_buffer_column_ts_nanos(
571578

572579
/**
573580
* Record a microsecond timestamp value for the given column.
581+
*
574582
* @param[in] buffer Line buffer object.
575583
* @param[in] name Column name.
576584
* @param[in] micros The timestamp in microseconds since the Unix epoch.
@@ -711,6 +719,7 @@ line_sender_opts* line_sender_opts_from_env(line_sender_error** err_out);
711719
/**
712720
* Create a new `line_sender_opts` instance with the given protocol,
713721
* hostname and port.
722+
*
714723
* @param[in] protocol The protocol to use.
715724
* @param[in] host The QuestDB database host.
716725
* @param[in] port The QuestDB ILP TCP port.
@@ -1058,6 +1067,7 @@ bool line_sender_flush(
10581067
*
10591068
* To send and clear in one step, call `line_sender_flush` instead. Also,
10601069
* see the docs on that function for more important details on flushing.
1070+
*
10611071
* @param[in] sender Line sender object.
10621072
* @param[in] buffer Line buffer object.
10631073
* @return true on success, false on error.

include/questdb/ingress/line_sender.hpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -641,18 +641,19 @@ class line_sender_buffer
641641
}
642642

643643
/**
644-
* Record a multidimensional double-precision array for the given column.
644+
* Record a multidimensional array for the given column.
645645
*
646-
* @tparam B Strides mode selector:
647-
* - `true` for byte-level strides
648-
* - `false` for element-level strides
649-
* @tparam T Element type (current only `double` is supported).
646+
* @tparam B Selects the unit used for the strides:
647+
* - `true`: the unit is bytes
648+
* - `false` the unit is elements
649+
* @tparam T Element type (currently only `double` is supported).
650650
* @tparam N Number of elements in the flat data array
651651
*
652652
* @param name Column name.
653653
* @param shape Array dimensions (e.g., [2,3] for a 2x3 matrix).
654-
* @param data Array first element data. Size must match product of
655-
* dimensions.
654+
* @param strides Strides for each dimension, in the unit specified by `B`.
655+
* @param data Array elements laid out in row-major order. Their number must
656+
* match the product of dimension sizes.
656657
*/
657658
template <bool B, typename T, size_t N>
658659
line_sender_buffer& column(

0 commit comments

Comments
 (0)