Skip to content

Commit f192c16

Browse files
committed
Merge branch 'develop' into tableStatistics
2 parents 93016b2 + 052ff6b commit f192c16

File tree

302 files changed

+10353
-4463
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

302 files changed

+10353
-4463
lines changed

.github/workflows/unit-test-cpp.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,15 @@ jobs:
104104
core.setOutput('platform_suffix', ``)
105105
}
106106
107-
- name: Install clang-format
107+
# Install dependencies
108+
- name: Install dependencies
108109
shell: bash
109110
run: |
110111
if [[ "$RUNNER_OS" == "Linux" ]]; then
111112
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-17 100
112113
sudo update-alternatives --set clang-format /usr/bin/clang-format-17
114+
sudo apt-get update
115+
sudo apt-get install -y uuid-dev
113116
elif [[ "$RUNNER_OS" == "Windows" ]]; then
114117
choco install llvm --version 17.0.6 --force
115118
else

.github/workflows/unit-test-java.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
fail-fast: false
4545
max-parallel: 15
4646
matrix:
47-
java: [ 8, 17, 21 ]
47+
java: [ 8, 17, 25 ]
4848
os: [ ubuntu-latest, macos-latest, windows-latest ]
4949
runs-on: ${{ matrix.os }}
5050

.github/workflows/unit-test-python.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,23 @@ jobs:
7575
core.setOutput('platform_suffix', ``)
7676
}
7777
78+
# Install dependencies
79+
- name: Install dependencies
80+
shell: bash
81+
run: |
82+
if [[ "$RUNNER_OS" == "Linux" ]]; then
83+
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-17 100
84+
sudo update-alternatives --set clang-format /usr/bin/clang-format-17
85+
sudo apt-get update
86+
sudo apt-get install -y uuid-dev
87+
elif [[ "$RUNNER_OS" == "Windows" ]]; then
88+
choco install llvm --version 17.0.6 --force
89+
else
90+
brew install llvm@17
91+
ln -sf $(brew --prefix llvm@17)/bin/clang-format /opt/homebrew/bin/clang-format
92+
fi
93+
94+
7895
# Run the actual maven build including all tests.
7996
- name: Build and test with Maven
8097
shell: bash

RELEASE_NOTES.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,26 @@
1818
under the License.
1919
2020
-->
21+
# Apache TsFile 2.2.0
22+
23+
## New Feature
24+
25+
- TsFile-Python fully supports TEXT and STRING data types.
26+
- The Python interface supports the to_dataframe method.
27+
- C++ TsFile supports encoding formats such as RLE.
28+
- Both C++ TsFile and Java TsFile table models support tag filtering.
29+
- C++ TsFile supports writing data of the TEXT type.
30+
- Added the CAMEL encoding method.
31+
- ...
32+
33+
## Improvement/Bugfix
34+
35+
- Fixed the issue where the CppTsFile write and query interfaces had various exceptions when handling null values.
36+
- Fixed the issue where Cpp TsFile failed to write data when TAG and FIELD columns were all empty (only timestamps existed with no actual data).
37+
- Fixed the issue where column names were all converted to lowercase when constructing a Tablet in Cpp TsFile, resulting in the failure to add values to Tablets constructed with uppercase column names.
38+
- Fixed the issue where queries would throw errors when the values of TEXT-type columns in the CPP TsFile table model were partially empty.
39+
- Fixed security vulnerabilities CVE-2025-12183, CVE-2025-66566 and CVE-2025-11226.
40+
- ...
2141

2242
# Apache TsFile 2.1.1
2343

@@ -103,6 +123,34 @@
103123
- Fixed the issue that the time of the first data item written to TSFile by measurement cannot be a negative number by @luoluoyuyu in #297
104124
- Fix float encoder overflow by @HTHou in #342
105125

126+
# Apache TsFile 1.1.3
127+
128+
* perf: Optimize aligned object memory size calculation
129+
* feat: add markRange / unmarkRange / merge for high-performance bit manipulation
130+
* Modify the TsFileSequenceReaderTimeseriesMetadataIterator next function to return a LinkedHashMap
131+
* fix GroupByMonthFilter.getTimeRanges
132+
* Fix bug in PaginationController
133+
* change config not found log to debug
134+
* Init all series writer for AlignedChunkGroupWriter
135+
* Added memory calculation for tablet
136+
* Dont print exception log when thread is interrupted
137+
* Bump lz4-java version to 1.10.1
138+
139+
# Apache TsFile 1.1.2
140+
141+
## Improvement/Bugfix
142+
143+
* Fix the bug in parse date to int when year out of range by @HTHou in #500
144+
* Add TsFileLastReader for retrieving last points in a TsFile by @jt2594838 in #506
145+
* Added accountable function to measurementSchema by @Caideyipi in #509
146+
* Correct the retained size calculation for BinaryColumn and BinaryColumnBuilder by @JackieTien97 in #514
147+
* add switch to disable native lz4 (#480) by @jt2594838 in #515
148+
* Correct the memroy calculation of BinaryColumnBuilder by @JackieTien97 in #530
149+
* Fetch max tsblock line number each time from TSFileConfig by @JackieTien97 in #535
150+
* Support set default compression by data type & Bump org.apache.commons:commons-lang3 from 3.15.0 to 3.18.0 by @jt2594838 in #547
151+
* Avoid calculating shallow size of map by @shuwenwei in #566
152+
* Add methods for RamUsageEstimator by @shuwenwei in #570
153+
106154
# Apache TsFile 1.1.1
107155

108156
## Improvement/Bugfix

cpp/.clang-format

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ ConstructorInitializerIndentWidth: 4
6565
ContinuationIndentWidth: 4
6666
Cpp11BracedListStyle: true
6767
DeriveLineEnding: true
68-
DerivePointerAlignment: true
6968
DisableFormat: false
7069
EmptyLineAfterAccessModifier: Never
7170
EmptyLineBeforeAccessModifier: LogicalBlock
@@ -207,7 +206,7 @@ SpacesInParentheses: false
207206
SpacesInSquareBrackets: false
208207
SpaceBeforeSquareBrackets: false
209208
BitFieldColonSpacing: Both
210-
Standard: Auto
209+
Standard: Cpp11
211210
StatementAttributeLikeMacros:
212211
- Q_EMIT
213212
StatementMacros:

cpp/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ build/
55
.settings/
66
.vscode/
77
cmake-build-debug/
8-
cmake*/

cpp/CMakeLists.txt

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,17 @@ under the License.
1919
cmake_minimum_required(VERSION 3.11)
2020
project(TsFile_CPP)
2121

22+
if (DEFINED ToolChain)
23+
include(${CMAKE_SOURCE_DIR}/cmake/ToolChain.cmake)
24+
message(STATUS "Using ToolChain: ${CMAKE_TOOLCHAIN_FILE}")
25+
else()
26+
message(STATUS "Not using ToolChain")
27+
endif ()
28+
2229
cmake_policy(SET CMP0079 NEW)
23-
set(TsFile_CPP_VERSION 2.2.0.dev)
30+
set(TsFile_CPP_VERSION 2.2.1.dev)
2431
set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -Wall")
32+
2533
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
2634
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused -Wuninitialized -D__STDC_FORMAT_MACROS")
2735
endif ()
@@ -55,6 +63,18 @@ if (NOT CMAKE_BUILD_TYPE)
5563
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
5664
endif ()
5765

66+
if (NOT DEFINED CMAKE_BUILD_PARALLEL_LEVEL)
67+
include(ProcessorCount)
68+
ProcessorCount(N)
69+
if (N EQUAL 0)
70+
set(N 1)
71+
endif ()
72+
set(CMAKE_BUILD_PARALLEL_LEVEL ${N} CACHE STRING "Number of parallel build jobs")
73+
message("CMAKE BUILD PARALLEL LEVEL: ${CMAKE_BUILD_PARALLEL_LEVEL} (auto-detected)")
74+
else ()
75+
message("CMAKE BUILD PARALLEL LEVEL: ${CMAKE_BUILD_PARALLEL_LEVEL} (from environment)")
76+
endif ()
77+
5878
message("CMAKE BUILD TYPE " ${CMAKE_BUILD_TYPE})
5979
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
6080
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g")
@@ -88,6 +108,40 @@ if (NOT WIN32)
88108
endif ()
89109
endif ()
90110

111+
option(BUILD_TEST "Build tests" ON)
112+
message("cmake using: BUILD_TEST=${BUILD_TEST}")
113+
114+
option(ENABLE_ANTLR4 "Enable ANTLR4 runtime" ON)
115+
message("cmake using: ENABLE_ANTLR4=${ENABLE_ANTLR4}")
116+
117+
option(ENABLE_SNAPPY "Enable Google Snappy compression" ON)
118+
message("cmake using: ENABLE_SNAPPY=${ENABLE_SNAPPY}")
119+
120+
if (ENABLE_SNAPPY)
121+
add_definitions(-DENABLE_SNAPPY)
122+
endif()
123+
124+
option(ENABLE_LZ4 "Enable LZ4 compression" ON)
125+
message("cmake using: ENABLE_LZ4=${ENABLE_LZ4}")
126+
127+
if (ENABLE_LZ4)
128+
add_definitions(-DENABLE_LZ4)
129+
endif()
130+
131+
option(ENABLE_LZOKAY "Enable LZOKAY compression" ON)
132+
message("cmake using: ENABLE_LZOKAY=${ENABLE_LZOKAY}")
133+
134+
if (ENABLE_LZOKAY)
135+
add_definitions(-DENABLE_LZOKAY)
136+
endif()
137+
138+
option(ENABLE_ZLIB "Enable Zlib compression" ON)
139+
message("cmake using: ENABLE_ZLIB=${ENABLE_ZLIB}")
140+
141+
if (ENABLE_ZLIB)
142+
add_definitions(-DENABLE_ZLIB)
143+
add_definitions(-DENABLE_GZIP)
144+
endif()
91145

92146
# All libs will be stored here, including libtsfile, compress-encoding lib.
93147
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
@@ -106,9 +160,14 @@ add_subdirectory(third_party)
106160
set(CMAKE_CXX_FLAGS "${SAVED_CXX_FLAGS}")
107161

108162
add_subdirectory(src)
109-
add_subdirectory(test)
110-
add_subdirectory(examples)
111-
if (TESTS_ENABLED)
112-
add_dependencies(TsFile_Test tsfile)
163+
if (BUILD_TEST)
164+
add_subdirectory(test)
165+
if (TESTS_ENABLED)
166+
add_dependencies(TsFile_Test tsfile)
167+
endif ()
168+
else()
169+
message("BUILD_TEST is OFF, skipping test directory")
113170
endif ()
114171

172+
add_subdirectory(examples)
173+

cpp/README.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,6 @@ The source code can be found in the `./src` directory. C/C++ examples are locate
4242

4343
We use `clang-format` to ensure that our C++ code adheres to a consistent set of rules defined in `./clang-format`. This is similar to the Google style.
4444

45-
**Feature List**:
46-
47-
- [ ] Add unit tests for the reader, writer, compression, etc.
48-
- [ ] Add unit tests for the C wrapper.
49-
- [ ] Support multiple data flushes.
50-
- [ ] Support aligned timeseries.
51-
- [ ] Support table description in tsfile.
52-
- [ ] Retrieve all table schemas/names.
53-
- [ ] Implement automatic flush.
54-
- [ ] Support out-of-order data writing.
55-
- [ ] Support TsFile V4. Note: TsFile CPP does not implement support for the table model, therefore there are differences in file output compared to the Java version.
56-
57-
**Bug List**:
58-
59-
- [ ] Flushing without writing after registering a timeseries will cause a core dump.
60-
- [ ] Misalignment in memory may lead to a bus error.
61-
6245
We welcome any bug reports. You can open an issue with a title starting with [CPP] to describe the bug, like: https://github.com/apache/tsfile/issues/94
6346

6447
## Build
@@ -67,7 +50,7 @@ We welcome any bug reports. You can open an issue with a title starting with [CP
6750

6851
```bash
6952
sudo apt-get update
70-
sudo apt-get install -y cmake make g++ clang-format
53+
sudo apt-get install -y cmake make g++ clang-format libuuid-dev
7154
```
7255

7356
To build tsfile, you can run: `bash build.sh`. If you have Maven tools, you can run: `mvn package -P with-cpp clean verify`. Then, you can find the shared object at `./build`.
@@ -81,6 +64,21 @@ If you compile using MinGW on windows and encounter an error, you can try replac
8164
* GCC 12.2.0 + LLVM/Clang/LLD/LLDB 16.0.0 + MinGW-w64 10.0.0 (MSVCRT) - release 5
8265
* GCC 11.2.0 + MinGW-w64 10.0.0 (MSVCRT) - release 1
8366

67+
### configure the cross-compilation toolchain
68+
69+
Modify the Toolchain File `cmake/ToolChain.cmake`, define the following variables:
70+
71+
- `CMAKE_C_COMPILER`: Specify the path to the C compiler.
72+
- `CMAKE_CXX_COMPILER`: Specify the path to the C++ compiler.
73+
- `CMAKE_FIND_ROOT_PATH`: Set the root path for the cross-compilation environment (e.g., the directory of the cross-compilation toolchain).
74+
75+
In the `cpp/` directory, run the following commands to create the build directory and start the compilation:
76+
```
77+
mkdir build && cd build
78+
cmake .. -DToolChain=ON
79+
make
80+
```
81+
8482
## Use TsFile
8583

8684
You can find examples on how to read and write data in `demo_read.cpp` and `demo_write.cpp` located under `./examples/cpp_examples`. There are also examples under `./examples/c_examples`on how to use a C-style API to read and write data in a C environment. You can run `bash build.sh` under `./examples` to generate an executable output under `./examples/build`.

cpp/build.sh

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,38 @@ use_cpp11=1
2525
enable_cov=0
2626
debug_se=0
2727
run_cov_only=0
28+
enable_antlr4=ON
29+
30+
enable_snappy=ON
31+
enable_lz4=ON
32+
enable_lzokay=ON
33+
enable_zlib=ON
2834

2935
shell_dir=$(cd "$(dirname "$0")";pwd)
3036

37+
# 添加get_key_value函数
38+
get_key_value() {
39+
echo "${1#*=}"
40+
}
41+
3142
function print_config()
3243
{
3344
echo "build_type=$build_type"
3445
echo "build_test=$build_test"
3546
echo "use_cpp11=$use_cpp11"
3647
echo "enable_cov=$enable_cov"
3748
echo "enable_asan=$enable_asan"
49+
echo "enable_antlr4=$enable_antlr4"
50+
echo "enable_snappy=$enable_snappy"
51+
echo "enable_lz4=$enable_lz4"
52+
echo "enable_lzokay=$enable_lzokay"
53+
echo "enable_zlib=$enable_zlib"
3854
}
3955

4056
function run_test_for_cov()
4157
{
4258
# sh ${shell_dir}/scripts/regression_unittest.sh
43-
sh ${shell_dir}/test/libtsfile_test/run_sdk_tests.sh
59+
sh ${shell_dir}/test/libtsfile_test/run_sdk_tests.sh
4460
}
4561

4662
parse_options()
@@ -53,20 +69,40 @@ parse_options()
5369
run_cov)
5470
run_cov_only=1;;
5571
-t=*)
56-
build_type=`get_key_value "$1"`;;
72+
build_type=$(get_key_value "$1");;
5773
-t)
5874
shift
59-
build_type=`get_key_value "$1"`;;
75+
build_type=$(get_key_value "$1");;
6076
-a=*)
61-
enable_asan=`get_key_value "$1"`;;
77+
enable_asan=$(get_key_value "$1");;
6278
-a)
6379
shift
64-
enable_asan=`get_key_value "$1"`;;
80+
enable_asan=$(get_key_value "$1");;
6581
-c=*)
66-
enable_cov=`get_key_value "$1"`;;
82+
enable_cov=$(get_key_value "$1");;
6783
-c)
6884
shift
69-
enable_cov=`get_key_value "$1"`;;
85+
enable_cov=$(get_key_value "$1");;
86+
--enable-antlr4=*)
87+
enable_antlr4=$(get_key_value "$1");;
88+
--enable-snappy=*)
89+
enable_snappy=$(get_key_value "$1");;
90+
--enable-lz4=*)
91+
enable_lz4=$(get_key_value "$1");;
92+
--enable-lzokay=*)
93+
enable_lzokay=$(get_key_value "$1");;
94+
--enable-zlib=*)
95+
enable_zlib=$(get_key_value "$1");;
96+
--disable-antlr4)
97+
enable_antlr4=OFF;;
98+
--disable-snappy)
99+
enable_snappy=OFF;;
100+
--disable-lz4)
101+
enable_lz4=OFF;;
102+
--disable-lzokay)
103+
enable_lzokay=OFF;;
104+
--disable-zlib)
105+
enable_zlib=OFF;;
70106
#-h | --help)
71107
# usage
72108
# exit 0;;
@@ -127,14 +163,12 @@ cmake ../../ \
127163
-DUSE_CPP11=$use_cpp11 \
128164
-DENABLE_COV=$enable_cov \
129165
-DDEBUG_SE=$debug_se \
130-
-DBUILD_TSFILE_ONLY=$build_tsfile_only
166+
-DENABLE_ANTLR4=$enable_antlr4 \
167+
-DBUILD_TSFILE_ONLY=$build_tsfile_only \
168+
-DENABLE_SNAPPY=$enable_snappy \
169+
-DENABLE_LZ4=$enable_lz4 \
170+
-DENABLE_LZOKAY=$enable_lzokay \
171+
-DENABLE_ZLIB=$enable_zlib
131172

132173
VERBOSE=1 make
133-
VERBOSE=1 make install
134-
135-
136-
137-
138-
139-
140-
174+
VERBOSE=1 make install

0 commit comments

Comments
 (0)