This is an automated email from the ASF dual-hosted git repository.
jiangtian pushed a commit to branch docs/dev
in repository https://gitbox.apache.org/repos/asf/tsfile.git
The following commit(s) were added to refs/heads/docs/dev by this push:
new a9c9f9e4 Supplement documentation related to TagFilter (#654)
a9c9f9e4 is described below
commit a9c9f9e450df61a27f5a03f836ec1881303e9040
Author: Hongzhi Gao <[email protected]>
AuthorDate: Thu Dec 4 18:50:25 2025 +0800
Supplement documentation related to TagFilter (#654)
* Supplement documentation related to TagFilter
* Add documentation about reducing dependencies.
* Add documentation about reducing dependencies.
* Add documentation about TagFilter example
---
.../InterfaceDefinition/InterfaceDefinition-CPP.md | 45 +++++++++++++++++
.../InterfaceDefinition-Java.md | 57 ++++++++++++++++++++++
src/UserGuide/develop/QuickStart/QuickStart-C.md | 20 ++++++++
src/UserGuide/develop/QuickStart/QuickStart-CPP.md | 26 +++++++++-
.../develop/QuickStart/QuickStart-JAVA.md | 5 +-
.../InterfaceDefinition/InterfaceDefinition-CPP.md | 45 +++++++++++++++++
.../InterfaceDefinition-Java.md | 57 ++++++++++++++++++++++
src/UserGuide/latest/QuickStart/QuickStart-C.md | 20 ++++++++
src/UserGuide/latest/QuickStart/QuickStart-CPP.md | 27 +++++++++-
src/UserGuide/latest/QuickStart/QuickStart.md | 5 +-
.../InterfaceDefinition/InterfaceDefinition-CPP.md | 44 +++++++++++++++++
.../UserGuide/develop/QuickStart/QuickStart-C.md | 21 +++++++-
.../UserGuide/develop/QuickStart/QuickStart-CPP.md | 27 +++++++++-
.../develop/QuickStart/QuickStart-JAVA.md | 5 +-
.../InterfaceDefinition/InterfaceDefinition-CPP.md | 44 +++++++++++++++++
src/zh/UserGuide/latest/QuickStart/QuickStart-C.md | 21 +++++++-
.../UserGuide/latest/QuickStart/QuickStart-CPP.md | 27 +++++++++-
src/zh/UserGuide/latest/QuickStart/QuickStart.md | 5 +-
18 files changed, 489 insertions(+), 12 deletions(-)
diff --git
a/src/UserGuide/develop/QuickStart/InterfaceDefinition/InterfaceDefinition-CPP.md
b/src/UserGuide/develop/QuickStart/InterfaceDefinition/InterfaceDefinition-CPP.md
index b165a024..044c496b 100644
---
a/src/UserGuide/develop/QuickStart/InterfaceDefinition/InterfaceDefinition-CPP.md
+++
b/src/UserGuide/develop/QuickStart/InterfaceDefinition/InterfaceDefinition-CPP.md
@@ -278,6 +278,23 @@ class TsFileReader {
int query(const std::string &table_name,
const std::vector<std::string> &columns_names, int64_t
start_time,
int64_t end_time, ResultSet *&result_set);
+
+ /**
+ * @brief query the tsfile by the table name, columns names, start time
+ * and end time, tag filter. this method is used to query the tsfile by the
+ * table model.
+ *
+ * @param [in] table_name the table name
+ * @param [in] columns_names the columns names
+ * @param [in] start_time the start time
+ * @param [in] end_time the end time
+ * @param [in] tag_filter the tag filter
+ * @param [out] result_set the result set
+ */
+ int query(const std::string& table_name,
+ const std::vector<std::string>& columns_names, int64_t
start_time,
+ int64_t end_time, ResultSet*& result_set, Filter* tag_filter);
+
/**
* @brief destroy the result set, this method should be called after the
* query is finished and result_set
@@ -440,4 +457,32 @@ class ResultSetMetadata {
*/
uint32_t get_column_count();
};
+```
+### Filter
+#### TagFilterBuilder
+Used to construct tag-based filters for querying data
+```cpp
+class TagFilterBuilder {
+ public:
+ explicit TagFilterBuilder(TableSchema* schema);
+
+ Filter* eq(const std::string& columnName, const std::string& value);
+ Filter* neq(const std::string& columnName, const std::string& value);
+ Filter* lt(const std::string& columnName, const std::string& value);
+ Filter* lteq(const std::string& columnName, const std::string& value);
+ Filter* gt(const std::string& columnName, const std::string& value);
+ Filter* gteq(const std::string& columnName, const std::string& value);
+ Filter* reg_exp(const std::string& columnName, const std::string& value);
+ Filter* not_reg_exp(const std::string& columnName,
+ const std::string& value);
+ Filter* between_and(const std::string& columnName, const std::string&
lower,
+ const std::string& upper);
+ Filter* not_between_and(const std::string& columnName,
+ const std::string& lower, const std::string&
upper);
+
+ // Logical operations
+ static Filter* and_filter(Filter* left, Filter* right);
+ static Filter* or_filter(Filter* left, Filter* right);
+ static Filter* not_filter(Filter* filter);
+};
```
\ No newline at end of file
diff --git
a/src/UserGuide/develop/QuickStart/InterfaceDefinition/InterfaceDefinition-Java.md
b/src/UserGuide/develop/QuickStart/InterfaceDefinition/InterfaceDefinition-Java.md
index 3ae53d09..b71931d3 100644
---
a/src/UserGuide/develop/QuickStart/InterfaceDefinition/InterfaceDefinition-Java.md
+++
b/src/UserGuide/develop/QuickStart/InterfaceDefinition/InterfaceDefinition-Java.md
@@ -160,6 +160,9 @@ Used to query data in tsfile
interface ITsFileReader extends AutoCloseable {
// Used to execute queries and return results
ResultSet query(String tableName, List<String> columnNames, long startTime,
long endTime);
+
+ // Used to execute queries and return results
+ ResultSet query(String tableName, List<String> columnNames, long startTime,
long endTime, Filter tagFilter);
// Return the schema of the table named tableName in tsfile
Optional<TableSchema> getTableSchemas(String tableName);
@@ -238,3 +241,57 @@ interface ResultSetMetadata {
TSDataType getColumnType(int columnIndex);
}
```
+### Filter
+#### TagFilterBuilder
+Used to construct tag-based filters for querying data
+```java
+class TagFilterBuilder {
+ // Constructor function
+ public TagFilterBuilder(TableSchema tableSchema);
+
+ // Equal to filter
+ public Filter eq(String columnName, Object value);
+
+ // Not equal to filter
+ public Filter neq(String columnName, Object value);
+
+ // Less than filter
+ public Filter lt(String columnName, Object value);
+
+ // Less than or equal to filter
+ public Filter lteq(String columnName, Object value);
+
+ // Greater than filter
+ public Filter gt(String columnName, Object value);
+
+ // Greater than or equal to filter
+ public Filter gteq(String columnName, Object value);
+
+ // Between and filter (inclusive)
+ public Filter betweenAnd(String columnName, Object value1, Object value2);
+
+ // Not between and filter
+ public Filter notBetweenAnd(String columnName, Object value1, Object value2);
+
+ // Regular expression filter
+ public Filter regExp(String columnName, String pattern);
+
+ // Not regular expression filter
+ public Filter notRegExp(String columnName, String pattern);
+
+ // LIKE pattern filter
+ public Filter like(String columnName, String pattern);
+
+ // NOT LIKE pattern filter
+ public Filter notLike(String columnName, String pattern);
+
+ // Logical AND filter
+ public Filter and(Filter left, Filter right);
+
+ // Logical OR filter
+ public Filter or(Filter left, Filter right);
+
+ // Logical NOT filter
+ public Filter not(Filter value);
+}
+```
\ No newline at end of file
diff --git a/src/UserGuide/develop/QuickStart/QuickStart-C.md
b/src/UserGuide/develop/QuickStart/QuickStart-C.md
index 68a25802..e65ddab2 100644
--- a/src/UserGuide/develop/QuickStart/QuickStart-C.md
+++ b/src/UserGuide/develop/QuickStart/QuickStart-C.md
@@ -50,7 +50,27 @@ Windows:
```shell
mvnw.cmd clean install -P with-cpp -DskipTests
```
+### Compilation Options
+TsFile provides build options to control the size of the generated library:
+```shell
+# Minimal build
+mvn clean install -P with-cpp -DskipTests \
+ -Dbuild.test=OFF \
+ -Denable.snappy=OFF \
+ -Denable.lz4=OFF \
+ -Denable.lzokay=OFF \
+ -Denable.zlib=OFF \
+ -Denable.antlr4=OFF
+```
+
+**Option Descriptions**
+- `enable.*=OFF:` Do not compile compression algorithms (reduces library size)
+- `enable.antlr4=OFF:` Do not compile ANTLR4 dependency (reduces library size)
+**Library Size Comparison**
+- `Full build:` ~3.2MB
+- `With ANTLR4 disabled:` ~1.9MB
+- `With all compression algorithms disabled:` ~1.7MB
### Directory Structure
• **Include Directory**: Located at
`tsfile/cpp/target/build/include/cwrapper`, it contains header files for
integration. Add this path to the compiler's include path (e.g., using `-I`
flag).
diff --git a/src/UserGuide/develop/QuickStart/QuickStart-CPP.md
b/src/UserGuide/develop/QuickStart/QuickStart-CPP.md
index 560d7028..e6f78614 100644
--- a/src/UserGuide/develop/QuickStart/QuickStart-CPP.md
+++ b/src/UserGuide/develop/QuickStart/QuickStart-CPP.md
@@ -41,7 +41,27 @@ mvn clean install -P with-cpp -DskipTests
```
Note: If Maven is not installed, you can use mvnw on Linux or mvnw.cmd on
Windows.
+### Compilation Options
+TsFile provides build options to control the size of the generated library:
+```shell
+# Minimal build
+mvn clean install -P with-cpp -DskipTests \
+ -Dbuild.test=OFF \
+ -Denable.snappy=OFF \
+ -Denable.lz4=OFF \
+ -Denable.lzokay=OFF \
+ -Denable.zlib=OFF \
+ -Denable.antlr4=OFF
+```
+
+**Option Descriptions**
+- `enable.*=OFF:` Do not compile compression algorithms (reduces library size)
+- `enable.antlr4=OFF:` Do not compile ANTLR4 dependency (reduces library size)
+**Library Size Comparison**
+- `Full build:` ~3.2MB
+- `With ANTLR4 disabled:` ~1.9MB
+- `With all compression algorithms disabled:` ~1.7MB
### Directory Structure
• **Include Directory**: Located at `tsfile/cpp/target/build/include`, it
contains header files for integration. Add this path to the compiler's include
path (e.g., using `-I` flag).
@@ -152,8 +172,12 @@ The sample code of using these interfaces is in
<https://github.com/apache/tsfil
columns.emplace_back("id2");
columns.emplace_back("s1");
+ auto table_schema = reader.get_table_schema(table_name);
+ storage::Filter* tag_filter1 =
storage::TagFilterBuilder(table_schema.get()).eq("id1", "id1_filed_1");
+ storage::Filter* tag_filter2 =
storage::TagFilterBuilder(table_schema.get()).eq("id2", "id1_filed_2");
+ storage::Filter* tag_filter =
storage::TagFilterBuilder(table_schema.get()).and_filter(tag_filter1,
tag_filter2);
// Column vector contains the columns you want to select.
- reader.query(table_name, columns, 0, 100, temp_ret);
+ reader.query(table_name, columns, 0, 100, temp_ret, tag_filter);
```
### Query Data
diff --git a/src/UserGuide/develop/QuickStart/QuickStart-JAVA.md
b/src/UserGuide/develop/QuickStart/QuickStart-JAVA.md
index 2d329a13..79fe1535 100644
--- a/src/UserGuide/develop/QuickStart/QuickStart-JAVA.md
+++ b/src/UserGuide/develop/QuickStart/QuickStart-JAVA.md
@@ -129,7 +129,10 @@ ITsFileReader reader =
### Construct Query Request
```shell
-ResultSet resultSet = reader.query(tableName, Arrays.asList("id1", "id2",
"s1", "s2"), 2, 8)
+TableSchema schema = reader.getTableSchemas(tableName);
+TagFilterBuilder filterBuilder = new TagFilterBuilder(schema);
+ResultSet resultSet = reader.query(tableName, Arrays.asList("id1", "id2",
"s1", "s2"),
+ 2, 8, filterBuilder.eq("id1", "id1_filed_1"));
```
### Query Data
diff --git
a/src/UserGuide/latest/QuickStart/InterfaceDefinition/InterfaceDefinition-CPP.md
b/src/UserGuide/latest/QuickStart/InterfaceDefinition/InterfaceDefinition-CPP.md
index b165a024..044c496b 100644
---
a/src/UserGuide/latest/QuickStart/InterfaceDefinition/InterfaceDefinition-CPP.md
+++
b/src/UserGuide/latest/QuickStart/InterfaceDefinition/InterfaceDefinition-CPP.md
@@ -278,6 +278,23 @@ class TsFileReader {
int query(const std::string &table_name,
const std::vector<std::string> &columns_names, int64_t
start_time,
int64_t end_time, ResultSet *&result_set);
+
+ /**
+ * @brief query the tsfile by the table name, columns names, start time
+ * and end time, tag filter. this method is used to query the tsfile by the
+ * table model.
+ *
+ * @param [in] table_name the table name
+ * @param [in] columns_names the columns names
+ * @param [in] start_time the start time
+ * @param [in] end_time the end time
+ * @param [in] tag_filter the tag filter
+ * @param [out] result_set the result set
+ */
+ int query(const std::string& table_name,
+ const std::vector<std::string>& columns_names, int64_t
start_time,
+ int64_t end_time, ResultSet*& result_set, Filter* tag_filter);
+
/**
* @brief destroy the result set, this method should be called after the
* query is finished and result_set
@@ -440,4 +457,32 @@ class ResultSetMetadata {
*/
uint32_t get_column_count();
};
+```
+### Filter
+#### TagFilterBuilder
+Used to construct tag-based filters for querying data
+```cpp
+class TagFilterBuilder {
+ public:
+ explicit TagFilterBuilder(TableSchema* schema);
+
+ Filter* eq(const std::string& columnName, const std::string& value);
+ Filter* neq(const std::string& columnName, const std::string& value);
+ Filter* lt(const std::string& columnName, const std::string& value);
+ Filter* lteq(const std::string& columnName, const std::string& value);
+ Filter* gt(const std::string& columnName, const std::string& value);
+ Filter* gteq(const std::string& columnName, const std::string& value);
+ Filter* reg_exp(const std::string& columnName, const std::string& value);
+ Filter* not_reg_exp(const std::string& columnName,
+ const std::string& value);
+ Filter* between_and(const std::string& columnName, const std::string&
lower,
+ const std::string& upper);
+ Filter* not_between_and(const std::string& columnName,
+ const std::string& lower, const std::string&
upper);
+
+ // Logical operations
+ static Filter* and_filter(Filter* left, Filter* right);
+ static Filter* or_filter(Filter* left, Filter* right);
+ static Filter* not_filter(Filter* filter);
+};
```
\ No newline at end of file
diff --git
a/src/UserGuide/latest/QuickStart/InterfaceDefinition/InterfaceDefinition-Java.md
b/src/UserGuide/latest/QuickStart/InterfaceDefinition/InterfaceDefinition-Java.md
index 3ae53d09..b71931d3 100644
---
a/src/UserGuide/latest/QuickStart/InterfaceDefinition/InterfaceDefinition-Java.md
+++
b/src/UserGuide/latest/QuickStart/InterfaceDefinition/InterfaceDefinition-Java.md
@@ -160,6 +160,9 @@ Used to query data in tsfile
interface ITsFileReader extends AutoCloseable {
// Used to execute queries and return results
ResultSet query(String tableName, List<String> columnNames, long startTime,
long endTime);
+
+ // Used to execute queries and return results
+ ResultSet query(String tableName, List<String> columnNames, long startTime,
long endTime, Filter tagFilter);
// Return the schema of the table named tableName in tsfile
Optional<TableSchema> getTableSchemas(String tableName);
@@ -238,3 +241,57 @@ interface ResultSetMetadata {
TSDataType getColumnType(int columnIndex);
}
```
+### Filter
+#### TagFilterBuilder
+Used to construct tag-based filters for querying data
+```java
+class TagFilterBuilder {
+ // Constructor function
+ public TagFilterBuilder(TableSchema tableSchema);
+
+ // Equal to filter
+ public Filter eq(String columnName, Object value);
+
+ // Not equal to filter
+ public Filter neq(String columnName, Object value);
+
+ // Less than filter
+ public Filter lt(String columnName, Object value);
+
+ // Less than or equal to filter
+ public Filter lteq(String columnName, Object value);
+
+ // Greater than filter
+ public Filter gt(String columnName, Object value);
+
+ // Greater than or equal to filter
+ public Filter gteq(String columnName, Object value);
+
+ // Between and filter (inclusive)
+ public Filter betweenAnd(String columnName, Object value1, Object value2);
+
+ // Not between and filter
+ public Filter notBetweenAnd(String columnName, Object value1, Object value2);
+
+ // Regular expression filter
+ public Filter regExp(String columnName, String pattern);
+
+ // Not regular expression filter
+ public Filter notRegExp(String columnName, String pattern);
+
+ // LIKE pattern filter
+ public Filter like(String columnName, String pattern);
+
+ // NOT LIKE pattern filter
+ public Filter notLike(String columnName, String pattern);
+
+ // Logical AND filter
+ public Filter and(Filter left, Filter right);
+
+ // Logical OR filter
+ public Filter or(Filter left, Filter right);
+
+ // Logical NOT filter
+ public Filter not(Filter value);
+}
+```
\ No newline at end of file
diff --git a/src/UserGuide/latest/QuickStart/QuickStart-C.md
b/src/UserGuide/latest/QuickStart/QuickStart-C.md
index 68a25802..e65ddab2 100644
--- a/src/UserGuide/latest/QuickStart/QuickStart-C.md
+++ b/src/UserGuide/latest/QuickStart/QuickStart-C.md
@@ -50,7 +50,27 @@ Windows:
```shell
mvnw.cmd clean install -P with-cpp -DskipTests
```
+### Compilation Options
+TsFile provides build options to control the size of the generated library:
+```shell
+# Minimal build
+mvn clean install -P with-cpp -DskipTests \
+ -Dbuild.test=OFF \
+ -Denable.snappy=OFF \
+ -Denable.lz4=OFF \
+ -Denable.lzokay=OFF \
+ -Denable.zlib=OFF \
+ -Denable.antlr4=OFF
+```
+
+**Option Descriptions**
+- `enable.*=OFF:` Do not compile compression algorithms (reduces library size)
+- `enable.antlr4=OFF:` Do not compile ANTLR4 dependency (reduces library size)
+**Library Size Comparison**
+- `Full build:` ~3.2MB
+- `With ANTLR4 disabled:` ~1.9MB
+- `With all compression algorithms disabled:` ~1.7MB
### Directory Structure
• **Include Directory**: Located at
`tsfile/cpp/target/build/include/cwrapper`, it contains header files for
integration. Add this path to the compiler's include path (e.g., using `-I`
flag).
diff --git a/src/UserGuide/latest/QuickStart/QuickStart-CPP.md
b/src/UserGuide/latest/QuickStart/QuickStart-CPP.md
index 560d7028..ebb08b67 100644
--- a/src/UserGuide/latest/QuickStart/QuickStart-CPP.md
+++ b/src/UserGuide/latest/QuickStart/QuickStart-CPP.md
@@ -41,6 +41,27 @@ mvn clean install -P with-cpp -DskipTests
```
Note: If Maven is not installed, you can use mvnw on Linux or mvnw.cmd on
Windows.
+### Compilation Options
+TsFile provides build options to control the size of the generated library:
+```shell
+# Minimal build
+mvn clean install -P with-cpp -DskipTests \
+ -Dbuild.test=OFF \
+ -Denable.snappy=OFF \
+ -Denable.lz4=OFF \
+ -Denable.lzokay=OFF \
+ -Denable.zlib=OFF \
+ -Denable.antlr4=OFF
+```
+
+**Option Descriptions**
+- `enable.*=OFF:` Do not compile compression algorithms (reduces library size)
+- `enable.antlr4=OFF:` Do not compile ANTLR4 dependency (reduces library size)
+
+**Library Size Comparison**
+- `Full build:` ~3.2MB
+- `With ANTLR4 disabled:` ~1.9MB
+- `With all compression algorithms disabled:` ~1.7MB
### Directory Structure
@@ -152,8 +173,12 @@ The sample code of using these interfaces is in
<https://github.com/apache/tsfil
columns.emplace_back("id2");
columns.emplace_back("s1");
+ auto table_schema = reader.get_table_schema(table_name);
+ storage::Filter* tag_filter1 =
storage::TagFilterBuilder(table_schema.get()).eq("id1", "id1_filed_1");
+ storage::Filter* tag_filter2 =
storage::TagFilterBuilder(table_schema.get()).eq("id2", "id1_filed_2");
+ storage::Filter* tag_filter =
storage::TagFilterBuilder(table_schema.get()).and_filter(tag_filter1,
tag_filter2);
// Column vector contains the columns you want to select.
- reader.query(table_name, columns, 0, 100, temp_ret);
+ reader.query(table_name, columns, 0, 100, temp_ret, tag_filter);
```
### Query Data
diff --git a/src/UserGuide/latest/QuickStart/QuickStart.md
b/src/UserGuide/latest/QuickStart/QuickStart.md
index 2d329a13..79fe1535 100644
--- a/src/UserGuide/latest/QuickStart/QuickStart.md
+++ b/src/UserGuide/latest/QuickStart/QuickStart.md
@@ -129,7 +129,10 @@ ITsFileReader reader =
### Construct Query Request
```shell
-ResultSet resultSet = reader.query(tableName, Arrays.asList("id1", "id2",
"s1", "s2"), 2, 8)
+TableSchema schema = reader.getTableSchemas(tableName);
+TagFilterBuilder filterBuilder = new TagFilterBuilder(schema);
+ResultSet resultSet = reader.query(tableName, Arrays.asList("id1", "id2",
"s1", "s2"),
+ 2, 8, filterBuilder.eq("id1", "id1_filed_1"));
```
### Query Data
diff --git
a/src/zh/UserGuide/develop/QuickStart/InterfaceDefinition/InterfaceDefinition-CPP.md
b/src/zh/UserGuide/develop/QuickStart/InterfaceDefinition/InterfaceDefinition-CPP.md
index 11ba24bf..c96bcfc6 100644
---
a/src/zh/UserGuide/develop/QuickStart/InterfaceDefinition/InterfaceDefinition-CPP.md
+++
b/src/zh/UserGuide/develop/QuickStart/InterfaceDefinition/InterfaceDefinition-CPP.md
@@ -278,6 +278,22 @@ class TsFileReader {
int query(const std::string &table_name,
const std::vector<std::string> &columns_names, int64_t
start_time,
int64_t end_time, ResultSet *&result_set);
+
+ /**
+ * @brief 通过表名、列名、开始时间、结束时间和标签过滤器查询 tsfile。
+ * 此方法用于通过表模型查询 tsfile。
+ *
+ * @param [in] table_name 表名
+ * @param [in] columns_names 列名
+ * @param [in] start_time 开始时间
+ * @param [in] end_time 结束时间
+ * @param [in] tag_filter 标签过滤器
+ * @param [out] result_set 结果集
+ */
+ int query(const std::string& table_name,
+ const std::vector<std::string>& columns_names, int64_t
start_time,
+ int64_t end_time, ResultSet*& result_set, Filter* tag_filter);
+
/**
* @brief 销毁结果集,该方法应在查询完成并使用完 result_set 后调用。
*
@@ -443,4 +459,32 @@ class ResultSetMetadata {
uint32_t get_column_count();
};
+```
+### Filter
+#### TagFilterBuilder
+用于构建基于Tag的过滤器以查询数据
+```cpp
+class TagFilterBuilder {
+ public:
+ explicit TagFilterBuilder(TableSchema* schema);
+
+ Filter* eq(const std::string& columnName, const std::string& value);
+ Filter* neq(const std::string& columnName, const std::string& value);
+ Filter* lt(const std::string& columnName, const std::string& value);
+ Filter* lteq(const std::string& columnName, const std::string& value);
+ Filter* gt(const std::string& columnName, const std::string& value);
+ Filter* gteq(const std::string& columnName, const std::string& value);
+ Filter* reg_exp(const std::string& columnName, const std::string& value);
+ Filter* not_reg_exp(const std::string& columnName,
+ const std::string& value);
+ Filter* between_and(const std::string& columnName, const std::string&
lower,
+ const std::string& upper);
+ Filter* not_between_and(const std::string& columnName,
+ const std::string& lower, const std::string&
upper);
+
+ // 逻辑操作
+ static Filter* and_filter(Filter* left, Filter* right);
+ static Filter* or_filter(Filter* left, Filter* right);
+ static Filter* not_filter(Filter* filter);
+};
```
\ No newline at end of file
diff --git a/src/zh/UserGuide/develop/QuickStart/QuickStart-C.md
b/src/zh/UserGuide/develop/QuickStart/QuickStart-C.md
index 9574787b..a9f055d1 100644
--- a/src/zh/UserGuide/develop/QuickStart/QuickStart-C.md
+++ b/src/zh/UserGuide/develop/QuickStart/QuickStart-C.md
@@ -51,7 +51,26 @@ mvnw clean install -P with-cpp -DskipTests
```shell
mvnw.cmd clean install -P with-cpp -DskipTests
```
-
+### 编译选项
+TsFile提供编译选项控制生成库的大小:
+```shell
+#最小化编译
+mvn clean install -P with-cpp -DskipTests \
+ -Dbuild.test=OFF \
+ -Denable.snappy=OFF \
+ -Denable.lz4=OFF \
+ -Denable.lzokay=OFF \
+ -Denable.zlib=OFF \
+ -Denable.antlr4=OFF
+```
+**选项说明:**
+- `enable.*=OFF`:不编译压缩算法(减少库体积)
+- `enable.antlr4=OFF`:不编译ANTLR4依赖(减少库体积)
+
+**库大小对比:**
+- 完整编译:约3.2MB
+- 关闭ANTLR4:约1.9MB
+- 关闭所有压缩算法:约1.7MB
### 目录结构
• **Include 目录**: 位于
`tsfile/cpp/target/build/include/cwrapper`,包含用于集成的头文件。将该路径添加到编译器的包含路径中(例如,使用 -I
标志)。
diff --git a/src/zh/UserGuide/develop/QuickStart/QuickStart-CPP.md
b/src/zh/UserGuide/develop/QuickStart/QuickStart-CPP.md
index 597296b4..3a3412e1 100644
--- a/src/zh/UserGuide/develop/QuickStart/QuickStart-CPP.md
+++ b/src/zh/UserGuide/develop/QuickStart/QuickStart-CPP.md
@@ -40,7 +40,26 @@ git clone https://github.com/apache/tsfile.git
mvn clean install -P with-cpp -DskipTests
```
注意:如果 Maven 没有安装,您可以在 Linux 上使用 `mvnw`,或者在 Windows 上使用 `mvnw.cmd`。
-
+### 编译选项
+TsFile提供编译选项控制生成库的大小:
+```shell
+#最小化编译
+mvn clean install -P with-cpp -DskipTests \
+ -Dbuild.test=OFF \
+ -Denable.snappy=OFF \
+ -Denable.lz4=OFF \
+ -Denable.lzokay=OFF \
+ -Denable.zlib=OFF \
+ -Denable.antlr4=OFF
+```
+**选项说明:**
+- `enable.*=OFF`:不编译压缩算法(减少库体积)
+- `enable.antlr4=OFF`:不编译ANTLR4依赖(减少库体积)
+
+**库大小对比:**
+- 完整编译:约3.2MB
+- 关闭ANTLR4:约1.9MB
+- 关闭所有压缩算法:约1.7MB
### 目录结构
• **Include 目录**: 位于
`tsfile/cpp/target/build/include`,包含用于集成的头文件。将该路径添加到编译器的包含路径中(例如,使用 -I 标志)。
@@ -151,8 +170,12 @@ target_link_libraries(your_target ${TSFILE_LIB})
columns.emplace_back("id2");
columns.emplace_back("s1");
+ auto table_schema = reader.get_table_schema(table_name);
+ storage::Filter* tag_filter1 =
storage::TagFilterBuilder(table_schema.get()).eq("id1", "id1_filed_1");
+ storage::Filter* tag_filter2 =
storage::TagFilterBuilder(table_schema.get()).eq("id2", "id1_filed_2");
+ storage::Filter* tag_filter =
storage::TagFilterBuilder(table_schema.get()).and_filter(tag_filter1,
tag_filter2);
// Column vector contains the columns you want to select.
- reader.query(table_name, columns, 0, 100, temp_ret);
+ reader.query(table_name, columns, 0, 100, temp_ret, tag_filter);
```
### 查询数据
diff --git a/src/zh/UserGuide/develop/QuickStart/QuickStart-JAVA.md
b/src/zh/UserGuide/develop/QuickStart/QuickStart-JAVA.md
index 597ab831..1c6a8f87 100644
--- a/src/zh/UserGuide/develop/QuickStart/QuickStart-JAVA.md
+++ b/src/zh/UserGuide/develop/QuickStart/QuickStart-JAVA.md
@@ -129,7 +129,10 @@ ITsFileReader reader =
### 构建查询请求
```shell
-ResultSet resultSet = reader.query(tableName, Arrays.asList("id1", "id2",
"s1", "s2"), 2, 8)
+TableSchema schema = reader.getTableSchemas(tableName);
+TagFilterBuilder filterBuilder = new TagFilterBuilder(schema);
+ResultSet resultSet = reader.query(tableName, Arrays.asList("id1", "id2",
"s1", "s2"),
+ 2, 8, filterBuilder.eq("id1", "id1_filed_1"));
```
### 查询数据
diff --git
a/src/zh/UserGuide/latest/QuickStart/InterfaceDefinition/InterfaceDefinition-CPP.md
b/src/zh/UserGuide/latest/QuickStart/InterfaceDefinition/InterfaceDefinition-CPP.md
index 11ba24bf..c96bcfc6 100644
---
a/src/zh/UserGuide/latest/QuickStart/InterfaceDefinition/InterfaceDefinition-CPP.md
+++
b/src/zh/UserGuide/latest/QuickStart/InterfaceDefinition/InterfaceDefinition-CPP.md
@@ -278,6 +278,22 @@ class TsFileReader {
int query(const std::string &table_name,
const std::vector<std::string> &columns_names, int64_t
start_time,
int64_t end_time, ResultSet *&result_set);
+
+ /**
+ * @brief 通过表名、列名、开始时间、结束时间和标签过滤器查询 tsfile。
+ * 此方法用于通过表模型查询 tsfile。
+ *
+ * @param [in] table_name 表名
+ * @param [in] columns_names 列名
+ * @param [in] start_time 开始时间
+ * @param [in] end_time 结束时间
+ * @param [in] tag_filter 标签过滤器
+ * @param [out] result_set 结果集
+ */
+ int query(const std::string& table_name,
+ const std::vector<std::string>& columns_names, int64_t
start_time,
+ int64_t end_time, ResultSet*& result_set, Filter* tag_filter);
+
/**
* @brief 销毁结果集,该方法应在查询完成并使用完 result_set 后调用。
*
@@ -443,4 +459,32 @@ class ResultSetMetadata {
uint32_t get_column_count();
};
+```
+### Filter
+#### TagFilterBuilder
+用于构建基于Tag的过滤器以查询数据
+```cpp
+class TagFilterBuilder {
+ public:
+ explicit TagFilterBuilder(TableSchema* schema);
+
+ Filter* eq(const std::string& columnName, const std::string& value);
+ Filter* neq(const std::string& columnName, const std::string& value);
+ Filter* lt(const std::string& columnName, const std::string& value);
+ Filter* lteq(const std::string& columnName, const std::string& value);
+ Filter* gt(const std::string& columnName, const std::string& value);
+ Filter* gteq(const std::string& columnName, const std::string& value);
+ Filter* reg_exp(const std::string& columnName, const std::string& value);
+ Filter* not_reg_exp(const std::string& columnName,
+ const std::string& value);
+ Filter* between_and(const std::string& columnName, const std::string&
lower,
+ const std::string& upper);
+ Filter* not_between_and(const std::string& columnName,
+ const std::string& lower, const std::string&
upper);
+
+ // 逻辑操作
+ static Filter* and_filter(Filter* left, Filter* right);
+ static Filter* or_filter(Filter* left, Filter* right);
+ static Filter* not_filter(Filter* filter);
+};
```
\ No newline at end of file
diff --git a/src/zh/UserGuide/latest/QuickStart/QuickStart-C.md
b/src/zh/UserGuide/latest/QuickStart/QuickStart-C.md
index 9574787b..a9f055d1 100644
--- a/src/zh/UserGuide/latest/QuickStart/QuickStart-C.md
+++ b/src/zh/UserGuide/latest/QuickStart/QuickStart-C.md
@@ -51,7 +51,26 @@ mvnw clean install -P with-cpp -DskipTests
```shell
mvnw.cmd clean install -P with-cpp -DskipTests
```
-
+### 编译选项
+TsFile提供编译选项控制生成库的大小:
+```shell
+#最小化编译
+mvn clean install -P with-cpp -DskipTests \
+ -Dbuild.test=OFF \
+ -Denable.snappy=OFF \
+ -Denable.lz4=OFF \
+ -Denable.lzokay=OFF \
+ -Denable.zlib=OFF \
+ -Denable.antlr4=OFF
+```
+**选项说明:**
+- `enable.*=OFF`:不编译压缩算法(减少库体积)
+- `enable.antlr4=OFF`:不编译ANTLR4依赖(减少库体积)
+
+**库大小对比:**
+- 完整编译:约3.2MB
+- 关闭ANTLR4:约1.9MB
+- 关闭所有压缩算法:约1.7MB
### 目录结构
• **Include 目录**: 位于
`tsfile/cpp/target/build/include/cwrapper`,包含用于集成的头文件。将该路径添加到编译器的包含路径中(例如,使用 -I
标志)。
diff --git a/src/zh/UserGuide/latest/QuickStart/QuickStart-CPP.md
b/src/zh/UserGuide/latest/QuickStart/QuickStart-CPP.md
index 597296b4..3a3412e1 100644
--- a/src/zh/UserGuide/latest/QuickStart/QuickStart-CPP.md
+++ b/src/zh/UserGuide/latest/QuickStart/QuickStart-CPP.md
@@ -40,7 +40,26 @@ git clone https://github.com/apache/tsfile.git
mvn clean install -P with-cpp -DskipTests
```
注意:如果 Maven 没有安装,您可以在 Linux 上使用 `mvnw`,或者在 Windows 上使用 `mvnw.cmd`。
-
+### 编译选项
+TsFile提供编译选项控制生成库的大小:
+```shell
+#最小化编译
+mvn clean install -P with-cpp -DskipTests \
+ -Dbuild.test=OFF \
+ -Denable.snappy=OFF \
+ -Denable.lz4=OFF \
+ -Denable.lzokay=OFF \
+ -Denable.zlib=OFF \
+ -Denable.antlr4=OFF
+```
+**选项说明:**
+- `enable.*=OFF`:不编译压缩算法(减少库体积)
+- `enable.antlr4=OFF`:不编译ANTLR4依赖(减少库体积)
+
+**库大小对比:**
+- 完整编译:约3.2MB
+- 关闭ANTLR4:约1.9MB
+- 关闭所有压缩算法:约1.7MB
### 目录结构
• **Include 目录**: 位于
`tsfile/cpp/target/build/include`,包含用于集成的头文件。将该路径添加到编译器的包含路径中(例如,使用 -I 标志)。
@@ -151,8 +170,12 @@ target_link_libraries(your_target ${TSFILE_LIB})
columns.emplace_back("id2");
columns.emplace_back("s1");
+ auto table_schema = reader.get_table_schema(table_name);
+ storage::Filter* tag_filter1 =
storage::TagFilterBuilder(table_schema.get()).eq("id1", "id1_filed_1");
+ storage::Filter* tag_filter2 =
storage::TagFilterBuilder(table_schema.get()).eq("id2", "id1_filed_2");
+ storage::Filter* tag_filter =
storage::TagFilterBuilder(table_schema.get()).and_filter(tag_filter1,
tag_filter2);
// Column vector contains the columns you want to select.
- reader.query(table_name, columns, 0, 100, temp_ret);
+ reader.query(table_name, columns, 0, 100, temp_ret, tag_filter);
```
### 查询数据
diff --git a/src/zh/UserGuide/latest/QuickStart/QuickStart.md
b/src/zh/UserGuide/latest/QuickStart/QuickStart.md
index 597ab831..1c6a8f87 100644
--- a/src/zh/UserGuide/latest/QuickStart/QuickStart.md
+++ b/src/zh/UserGuide/latest/QuickStart/QuickStart.md
@@ -129,7 +129,10 @@ ITsFileReader reader =
### 构建查询请求
```shell
-ResultSet resultSet = reader.query(tableName, Arrays.asList("id1", "id2",
"s1", "s2"), 2, 8)
+TableSchema schema = reader.getTableSchemas(tableName);
+TagFilterBuilder filterBuilder = new TagFilterBuilder(schema);
+ResultSet resultSet = reader.query(tableName, Arrays.asList("id1", "id2",
"s1", "s2"),
+ 2, 8, filterBuilder.eq("id1", "id1_filed_1"));
```
### 查询数据