Merge branch '3.0' of https://github.com/taosdata/TDengine into refact/tsdb_optimize

This commit is contained in:
Hongze Cheng 2022-08-29 15:47:27 +08:00
commit d2621cb657
17 changed files with 1208 additions and 112 deletions

View File

@ -2,7 +2,7 @@
# taos-tools
ExternalProject_Add(taos-tools
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
GIT_TAG e8bfca6
GIT_TAG aa45ad4
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE

View File

@ -3,7 +3,7 @@ title: Introduction
toc_max_heading_level: 2
---
TDengine is an open source, high-performance, cloud native [time-series database](https://tdengine.com/tsdb/) optimized for Internet of Things (IoT), Connected Cars, and Industrial IoT. Its code, including its cluster feature is open source under GNU AGPL v3.0. Besides the database engine, it provides [caching](/develop/cache), [stream processing](/develop/stream), [data subscription](/develop/tmq) and other functionalities to reduce the system complexity and cost of development and operation.
TDengine is an open source, high-performance, cloud native [time-series database](https://tdengine.com/tsdb/) optimized for Internet of Things (IoT), Connected Cars, and Industrial IoT. Its code, including its cluster feature is open source under GNU AGPL v3.0. Besides the database engine, it provides [caching](../develop/cache), [stream processing](../develop/stream), [data subscription](../develop/tmq) and other functionalities to reduce the system complexity and cost of development and operation.
This section introduces the major features, competitive advantages, typical use-cases and benchmarks to help you get a high level overview of TDengine.
@ -12,32 +12,32 @@ This section introduces the major features, competitive advantages, typical use-
The major features are listed below:
1. Insert data
* supports [using SQL to insert](/develop/insert-data/sql-writing).
* supports [schemaless writing](/reference/schemaless/) just like NoSQL databases. It also supports standard protocols like [InfluxDB LINE](/develop/insert-data/influxdb-line)[OpenTSDB Telnet](/develop/insert-data/opentsdb-telnet), [OpenTSDB JSON ](/develop/insert-data/opentsdb-json) among others.
* supports seamless integration with third-party tools like [Telegraf](/third-party/telegraf/), [Prometheus](/third-party/prometheus/), [collectd](/third-party/collectd/), [StatsD](/third-party/statsd/), [TCollector](/third-party/tcollector/) and [icinga2/](/third-party/icinga2/), they can write data into TDengine with simple configuration and without a single line of code.
* supports [using SQL to insert](../develop/insert-data/sql-writing).
* supports [schemaless writing](../reference/schemaless/) just like NoSQL databases. It also supports standard protocols like [InfluxDB LINE](../develop/insert-data/influxdb-line)[OpenTSDB Telnet](../develop/insert-data/opentsdb-telnet), [OpenTSDB JSON ](../develop/insert-data/opentsdb-json) among others.
* supports seamless integration with third-party tools like [Telegraf](../third-party/telegraf/), [Prometheus](../third-party/prometheus/), [collectd](../third-party/collectd/), [StatsD](../third-party/statsd/), [TCollector](../third-party/tcollector/) and [icinga2/](../third-party/icinga2/), they can write data into TDengine with simple configuration and without a single line of code.
2. Query data
* supports standard [SQL](/taos-sql/), including nested query.
* supports [time series specific functions](/taos-sql/function/#time-series-extensions) and [time series specific queries](/taos-sql/distinguished), like downsampling, interpolation, cumulated sum, time weighted average, state window, session window and many others.
* supports [user defined functions](/taos-sql/udf).
3. [Caching](/develop/cache/): TDengine always saves the last data point in cache, so Redis is not needed for time-series data processing.
4. [Stream Processing](/develop/stream/): not only is the continuous query is supported, but TDengine also supports even driven stream processing, so Flink or spark is not needed for time-series daata processing.
5. [Data Dubscription](/develop/tmq/): application can subscribe a table or a set of tables. API is the same as Kafka, but you can specify filter conditions.
* supports standard [SQL](../taos-sql/), including nested query.
* supports [time series specific functions](../taos-sql/function/#time-series-extensions) and [time series specific queries](../taos-sql/distinguished), like downsampling, interpolation, cumulated sum, time weighted average, state window, session window and many others.
* supports [user defined functions](../taos-sql/udf).
3. [Caching](../develop/cache/): TDengine always saves the last data point in cache, so Redis is not needed for time-series data processing.
4. [Stream Processing](../develop/stream/): not only is the continuous query is supported, but TDengine also supports even driven stream processing, so Flink or spark is not needed for time-series daata processing.
5. [Data Dubscription](../develop/tmq/): application can subscribe a table or a set of tables. API is the same as Kafka, but you can specify filter conditions.
6. Visualization
* supports seamless integration with [Grafana](/third-party/grafana/) for visualization.
* supports seamless integration with [Grafana](../third-party/grafana/) for visualization.
* supports seamless integration with Google Data Studio.
7. Cluster
* supports [cluster](/deployment/) with the capability of increasing processing power by adding more nodes.
* supports [deployment on Kubernetes](/deployment/k8s/)
* supports [cluster](../deployment/) with the capability of increasing processing power by adding more nodes.
* supports [deployment on Kubernetes](../deployment/k8s/)
* supports high availability via data replication.
8. Administration
* provides [monitoring](/operation/monitor) on running instances of TDengine.
* provides many ways to [import](/operation/import) and [export](/operation/export) data.
* provides [monitoring](../operation/monitor) on running instances of TDengine.
* provides many ways to [import](../operation/import) and [export](../operation/export) data.
9. Tools
* provides an interactive [command-line interface](/reference/taos-shell) for management, maintenance and ad-hoc queries.
* provides a tool [taosBenchmark](/reference/taosbenchmark/) for testing the performance of TDengine.
* provides an interactive [command-line interface](../reference/taos-shell) for management, maintenance and ad-hoc queries.
* provides a tool [taosBenchmark](../reference/taosbenchmark/) for testing the performance of TDengine.
10. Programming
* provides [connectors](/reference/connector/) for [C/C++](/reference/connector/cpp), [Java](/reference/connector/java), [Python](/reference/connector/python), [Go](/reference/connector/go), [Rust](/reference/connector/rust), [Node.js](/reference/connector/node) and other programming languages.
* provides a [REST API](/reference/rest-api/).
* provides [connectors](../reference/connector/) for [C/C++](../reference/connector/cpp), [Java](../reference/connector/java), [Python](../reference/connector/python), [Go](../reference/connector/go), [Rust](../reference/connector/rust), [Node.js](../reference/connector/node) and other programming languages.
* provides a [REST API](../reference/rest-api/).
For more details on features, please read through the entire documentation.

View File

@ -4,7 +4,7 @@ description: 简要介绍 TDengine 的主要功能
toc_max_heading_level: 2
---
TDengine 是一款[开源](https://www.taosdata.com/tdengine/open_source_time-series_database)、[高性能](https://www.taosdata.com/tdengine/fast)、[云原生](https://www.taosdata.com/tdengine/cloud_native_time-series_database)的<a href="https://www.taosdata.com/" data-internallinksmanager029f6b8e52c="2" title="时序数据库" target="_blank" rel="noopener">时序数据库</a><a href="https://www.taosdata.com/time-series-database" data-internallinksmanager029f6b8e52c="9" title="Time Series DataBase" target="_blank" rel="noopener">Time Series Database</a>, <a href="https://www.taosdata.com/tsdb" data-internallinksmanager029f6b8e52c="8" title="TSDB" target="_blank" rel="noopener">TSDB</a>。TDengine 能被广泛运用于物联网、工业互联网、车联网、IT 运维、金融等领域。除核心的时序数据库功能外TDengine 还提供[缓存](../develop/cache/)、[数据订阅](../develop/tmq)、[流式计算](../develop/stream)等功能,是一极简的时序数据处理平台,最大程度的减小系统设计的复杂度,降低研发和运营成本。
TDengine 是一款开源、高性能、云原生的[时序数据库](https://tdengine.com/tsdb/)且针对物联网、车联网以及工业互联网进行了优化。TDengine 的代码,包括其集群功能,都在 GNU AGPL v3.0 下开源。除核心的时序数据库功能外TDengine 还提供[缓存](../develop/cache/)、[数据订阅](../develop/tmq)、[流式计算](../develop/stream)等其它功能以降低系统复杂度及研发和运维成本。
本章节介绍TDengine的主要功能、竞争优势、适用场景、与其他数据库的对比测试等等让大家对TDengine有个整体的了解。
@ -12,47 +12,70 @@ TDengine 是一款[开源](https://www.taosdata.com/tdengine/open_source_time-se
TDengine的主要功能如下
1. 高速数据写入,除 [SQL 写入](../develop/insert-data/sql-writing)外,还支持 [Schemaless 写入](../reference/schemaless/),支持 [InfluxDB LINE 协议](../develop/insert-data/influxdb-line)[OpenTSDB Telnet](../develop/insert-data/opentsdb-telnet), [OpenTSDB JSON ](../develop/insert-data/opentsdb-json)等协议写入;
2. 第三方数据采集工具 [Telegraf](../third-party/telegraf)[Prometheus](../third-party/prometheus)[StatsD](../third-party/statsd)[collectd](../third-party/collectd)[icinga2](../third-party/icinga2), [TCollector](../third-party/tcollector), [EMQ](../third-party/emq-broker), [HiveMQ](../third-party/hive-mq-broker) 等都可以进行配置后,不用任何代码,即可将数据写入;
3. 支持[各种查询](../develop/query-data),包括聚合查询、嵌套查询、降采样查询、插值等
4. 支持[用户自定义函数](../develop/udf)
5. 支持[缓存](../develop/cache),将每张表的最后一条记录缓存起来,这样无需 Redis
6. 支持[流式计算](../develop/stream)(Stream Processing)
7. 支持[数据订阅](../develop/tmq),而且可以指定过滤条件
8. 支持[集群](../deployment/),可以通过多节点进行水平扩展,并通过多副本实现高可靠
9. 提供[命令行程序](../reference/taos-shell),便于管理集群,检查系统状态,做即席查询
10. 提供多种数据的[导入](../operation/import)、[导出](../operation/export)
11. 支持对[TDengine 集群本身的监控](../operation/monitor)
12. 提供各种语言的[连接器](../connector): 如 C/C++, Java, Go, Node.JS, Rust, Python, C# 等
13. 支持 [REST 接口](../connector/rest-api/)
14. 支持与[ Grafana 无缝集成](../third-party/grafana)
15. 支持与 Google Data Studio 无缝集成
16. 支持 [Kubernetes 部署](../deployment/k8s)
1. 写入数据,支持
- [SQL 写入](../develop/insert-data/sql-writing)
- [Schemaless 写入](../reference/schemaless/),支持多种标准写入协议
- [InfluxDB LINE 协议](../develop/insert-data/influxdb-line)
- [OpenTSDB Telnet 协议](../develop/insert-data/opentsdb-telnet)
- [OpenTSDB JSON 协议](../develop/insert-data/opentsdb-json)
- 与多种第三方工具的无缝集成,它们都可以仅通过配置而无需任何代码即可将数据写入 TDengine
- [Telegraf](../third-party/telegraf)
- [Prometheus](../third-party/prometheus)
- [StatsD](../third-party/statsd)
- [collectd](../third-party/collectd)
- [icinga2](../third-party/icinga2)
- [TCollector](../third-party/tcollector)
- [EMQ](../third-party/emq-broker)
- [HiveMQ](../third-party/hive-mq-broker)
2. 查询数据,支持
- [标准SQL](../taos-sql),含嵌套查询
- [时序数据特色函数](../taos-sql/function/#time-series-extensions)
- [时序顺序特色查询](../taos-sql/distinguished),例如降采样、插值、累加和、时间加权平均、状态窗口、会话窗口等
- [用户自定义函数](../taos-sql/udf)
3. [缓存](../develop/cache),将每张表的最后一条记录缓存起来,这样无需 Redis 就能对时序数据进行高效处理
4. [流式计算](../develop/stream)(Stream Processing)TDengine 不仅支持连续查询,还支持事件驱动的流式计算,这样在处理时序数据时就无需 Flink 或 Spark 这样流计算组件
5. [数据订阅](../develop/tmq)应用程序可以订阅一张表或一组表的数据API 与 Kafka 相同,而且可以指定过滤条件
6. 可视化
- 支持与 [Grafana](../third-party/grafana/) 的无缝集成
- 支持与 Google Data Studio 的无缝集成
7. 集群
- 集群部署(../deployment/),可以通过增加节点进行水平扩展以提升处理能力
- 可以通过 [Kubernets 部署 TDengine](../deployment/k8s/)
- 通过多副本提供高可用能力
8. 管理
- [监控](../operation/monitor)运行中的 TDengine 实例
- 多种[数据导入](../operation/import)方式
- 多种[数据导出](../operation/export)方式
9. 工具
- 提供交互式[命令行程序](../reference/taos-shell),便于管理集群,检查系统状态,做即席查询
- 提供压力测试工具[taosBenchmark](../reference/taosbenchmark),用于测试 TDengine 的性能
10. 编程
- 提供各种语言的[连接器](../connector): 如 [C/C++](../connector/cpp), [Java](../connector/java), [Go](../connector/go), [Node.JS](../connector/node), [Rust](../connector/rust), [Python](../connector/python), [C#](../connector/csharp) 等
- 支持 [REST 接口](../connector/rest-api/)
更多细小的功能,请阅读整个文档。
更多细功能,请阅读整个文档。
## 竞争优势
由于 TDengine 充分利用了[时序数据特点](https://www.taosdata.com/blog/2019/07/09/105.html)比如结构化、无需事务、很少删除或更新、写多读少等等设计了全新的针对时序数据的存储引擎和计算引擎因此与其他时序数据库相比TDengine 有以下特点:
由于 TDengine 充分利用了[时序数据特点](https://www.taosdata.com/blog/2019/07/09/105.html)比如结构化、无需事务、很少删除或更新、写多读少等等因此与其他时序数据库相比TDengine 有以下特点:
- **[高性能](https://www.taosdata.com/tdengine/fast)**通过创新的存储引擎设计无论是数据写入还是查询TDengine 的性能比通用数据库快 10 倍以上也远超其他时序数据库存储空间不及通用数据库的1/10。
- **[高性能](https://www.taosdata.com/tdengine/fast)**TDengine 是唯一一个解决了时序数据存储的高基数难题的时序数据库,支持上亿数据采集点,并在数据插入、查询和数据压缩上远胜其它时序数据库
- **[云原生](https://www.taosdata.com/tdengine/cloud_native_time-series_database)**通过原生分布式的设计充分利用云平台的优势TDengine 提供了水平扩展能力具备弹性、韧性和可观测性支持k8s部署可运行在公有云、私有云和混合云上。
- **[极简时序数据平台](https://www.taosdata.com/tdengine/simplified_solution_for_time-series_data_processing)**TDengine 内建缓存、流式计算和数据订阅等功能,为时序数据的处理提供了极简的解决方案,从而大幅降低了业务系统的设计复杂度和运维成本
- **[极简时序数据平台](https://www.taosdata.com/tdengine/simplified_solution_for_time-series_data_processing)**TDengine 内建消息队列、缓存、流式计算等功能,应用无需再集成 Kafka/Redis/HBase/Spark 等软件,大幅降低系统的复杂度,降低应用开发和运营成本。
- **[云原生](https://www.taosdata.com/tdengine/cloud_native_time-series_database)**通过原生的分布式设计、数据分片和分区、存算分离、RAFT 协议、Kubernets 部署和完整的可观测性TDengine 是一款云原生时序数据库并且能够部署在公有云、私有云和混合云上
- **[分析能力](https://www.taosdata.com/tdengine/easy_data_analytics)**:支持 SQL同时为时序数据特有的分析提供SQL扩展。通过超级表、存储计算分离、分区分片、预计算、自定义函数等技术TDengine 具备强大的分析能力。
- **[简单易用](https://www.taosdata.com/tdengine/ease_of_use)**对系统管理员来说TDengine 大幅降低了管理和维护的代价。对开发者来说, TDengine 提供了简单的接口、极简的解决方案和与第三方工具的无缝集成。对数据分析专家来说TDengine 提供了便捷的数据访问
- **[简单易用](https://www.taosdata.com/tdengine/ease_of_use)**无任何依赖安装、集群几秒搞定提供REST以及各种语言连接器与众多第三方工具无缝集成提供命令行程序便于管理和即席查询提供各种运维工具。
- **[分析能力](https://www.taosdata.com/tdengine/easy_data_analytics)**通过超级表、存储计算分离、分区分片、预计算和其它技术TDengine 能够高效地浏览、格式化和访问数据
- **[核心开源](https://www.taosdata.com/tdengine/open_source_time-series_database)**TDengine 的核心代码包括集群功能全部开源截止到2022年8月1日全球超过 135.9k 个运行实例GitHub Star 18.7kFork 4.4k,社区活跃。
- **[核心开源](https://www.taosdata.com/tdengine/open_source_time-series_database)**TDengine 的核心代码包括集群功能全部在开源协议下公开。全球超过 140k 个运行实例GitHub Star 19k且拥有一个活跃的开发者社区
采用 TDengine可将典型的物联网、车联网、工业互联网大数据平台的总拥有成本大幅降低。表现在几个方面
1. 由于其超强性能,它能将系统需要的计算资源和存储资源大幅降低
2. 因为支持 SQL能与众多第三方软件无缝集成学习迁移成本大幅下降
3. 因为是一极简的时序数据平台,系统复杂度、研发和运营成本大幅降低
4. 因为维护简单,运营维护成本能大幅降低
## 技术生态
@ -67,7 +90,7 @@ TDengine的主要功能如下
上图中,左侧是各种数据采集或消息队列,包括 OPC-UA、MQTT、Telegraf、也包括 Kafka, 他们的数据将被源源不断的写入到 TDengine。右侧则是可视化、BI 工具、组态软件、应用程序。下侧则是 TDengine 自身提供的命令行程序 (CLI) 以及可视化管理管理。
## 总体适用场景
## 典型适用场景
作为一个高性能、分布式、支持 SQL 的时序数据库 Database)TDengine 的典型适用场景包括但不限于 IoT、工业互联网、车联网、IT 运维、能源、金融证券等领域。需要指出的是TDengine 是针对时序数据场景设计的专用数据库和专用大数据处理工具因充分利用了时序大数据的特点它无法用来处理网络爬虫、微博、微信、电商、ERP、CRM 等通用型数据。本文对适用场景做更多详细的分析。

View File

@ -6,11 +6,11 @@ description: TDengine 提供的时序数据特有的查询功能
TDengine 是专为时序数据而研发的大数据平台,存储和计算都针对时序数据的特定进行了量身定制,在支持标准 SQL 的基础之上,还提供了一系列贴合时序业务场景的特色查询语法,极大的方便时序场景的应用开发。
TDengine 提供的特色查询包括标签切分查询和窗口切分查询。
TDengine 提供的特色查询包括数据切分查询和窗口切分查询。
## 标签切分查询
## 数据切分查询
超级表查询中,当需要针对标签进行数据切分然后在切分出的数据空间内再进行一系列的计算时使用标签切分子句,标签切分的语句如下:
当需要按一定的维度对数据进行切分然后在切分出的数据空间内再进行一系列的计算时使用数据切分子句,数据切分语句的语法如下:
```sql
PARTITION BY part_list
@ -18,22 +18,23 @@ PARTITION BY part_list
part_list 可以是任意的标量表达式,包括列、常量、标量函数和它们的组合。
当 PARTITION BY 和标签一起使用时TDengine 按如下方式处理标签切分子句:
TDengine 按如下方式处理数据切分子句:
- 标签切分子句位于 WHERE 子句之后,且不能和 JOIN 子句一起使用
- 标签切分子句将超级表数据按指定的标签组合进行切分每个切分的分片进行指定的计算。计算由之后的子句定义窗口子句、GROUP BY 子句或 SELECT 子句)。
- 标签切分子句可以和窗口切分子句(或 GROUP BY 子句)一起使用,此时后面的子句作用在每个切分的分片上。例如,将数据按标签 location 进行分组,并对每个组按 10 分钟进行降采样,取其最大值。
- 数据切分子句位于 WHERE 子句之后
- 数据切分子句将表数据按指定的维度进行切分每个切分的分片进行指定的计算。计算由之后的子句定义窗口子句、GROUP BY 子句或 SELECT 子句)。
- 数据切分子句可以和窗口切分子句(或 GROUP BY 子句)一起使用,此时后面的子句作用在每个切分的分片上。例如,将数据按标签 location 进行分组,并对每个组按 10 分钟进行降采样,取其最大值。
```sql
select max(current) from meters partition by location interval(10m)
```
数据切分子句最常见的用法就是在超级表查询中,按标签将子表数据进行切分,然后分别进行计算。特别是 PARTITION BY TBNAME 用法,它将每个子表的数据独立出来,形成一条条独立的时间序列,极大的方便了各种时序场景的统计分析。
## 窗口切分查询
TDengine 支持按时间段窗口切分方式进行聚合结果查询,比如温度传感器每秒采集一次数据,但需查询每隔 10 分钟的温度平均值。这种场景下可以使用窗口子句来获得需要的查询结果。窗口子句用于针对查询的数据集合按照窗口切分成为查询子集并进行聚合窗口包含时间窗口time window、状态窗口status window、会话窗口session window三种窗口。其中时间窗口又可划分为滑动时间窗口和翻转时间窗口。窗口切分查询语法如下
```sql
SELECT function_list FROM tb_name
SELECT select_list FROM tb_name
[WHERE where_condition]
[SESSION(ts_col, tol_val)]
[STATE_WINDOW(col)]
@ -43,19 +44,15 @@ SELECT function_list FROM tb_name
在上述语法中的具体限制如下
### 窗口切分查询中使用函数的限制
- 在聚合查询中function_list 位置允许使用聚合和选择函数并要求每个函数仅输出单个结果例如COUNT、AVG、SUM、STDDEV、LEASTSQUARES、PERCENTILE、MIN、MAX、FIRST、LAST而不能使用具有多行输出结果的函数例如DIFF 以及四则运算)。
- 此外 LAST_ROW 查询也不能与窗口聚合同时出现。
- 标量函数CEIL/FLOOR 等)也不能使用在窗口聚合查询中。
### 窗口子句的规则
- 窗口子句位于标签切分子句之后GROUP BY 子句之前,且不可以和 GROUP BY 子句一起使用。
- 窗口子句位于数据切分子句之后GROUP BY 子句之前,且不可以和 GROUP BY 子句一起使用。
- 窗口子句将数据按窗口进行切分,对每个窗口进行 SELECT 列表中的表达式的计算SELECT 列表中的表达式只能包含:
- 常量。
- 聚集函数。
- _wstart伪列、_wend伪列和_wduration伪列。
- 聚集函数(包括选择函数和可以由参数确定输出行数的时序特有函数)。
- 包含上面表达式的表达式。
- 且至少包含一个聚集函数。
- 窗口子句不可以和 GROUP BY 子句一起使用。
- WHERE 语句可以指定查询的起止时间和其他过滤条件。
@ -74,7 +71,7 @@ FILL 语句指定某一窗口区间数据缺失的情况下的填充模式。填
1. 使用 FILL 语句的时候可能生成大量的填充输出,务必指定查询的时间区间。针对每次查询,系统可返回不超过 1 千万条具有插值的结果。
2. 在时间维度聚合中,返回的结果中时间序列严格单调递增。
3. 如果查询对象是超级表,则聚合函数会作用于该超级表下满足值过滤条件的所有表的数据。如果查询中没有使用 GROUP BY 语句,则返回的结果按照时间序列严格单调递增;如果查询中使用了 GROUP BY 语句分组,则返回结果中每个 GROUP 内不按照时间序列严格单调递增。
3. 如果查询对象是超级表,则聚合函数会作用于该超级表下满足值过滤条件的所有表的数据。如果查询中没有使用 PARTITION BY 语句,则返回的结果按照时间序列严格单调递增;如果查询中使用了 PARTITION BY 语句分组,则返回结果中每个 PARTITION 内不按照时间序列严格单调递增。
:::
@ -106,7 +103,7 @@ SELECT COUNT(*) FROM temp_tb_1 INTERVAL(1m) SLIDING(2m);
### 状态窗口
使用整数(布尔值)或字符串来标识产生记录时候设备的状态量。产生的记录如果具有相同的状态量数值则归属于同一个状态窗口,数值改变后该窗口关闭。如下图所示,根据状态量确定的状态窗口分别是[2019-04-28 14:22:072019-04-28 14:22:10]和[2019-04-28 14:22:112019-04-28 14:22:12]两个。(状态窗口暂不支持对超级表使用)
使用整数(布尔值)或字符串来标识产生记录时候设备的状态量。产生的记录如果具有相同的状态量数值则归属于同一个状态窗口,数值改变后该窗口关闭。如下图所示,根据状态量确定的状态窗口分别是[2019-04-28 14:22:072019-04-28 14:22:10]和[2019-04-28 14:22:112019-04-28 14:22:12]两个。
![TDengine Database 时间窗口示意图](./timewindow-3.webp)
@ -122,7 +119,7 @@ SELECT COUNT(*), FIRST(ts), status FROM temp_tb_1 STATE_WINDOW(status);
![TDengine Database 时间窗口示意图](./timewindow-2.webp)
在 tol_value 时间间隔范围内的结果都认为归属于同一个窗口,如果连续的两条记录的时间超过 tol_val则自动开启下一个窗口。(会话窗口暂不支持对超级表使用)
在 tol_value 时间间隔范围内的结果都认为归属于同一个窗口,如果连续的两条记录的时间超过 tol_val则自动开启下一个窗口。
```

View File

@ -105,6 +105,97 @@ int32_t compareStrPatternNotMatch(const void *pLeft, const void *pRight);
int32_t compareWStrPatternMatch(const void *pLeft, const void *pRight);
int32_t compareWStrPatternNotMatch(const void *pLeft, const void *pRight);
int32_t compareInt8Int16(const void *pLeft, const void *pRight);
int32_t compareInt8Int32(const void *pLeft, const void *pRight);
int32_t compareInt8Int64(const void *pLeft, const void *pRight);
int32_t compareInt8Float(const void *pLeft, const void *pRight);
int32_t compareInt8Double(const void *pLeft, const void *pRight);
int32_t compareInt8Uint8(const void *pLeft, const void *pRight);
int32_t compareInt8Uint16(const void *pLeft, const void *pRight);
int32_t compareInt8Uint32(const void *pLeft, const void *pRight);
int32_t compareInt8Uint64(const void *pLeft, const void *pRight);
int32_t compareInt16Int8(const void *pLeft, const void *pRight);
int32_t compareInt16Int32(const void *pLeft, const void *pRight);
int32_t compareInt16Int64(const void *pLeft, const void *pRight);
int32_t compareInt16Float(const void *pLeft, const void *pRight);
int32_t compareInt16Double(const void *pLeft, const void *pRight);
int32_t compareInt16Uint8(const void *pLeft, const void *pRight);
int32_t compareInt16Uint16(const void *pLeft, const void *pRight);
int32_t compareInt16Uint32(const void *pLeft, const void *pRight);
int32_t compareInt16Uint64(const void *pLeft, const void *pRight);
int32_t compareInt32Int8(const void *pLeft, const void *pRight);
int32_t compareInt32Int16(const void *pLeft, const void *pRight);
int32_t compareInt32Int64(const void *pLeft, const void *pRight);
int32_t compareInt32Float(const void *pLeft, const void *pRight);
int32_t compareInt32Double(const void *pLeft, const void *pRight);
int32_t compareInt32Uint8(const void *pLeft, const void *pRight);
int32_t compareInt32Uint16(const void *pLeft, const void *pRight);
int32_t compareInt32Uint32(const void *pLeft, const void *pRight);
int32_t compareInt32Uint64(const void *pLeft, const void *pRight);
int32_t compareInt64Int8(const void *pLeft, const void *pRight);
int32_t compareInt64Int16(const void *pLeft, const void *pRight);
int32_t compareInt64Int32(const void *pLeft, const void *pRight);
int32_t compareInt64Float(const void *pLeft, const void *pRight);
int32_t compareInt64Double(const void *pLeft, const void *pRight);
int32_t compareInt64Uint8(const void *pLeft, const void *pRight);
int32_t compareInt64Uint16(const void *pLeft, const void *pRight);
int32_t compareInt64Uint32(const void *pLeft, const void *pRight);
int32_t compareInt64Uint64(const void *pLeft, const void *pRight);
int32_t compareFloatInt8(const void *pLeft, const void *pRight);
int32_t compareFloatInt16(const void *pLeft, const void *pRight);
int32_t compareFloatInt32(const void *pLeft, const void *pRight);
int32_t compareFloatInt64(const void *pLeft, const void *pRight);
int32_t compareFloatDouble(const void *pLeft, const void *pRight);
int32_t compareFloatUint8(const void *pLeft, const void *pRight);
int32_t compareFloatUint16(const void *pLeft, const void *pRight);
int32_t compareFloatUint32(const void *pLeft, const void *pRight);
int32_t compareFloatUint64(const void *pLeft, const void *pRight);
int32_t compareDoubleInt8(const void *pLeft, const void *pRight);
int32_t compareDoubleInt16(const void *pLeft, const void *pRight);
int32_t compareDoubleInt32(const void *pLeft, const void *pRight);
int32_t compareDoubleInt64(const void *pLeft, const void *pRight);
int32_t compareDoubleFloat(const void *pLeft, const void *pRight);
int32_t compareDoubleUint8(const void *pLeft, const void *pRight);
int32_t compareDoubleUint16(const void *pLeft, const void *pRight);
int32_t compareDoubleUint32(const void *pLeft, const void *pRight);
int32_t compareDoubleUint64(const void *pLeft, const void *pRight);
int32_t compareUint8Int8(const void *pLeft, const void *pRight);
int32_t compareUint8Int16(const void *pLeft, const void *pRight);
int32_t compareUint8Int32(const void *pLeft, const void *pRight);
int32_t compareUint8Int64(const void *pLeft, const void *pRight);
int32_t compareUint8Float(const void *pLeft, const void *pRight);
int32_t compareUint8Double(const void *pLeft, const void *pRight);
int32_t compareUint8Uint16(const void *pLeft, const void *pRight);
int32_t compareUint8Uint32(const void *pLeft, const void *pRight);
int32_t compareUint8Uint64(const void *pLeft, const void *pRight);
int32_t compareUint16Int8(const void *pLeft, const void *pRight);
int32_t compareUint16Int16(const void *pLeft, const void *pRight);
int32_t compareUint16Int32(const void *pLeft, const void *pRight);
int32_t compareUint16Int64(const void *pLeft, const void *pRight);
int32_t compareUint16Float(const void *pLeft, const void *pRight);
int32_t compareUint16Double(const void *pLeft, const void *pRight);
int32_t compareUint16Uint8(const void *pLeft, const void *pRight);
int32_t compareUint16Uint32(const void *pLeft, const void *pRight);
int32_t compareUint16Uint64(const void *pLeft, const void *pRight);
int32_t compareUint32Int8(const void *pLeft, const void *pRight);
int32_t compareUint32Int16(const void *pLeft, const void *pRight);
int32_t compareUint32Int32(const void *pLeft, const void *pRight);
int32_t compareUint32Int64(const void *pLeft, const void *pRight);
int32_t compareUint32Float(const void *pLeft, const void *pRight);
int32_t compareUint32Double(const void *pLeft, const void *pRight);
int32_t compareUint32Uint8(const void *pLeft, const void *pRight);
int32_t compareUint32Uint16(const void *pLeft, const void *pRight);
int32_t compareUint32Uint64(const void *pLeft, const void *pRight);
int32_t compareUint64Int8(const void *pLeft, const void *pRight);
int32_t compareUint64Int16(const void *pLeft, const void *pRight);
int32_t compareUint64Int32(const void *pLeft, const void *pRight);
int32_t compareUint64Int64(const void *pLeft, const void *pRight);
int32_t compareUint64Float(const void *pLeft, const void *pRight);
int32_t compareUint64Double(const void *pLeft, const void *pRight);
int32_t compareUint64Uint8(const void *pLeft, const void *pRight);
int32_t compareUint64Uint16(const void *pLeft, const void *pRight);
int32_t compareUint64Uint32(const void *pLeft, const void *pRight);
__compar_fn_t getComparFunc(int32_t type, int32_t optr);
__compar_fn_t getKeyComparFunc(int32_t keyType, int32_t order);
int32_t doCompare(const char *a, const char *b, int32_t type, size_t size);

View File

@ -1,6 +1,7 @@
def sync_source(branch_name) {
sh '''
hostname
IP
env
echo ''' + branch_name + '''
'''
@ -15,6 +16,7 @@ def sync_source(branch_name) {
cd ${TDENGINE_ROOT_DIR}
git reset --hard
git fetch || git fetch
rm -rf examples/rust/
git checkout ''' + branch_name + ''' -f
git branch
git pull || git pull
@ -53,6 +55,16 @@ pipeline {
defaultValue:'3.0.0.1',
description: 'This number of baseVerison is generally not modified.Now it is 3.0.0.1'
)
string (
name:'toolsVersion',
defaultValue:'2.1.2',
description: 'This number of baseVerison is generally not modified.Now it is 3.0.0.1'
)
string (
name:'toolsBaseVersion',
defaultValue:'2.1.2',
description: 'This number of baseVerison is generally not modified.Now it is 3.0.0.1'
)
}
environment{
WORK_DIR = '/var/lib/jenkins/workspace'
@ -86,26 +98,18 @@ pipeline {
TD_CLIENT_EXE = "TDengine-client-${version}-Windows-x64.exe"
TD_TOOLS_TAR = "taosTools-${toolsVersion}-Linux-x64.tar.gz"
}
stages {
stage ('RUN') {
stage('get check package scritps'){
agent{label 'ubuntu18'}
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
script{
sync_source("${BRANCH_NAME}")
}
}
}
}
parallel {
stage('ubuntu16') {
agent{label " ubuntu16 "}
steps {
timeout(time: 3, unit: 'MINUTES'){
timeout(time: 10, unit: 'MINUTES'){
sync_source("${BRANCH_NAME}")
sh '''
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
@ -128,7 +132,8 @@ pipeline {
stage('ubuntu18') {
agent{label " ubuntu18 "}
steps {
timeout(time: 3, unit: 'MINUTES'){
timeout(time: 10, unit: 'MINUTES'){
sync_source("${BRANCH_NAME}")
sh '''
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
@ -151,7 +156,8 @@ pipeline {
stage('centos7') {
agent{label " centos7_9 "}
steps {
timeout(time: 240, unit: 'MINUTES'){
timeout(time: 10, unit: 'MINUTES'){
sync_source("${BRANCH_NAME}")
sh '''
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
@ -161,6 +167,7 @@ pipeline {
sh '''
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server
bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server
python3 checkPackageRuning.py
'''
sh '''
@ -174,7 +181,8 @@ pipeline {
stage('centos8') {
agent{label " centos8_3 "}
steps {
timeout(time: 240, unit: 'MINUTES'){
timeout(time: 10, unit: 'MINUTES'){
sync_source("${BRANCH_NAME}")
sh '''
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server

View File

@ -22,10 +22,12 @@ import time
# install taospy
out = subprocess.getoutput("pip3 show taospy|grep Version| awk -F ':' '{print $2}' ")
print(out)
print("taospy version %s "%out)
if (out == "" ):
os.system("pip install git+https://github.com/taosdata/taos-connector-python.git")
print("install taos python connector")
else:
os.system("pip3 install --upgrade taospy ")

View File

@ -1,8 +1,32 @@
#!/bin/sh
# function installPkgAndCheckFile{
# # ============================= get input parameters =================================================
echo "Download package"
# # install.sh -v [server | client] -e [yes | no] -i [systemd | service | ...]
# # set parameters by default value
# interactiveFqdn=yes # [yes | no]
# verType=server # [server | client]
# initType=systemd # [systemd | service | ...]
# while getopts "hv:d:" arg
# do
# case $arg in
# d)
# #echo "interactiveFqdn=$OPTARG"
# script_dir=$( echo $OPTARG )
# ;;
# h)
# echo "Usage: `basename $0` -d scripy_path"
# exit 0
# ;;
# ?) #unknow option
# echo "unkonw argument"
# exit 1
# ;;
# esac
# done
# echo "Download package"
packgeName=$1
version=$2
@ -25,22 +49,42 @@ elif [ ${testFile} = "tools" ];then
installCmd="install-taostools.sh"
fi
function cmdInstall {
comd=$1
if command -v ${comd} ;then
echo "${comd} is already installed"
else
if command -v apt ;then
apt-get install ${comd}
elif command -v yum ;then
yum install ${comd}
else
echo "you should install ${comd} manually"
fi
fi
}
echo "Uninstall all components of TDeingne"
if command -v rmtaos ;then
echo "uninstall all components of TDeingne:rmtaos"
echo " "
rmtaos
else
echo "os doesn't include TDengine "
fi
if command -v rmtaostools ;then
echo "uninstall all components of TDeingne:rmtaostools"
echo " "
rmtaostools
else
echo "os doesn't include rmtaostools "
fi
cmdInstall tree
cmdInstall wget
echo "new workroom path"
installPath="/usr/local/src/packageTest"
oriInstallPath="/usr/local/src/packageTest/3.1"
@ -104,6 +148,11 @@ elif [[ ${packgeName} =~ "tar" ]];then
else
bash ${installCmd}
fi
if [[ ${packgeName} =~ "Lite" ]];then
cd ${installPath}
wget https://www.taosdata.com/assets-download/3.0/taosTools-2.1.2-Linux-x64.tar.gz
tar xvf taosTools-2.1.2-Linux-x64.tar.gz
cd taosTools-2.1.2 && bash install-taostools.sh
fi
# }

View File

@ -27,11 +27,18 @@ else()
INCLUDE_DIRECTORIES(jni/linux)
endif()
set_target_properties(
taos
PROPERTIES
CLEAN_DIRECT_OUTPUT
1
)
set_target_properties(
taos
PROPERTIES
VERSION ${TD_VER_NUMBER}
SOVERSION ${TD_VER_NUMBER}
SOVERSION 1
)
add_library(taos_static STATIC ${CLIENT_SRC})

View File

@ -5001,7 +5001,7 @@ static int32_t checkCreateStream(STranslateContext* pCxt, SCreateStreamStmt* pSt
return TSDB_CODE_SUCCESS;
}
if (QUERY_NODE_SELECT_STMT != nodeType(pStmt->pQuery) ||
if (QUERY_NODE_SELECT_STMT != nodeType(pStmt->pQuery) || NULL == ((SSelectStmt*)pStmt->pQuery)->pFromTable ||
QUERY_NODE_REAL_TABLE != nodeType(((SSelectStmt*)pStmt->pQuery)->pFromTable)) {
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Unsupported stream query");
}

View File

@ -1084,7 +1084,7 @@ static int32_t sortPriKeyOptGetSequencingNodesImpl(SLogicNode* pNode, bool* pNot
switch (nodeType(pNode)) {
case QUERY_NODE_LOGIC_PLAN_SCAN: {
SScanLogicNode* pScan = (SScanLogicNode*)pNode;
if (NULL != pScan->pGroupTags) {
if (NULL != pScan->pGroupTags || TSDB_SYSTEM_TABLE == pScan->tableType) {
*pNotOptimize = true;
return TSDB_CODE_SUCCESS;
}

View File

@ -350,6 +350,7 @@ struct SFilterInfo {
extern bool filterDoCompare(__compar_fn_t func, uint8_t optr, void *left, void *right);
extern __compar_fn_t filterGetCompFunc(int32_t type, int32_t optr);
extern __compar_fn_t filterGetCompFuncEx(int32_t lType, int32_t rType, int32_t optr);
#ifdef __cplusplus
}

View File

@ -47,6 +47,7 @@ typedef struct SScalarCtx {
#define SCL_IS_NULL_VALUE_NODE(_node) ((QUERY_NODE_VALUE == nodeType(_node)) && (TSDB_DATA_TYPE_NULL == ((SValueNode *)_node)->node.resType.type))
#define SCL_IS_COMPARISON_OPERATOR(_opType) ((_opType) >= OP_TYPE_GREATER_THAN && (_opType) < OP_TYPE_IS_NOT_UNKNOWN)
#define SCL_DOWNGRADE_DATETYPE(_type) ((_type) == TSDB_DATA_TYPE_BIGINT || TSDB_DATA_TYPE_DOUBLE == (_type) || (_type) == TSDB_DATA_TYPE_UBIGINT)
#define SCL_NO_NEED_CONVERT_COMPARISION(_ltype, _rtype, _optr) (IS_NUMERIC_TYPE(_ltype) && IS_NUMERIC_TYPE(_rtype) && ((_optr) >= OP_TYPE_GREATER_THAN && (_optr) <= OP_TYPE_NOT_EQUAL))
#define sclFatal(...) qFatal(__VA_ARGS__)
#define sclError(...) qError(__VA_ARGS__)

View File

@ -132,6 +132,77 @@ __compar_fn_t gDataCompare[] = {compareInt32Val, compareInt8Val, compareInt16Val
compareChkNotInString, compareStrPatternNotMatch, compareWStrPatternNotMatch
};
__compar_fn_t gInt8SignCompare[] = {
compareInt8Val, compareInt8Int16, compareInt8Int32, compareInt8Int64, compareInt8Float, compareInt8Double
};
__compar_fn_t gInt8UsignCompare[] = {
compareInt8Uint8, compareInt8Uint16, compareInt8Uint32, compareInt8Uint64
};
__compar_fn_t gInt16SignCompare[] = {
compareInt16Int8, compareInt16Val, compareInt16Int32, compareInt16Int64, compareInt16Float, compareInt16Double
};
__compar_fn_t gInt16UsignCompare[] = {
compareInt16Uint8, compareInt16Uint16, compareInt16Uint32, compareInt16Uint64
};
__compar_fn_t gInt32SignCompare[] = {
compareInt32Int8, compareInt32Int16, compareInt32Val, compareInt32Int64, compareInt32Float, compareInt32Double
};
__compar_fn_t gInt32UsignCompare[] = {
compareInt32Uint8, compareInt32Uint16, compareInt32Uint32, compareInt32Uint64
};
__compar_fn_t gInt64SignCompare[] = {
compareInt64Int8, compareInt64Int16, compareInt64Int32, compareInt64Val, compareInt64Float, compareInt64Double
};
__compar_fn_t gInt64UsignCompare[] = {
compareInt64Uint8, compareInt64Uint16, compareInt64Uint32, compareInt64Uint64
};
__compar_fn_t gFloatSignCompare[] = {
compareFloatInt8, compareFloatInt16, compareFloatInt32, compareFloatInt64, compareFloatVal, compareFloatDouble
};
__compar_fn_t gFloatUsignCompare[] = {
compareFloatUint8, compareFloatUint16, compareFloatUint32, compareFloatUint64
};
__compar_fn_t gDoubleSignCompare[] = {
compareDoubleInt8, compareDoubleInt16, compareDoubleInt32, compareDoubleInt64, compareDoubleFloat, compareDoubleVal
};
__compar_fn_t gDoubleUsignCompare[] = {
compareDoubleUint8, compareDoubleUint16, compareDoubleUint32, compareDoubleUint64
};
__compar_fn_t gUint8SignCompare[] = {
compareUint8Int8, compareUint8Int16, compareUint8Int32, compareUint8Int64, compareUint8Float, compareUint8Double
};
__compar_fn_t gUint8UsignCompare[] = {
compareUint8Val, compareUint8Uint16, compareUint8Uint32, compareUint8Uint64
};
__compar_fn_t gUint16SignCompare[] = {
compareUint16Int8, compareUint16Int16, compareUint16Int32, compareUint16Int64, compareUint16Float, compareUint16Double
};
__compar_fn_t gUint16UsignCompare[] = {
compareUint16Uint8, compareUint16Val, compareUint16Uint32, compareUint16Uint64
};
__compar_fn_t gUint32SignCompare[] = {
compareUint32Int8, compareUint32Int16, compareUint32Int32, compareUint32Int64, compareUint32Float, compareUint32Double
};
__compar_fn_t gUint32UsignCompare[] = {
compareUint32Uint8, compareUint32Uint16, compareUint32Val, compareUint32Uint64
};
__compar_fn_t gUint64SignCompare[] = {
compareUint64Int8, compareUint64Int16, compareUint64Int32, compareUint64Int64, compareUint64Float, compareUint64Double
};
__compar_fn_t gUint64UsignCompare[] = {
compareUint64Uint8, compareUint64Uint16, compareUint64Uint32, compareUint64Val
};
int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) {
int8_t comparFn = 0;
@ -257,6 +328,93 @@ __compar_fn_t filterGetCompFunc(int32_t type, int32_t optr) {
return gDataCompare[filterGetCompFuncIdx(type, optr)];
}
__compar_fn_t filterGetCompFuncEx(int32_t lType, int32_t rType, int32_t optr) {
switch (lType) {
case TSDB_DATA_TYPE_TINYINT: {
if (IS_SIGNED_NUMERIC_TYPE(rType) || IS_FLOAT_TYPE(rType)) {
return gInt8SignCompare[rType - TSDB_DATA_TYPE_TINYINT];
} else {
return gInt8UsignCompare[rType - TSDB_DATA_TYPE_UTINYINT];
}
break;
}
case TSDB_DATA_TYPE_SMALLINT: {
if (IS_SIGNED_NUMERIC_TYPE(rType) || IS_FLOAT_TYPE(rType)) {
return gInt16SignCompare[rType - TSDB_DATA_TYPE_TINYINT];
} else {
return gInt16UsignCompare[rType - TSDB_DATA_TYPE_UTINYINT];
}
break;
}
case TSDB_DATA_TYPE_INT: {
if (IS_SIGNED_NUMERIC_TYPE(rType) || IS_FLOAT_TYPE(rType)) {
return gInt32SignCompare[rType - TSDB_DATA_TYPE_TINYINT];
} else {
return gInt32UsignCompare[rType - TSDB_DATA_TYPE_UTINYINT];
}
break;
}
case TSDB_DATA_TYPE_BIGINT: {
if (IS_SIGNED_NUMERIC_TYPE(rType) || IS_FLOAT_TYPE(rType)) {
return gInt64SignCompare[rType - TSDB_DATA_TYPE_TINYINT];
} else {
return gInt64UsignCompare[rType - TSDB_DATA_TYPE_UTINYINT];
}
break;
}
case TSDB_DATA_TYPE_FLOAT: {
if (IS_SIGNED_NUMERIC_TYPE(rType) || IS_FLOAT_TYPE(rType)) {
return gFloatSignCompare[rType - TSDB_DATA_TYPE_TINYINT];
} else {
return gFloatUsignCompare[rType - TSDB_DATA_TYPE_UTINYINT];
}
break;
}
case TSDB_DATA_TYPE_DOUBLE: {
if (IS_SIGNED_NUMERIC_TYPE(rType) || IS_FLOAT_TYPE(rType)) {
return gDoubleSignCompare[rType - TSDB_DATA_TYPE_TINYINT];
} else {
return gDoubleUsignCompare[rType - TSDB_DATA_TYPE_UTINYINT];
}
break;
}
case TSDB_DATA_TYPE_UTINYINT: {
if (IS_SIGNED_NUMERIC_TYPE(rType) || IS_FLOAT_TYPE(rType)) {
return gUint8SignCompare[rType - TSDB_DATA_TYPE_TINYINT];
} else {
return gUint8UsignCompare[rType - TSDB_DATA_TYPE_UTINYINT];
}
break;
}
case TSDB_DATA_TYPE_USMALLINT: {
if (IS_SIGNED_NUMERIC_TYPE(rType) || IS_FLOAT_TYPE(rType)) {
return gUint16SignCompare[rType - TSDB_DATA_TYPE_TINYINT];
} else {
return gUint16UsignCompare[rType - TSDB_DATA_TYPE_UTINYINT];
}
break;
}
case TSDB_DATA_TYPE_UINT: {
if (IS_SIGNED_NUMERIC_TYPE(rType) || IS_FLOAT_TYPE(rType)) {
return gUint32SignCompare[rType - TSDB_DATA_TYPE_TINYINT];
} else {
return gUint32UsignCompare[rType - TSDB_DATA_TYPE_UTINYINT];
}
break;
}
case TSDB_DATA_TYPE_UBIGINT: {
if (IS_SIGNED_NUMERIC_TYPE(rType) || IS_FLOAT_TYPE(rType)) {
return gUint64SignCompare[rType - TSDB_DATA_TYPE_TINYINT];
} else {
return gUint64UsignCompare[rType - TSDB_DATA_TYPE_UTINYINT];
}
break;
}
default:
break;
}
return NULL;
}
static FORCE_INLINE int32_t filterCompareGroupCtx(const void *pLeft, const void *pRight) {
SFilterGroupCtx *left = *((SFilterGroupCtx**)pLeft), *right = *((SFilterGroupCtx**)pRight);

View File

@ -909,11 +909,11 @@ int32_t vectorConvertImpl(const SScalarParam* pIn, SScalarParam* pOut, int32_t*
int8_t gConvertTypes[TSDB_DATA_TYPE_BLOB+1][TSDB_DATA_TYPE_BLOB+1] = {
/* NULL BOOL TINY SMAL INT BIG FLOA DOUB VARC TIME NCHA UTIN USMA UINT UBIG JSON VARB DECI BLOB */
/*NULL*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/*BOOL*/ 0, 0, 0, 3, 4, 5, 6, 7, 7, 9, 7, 0, 12, 13, 14, 0, 7, 0, 0,
/*BOOL*/ 0, 0, 2, 3, 4, 5, 6, 7, 7, 9, 7, 11, 12, 13, 14, 0, 7, 0, 0,
/*TINY*/ 0, 0, 0, 3, 4, 5, 6, 7, 7, 9, 7, 3, 4, 5, 7, 0, 7, 0, 0,
/*SMAL*/ 0, 0, 0, 0, 4, 5, 6, 7, 7, 9, 7, 3, 4, 5, 7, 0, 7, 0, 0,
/*INT */ 0, 0, 0, 0, 0, 5, 6, 7, 7, 9, 7, 4, 4, 5, 7, 0, 7, 0, 0,
/*BIGI*/ 0, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 5, 5, 5, 7, 0, 7, 0, 0,
/*BIGI*/ 0, 0, 0, 0, 0, 0, 6, 7, 7, 9, 7, 5, 5, 5, 7, 0, 7, 0, 0,
/*FLOA*/ 0, 0, 0, 0, 0, 0, 0, 7, 7, 6, 7, 6, 6, 6, 6, 0, 7, 0, 0,
/*DOUB*/ 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 0, 7, 0, 0,
/*VARC*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 8, 7, 7, 7, 7, 0, 0, 0, 0,
@ -1681,10 +1681,14 @@ void vectorBitOr(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut, int32_t _ord, int32_t optr) {
int32_t i = ((_ord) == TSDB_ORDER_ASC) ? 0 : TMAX(pLeft->numOfRows, pRight->numOfRows) - 1;
int32_t step = ((_ord) == TSDB_ORDER_ASC) ? 1 : -1;
int32_t lType = GET_PARAM_TYPE(pLeft);
int32_t rType = GET_PARAM_TYPE(pRight);
__compar_fn_t fp = NULL;
__compar_fn_t fp = filterGetCompFunc(GET_PARAM_TYPE(pLeft), optr);
if(terrno != TSDB_CODE_SUCCESS){
return;
if (lType == rType) {
fp = filterGetCompFunc(lType, optr);
} else {
fp = filterGetCompFuncEx(lType, rType, optr);
}
pOut->numOfRows = TMAX(pLeft->numOfRows, pRight->numOfRows);
@ -1716,12 +1720,15 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
void vectorCompare(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut, int32_t _ord, int32_t optr) {
SScalarParam pLeftOut = {0};
SScalarParam pRightOut = {0};
vectorConvert(pLeft, pRight, &pLeftOut, &pRightOut);
SScalarParam *param1 = NULL;
SScalarParam *param2 = NULL;
if (SCL_NO_NEED_CONVERT_COMPARISION(GET_PARAM_TYPE(pLeft), GET_PARAM_TYPE(pRight), optr)) {
param1 = pLeft;
param2 = pRight;
} else {
vectorConvert(pLeft, pRight, &pLeftOut, &pRightOut);
if (pLeftOut.columnData != NULL) {
param1 = &pLeftOut;
} else {
@ -1733,6 +1740,7 @@ void vectorCompare(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
} else {
param2 = pRight;
}
}
vectorCompareImpl(param1, param2, pOut, _ord, optr);
sclFreeParam(&pLeftOut);

View File

@ -247,6 +247,756 @@ int32_t compareJsonVal(const void *pLeft, const void *pRight) {
}
}
int32_t compareInt8Int16(const void *pLeft, const void *pRight) {
int8_t left = GET_INT32_VAL(pLeft);
int16_t right = GET_INT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt8Int32(const void *pLeft, const void *pRight) {
int8_t left = GET_INT32_VAL(pLeft);
int32_t right = GET_INT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt8Int64(const void *pLeft, const void *pRight) {
int8_t left = GET_INT32_VAL(pLeft);
int64_t right = GET_INT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt8Float(const void *pLeft, const void *pRight) {
int8_t left = GET_INT32_VAL(pLeft);
float right = GET_FLOAT_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt8Double(const void *pLeft, const void *pRight) {
int8_t left = GET_INT32_VAL(pLeft);
double right = GET_DOUBLE_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt8Uint8(const void *pLeft, const void *pRight) {
int8_t left = GET_INT32_VAL(pLeft);
uint8_t right = GET_UINT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt8Uint16(const void *pLeft, const void *pRight) {
int8_t left = GET_INT32_VAL(pLeft);
uint16_t right = GET_UINT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt8Uint32(const void *pLeft, const void *pRight) {
int8_t left = GET_INT32_VAL(pLeft);
uint32_t right = GET_UINT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt8Uint64(const void *pLeft, const void *pRight) {
int8_t left = GET_INT32_VAL(pLeft);
uint64_t right = GET_UINT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt16Int8(const void *pLeft, const void *pRight) {
int16_t left = GET_INT32_VAL(pLeft);
int8_t right = GET_INT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt16Int32(const void *pLeft, const void *pRight) {
int16_t left = GET_INT32_VAL(pLeft);
int32_t right = GET_INT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt16Int64(const void *pLeft, const void *pRight) {
int16_t left = GET_INT32_VAL(pLeft);
int64_t right = GET_INT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt16Float(const void *pLeft, const void *pRight) {
int16_t left = GET_INT32_VAL(pLeft);
float right = GET_FLOAT_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt16Double(const void *pLeft, const void *pRight) {
int16_t left = GET_INT32_VAL(pLeft);
double right = GET_DOUBLE_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt16Uint8(const void *pLeft, const void *pRight) {
int16_t left = GET_INT32_VAL(pLeft);
uint8_t right = GET_UINT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt16Uint16(const void *pLeft, const void *pRight) {
int16_t left = GET_INT32_VAL(pLeft);
uint16_t right = GET_UINT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt16Uint32(const void *pLeft, const void *pRight) {
int16_t left = GET_INT32_VAL(pLeft);
uint32_t right = GET_UINT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt16Uint64(const void *pLeft, const void *pRight) {
int16_t left = GET_INT32_VAL(pLeft);
uint64_t right = GET_UINT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt32Int8(const void *pLeft, const void *pRight) {
int32_t left = GET_INT32_VAL(pLeft);
int8_t right = GET_INT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt32Int16(const void *pLeft, const void *pRight) {
int32_t left = GET_INT32_VAL(pLeft);
int16_t right = GET_INT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt32Int64(const void *pLeft, const void *pRight) {
int32_t left = GET_INT32_VAL(pLeft);
int64_t right = GET_INT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt32Float(const void *pLeft, const void *pRight) {
int32_t left = GET_INT32_VAL(pLeft);
float right = GET_FLOAT_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt32Double(const void *pLeft, const void *pRight) {
int32_t left = GET_INT32_VAL(pLeft);
double right = GET_DOUBLE_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt32Uint8(const void *pLeft, const void *pRight) {
int32_t left = GET_INT32_VAL(pLeft);
uint8_t right = GET_UINT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt32Uint16(const void *pLeft, const void *pRight) {
int32_t left = GET_INT32_VAL(pLeft);
uint16_t right = GET_UINT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt32Uint32(const void *pLeft, const void *pRight) {
int32_t left = GET_INT32_VAL(pLeft);
uint32_t right = GET_UINT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt32Uint64(const void *pLeft, const void *pRight) {
int32_t left = GET_INT32_VAL(pLeft);
uint64_t right = GET_UINT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt64Int8(const void *pLeft, const void *pRight) {
int64_t left = GET_INT64_VAL(pLeft);
int8_t right = GET_INT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt64Int16(const void *pLeft, const void *pRight) {
int64_t left = GET_INT64_VAL(pLeft);
int16_t right = GET_INT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt64Int32(const void *pLeft, const void *pRight) {
int64_t left = GET_INT64_VAL(pLeft);
int32_t right = GET_INT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt64Float(const void *pLeft, const void *pRight) {
int64_t left = GET_INT64_VAL(pLeft);
float right = GET_FLOAT_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt64Double(const void *pLeft, const void *pRight) {
int64_t left = GET_INT64_VAL(pLeft);
double right = GET_DOUBLE_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt64Uint8(const void *pLeft, const void *pRight) {
int64_t left = GET_INT64_VAL(pLeft);
uint8_t right = GET_UINT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt64Uint16(const void *pLeft, const void *pRight) {
int64_t left = GET_INT64_VAL(pLeft);
uint16_t right = GET_UINT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt64Uint32(const void *pLeft, const void *pRight) {
int64_t left = GET_INT64_VAL(pLeft);
uint32_t right = GET_UINT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareInt64Uint64(const void *pLeft, const void *pRight) {
int64_t left = GET_INT64_VAL(pLeft);
uint64_t right = GET_UINT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareFloatInt8(const void *pLeft, const void *pRight) {
float left = GET_FLOAT_VAL(pLeft);
int8_t right = GET_INT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareFloatInt16(const void *pLeft, const void *pRight) {
float left = GET_FLOAT_VAL(pLeft);
int16_t right = GET_INT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareFloatInt32(const void *pLeft, const void *pRight) {
float left = GET_FLOAT_VAL(pLeft);
int32_t right = GET_INT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareFloatInt64(const void *pLeft, const void *pRight) {
float left = GET_FLOAT_VAL(pLeft);
int64_t right = GET_INT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareFloatDouble(const void *pLeft, const void *pRight) {
float left = GET_FLOAT_VAL(pLeft);
double right = GET_DOUBLE_VAL(pRight);
if (isnan(left) && isnan(right)) {
return 0;
}
if (isnan(left)) {
return -1;
}
if (isnan(right)) {
return 1;
}
if (FLT_EQUAL(left, right)) {
return 0;
}
return FLT_GREATER(left, right) ? 1 : -1;
}
int32_t compareFloatUint8(const void *pLeft, const void *pRight) {
float left = GET_FLOAT_VAL(pLeft);
uint8_t right = GET_UINT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareFloatUint16(const void *pLeft, const void *pRight) {
float left = GET_FLOAT_VAL(pLeft);
uint16_t right = GET_UINT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareFloatUint32(const void *pLeft, const void *pRight) {
float left = GET_FLOAT_VAL(pLeft);
uint32_t right = GET_UINT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareFloatUint64(const void *pLeft, const void *pRight) {
float left = GET_FLOAT_VAL(pLeft);
uint64_t right = GET_UINT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareDoubleInt8(const void *pLeft, const void *pRight) {
double left = GET_DOUBLE_VAL(pLeft);
int8_t right = GET_INT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareDoubleInt16(const void *pLeft, const void *pRight) {
double left = GET_DOUBLE_VAL(pLeft);
int16_t right = GET_INT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareDoubleInt32(const void *pLeft, const void *pRight) {
double left = GET_DOUBLE_VAL(pLeft);
int32_t right = GET_INT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareDoubleInt64(const void *pLeft, const void *pRight) {
double left = GET_DOUBLE_VAL(pLeft);
int64_t right = GET_INT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareDoubleFloat(const void *pLeft, const void *pRight) {
double left = GET_DOUBLE_VAL(pLeft);
float right = GET_FLOAT_VAL(pRight);
if (isnan(left) && isnan(right)) {
return 0;
}
if (isnan(left)) {
return -1;
}
if (isnan(right)) {
return 1;
}
if (FLT_EQUAL(left, right)) {
return 0;
}
return FLT_GREATER(left, right) ? 1 : -1;
}
int32_t compareDoubleUint8(const void *pLeft, const void *pRight) {
double left = GET_DOUBLE_VAL(pLeft);
uint8_t right = GET_UINT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareDoubleUint16(const void *pLeft, const void *pRight) {
double left = GET_DOUBLE_VAL(pLeft);
uint16_t right = GET_UINT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareDoubleUint32(const void *pLeft, const void *pRight) {
double left = GET_DOUBLE_VAL(pLeft);
uint32_t right = GET_UINT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareDoubleUint64(const void *pLeft, const void *pRight) {
double left = GET_DOUBLE_VAL(pLeft);
uint64_t right = GET_UINT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint8Int8(const void *pLeft, const void *pRight) {
uint8_t left = GET_UINT8_VAL(pLeft);
int8_t right = GET_INT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint8Int16(const void *pLeft, const void *pRight) {
uint8_t left = GET_UINT8_VAL(pLeft);
int16_t right = GET_INT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint8Int32(const void *pLeft, const void *pRight) {
uint8_t left = GET_UINT8_VAL(pLeft);
int32_t right = GET_INT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint8Int64(const void *pLeft, const void *pRight) {
uint8_t left = GET_UINT8_VAL(pLeft);
int64_t right = GET_INT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint8Float(const void *pLeft, const void *pRight) {
uint8_t left = GET_UINT8_VAL(pLeft);
float right = GET_FLOAT_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint8Double(const void *pLeft, const void *pRight) {
uint8_t left = GET_UINT8_VAL(pLeft);
double right = GET_DOUBLE_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint8Uint16(const void *pLeft, const void *pRight) {
uint8_t left = GET_UINT8_VAL(pLeft);
uint16_t right = GET_UINT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint8Uint32(const void *pLeft, const void *pRight) {
uint8_t left = GET_UINT8_VAL(pLeft);
uint32_t right = GET_UINT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint8Uint64(const void *pLeft, const void *pRight) {
uint8_t left = GET_UINT8_VAL(pLeft);
uint64_t right = GET_UINT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint16Int8(const void *pLeft, const void *pRight) {
uint16_t left = GET_UINT16_VAL(pLeft);
int8_t right = GET_INT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint16Int16(const void *pLeft, const void *pRight) {
uint16_t left = GET_UINT16_VAL(pLeft);
int16_t right = GET_INT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint16Int32(const void *pLeft, const void *pRight) {
uint16_t left = GET_UINT16_VAL(pLeft);
int32_t right = GET_INT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint16Int64(const void *pLeft, const void *pRight) {
uint16_t left = GET_UINT16_VAL(pLeft);
int64_t right = GET_INT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint16Float(const void *pLeft, const void *pRight) {
uint16_t left = GET_UINT16_VAL(pLeft);
float right = GET_FLOAT_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint16Double(const void *pLeft, const void *pRight) {
uint16_t left = GET_UINT16_VAL(pLeft);
double right = GET_DOUBLE_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint16Uint8(const void *pLeft, const void *pRight) {
uint16_t left = GET_UINT16_VAL(pLeft);
uint8_t right = GET_UINT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint16Uint32(const void *pLeft, const void *pRight) {
uint16_t left = GET_UINT16_VAL(pLeft);
uint32_t right = GET_UINT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint16Uint64(const void *pLeft, const void *pRight) {
uint16_t left = GET_UINT16_VAL(pLeft);
uint64_t right = GET_UINT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint32Int8(const void *pLeft, const void *pRight) {
uint32_t left = GET_UINT32_VAL(pLeft);
int8_t right = GET_INT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint32Int16(const void *pLeft, const void *pRight) {
uint32_t left = GET_UINT32_VAL(pLeft);
int16_t right = GET_INT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint32Int32(const void *pLeft, const void *pRight) {
uint32_t left = GET_UINT32_VAL(pLeft);
int32_t right = GET_INT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint32Int64(const void *pLeft, const void *pRight) {
uint32_t left = GET_UINT32_VAL(pLeft);
int64_t right = GET_INT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint32Float(const void *pLeft, const void *pRight) {
uint32_t left = GET_UINT32_VAL(pLeft);
float right = GET_FLOAT_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint32Double(const void *pLeft, const void *pRight) {
uint32_t left = GET_UINT32_VAL(pLeft);
double right = GET_DOUBLE_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint32Uint8(const void *pLeft, const void *pRight) {
uint32_t left = GET_UINT32_VAL(pLeft);
uint8_t right = GET_UINT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint32Uint16(const void *pLeft, const void *pRight) {
uint32_t left = GET_UINT32_VAL(pLeft);
uint16_t right = GET_UINT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint32Uint64(const void *pLeft, const void *pRight) {
uint32_t left = GET_UINT32_VAL(pLeft);
uint64_t right = GET_UINT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint64Int8(const void *pLeft, const void *pRight) {
uint64_t left = GET_UINT64_VAL(pLeft);
int8_t right = GET_INT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint64Int16(const void *pLeft, const void *pRight) {
uint64_t left = GET_UINT64_VAL(pLeft);
int16_t right = GET_INT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint64Int32(const void *pLeft, const void *pRight) {
uint64_t left = GET_UINT64_VAL(pLeft);
int32_t right = GET_INT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint64Int64(const void *pLeft, const void *pRight) {
uint64_t left = GET_UINT64_VAL(pLeft);
int64_t right = GET_INT64_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint64Float(const void *pLeft, const void *pRight) {
uint64_t left = GET_UINT64_VAL(pLeft);
float right = GET_FLOAT_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint64Double(const void *pLeft, const void *pRight) {
uint64_t left = GET_UINT64_VAL(pLeft);
double right = GET_DOUBLE_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint64Uint8(const void *pLeft, const void *pRight) {
uint64_t left = GET_UINT64_VAL(pLeft);
uint8_t right = GET_UINT8_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint64Uint16(const void *pLeft, const void *pRight) {
uint64_t left = GET_UINT64_VAL(pLeft);
uint16_t right = GET_UINT16_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareUint64Uint32(const void *pLeft, const void *pRight) {
uint64_t left = GET_UINT64_VAL(pLeft);
uint32_t right = GET_UINT32_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1;
return 0;
}
int32_t compareJsonValDesc(const void *pLeft, const void *pRight) {
return compareJsonVal(pRight, pLeft);
}

View File

@ -82,6 +82,7 @@ ELSE ()
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR}/taosadapter
)
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/taosadapter
COMMAND git rev-parse --short HEAD
RESULT_VARIABLE commit_sha1
OUTPUT_VARIABLE taosadapter_commit_sha1
@ -118,8 +119,8 @@ ELSE ()
PATCH_COMMAND
COMMAND git clean -f -d
BUILD_COMMAND
COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -ldflags "-s -w -X github.com/taosdata/taosadapter/version.Version=${taos_version} -X github.com/taosdata/taosadapter/version.CommitID=${taosadapter_commit_sha1}"
COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -o taosadapter-debug -ldflags "-X github.com/taosdata/taosadapter/version.Version=${taos_version} -X github.com/taosdata/taosadapter/version.CommitID=${taosadapter_commit_sha1}"
COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -ldflags "-s -w -X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}"
COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -o taosadapter-debug -ldflags "-X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}"
INSTALL_COMMAND
COMMAND ${_upx_prefix}/src/upx/upx taosadapter
COMMAND cmake -E copy taosadapter ${CMAKE_BINARY_DIR}/build/bin
@ -141,8 +142,8 @@ ELSE ()
PATCH_COMMAND
COMMAND git clean -f -d
BUILD_COMMAND
COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -ldflags "-s -w -X github.com/taosdata/taosadapter/version.Version=${taos_version} -X github.com/taosdata/taosadapter/version.CommitID=${taosadapter_commit_sha1}"
COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -o taosadapter-debug -ldflags "-X github.com/taosdata/taosadapter/version.Version=${taos_version} -X github.com/taosdata/taosadapter/version.CommitID=${taosadapter_commit_sha1}"
COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -ldflags "-s -w -X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}"
COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -o taosadapter-debug -ldflags "-X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}"
INSTALL_COMMAND
COMMAND cmake -E copy taosadapter ${CMAKE_BINARY_DIR}/build/bin
COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test/cfg/
@ -174,8 +175,8 @@ ELSE ()
BUILD_COMMAND
COMMAND set CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client
COMMAND set CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib
COMMAND go build -a -o taosadapter.exe -ldflags "-s -w -X github.com/taosdata/taosadapter/version.Version=${taos_version} -X github.com/taosdata/taosadapter/version.CommitID=${taosadapter_commit_sha1}"
COMMAND go build -a -o taosadapter-debug.exe -ldflags "-X github.com/taosdata/taosadapter/version.Version=${taos_version} -X github.com/taosdata/taosadapter/version.CommitID=${taosadapter_commit_sha1}"
COMMAND go build -a -o taosadapter.exe -ldflags "-s -w -X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}"
COMMAND go build -a -o taosadapter-debug.exe -ldflags "-X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}"
INSTALL_COMMAND
COMMAND ${_upx_prefix}/src/upx/upx taosadapter.exe
COMMAND cmake -E copy taosadapter.exe ${CMAKE_BINARY_DIR}/build/bin