chore: merge 3.0
This commit is contained in:
commit
2668894878
|
@ -80,7 +80,7 @@ TDengine 目前可以在 Linux、 Windows、macOS 等平台上安装和运行。
|
|||
### Ubuntu 18.04、20.04、22.04
|
||||
|
||||
```bash
|
||||
sudo apt-get udpate
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc cmake build-essential git libjansson-dev \
|
||||
libsnappy-dev liblzma-dev zlib1g-dev pkg-config
|
||||
```
|
||||
|
|
|
@ -29,6 +29,17 @@ SELECT a.* FROM meters a LEFT ASOF JOIN meters b ON timetruncate(a.ts, 1s) < tim
|
|||
### Main Join Condition
|
||||
|
||||
As a time-series database, all join queries in TDengine revolve around the primary key timestamp column. Therefore, all join queries (except ASOF/Window Join) must include an equality condition on the primary key column, and the first primary key column equality condition that appears in the join conditions will be considered the main join condition. ASOF Join's main join condition can include non-equality conditions, while Window Join's main join condition is specified through `WINDOW_OFFSET`.
|
||||
Starting from version 3.3.6.0, TDengine supports constant timestamps in subqueries (including constant functions with return timestamps such as today (), now (), etc., constant timestamps and their addition and subtraction operations) as equivalent primary key columns that can appear in the main join condition. For example:
|
||||
|
||||
```sql
|
||||
SELECT * from d1001 a JOIN (SELECT today() as ts1, * from d1002 WHERE ts = '2025-03-19 10:00:00.000') b ON timetruncate(a.ts, 1d) = b.ts1;
|
||||
```
|
||||
|
||||
The above example SQL will perform join operation between all records in table d1001 today and a certain time record in table d1002. It should be noticed that the constant time string appears in SQL will not be treated as a timestamp by default. For example, "2025-03-19 10:00:00.000" will only be treated as a string instead of a timestamp. Therefore, when it needs to be treated as a constant timestamp, you can specify the constant string as a timestamp type by using the type prefix timestamp. For example:
|
||||
|
||||
```sql
|
||||
SELECT * from d1001 a JOIN (SELECT timestamp '2025-03-19 10:00:00.000' as ts1, * from d1002 WHERE ts = '2025-03-19 10:00:00.000') b ON timetruncate(a.ts, 1d) = b.ts1;
|
||||
```
|
||||
|
||||
Apart from Window Join, TDengine supports the `timetruncate` function operation in the main join condition, such as `ON timetruncate(a.ts, 1s) = timetruncate(b.ts, 1s)`, but does not support other functions and scalar operations.
|
||||
|
||||
|
@ -38,7 +49,7 @@ The characteristic ASOF/Window Join of time-series databases supports grouping t
|
|||
|
||||
### Primary Key Timeline
|
||||
|
||||
As a time-series database, TDengine requires each table (subtable) to have a primary key timestamp column, which will serve as the primary key timeline for many time-related operations. The result of a subquery or the result of a Join operation also needs to clearly identify which column will be considered the primary key timeline for subsequent time-related operations. In subqueries, the first appearing ordered primary key column (or its operation) or a pseudocolumn equivalent to the primary key column (`_wstart`/`_wend`) will be considered the primary key timeline of the output table. The selection of the primary key timeline in Join output results follows these rules:
|
||||
As a time-series database, TDengine requires each table (subtable) to have a primary key timestamp column, which will serve as the primary key timeline for many time-related operations. The result of a subquery or the result of a Join operation also needs to clearly identify which column will be considered the primary key timeline for subsequent time-related operations. In subqueries, the first appearing ordered primary key column (or its operation) or a pseudocolumn equivalent to the primary key column (`_wstart`/`_wend`) will be considered the primary key timeline of the output table. In addition, starting with version 3.3.6.0, TDengine also supports constant timestamp columns in subquery results as the primary key timeline for the output table. The selection of the primary key timeline in Join output results follows these rules:
|
||||
|
||||
- In the Left/Right Join series, the primary key column of the driving table (subquery) will be used as the primary key timeline for subsequent queries; additionally, within the Window Join window, since both tables are ordered, any table's primary key column can be used as the primary key timeline, with a preference for the primary key column of the same table.
|
||||
- Inner Join can use the primary key column of any table as the primary key timeline, but when there are grouping conditions similar to tag column equality conditions related by `AND` with the main join condition, it will not produce a primary key timeline.
|
||||
|
|
|
@ -1121,10 +1121,14 @@ In addition to using SQL or parameter binding APIs to insert data, you can also
|
|||
- conf: [Input] Pointer to a valid tmq_conf_t structure, representing a TMQ configuration object.
|
||||
- key: [Input] Configuration item key name.
|
||||
- value: [Input] Configuration item value.
|
||||
- **Return Value**: Returns a tmq_conf_res_t enum value, indicating the result of the configuration setting.
|
||||
- TMQ_CONF_OK: Successfully set the configuration item.
|
||||
- TMQ_CONF_INVALID_KEY: Invalid key value.
|
||||
- TMQ_CONF_UNKNOWN: Invalid key name.
|
||||
- **Return Value**: Returns a tmq_conf_res_t enum value, indicating the result of the configuration setting. tmq_conf_res_t defined as follows:
|
||||
```
|
||||
typedef enum tmq_conf_res_t {
|
||||
TMQ_CONF_UNKNOWN = -2, // invalid key
|
||||
TMQ_CONF_INVALID = -1, // invalid value
|
||||
TMQ_CONF_OK = 0, // success
|
||||
} tmq_conf_res_t;
|
||||
```
|
||||
|
||||
- `void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *param)`
|
||||
- **Interface Description**: Sets the auto-commit callback function in the TMQ configuration object.
|
||||
|
|
|
@ -559,9 +559,10 @@ This document details the server error codes that may be encountered when using
|
|||
|
||||
## virtual table
|
||||
|
||||
| Error Code | Description | Possible Error Scenarios or Reasons | Recommended Actions for Users |
|
||||
|-------------|---------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|
|
||||
| 0x80006200 | Virtual table scan internal error | virtual table scan operator internal error, generally does not occur | Check error logs, contact development for handling |
|
||||
| 0x80006201 | Virtual table scan invalid downstream operator type | The incorrect execution plan generated causes the downstream operator type of the virtual table scan operator to be incorrect. | Check error logs, contact development for handling |
|
||||
| 0x80006202 | Virtual table prim timestamp column should not has ref | The timestamp primary key column of a virtual table should not have a data source. If it does, this error will occur during subsequent queries on the virtual table. | Check error logs, contact development for handling |
|
||||
| 0x80006203 | Create virtual child table must use virtual super table | Create virtual child table using non-virtual super table | create virtual child table using virtual super table |
|
||||
| Error Code | Description | Possible Error Scenarios or Reasons | Recommended Actions for Users |
|
||||
|------------|---------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------|
|
||||
| 0x80006200 | Virtual table scan internal error | virtual table scan operator internal error, generally does not occur | Check error logs, contact development for handling |
|
||||
| 0x80006201 | Virtual table scan invalid downstream operator type | The incorrect execution plan generated causes the downstream operator type of the virtual table scan operator to be incorrect. | Check error logs, contact development for handling |
|
||||
| 0x80006202 | Virtual table prim timestamp column should not has ref | The timestamp primary key column of a virtual table should not have a data source. If it does, this error will occur during subsequent queries on the virtual table. | Check error logs, contact development for handling |
|
||||
| 0x80006203 | Create virtual child table must use virtual super table | Create virtual child table using non-virtual super table | create virtual child table using virtual super table |
|
||||
| 0x80006204 | Virtual table not support decimal type | Create virtual table using decimal type | create virtual table without using decimal type |
|
||||
|
|
|
@ -30,6 +30,17 @@ SELECT a.* FROM meters a LEFT ASOF JOIN meters b ON timetruncate(a.ts, 1s) < tim
|
|||
### 主连接条件
|
||||
|
||||
作为一款时序数据库,TDengine 所有的关联查询都围绕主键时戳列进行,因此要求除 ASOF/Window Join 外的所有关联查询都必须含有主键列的等值连接条件,而按照顺序首次出现在连接条件中的主键列等值连接条件将会被作为主连接条件。ASOF Join 的主连接条件可以包含非等值的连接条件,而 Window Join 的主连接条件则是通过 `WINDOW_OFFSET` 来指定。
|
||||
从 3.3.6.0 版本开始,TDengine 支持子查询中的常量(包含返回时戳的常量函数如today()、now()等,常量时戳及其加减运算)作为等价主键列可以出现在主连接条件中。例如:
|
||||
|
||||
```sql
|
||||
SELECT * from d1001 a JOIN (SELECT today() as ts1, * from d1002 WHERE ts = '2025-03-19 10:00:00.000') b ON timetruncate(a.ts, 1d) = b.ts1;
|
||||
```
|
||||
|
||||
上面的示例语句可以实现表 d1001 今天的所有记录与表 d1002 中某一时刻的某条记录进行关联运算。需要注意的是,SQL 中出现的时间字符串常量默认不会被当作时戳,例如 `'2025-03-19 10:00:00.000'` 只会被当作字符串而不是时戳,因此当需要作为常量时戳处理时,可以通过类型前缀 timestamp 来指定字符串常量为时间戳类型,例如:
|
||||
|
||||
```sql
|
||||
SELECT * from d1001 a JOIN (SELECT timestamp '2025-03-19 10:00:00.000' as ts1, * from d1002 WHERE ts = '2025-03-19 10:00:00.000') b ON timetruncate(a.ts, 1d) = b.ts1;
|
||||
```
|
||||
|
||||
除 Window Join 外,TDengine 支持在主连接条件中进行 `timetruncate` 函数操作,例如 `ON timetruncate(a.ts, 1s) = timetruncate(b.ts, 1s)`,除此之外,暂不支持其他函数及标量运算。
|
||||
|
||||
|
@ -39,7 +50,7 @@ SELECT a.* FROM meters a LEFT ASOF JOIN meters b ON timetruncate(a.ts, 1s) < tim
|
|||
|
||||
### 主键时间线
|
||||
|
||||
TDengine 作为时序数据库要求每个表(子表)中必须有主键时间戳列,它将作为该表的主键时间线进行很多跟时间相关的运算,而子查询的结果或者 Join 运算的结果中也需要明确哪一列将被视作主键时间线参与后续的时间相关的运算。在子查询中,查询结果中存在的有序的第一个出现的主键列(或其运算)或等同主键列的伪列(`_wstart`/`_wend`)将被视作该输出表的主键时间线。Join 输出结果中主键时间线的选择遵从以下规则:
|
||||
TDengine 作为时序数据库要求每个表(子表)中必须有主键时间戳列,它将作为该表的主键时间线进行很多跟时间相关的运算,而子查询的结果或者 Join 运算的结果中也需要明确哪一列将被视作主键时间线参与后续的时间相关的运算。在子查询中,查询结果中存在的有序的第一个出现的主键列(或其运算)或等同主键列的伪列(`_wstart`/`_wend`)将被视作该输出表的主键时间线。此外,从 3.3.6.0 版本开始,TDengine 也开始支持子查询结果中的常量时戳列作为输出表的主键时间线。Join 输出结果中主键时间线的选择遵从以下规则:
|
||||
- Left/Right Join 系列中驱动表(子查询)的主键列将被作为后续查询的主键时间线;此外,在 Window Join 窗口内,因为左右表同时有序所以在窗口内可以把任意一个表的主键列做作主键时间线,优先选择本表的主键列作为主键时间线。
|
||||
- Inner Join 可以把任意一个表的主键列做作主键时间线,当存在类似分组条件(Tag 列的等值条件且与主连接条件 `AND` 关系)时将无法产生主键时间线。
|
||||
- Full Join 因为无法产生任何一个有效的主键时间序列,因此没有主键时间线,这也就意味着 Full Join 中无法进行时间线相关的运算。
|
||||
|
|
|
@ -1115,10 +1115,14 @@ TDengine 的异步 API 均采用非阻塞调用模式。应用程序可以用多
|
|||
- conf:[入参] 指向一个有效的 tmq_conf_t 结构体指针,该结构体代表一个 TMQ 配置对象。
|
||||
- key:[入参] 数配置项的键名。
|
||||
- value:[入参] 配置项的值。
|
||||
- **返回值**:返回一个 tmq_conf_res_t 枚举值,表示配置设置的结果。
|
||||
- TMQ_CONF_OK:成功设置配置项。
|
||||
- TMQ_CONF_INVALID_KEY:键值无效。
|
||||
- TMQ_CONF_UNKNOWN:键名无效。
|
||||
- **返回值**:返回一个 tmq_conf_res_t 枚举值,表示配置设置的结果。tmq_conf_res_t 定义如下:
|
||||
```
|
||||
typedef enum tmq_conf_res_t {
|
||||
TMQ_CONF_UNKNOWN = -2, // 键名无效
|
||||
TMQ_CONF_INVALID = -1, // 键值无效
|
||||
TMQ_CONF_OK = 0, // 成功设置配置项
|
||||
} tmq_conf_res_t;
|
||||
```
|
||||
|
||||
- `void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *param)`
|
||||
- **接口说明**:设置 TMQ 配置对象中的自动提交回调函数。
|
||||
|
|
|
@ -578,10 +578,11 @@ description: TDengine 服务端的错误码列表和详细说明
|
|||
|
||||
## virtual table
|
||||
|
||||
| 错误码 | 错误描述 | 可能的出错场景或者可能的原因 | 建议用户采取的措施 |
|
||||
|------------|---------------------------------------------------------|------------------------------------------------|------------------------|
|
||||
| 0x80006200 | Virtual table scan 算子内部错误 | virtual table scan 算子内部逻辑错误,一般不会出现 | 具体查看client端的错误日志提示 |
|
||||
| 0x80006201 | Virtual table scan invalid downstream operator type | 由于生成的执行计划不对,导致 virtual table scan 算子的下游算子类型不正确 | 保留 explain 执行计划,联系开发处理 |
|
||||
| 0x80006202 | Virtual table prim timestamp column should not has ref | 虚拟表的时间戳主键列不应该有数据源,如果有,后续查询虚拟表的时候就会出现该错误 | 检查错误日志,联系开发处理 |
|
||||
| 0x80006203 | Create virtual child table must use virtual super table | 虚拟子表必须建在虚拟超级表下,否则就会出现该错误 | 创建虚拟子表的时候,USING 虚拟超级表 |
|
||||
| 错误码 | 错误描述 | 可能的出错场景或者可能的原因 | 建议用户采取的措施 |
|
||||
|------------|---------------------------------------------------------|------------------------------------------------|----------------------------|
|
||||
| 0x80006200 | Virtual table scan 算子内部错误 | virtual table scan 算子内部逻辑错误,一般不会出现 | 具体查看client端的错误日志提示 |
|
||||
| 0x80006201 | Virtual table scan invalid downstream operator type | 由于生成的执行计划不对,导致 virtual table scan 算子的下游算子类型不正确 | 保留 explain 执行计划,联系开发处理 |
|
||||
| 0x80006202 | Virtual table prim timestamp column should not has ref | 虚拟表的时间戳主键列不应该有数据源,如果有,后续查询虚拟表的时候就会出现该错误 | 检查错误日志,联系开发处理 |
|
||||
| 0x80006203 | Create virtual child table must use virtual super table | 虚拟子表必须建在虚拟超级表下,否则就会出现该错误 | 创建虚拟子表的时候,USING 虚拟超级表 |
|
||||
| 0x80006204 | Virtual table not support decimal type | 虚拟表不支持 decimal 类型 | 创建虚拟表时不使用 decimal 类型的列/tag |
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@ const char* tNameGetDbNameP(const SName* name);
|
|||
|
||||
int32_t tNameGetFullDbName(const SName* name, char* dst);
|
||||
|
||||
int32_t tNameGetFullTableName(const SName* name, char* dst);
|
||||
|
||||
bool tNameIsEmpty(const SName* name);
|
||||
|
||||
void tNameAssign(SName* dst, const SName* src);
|
||||
|
|
|
@ -134,6 +134,8 @@ int32_t qUpdateTableListForStreamScanner(qTaskInfo_t tinfo, const SArray* tableI
|
|||
|
||||
bool qIsDynamicExecTask(qTaskInfo_t tinfo);
|
||||
|
||||
void qDestroyOperatorParam(SOperatorParam* pParam);
|
||||
|
||||
void qUpdateOperatorParam(qTaskInfo_t tinfo, void* pParam);
|
||||
|
||||
/**
|
||||
|
|
|
@ -1070,6 +1070,7 @@ int32_t taosGetErrSize();
|
|||
#define TSDB_CODE_VTABLE_SCAN_INVALID_DOWNSTREAM TAOS_DEF_ERROR_CODE(0, 0x6201)
|
||||
#define TSDB_CODE_VTABLE_PRIMTS_HAS_REF TAOS_DEF_ERROR_CODE(0, 0x6202)
|
||||
#define TSDB_CODE_VTABLE_NOT_VIRTUAL_SUPER_TABLE TAOS_DEF_ERROR_CODE(0, 0x6203)
|
||||
#define TSDB_CODE_VTABLE_NOT_SUPPORT_DATA_TYPE TAOS_DEF_ERROR_CODE(0, 0x6204)
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -36,6 +36,12 @@ extern "C" {
|
|||
#define FLT_GREATEREQUAL(_x, _y) (FLT_EQUAL((_x), (_y)) || ((_x) > (_y)))
|
||||
#define FLT_LESSEQUAL(_x, _y) (FLT_EQUAL((_x), (_y)) || ((_x) < (_y)))
|
||||
|
||||
#define DBL_EQUAL(_x, _y) fabs((_x) - (_y)) <= (FLT_COMPAR_TOL_FACTOR * DBL_EPSILON)
|
||||
#define DBL_GREATER(_x, _y) (!DBL_EQUAL((_x), (_y)) && ((_x) > (_y)))
|
||||
#define DBL_LESS(_x, _y) (!DBL_EQUAL((_x), (_y)) && ((_x) < (_y)))
|
||||
#define DBL_GREATEREQUAL(_x, _y) (DBL_EQUAL((_x), (_y)) || ((_x) > (_y)))
|
||||
#define DBL_LESSEQUAL(_x, _y) (DBL_EQUAL((_x), (_y)) || ((_x) < (_y)))
|
||||
|
||||
#define PATTERN_COMPARE_INFO_INITIALIZER { '%', '_', L'%', L'_' }
|
||||
|
||||
typedef struct SPatternCompareInfo {
|
||||
|
|
|
@ -313,7 +313,7 @@ typedef struct SSyncQueryParam {
|
|||
void* doAsyncFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4);
|
||||
void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4);
|
||||
|
||||
void doSetOneRowPtr(SReqResultInfo* pResultInfo, bool isStmt);
|
||||
void doSetOneRowPtr(SReqResultInfo* pResultInfo);
|
||||
void setResPrecision(SReqResultInfo* pResInfo, int32_t precision);
|
||||
int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableRsp* pRsp, bool convertUcs4, bool isStmt);
|
||||
int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4, bool isStmt);
|
||||
|
|
|
@ -1941,12 +1941,12 @@ TAOS* taos_connect_auth(const char* ip, const char* user, const char* auth, cons
|
|||
// return taos_connect(ipStr, userStr, passStr, dbStr, port);
|
||||
// }
|
||||
|
||||
void doSetOneRowPtr(SReqResultInfo* pResultInfo, bool isStmt) {
|
||||
void doSetOneRowPtr(SReqResultInfo* pResultInfo) {
|
||||
for (int32_t i = 0; i < pResultInfo->numOfCols; ++i) {
|
||||
SResultColumn* pCol = &pResultInfo->pCol[i];
|
||||
|
||||
int32_t type = pResultInfo->fields[i].type;
|
||||
int32_t schemaBytes = calcSchemaBytesFromTypeBytes(type, pResultInfo->fields[i].bytes, isStmt);
|
||||
int32_t schemaBytes = calcSchemaBytesFromTypeBytes(type, pResultInfo->userFields[i].bytes, false);
|
||||
|
||||
if (IS_VAR_DATA_TYPE(type)) {
|
||||
if (!IS_VAR_NULL_TYPE(type, schemaBytes) && pCol->offset[pResultInfo->current] != -1) {
|
||||
|
@ -2012,7 +2012,7 @@ void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4)
|
|||
}
|
||||
|
||||
if (setupOneRowPtr) {
|
||||
doSetOneRowPtr(pResultInfo, pRequest->isStmtBind);
|
||||
doSetOneRowPtr(pResultInfo);
|
||||
pResultInfo->current += 1;
|
||||
}
|
||||
|
||||
|
@ -2059,7 +2059,7 @@ void* doAsyncFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertU
|
|||
return NULL;
|
||||
} else {
|
||||
if (setupOneRowPtr) {
|
||||
doSetOneRowPtr(pResultInfo, pRequest->isStmtBind);
|
||||
doSetOneRowPtr(pResultInfo);
|
||||
pResultInfo->current += 1;
|
||||
}
|
||||
|
||||
|
@ -2135,8 +2135,9 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t* colLength, bo
|
|||
|
||||
static int32_t convertDecimalType(SReqResultInfo* pResultInfo) {
|
||||
for (int32_t i = 0; i < pResultInfo->numOfCols; ++i) {
|
||||
TAOS_FIELD_E* pField = pResultInfo->fields + i;
|
||||
int32_t type = pField->type;
|
||||
TAOS_FIELD_E* pFieldE = pResultInfo->fields + i;
|
||||
TAOS_FIELD* pField = pResultInfo->userFields + i;
|
||||
int32_t type = pFieldE->type;
|
||||
int32_t bufLen = 0;
|
||||
char* p = NULL;
|
||||
if (!IS_DECIMAL_TYPE(type) || !pResultInfo->pCol[i].pData) {
|
||||
|
@ -2144,6 +2145,7 @@ static int32_t convertDecimalType(SReqResultInfo* pResultInfo) {
|
|||
} else {
|
||||
bufLen = 64;
|
||||
p = taosMemoryRealloc(pResultInfo->convertBuf[i], bufLen * pResultInfo->numOfRows);
|
||||
pFieldE->bytes = bufLen;
|
||||
pField->bytes = bufLen;
|
||||
}
|
||||
if (!p) return terrno;
|
||||
|
@ -2151,7 +2153,7 @@ static int32_t convertDecimalType(SReqResultInfo* pResultInfo) {
|
|||
|
||||
for (int32_t j = 0; j < pResultInfo->numOfRows; ++j) {
|
||||
int32_t code = decimalToStr((DecimalWord*)(pResultInfo->pCol[i].pData + j * tDataTypes[type].bytes), type,
|
||||
pField->precision, pField->scale, p, bufLen);
|
||||
pFieldE->precision, pFieldE->scale, p, bufLen);
|
||||
p += bufLen;
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
return code;
|
||||
|
@ -2395,6 +2397,7 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo) {
|
|||
}
|
||||
|
||||
int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4, bool isStmt) {
|
||||
bool convertForDecimal = convertUcs4;
|
||||
if (pResultInfo == NULL || pResultInfo->numOfCols <= 0 || pResultInfo->fields == NULL) {
|
||||
tscError("setResultDataPtr paras error");
|
||||
return TSDB_CODE_TSC_INTERNAL_ERROR;
|
||||
|
@ -2507,7 +2510,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4, bool isS
|
|||
code = doConvertUCS4(pResultInfo, colLength, isStmt);
|
||||
}
|
||||
#endif
|
||||
if (TSDB_CODE_SUCCESS == code && convertUcs4) {
|
||||
if (TSDB_CODE_SUCCESS == code && convertForDecimal) {
|
||||
code = convertDecimalType(pResultInfo);
|
||||
}
|
||||
return code;
|
||||
|
|
|
@ -647,7 +647,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
|
|||
}
|
||||
|
||||
if (pResultInfo->current < pResultInfo->numOfRows) {
|
||||
doSetOneRowPtr(pResultInfo, false);
|
||||
doSetOneRowPtr(pResultInfo);
|
||||
pResultInfo->current += 1;
|
||||
return pResultInfo->row;
|
||||
} else {
|
||||
|
@ -655,7 +655,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
doSetOneRowPtr(pResultInfo, false);
|
||||
doSetOneRowPtr(pResultInfo);
|
||||
pResultInfo->current += 1;
|
||||
return pResultInfo->row;
|
||||
}
|
||||
|
|
|
@ -9486,10 +9486,11 @@ int32_t tDeserializeSOperatorParam(SDecoder *pDecoder, SOperatorParam *pOpParam)
|
|||
TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pOpParam->downstreamIdx));
|
||||
switch (pOpParam->opType) {
|
||||
case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: {
|
||||
STableScanOperatorParam *pScan = taosMemoryMalloc(sizeof(STableScanOperatorParam));
|
||||
if (NULL == pScan) {
|
||||
pOpParam->value = taosMemoryMalloc(sizeof(STableScanOperatorParam));
|
||||
if (NULL == pOpParam->value) {
|
||||
TAOS_CHECK_RETURN(terrno);
|
||||
}
|
||||
STableScanOperatorParam *pScan = pOpParam->value;
|
||||
TAOS_CHECK_RETURN(tDecodeI8(pDecoder, (int8_t *)&pScan->tableSeq));
|
||||
int32_t uidNum = 0;
|
||||
int64_t uid = 0;
|
||||
|
@ -9535,8 +9536,6 @@ int32_t tDeserializeSOperatorParam(SDecoder *pDecoder, SOperatorParam *pOpParam)
|
|||
}
|
||||
TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pScan->window.skey));
|
||||
TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pScan->window.ekey));
|
||||
|
||||
pOpParam->value = pScan;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -104,6 +104,14 @@ const char* tNameGetTableName(const SName* name) {
|
|||
return &name->tname[0];
|
||||
}
|
||||
|
||||
int32_t tNameGetFullTableName(const SName* name, char* dst) {
|
||||
if (name == NULL || dst == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
(void)snprintf(dst, TSDB_TABLE_FNAME_LEN, "%s.%s", name->dbname, name->tname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tNameAssign(SName* dst, const SName* src) { memcpy(dst, src, sizeof(SName)); }
|
||||
|
||||
int32_t tNameSetDbName(SName* dst, int32_t acct, const char* dbName, size_t nameLen) {
|
||||
|
@ -230,7 +238,7 @@ static int compareKv(const void* p1, const void* p2) {
|
|||
}
|
||||
|
||||
/*
|
||||
* use stable name and tags to grearate child table name
|
||||
* use stable name and tags to generate child table name
|
||||
*/
|
||||
int32_t buildChildTableName(RandTableName* rName) {
|
||||
taosArraySort(rName->tags, compareKv);
|
||||
|
|
|
@ -202,6 +202,7 @@ _return:
|
|||
|
||||
int32_t ctgGetTbMeta(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgTbMetaCtx* ctx, STableMeta** pTableMeta) {
|
||||
int32_t code = 0;
|
||||
int32_t line = 0;
|
||||
STableMetaOutput* output = NULL;
|
||||
|
||||
CTG_ERR_RET(ctgGetTbMetaFromCache(pCtg, ctx, pTableMeta));
|
||||
|
@ -224,7 +225,7 @@ int32_t ctgGetTbMeta(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgTbMetaCtx* ctx
|
|||
goto _return;
|
||||
}
|
||||
|
||||
if (CTG_IS_META_VBOTH(output->metaType) || CTG_IS_META_VCTABLE(output->metaType)) {
|
||||
if (CTG_IS_META_VBOTH(output->metaType)) {
|
||||
int32_t colRefSize = output->vctbMeta->numOfColRefs * sizeof(SColRef);
|
||||
if (output->tbMeta) {
|
||||
int32_t metaSize = CTG_META_SIZE(output->tbMeta);
|
||||
|
@ -246,17 +247,14 @@ int32_t ctgGetTbMeta(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgTbMetaCtx* ctx
|
|||
goto _return;
|
||||
}
|
||||
|
||||
if ((!CTG_IS_META_CTABLE(output->metaType)) || output->tbMeta) {
|
||||
if ((!CTG_IS_META_CTABLE(output->metaType) && !CTG_IS_META_VCTABLE(output->metaType)) || output->tbMeta) {
|
||||
ctgError("invalid metaType:%d", output->metaType);
|
||||
taosMemoryFreeClear(output->vctbMeta);
|
||||
taosMemoryFreeClear(output->tbMeta);
|
||||
CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
// HANDLE ONLY CHILD TABLE META
|
||||
|
||||
taosMemoryFreeClear(output->tbMeta);
|
||||
taosMemoryFreeClear(output->vctbMeta);
|
||||
// HANDLE ONLY (VIRTUAL) CHILD TABLE META
|
||||
|
||||
SName stbName = *ctx->pName;
|
||||
TAOS_STRCPY(stbName.tname, output->tbName);
|
||||
|
@ -269,8 +267,21 @@ int32_t ctgGetTbMeta(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgTbMetaCtx* ctx
|
|||
ctgDebug("tb:%s, stb no longer exist, db:%s", ctx->pName->tname, output->dbFName);
|
||||
continue;
|
||||
}
|
||||
if (CTG_IS_META_CTABLE(output->metaType)) {
|
||||
TAOS_MEMCPY(*pTableMeta, &output->ctbMeta, sizeof(output->ctbMeta));
|
||||
} else if (CTG_IS_META_VCTABLE(output->metaType)) {
|
||||
int32_t colRefSize = output->vctbMeta->numOfColRefs * sizeof(SColRef);
|
||||
int32_t metaSize = CTG_META_SIZE(*pTableMeta);
|
||||
(*pTableMeta) = taosMemoryRealloc(*pTableMeta, metaSize + colRefSize);
|
||||
QUERY_CHECK_NULL(*pTableMeta, code , line, _return, terrno);
|
||||
TAOS_MEMCPY(*pTableMeta, output->vctbMeta, sizeof(SVCTableMeta));
|
||||
(*pTableMeta)->colRef = (SColRef *)((char *)(*pTableMeta) + metaSize);
|
||||
TAOS_MEMCPY((*pTableMeta)->colRef, output->vctbMeta->colRef, colRefSize);
|
||||
(*pTableMeta)->numOfColRefs = output->vctbMeta->numOfColRefs;
|
||||
}
|
||||
|
||||
TAOS_MEMCPY(*pTableMeta, &output->ctbMeta, sizeof(output->ctbMeta));
|
||||
taosMemoryFreeClear(output->tbMeta);
|
||||
taosMemoryFreeClear(output->vctbMeta);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -75,20 +75,20 @@ typedef struct SStbJoinDynCtrlInfo {
|
|||
} SStbJoinDynCtrlInfo;
|
||||
|
||||
typedef struct SVtbScanDynCtrlInfo {
|
||||
int32_t acctId;
|
||||
SUseDbRsp* pRsp;
|
||||
SUseDbReq req;
|
||||
bool scanAllCols;
|
||||
tsem_t ready;
|
||||
SEpSet epSet;
|
||||
SUseDbRsp* pRsp;
|
||||
uint64_t suid;
|
||||
SReadHandle readHandle;
|
||||
SArray* childTableList;
|
||||
int32_t acctId;
|
||||
int32_t curTableIdx;
|
||||
int32_t lastTableIdx;
|
||||
SOperatorParam* vtbScanParam;
|
||||
int32_t readTableIdx;
|
||||
SHashObj* dbVgInfoMap;
|
||||
SArray* readColList;
|
||||
bool scanAllCols;
|
||||
SArray* childTableList;
|
||||
SHashObj* dbVgInfoMap;
|
||||
SHashObj* orgTbVgColMap;
|
||||
SReadHandle readHandle;
|
||||
SOperatorParam* vtbScanParam;
|
||||
} SVtbScanDynCtrlInfo;
|
||||
|
||||
typedef struct SDynQueryCtrlOperatorInfo {
|
||||
|
|
|
@ -80,6 +80,13 @@ static void destroyStbJoinDynCtrlInfo(SStbJoinDynCtrlInfo* pStbJoin) {
|
|||
destroyStbJoinTableList(pStbJoin->ctx.prev.pListHead);
|
||||
}
|
||||
|
||||
void destroyOrgTbInfo(void *info) {
|
||||
SOrgTbInfo *pOrgTbInfo = (SOrgTbInfo *)info;
|
||||
if (pOrgTbInfo) {
|
||||
taosArrayDestroy(pOrgTbInfo->colMap);
|
||||
}
|
||||
}
|
||||
|
||||
void freeUseDbOutput(void* pOutput) {
|
||||
SUseDbOutput *pOut = *(SUseDbOutput**)pOutput;
|
||||
if (NULL == pOutput) {
|
||||
|
@ -103,6 +110,10 @@ static void destroyVtbScanDynCtrlInfo(SVtbScanDynCtrlInfo* pVtbScan) {
|
|||
taosHashSetFreeFp(pVtbScan->dbVgInfoMap, freeUseDbOutput);
|
||||
taosHashCleanup(pVtbScan->dbVgInfoMap);
|
||||
}
|
||||
if (pVtbScan->orgTbVgColMap) {
|
||||
taosHashSetFreeFp(pVtbScan->orgTbVgColMap, destroyOrgTbInfo);
|
||||
taosHashCleanup(pVtbScan->orgTbVgColMap);
|
||||
}
|
||||
if (pVtbScan->pRsp) {
|
||||
tFreeSUsedbRsp(pVtbScan->pRsp);
|
||||
taosMemoryFreeClear(pVtbScan->pRsp);
|
||||
|
@ -1071,7 +1082,7 @@ _return:
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t buildVtbScanOperatorParam(SDynQueryCtrlOperatorInfo* pInfo, SOperatorParam** ppRes) {
|
||||
static int32_t buildVtbScanOperatorParam(SDynQueryCtrlOperatorInfo* pInfo, SOperatorParam** ppRes, uint64_t uid) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t lino = 0;
|
||||
SVTableScanOperatorParam* pVScan = NULL;
|
||||
|
@ -1085,6 +1096,7 @@ static int32_t buildVtbScanOperatorParam(SDynQueryCtrlOperatorInfo* pInfo, SOper
|
|||
QUERY_CHECK_NULL(pVScan, code, lino, _return, terrno);
|
||||
pVScan->pOpParamArray = taosArrayInit(1, POINTER_BYTES);
|
||||
QUERY_CHECK_NULL(pVScan->pOpParamArray, code, lino, _return, terrno);
|
||||
pVScan->uid = uid;
|
||||
|
||||
(*ppRes)->opType = QUERY_NODE_PHYSICAL_PLAN_VIRTUAL_TABLE_SCAN;
|
||||
(*ppRes)->downstreamIdx = 0;
|
||||
|
@ -1283,11 +1295,32 @@ bool colNeedScan(SOperatorInfo* pOperator, col_id_t colId) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void destroyOrgTbInfo(void *info) {
|
||||
SOrgTbInfo *pOrgTbInfo = (SOrgTbInfo *)info;
|
||||
if (pOrgTbInfo) {
|
||||
taosArrayDestroy(pOrgTbInfo->colMap);
|
||||
int32_t getDbVgInfo(SOperatorInfo* pOperator, SName *name, SDBVgInfo **dbVgInfo) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t line = 0;
|
||||
SDynQueryCtrlOperatorInfo* pInfo = pOperator->info;
|
||||
SVtbScanDynCtrlInfo* pVtbScan = (SVtbScanDynCtrlInfo*)&pInfo->vtbScan;
|
||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||
SReadHandle* pHandle = &pVtbScan->readHandle;
|
||||
SUseDbOutput* output = NULL;
|
||||
SUseDbOutput** find = (SUseDbOutput**)taosHashGet(pInfo->vtbScan.dbVgInfoMap, name->dbname, strlen(name->dbname));
|
||||
|
||||
QRY_PARAM_CHECK(dbVgInfo);
|
||||
|
||||
if (find == NULL) {
|
||||
output = taosMemoryMalloc(sizeof(SUseDbOutput));
|
||||
QUERY_CHECK_CODE(buildDbVgInfoMap(pOperator, pHandle, name, pTaskInfo, output), line, _return);
|
||||
QUERY_CHECK_CODE(taosHashPut(pInfo->vtbScan.dbVgInfoMap, name->dbname, strlen(name->dbname), &output, POINTER_BYTES), line, _return);
|
||||
} else {
|
||||
output = *find;
|
||||
}
|
||||
|
||||
*dbVgInfo = output->dbVgroup;
|
||||
return code;
|
||||
_return:
|
||||
qError("%s failed at line %d since %s", __func__, line, tstrerror(code));
|
||||
freeUseDbOutput(output);
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t vtbScan(SOperatorInfo* pOperator, SSDataBlock** pRes) {
|
||||
|
@ -1298,7 +1331,7 @@ int32_t vtbScan(SOperatorInfo* pOperator, SSDataBlock** pRes) {
|
|||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||
SReadHandle* pHandle = &pVtbScan->readHandle;
|
||||
SMetaReader mr = {0};
|
||||
SHashObj* orgTbVgColMap = NULL;
|
||||
SDBVgInfo* dbVgInfo = NULL;
|
||||
|
||||
QRY_PARAM_CHECK(pRes);
|
||||
if (pOperator->status == OP_EXEC_DONE) {
|
||||
|
@ -1312,51 +1345,40 @@ int32_t vtbScan(SOperatorInfo* pOperator, SSDataBlock** pRes) {
|
|||
|
||||
size_t num = taosArrayGetSize(pVtbScan->childTableList);
|
||||
|
||||
// no child table, return
|
||||
if (num == 0) {
|
||||
setOperatorCompleted(pOperator);
|
||||
return code;
|
||||
}
|
||||
|
||||
// TODO(smj) : proper hash size
|
||||
orgTbVgColMap = taosHashInit(num * 64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
|
||||
QUERY_CHECK_NULL(orgTbVgColMap, code, line, _return, terrno);
|
||||
taosHashSetFreeFp(orgTbVgColMap, destroyOrgTbInfo);
|
||||
pVtbScan->orgTbVgColMap = taosHashInit(num * 64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
|
||||
QUERY_CHECK_NULL(pVtbScan->orgTbVgColMap, code, line, _return, terrno);
|
||||
taosHashSetFreeFp(pVtbScan->orgTbVgColMap, destroyOrgTbInfo);
|
||||
|
||||
while (true) {
|
||||
if (pVtbScan->readTableIdx == pVtbScan->lastTableIdx) {
|
||||
if (pVtbScan->curTableIdx == pVtbScan->lastTableIdx) {
|
||||
QUERY_CHECK_CODE(pOperator->pDownstream[0]->fpSet.getNextFn(pOperator->pDownstream[0], pRes), line, _return);
|
||||
} else {
|
||||
uint64_t* id = taosArrayGet(pVtbScan->childTableList, pVtbScan->readTableIdx);
|
||||
uint64_t* id = taosArrayGet(pVtbScan->childTableList, pVtbScan->curTableIdx);
|
||||
QUERY_CHECK_NULL(id, code, line, _return, terrno);
|
||||
pHandle->api.metaReaderFn.initReader(&mr, pHandle->vnode, META_READER_LOCK, &pHandle->api.metaFn);
|
||||
QUERY_CHECK_CODE(pHandle->api.metaReaderFn.getTableEntryByUid(&mr, *id), line, _return);
|
||||
|
||||
for (int32_t j = 0; j < mr.me.colRef.nCols; j++) {
|
||||
if (mr.me.colRef.pColRef[j].hasRef && colNeedScan(pOperator, mr.me.colRef.pColRef[j].id)) {
|
||||
SName name = {0};
|
||||
toName(pInfo->vtbScan.acctId, mr.me.colRef.pColRef[j].refDbName, "", &name);
|
||||
SUseDbOutput* output = NULL;
|
||||
SUseDbOutput** find = (SUseDbOutput**)taosHashGet(pInfo->vtbScan.dbVgInfoMap, name.dbname, strlen(name.dbname));
|
||||
if (find == NULL) {
|
||||
output = taosMemoryMalloc(sizeof(SUseDbOutput));
|
||||
QUERY_CHECK_CODE(buildDbVgInfoMap(pOperator, pHandle, &name, pTaskInfo, output), line, _return);
|
||||
QUERY_CHECK_CODE(taosHashPut(pInfo->vtbScan.dbVgInfoMap, name.dbname, strlen(name.dbname), &output, sizeof(output)), line, _return);
|
||||
} else {
|
||||
output = *find;
|
||||
}
|
||||
int32_t vgId = 0;
|
||||
char dbFname[TSDB_DB_FNAME_LEN] = {0};
|
||||
QUERY_CHECK_CODE(tNameGetFullDbName(&name, dbFname), line, _return);
|
||||
QUERY_CHECK_CODE(getVgId(output->dbVgroup, dbFname, &vgId, mr.me.colRef.pColRef[j].refTableName), line, _return);
|
||||
char orgTbFName[TSDB_TABLE_FNAME_LEN] = {0};
|
||||
TAOS_STRNCAT(orgTbFName, mr.me.colRef.pColRef[j].refDbName, TSDB_DB_NAME_LEN);
|
||||
TAOS_STRNCAT(orgTbFName, ".", 2);
|
||||
TAOS_STRNCAT(orgTbFName, mr.me.colRef.pColRef[j].refTableName, TSDB_TABLE_NAME_LEN);
|
||||
SName name = {0};
|
||||
char dbFname[TSDB_DB_FNAME_LEN] = {0};
|
||||
char orgTbFName[TSDB_TABLE_FNAME_LEN] = {0};
|
||||
|
||||
void *tbVgCol = taosHashGet(orgTbVgColMap, orgTbFName, sizeof(orgTbFName));
|
||||
if (!tbVgCol) {
|
||||
toName(pInfo->vtbScan.acctId, mr.me.colRef.pColRef[j].refDbName, mr.me.colRef.pColRef[j].refTableName, &name);
|
||||
QUERY_CHECK_CODE(getDbVgInfo(pOperator, &name, &dbVgInfo), line, _return);
|
||||
QUERY_CHECK_CODE(tNameGetFullDbName(&name, dbFname), line, _return);
|
||||
QUERY_CHECK_CODE(tNameGetFullTableName(&name, orgTbFName), line, _return);
|
||||
|
||||
void *pVal = taosHashGet(pVtbScan->orgTbVgColMap, orgTbFName, sizeof(orgTbFName));
|
||||
if (!pVal) {
|
||||
SOrgTbInfo map = {0};
|
||||
map.vgId = vgId;
|
||||
QUERY_CHECK_CODE(getVgId(dbVgInfo, dbFname, &map.vgId, name.tname), line, _return);
|
||||
tstrncpy(map.tbName, orgTbFName, sizeof(map.tbName));
|
||||
map.colMap = taosArrayInit(10, sizeof(SColIdNameKV));
|
||||
QUERY_CHECK_NULL(map.colMap, code, line, _return, terrno);
|
||||
|
@ -1364,40 +1386,43 @@ int32_t vtbScan(SOperatorInfo* pOperator, SSDataBlock** pRes) {
|
|||
colIdNameKV.colId = mr.me.colRef.pColRef[j].id;
|
||||
tstrncpy(colIdNameKV.colName, mr.me.colRef.pColRef[j].refColName, sizeof(colIdNameKV.colName));
|
||||
QUERY_CHECK_NULL(taosArrayPush(map.colMap, &colIdNameKV), code, line, _return, terrno);
|
||||
QUERY_CHECK_CODE(taosHashPut(orgTbVgColMap, orgTbFName, sizeof(orgTbFName), &map, sizeof(map)), line, _return);
|
||||
QUERY_CHECK_CODE(taosHashPut(pVtbScan->orgTbVgColMap, orgTbFName, sizeof(orgTbFName), &map, sizeof(map)), line, _return);
|
||||
} else {
|
||||
SOrgTbInfo *map = (SOrgTbInfo *)tbVgCol;
|
||||
SOrgTbInfo *tbInfo = (SOrgTbInfo *)pVal;
|
||||
SColIdNameKV colIdNameKV = {0};
|
||||
colIdNameKV.colId = mr.me.colRef.pColRef[j].id;
|
||||
tstrncpy(colIdNameKV.colName, mr.me.colRef.pColRef[j].refColName, sizeof(colIdNameKV.colName));
|
||||
QUERY_CHECK_NULL(taosArrayPush(map->colMap, &colIdNameKV), code, line, _return, terrno);
|
||||
QUERY_CHECK_NULL(taosArrayPush(tbInfo->colMap, &colIdNameKV), code, line, _return, terrno);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pVtbScan->vtbScanParam = NULL;
|
||||
QUERY_CHECK_CODE(buildVtbScanOperatorParam(pInfo, &pVtbScan->vtbScanParam), line, _return);
|
||||
((SVTableScanOperatorParam*)pVtbScan->vtbScanParam->value)->uid = *id;
|
||||
QUERY_CHECK_CODE(buildVtbScanOperatorParam(pInfo, &pVtbScan->vtbScanParam, *id), line, _return);
|
||||
|
||||
void* pIter = taosHashIterate(orgTbVgColMap, NULL);
|
||||
void* pIter = taosHashIterate(pVtbScan->orgTbVgColMap, NULL);
|
||||
while (pIter != NULL) {
|
||||
SOrgTbInfo* pMap = (SOrgTbInfo*)pIter;
|
||||
SOperatorParam* pExchangeParam = NULL;
|
||||
QUERY_CHECK_CODE(buildExchangeOperatorParamForVScan(&pExchangeParam, 0, pMap), line, _return);
|
||||
QUERY_CHECK_NULL(taosArrayPush(((SVTableScanOperatorParam*)pVtbScan->vtbScanParam->value)->pOpParamArray, &pExchangeParam), code, line, _return, terrno);
|
||||
pIter = taosHashIterate(orgTbVgColMap, pIter);
|
||||
pIter = taosHashIterate(pVtbScan->orgTbVgColMap, pIter);
|
||||
}
|
||||
pHandle->api.metaReaderFn.clearReader(&mr);
|
||||
|
||||
// reset downstream operator's status
|
||||
pOperator->pDownstream[0]->status = OP_NOT_OPENED;
|
||||
QUERY_CHECK_CODE(pOperator->pDownstream[0]->fpSet.getNextExtFn(pOperator->pDownstream[0], pVtbScan->vtbScanParam, pRes), line, _return);
|
||||
}
|
||||
|
||||
if (*pRes) {
|
||||
pVtbScan->lastTableIdx = pVtbScan->readTableIdx;
|
||||
// has result, still read data from this table.
|
||||
pVtbScan->lastTableIdx = pVtbScan->curTableIdx;
|
||||
break;
|
||||
} else {
|
||||
pVtbScan->readTableIdx++;
|
||||
if (pVtbScan->readTableIdx >= taosArrayGetSize(pVtbScan->childTableList)) {
|
||||
// no result, read next table.
|
||||
pVtbScan->curTableIdx++;
|
||||
if (pVtbScan->curTableIdx >= taosArrayGetSize(pVtbScan->childTableList)) {
|
||||
setOperatorCompleted(pOperator);
|
||||
break;
|
||||
}
|
||||
|
@ -1405,7 +1430,8 @@ int32_t vtbScan(SOperatorInfo* pOperator, SSDataBlock** pRes) {
|
|||
}
|
||||
|
||||
_return:
|
||||
taosHashCleanup(orgTbVgColMap);
|
||||
taosHashCleanup(pVtbScan->orgTbVgColMap);
|
||||
pVtbScan->orgTbVgColMap = NULL;
|
||||
if (pOperator->cost.openCost == 0) {
|
||||
pOperator->cost.openCost = (double)(taosGetTimestampUs() - st) / 1000.0;
|
||||
}
|
||||
|
@ -1459,7 +1485,7 @@ static int32_t initVtbScanInfo(SOperatorInfo* pOperator, SDynQueryCtrlOperatorIn
|
|||
pInfo->vtbScan.epSet = pPhyciNode->vtbScan.mgmtEpSet;
|
||||
pInfo->vtbScan.acctId = pPhyciNode->vtbScan.accountId;
|
||||
pInfo->vtbScan.readHandle = *pHandle;
|
||||
pInfo->vtbScan.readTableIdx = 0;
|
||||
pInfo->vtbScan.curTableIdx = 0;
|
||||
pInfo->vtbScan.lastTableIdx = -1;
|
||||
|
||||
pInfo->vtbScan.readColList = taosArrayInit(LIST_LENGTH(pPhyciNode->vtbScan.pScanCols), sizeof(col_id_t));
|
||||
|
@ -1472,12 +1498,17 @@ static int32_t initVtbScanInfo(SOperatorInfo* pOperator, SDynQueryCtrlOperatorIn
|
|||
}
|
||||
|
||||
pInfo->vtbScan.childTableList = taosArrayInit(10, sizeof(uint64_t));
|
||||
QUERY_CHECK_NULL(pInfo->vtbScan.childTableList, code, line, _return, terrno);
|
||||
QUERY_CHECK_CODE(pHandle->api.metaFn.getChildTableList(pHandle->vnode, pInfo->vtbScan.suid, pInfo->vtbScan.childTableList), line, _return);
|
||||
|
||||
pInfo->vtbScan.dbVgInfoMap = taosHashInit(taosArrayGetSize(pInfo->vtbScan.childTableList), taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
|
||||
QUERY_CHECK_NULL(pInfo->vtbScan.dbVgInfoMap, code, line, _return, terrno);
|
||||
|
||||
return code;
|
||||
_return:
|
||||
// no need to destroy array and hashmap allocated in this function,
|
||||
// since the operator's destroy function will take care of it
|
||||
qError("%s failed at line %d since %s", __func__, line, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
|
@ -626,6 +626,13 @@ void destroyOperatorParam(SOperatorParam* pParam) {
|
|||
// TODO
|
||||
}
|
||||
|
||||
void qDestroyOperatorParam(SOperatorParam* pParam) {
|
||||
if (NULL == pParam) {
|
||||
return;
|
||||
}
|
||||
freeOperatorParam(pParam, OP_GET_PARAM);
|
||||
}
|
||||
|
||||
void qUpdateOperatorParam(qTaskInfo_t tinfo, void* pParam) {
|
||||
destroyOperatorParam(((SExecTaskInfo*)tinfo)->pOpParam);
|
||||
((SExecTaskInfo*)tinfo)->pOpParam = pParam;
|
||||
|
|
|
@ -967,6 +967,7 @@ static void doStateWindowAggImpl(SOperatorInfo* pOperator, SStateWindowOperatorI
|
|||
}
|
||||
int64_t gid = pBlock->info.id.groupId;
|
||||
|
||||
bool hasResult = false;
|
||||
bool masterScan = true;
|
||||
int32_t numOfOutput = pOperator->exprSupp.numOfExprs;
|
||||
int32_t bytes = pStateColInfoData->info.bytes;
|
||||
|
@ -988,6 +989,7 @@ static void doStateWindowAggImpl(SOperatorInfo* pOperator, SStateWindowOperatorI
|
|||
if (colDataIsNull(pStateColInfoData, pBlock->info.rows, j, pAgg)) {
|
||||
continue;
|
||||
}
|
||||
hasResult = true;
|
||||
if (pStateColInfoData->pData == NULL) {
|
||||
qError("%s:%d state column data is null", __FILE__, __LINE__);
|
||||
pTaskInfo->code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
|
@ -1043,6 +1045,9 @@ static void doStateWindowAggImpl(SOperatorInfo* pOperator, SStateWindowOperatorI
|
|||
}
|
||||
}
|
||||
|
||||
if (!hasResult) {
|
||||
return;
|
||||
}
|
||||
SResultRow* pResult = NULL;
|
||||
pRowSup->win.ekey = tsList[pBlock->info.rows - 1];
|
||||
int32_t ret = setTimeWindowOutputBuf(&pInfo->binfo.resultRowInfo, &pRowSup->win, masterScan, &pResult, gid,
|
||||
|
|
|
@ -53,7 +53,7 @@ typedef struct STranslateContext {
|
|||
|
||||
int32_t biRewriteToTbnameFunc(STranslateContext* pCxt, SNode** ppNode, bool* pRet);
|
||||
int32_t biRewriteSelectStar(STranslateContext* pCxt, SSelectStmt* pSelect);
|
||||
int32_t biCheckCreateTableTbnameCol(STranslateContext* pCxt, SCreateTableStmt* pStmt);
|
||||
int32_t biCheckCreateTableTbnameCol(STranslateContext* pCxt, SNodeList* pTags, SNodeList* pCols);
|
||||
int32_t findTable(STranslateContext* pCxt, const char* pTableAlias, STableNode** pOutput);
|
||||
int32_t getTargetMetaImpl(SParseContext* pParCxt, SParseMetaCache* pMetaCache, const SName* pName, STableMeta** pMeta,
|
||||
bool couldBeView);
|
||||
|
|
|
@ -1992,10 +1992,10 @@ int32_t biRewriteToTbnameFunc(STranslateContext* pCxt, SNode** ppNode, bool* pRe
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t biCheckCreateTableTbnameCol(STranslateContext* pCxt, SCreateTableStmt* pStmt) {
|
||||
if (pStmt->pTags) {
|
||||
int32_t biCheckCreateTableTbnameCol(STranslateContext* pCxt, SNodeList* pTags, SNodeList* pCols) {
|
||||
if (pTags) {
|
||||
SNode* pNode = NULL;
|
||||
FOREACH(pNode, pStmt->pTags) {
|
||||
FOREACH(pNode, pTags) {
|
||||
SColumnDefNode* pTag = (SColumnDefNode*)pNode;
|
||||
if (strcasecmp(pTag->colName, "tbname") == 0) {
|
||||
int32_t code = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TAG_NAME,
|
||||
|
@ -2004,9 +2004,9 @@ int32_t biCheckCreateTableTbnameCol(STranslateContext* pCxt, SCreateTableStmt* p
|
|||
}
|
||||
}
|
||||
}
|
||||
if (pStmt->pCols) {
|
||||
if (pCols) {
|
||||
SNode* pNode = NULL;
|
||||
FOREACH(pNode, pStmt->pCols) {
|
||||
FOREACH(pNode, pCols) {
|
||||
SColumnDefNode* pCol = (SColumnDefNode*)pNode;
|
||||
if (strcasecmp(pCol->colName, "tbname") == 0) {
|
||||
int32_t code = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN,
|
||||
|
@ -5387,24 +5387,6 @@ int32_t mergeInnerJoinConds(SNode** ppDst, SNode** ppSrc) {
|
|||
return code;
|
||||
}
|
||||
|
||||
bool isColumnExpr(SNode* pNode) {
|
||||
SExprNode* pExpr = (SExprNode*)pNode;
|
||||
if (QUERY_NODE_COLUMN != nodeType(pNode) && QUERY_NODE_FUNCTION != nodeType(pNode)) {
|
||||
return false;
|
||||
}
|
||||
if (QUERY_NODE_FUNCTION == nodeType(pNode)) {
|
||||
SFunctionNode* pFunc = (SFunctionNode*)pNode;
|
||||
if (FUNCTION_TYPE_TIMETRUNCATE != pFunc->funcType && strcasecmp(((SFunctionNode*)pNode)->functionName, "timetruncate")) {
|
||||
return false;
|
||||
}
|
||||
if (!nodesContainsColumn(nodesListGetNode(pFunc->pParameterList, 0))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t splitJoinColPrimaryCond(SNode** ppSrc, SNode** ppDst) {
|
||||
if (NULL == *ppSrc) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -5417,7 +5399,7 @@ int32_t splitJoinColPrimaryCond(SNode** ppSrc, SNode** ppDst) {
|
|||
if (OP_TYPE_EQUAL != pOp->opType) {
|
||||
break;
|
||||
}
|
||||
if (isColumnExpr(pOp->pLeft) && isColumnExpr(pOp->pRight)) {
|
||||
if (nodesContainsColumn(pOp->pLeft) && nodesContainsColumn(pOp->pRight)) {
|
||||
TSWAP(*ppSrc, *ppDst);
|
||||
}
|
||||
break;
|
||||
|
@ -9691,7 +9673,7 @@ static int32_t translateS3MigrateDatabase(STranslateContext* pCxt, SS3MigrateDat
|
|||
return buildCmdMsg(pCxt, TDMT_MND_S3MIGRATE_DB, (FSerializeFunc)tSerializeSS3MigrateDbReq, &req);
|
||||
}
|
||||
|
||||
static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray, bool calBytes) {
|
||||
static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray, bool calBytes, bool virtualTable) {
|
||||
*pArray = taosArrayInit(LIST_LENGTH(pList), sizeof(SFieldWithOptions));
|
||||
if (!pArray) return terrno;
|
||||
|
||||
|
@ -9699,6 +9681,10 @@ static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray, bool calB
|
|||
SNode* pNode;
|
||||
FOREACH(pNode, pList) {
|
||||
SColumnDefNode* pCol = (SColumnDefNode*)pNode;
|
||||
if (virtualTable && IS_DECIMAL_TYPE(pCol->dataType.type)) {
|
||||
code = TSDB_CODE_VTABLE_NOT_SUPPORT_DATA_TYPE;
|
||||
break;
|
||||
}
|
||||
SFieldWithOptions field = {.type = pCol->dataType.type, .bytes = calcTypeBytes(pCol->dataType)};
|
||||
if (calBytes) {
|
||||
field.bytes = calcTypeBytes(pCol->dataType);
|
||||
|
@ -9733,7 +9719,7 @@ static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray, bool calB
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t tagDefNodeToField(SNodeList* pList, SArray** pArray, bool calBytes) {
|
||||
static int32_t tagDefNodeToField(SNodeList* pList, SArray** pArray, bool calBytes, bool virtualTable) {
|
||||
*pArray = taosArrayInit(LIST_LENGTH(pList), sizeof(SField));
|
||||
if (!*pArray) return terrno;
|
||||
SNode* pNode;
|
||||
|
@ -9742,6 +9728,11 @@ static int32_t tagDefNodeToField(SNodeList* pList, SArray** pArray, bool calByte
|
|||
SField field = {
|
||||
.type = pCol->dataType.type,
|
||||
};
|
||||
if (virtualTable && IS_DECIMAL_TYPE(pCol->dataType.type)) {
|
||||
taosArrayDestroy(*pArray);
|
||||
*pArray = NULL;
|
||||
return TSDB_CODE_VTABLE_NOT_SUPPORT_DATA_TYPE;
|
||||
}
|
||||
if (calBytes) {
|
||||
field.bytes = calcTypeBytes(pCol->dataType);
|
||||
} else {
|
||||
|
@ -10005,6 +9996,10 @@ static int32_t checkTableSchema(STranslateContext* pCxt, SCreateTableStmt* pStmt
|
|||
return checkTableSchemaImpl(pCxt, pStmt->pTags, pStmt->pCols, pStmt->pOptions->pRollupFuncs);
|
||||
}
|
||||
|
||||
static int32_t checkVTableSchema(STranslateContext* pCxt, SCreateVTableStmt* pStmt) {
|
||||
return checkTableSchemaImpl(pCxt, NULL, pStmt->pCols, NULL);
|
||||
}
|
||||
|
||||
static int32_t getTableDelayOrWatermarkOption(STranslateContext* pCxt, const char* pName, int64_t minVal,
|
||||
int64_t maxVal, SValueNode* pVal, int64_t* pMaxDelay) {
|
||||
int32_t code = (DEAL_RES_ERROR == translateValue(pCxt, pVal) ? pCxt->errCode : TSDB_CODE_SUCCESS);
|
||||
|
@ -10165,7 +10160,7 @@ static int32_t checkCreateTable(STranslateContext* pCxt, SCreateTableStmt* pStmt
|
|||
}
|
||||
}
|
||||
if (pCxt->pParseCxt->biMode != 0 && TSDB_CODE_SUCCESS == code) {
|
||||
code = biCheckCreateTableTbnameCol(pCxt, pStmt);
|
||||
code = biCheckCreateTableTbnameCol(pCxt, pStmt->pTags, pStmt->pCols);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
@ -10564,8 +10559,8 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm
|
|||
pReq->source = TD_REQ_FROM_APP;
|
||||
// columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true);
|
||||
// columnDefNodeToField(pStmt->pTags, &pReq->pTags, true);
|
||||
code = columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true);
|
||||
if (TSDB_CODE_SUCCESS == code) code = tagDefNodeToField(pStmt->pTags, &pReq->pTags, true);
|
||||
code = columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true, pStmt->pOptions->virtualStb);
|
||||
if (TSDB_CODE_SUCCESS == code) code = tagDefNodeToField(pStmt->pTags, &pReq->pTags, true, pStmt->pOptions->virtualStb);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
pReq->numOfColumns = LIST_LENGTH(pStmt->pCols);
|
||||
pReq->numOfTags = LIST_LENGTH(pStmt->pTags);
|
||||
|
@ -10794,6 +10789,10 @@ static SSchema* getTagSchema(const STableMeta* pTableMeta, const char* pTagName)
|
|||
|
||||
static int32_t checkAlterSuperTableBySchema(STranslateContext* pCxt, SAlterTableStmt* pStmt,
|
||||
const STableMeta* pTableMeta) {
|
||||
if (pTableMeta->virtualStb && IS_DECIMAL_TYPE(pStmt->dataType.type)) {
|
||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_VTABLE_NOT_SUPPORT_DATA_TYPE);
|
||||
}
|
||||
|
||||
SSchema* pTagsSchema = getTableTagSchema(pTableMeta);
|
||||
if (getNumOfTags(pTableMeta) == 1 && pTagsSchema->type == TSDB_DATA_TYPE_JSON &&
|
||||
(pStmt->alterType == TSDB_ALTER_TABLE_ADD_TAG || pStmt->alterType == TSDB_ALTER_TABLE_DROP_TAG ||
|
||||
|
@ -13501,10 +13500,10 @@ static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt*
|
|||
pReq->igUpdate = pStmt->pOptions->ignoreUpdate;
|
||||
if (pReq->createStb) {
|
||||
pReq->numOfTags = LIST_LENGTH(pStmt->pTags);
|
||||
code = tagDefNodeToField(pStmt->pTags, &pReq->pTags, true);
|
||||
code = tagDefNodeToField(pStmt->pTags, &pReq->pTags, true, false);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = columnDefNodeToField(pStmt->pCols, &pReq->pCols, false);
|
||||
code = columnDefNodeToField(pStmt->pCols, &pReq->pCols, false, false);
|
||||
}
|
||||
pReq->recalculateInterval = 0;
|
||||
if (NULL != pStmt->pOptions->pRecInterval) {
|
||||
|
@ -17712,6 +17711,12 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S
|
|||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_DUPLICATED_COLUMN);
|
||||
}
|
||||
|
||||
if (TSDB_VIRTUAL_CHILD_TABLE == pTableMeta->tableType || TSDB_VIRTUAL_NORMAL_TABLE == pTableMeta->tableType) {
|
||||
if (IS_DECIMAL_TYPE(pStmt->dataType.type)) {
|
||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_VTABLE_NOT_SUPPORT_DATA_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
if ((TSDB_DATA_TYPE_VARCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) ||
|
||||
(TSDB_DATA_TYPE_VARBINARY == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) ||
|
||||
(TSDB_DATA_TYPE_NCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_NCHAR_LEN)) {
|
||||
|
@ -18192,15 +18197,40 @@ _return:
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t checkCreateVirtualTable(STranslateContext* pCxt, SCreateVTableStmt* pStmt) {
|
||||
if (NULL != strchr(pStmt->tableName, '.')) {
|
||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME,
|
||||
"The table name cannot contain '.'");
|
||||
}
|
||||
|
||||
if (IS_SYS_DBNAME(pStmt->dbName)) {
|
||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_TSC_INVALID_OPERATION,
|
||||
"Cannot create table of system database: `%s`.`%s`", pStmt->dbName,
|
||||
pStmt->tableName);
|
||||
}
|
||||
|
||||
PAR_ERR_RET(checkVTableSchema(pCxt, pStmt));
|
||||
|
||||
PAR_ERR_RET(checkColumnOptions(pStmt->pCols));
|
||||
|
||||
if (pCxt->pParseCxt->biMode != 0) {
|
||||
PAR_ERR_RET(biCheckCreateTableTbnameCol(pCxt, NULL, pStmt->pCols));
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t rewriteCreateVirtualTable(STranslateContext* pCxt, SQuery* pQuery) {
|
||||
SCreateVTableStmt* pStmt = (SCreateVTableStmt*)pQuery->pRoot;
|
||||
int32_t code = TSDB_CODE_SUCCESS;// TODO(smj):checkCreateTable(pCxt, pStmt, false);
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SVgroupInfo info = {0};
|
||||
SName name = {0};
|
||||
SArray* pBufArray = NULL;
|
||||
SNode* pNode = NULL;
|
||||
int32_t index = 0;
|
||||
|
||||
PAR_ERR_JRET(checkCreateVirtualTable(pCxt, pStmt));
|
||||
|
||||
pBufArray = taosArrayInit(1, POINTER_BYTES);
|
||||
if (NULL == pBufArray) {
|
||||
PAR_ERR_JRET(terrno);
|
||||
|
@ -18215,6 +18245,9 @@ static int32_t rewriteCreateVirtualTable(STranslateContext* pCxt, SQuery* pQuery
|
|||
if (index == 0) {
|
||||
PAR_ERR_JRET(generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_VTABLE_PRIMTS_HAS_REF));
|
||||
}
|
||||
if (IS_DECIMAL_TYPE(pColNode->dataType.type)) {
|
||||
PAR_ERR_JRET(generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_VTABLE_NOT_SUPPORT_DATA_TYPE));
|
||||
}
|
||||
PAR_ERR_JRET(checkColRef(pCxt, pColOptions->refDb, pColOptions->refTable, pColOptions->refColumn,
|
||||
(SDataType){.type = pColNode->dataType.type,
|
||||
.bytes = calcTypeBytes(pColNode->dataType)}));
|
||||
|
@ -18235,7 +18268,7 @@ _return:
|
|||
}
|
||||
|
||||
static int32_t rewriteCreateVirtualSubTable(STranslateContext* pCxt, SQuery* pQuery) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;// TODO(smj):checkCreateTable(pCxt, pStmt, false);
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SCreateVSubTableStmt* pStmt = (SCreateVSubTableStmt*)pQuery->pRoot;
|
||||
SVgroupInfo info = {0};
|
||||
SName name = {0};
|
||||
|
|
|
@ -659,11 +659,11 @@ static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
|
|||
pJoin->node.groupAction = GROUP_ACTION_CLEAR;
|
||||
pJoin->hashJoinHint = getHashJoinOptHint(pSelect->pHint);
|
||||
pJoin->batchScanHint = getBatchScanOptionFromHint(pSelect->pHint);
|
||||
pJoin->node.requireDataOrder = pJoin->hashJoinHint ? DATA_ORDER_LEVEL_NONE : DATA_ORDER_LEVEL_GLOBAL;
|
||||
pJoin->node.requireDataOrder = (pJoin->hashJoinHint || pJoinTable->leftNoOrderedSubQuery || pJoinTable->rightNoOrderedSubQuery) ? DATA_ORDER_LEVEL_NONE : DATA_ORDER_LEVEL_GLOBAL;
|
||||
pJoin->node.resultDataOrder = DATA_ORDER_LEVEL_NONE;
|
||||
pJoin->isLowLevelJoin = pJoinTable->isLowLevelJoin;
|
||||
pJoin->leftNoOrderedSubQuery = pJoinTable->leftNoOrderedSubQuery;
|
||||
pJoin->rightNoOrderedSubQuery = pJoinTable->leftNoOrderedSubQuery;
|
||||
pJoin->rightNoOrderedSubQuery = pJoinTable->rightNoOrderedSubQuery;
|
||||
|
||||
code = nodesCloneNode(pJoinTable->pWindowOffset, &pJoin->pWindowOffset);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
|
|
|
@ -869,6 +869,10 @@ static bool pdcJoinIsPrimEqualCond(SJoinLogicNode* pJoin, SNode* pCond, bool con
|
|||
}
|
||||
}
|
||||
|
||||
if (constAsPrim && ((pJoin->leftNoOrderedSubQuery && !pJoin->leftConstPrimGot) || (pJoin->rightNoOrderedSubQuery && !pJoin->rightConstPrimGot))) {
|
||||
res = false;
|
||||
}
|
||||
|
||||
tSimpleHashCleanup(pLeftTables);
|
||||
tSimpleHashCleanup(pRightTables);
|
||||
|
||||
|
@ -926,20 +930,26 @@ static int32_t pdcJoinSplitPrimInLogicCond(SJoinLogicNode* pJoin, SNode** ppInpu
|
|||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
nodesDestroyNode(*ppInput);
|
||||
*ppInput = NULL;
|
||||
|
||||
if (NULL != *ppPrimEqCond) {
|
||||
*ppOnCond = pTempOnCond;
|
||||
nodesDestroyNode(*ppInput);
|
||||
*ppInput = NULL;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
nodesDestroyNode(pTempOnCond);
|
||||
planError("no primary key equal cond found, condListNum:%d", pLogicCond->pParameterList->length);
|
||||
return TSDB_CODE_PLAN_INTERNAL_ERROR;
|
||||
if (!constAsPrim) {
|
||||
planError("no primary key equal cond found, condListNum:%d", pLogicCond->pParameterList->length);
|
||||
return TSDB_CODE_PLAN_INTERNAL_ERROR;
|
||||
}
|
||||
} else {
|
||||
nodesDestroyList(pOnConds);
|
||||
nodesDestroyNode(pTempOnCond);
|
||||
return code;
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t pdcJoinSplitPrimEqCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin) {
|
||||
|
@ -1417,7 +1427,7 @@ static int32_t pdcJoinSplitConstPrimEqCond(SOptimizeContext* pCxt, SJoinLogicNod
|
|||
if (TSDB_CODE_SUCCESS == code) {
|
||||
pJoin->pPrimKeyEqCond = pPrimKeyEqCond;
|
||||
*ppCond = pJoinOnCond;
|
||||
if (pJoin->rightConstPrimGot || pJoin->leftConstPrimGot) {
|
||||
if (pJoin->pPrimKeyEqCond && (pJoin->rightConstPrimGot || pJoin->leftConstPrimGot)) {
|
||||
code = scalarConvertOpValueNodeTs((SOperatorNode*)pJoin->pPrimKeyEqCond);
|
||||
}
|
||||
} else {
|
||||
|
@ -1485,7 +1495,8 @@ static int32_t pdcJoinCheckAllCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin
|
|||
}
|
||||
}
|
||||
|
||||
return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PLAN_EXPECTED_TS_EQUAL);
|
||||
return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PAR_NOT_SUPPORT_JOIN,
|
||||
"Join requires valid time series input and primary timestamp equal condition");
|
||||
}
|
||||
|
||||
if (IS_ASOF_JOIN(pJoin->subType)) {
|
||||
|
@ -2643,22 +2654,39 @@ static int32_t sortForJoinOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pL
|
|||
EOrder targetOrder = 0;
|
||||
SSHashObj* pTables = NULL;
|
||||
|
||||
if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pLeft) &&
|
||||
((SScanLogicNode*)pLeft)->node.outputTsOrder != SCAN_ORDER_BOTH) {
|
||||
pScan = (SScanLogicNode*)pLeft;
|
||||
pChild = pRight;
|
||||
pChildPos = &pJoin->node.pChildren->pTail->pNode;
|
||||
targetOrder = pScan->node.outputTsOrder;
|
||||
} else if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pRight) &&
|
||||
((SScanLogicNode*)pRight)->node.outputTsOrder != SCAN_ORDER_BOTH) {
|
||||
pScan = (SScanLogicNode*)pRight;
|
||||
pChild = pLeft;
|
||||
pChildPos = &pJoin->node.pChildren->pHead->pNode;
|
||||
targetOrder = pScan->node.outputTsOrder;
|
||||
if (pJoin->node.inputTsOrder) {
|
||||
targetOrder = pJoin->node.inputTsOrder;
|
||||
|
||||
if (pRight->outputTsOrder == pJoin->node.inputTsOrder) {
|
||||
pChild = pLeft;
|
||||
pChildPos = &pJoin->node.pChildren->pHead->pNode;
|
||||
} else if (pLeft->outputTsOrder == pJoin->node.inputTsOrder) {
|
||||
pChild = pRight;
|
||||
pChildPos = &pJoin->node.pChildren->pTail->pNode;
|
||||
} else {
|
||||
pChild = pRight;
|
||||
pChildPos = &pJoin->node.pChildren->pTail->pNode;
|
||||
targetOrder = pLeft->outputTsOrder;
|
||||
}
|
||||
} else {
|
||||
pChild = pRight;
|
||||
pChildPos = &pJoin->node.pChildren->pTail->pNode;
|
||||
targetOrder = pLeft->outputTsOrder;
|
||||
if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pLeft) &&
|
||||
((SScanLogicNode*)pLeft)->node.outputTsOrder != SCAN_ORDER_BOTH) {
|
||||
pScan = (SScanLogicNode*)pLeft;
|
||||
pChild = pRight;
|
||||
pChildPos = &pJoin->node.pChildren->pTail->pNode;
|
||||
targetOrder = pScan->node.outputTsOrder;
|
||||
} else if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pRight) &&
|
||||
((SScanLogicNode*)pRight)->node.outputTsOrder != SCAN_ORDER_BOTH) {
|
||||
pScan = (SScanLogicNode*)pRight;
|
||||
pChild = pLeft;
|
||||
pChildPos = &pJoin->node.pChildren->pHead->pNode;
|
||||
targetOrder = pScan->node.outputTsOrder;
|
||||
} else {
|
||||
pChild = pRight;
|
||||
pChildPos = &pJoin->node.pChildren->pTail->pNode;
|
||||
targetOrder = pLeft->outputTsOrder;
|
||||
}
|
||||
pJoin->node.inputTsOrder = targetOrder;
|
||||
}
|
||||
|
||||
if (QUERY_NODE_OPERATOR != nodeType(pJoin->pPrimKeyEqCond)) {
|
||||
|
|
|
@ -26,6 +26,8 @@ static char* getUsageErrFormat(int32_t errCode) {
|
|||
return "not support cross join";
|
||||
case TSDB_CODE_PLAN_NOT_SUPPORT_JOIN_COND:
|
||||
return "Not supported join conditions";
|
||||
case TSDB_CODE_PAR_NOT_SUPPORT_JOIN:
|
||||
return "Not supported join since '%s'";
|
||||
case TSDB_CODE_PLAN_SLOT_NOT_FOUND:
|
||||
return "not found slot id by slot key";
|
||||
case TSDB_CODE_PLAN_INVALID_TABLE_TYPE:
|
||||
|
|
|
@ -1018,6 +1018,7 @@ int32_t qwProcessFetch(QW_FPARAMS_DEF, SQWMsg *qwMsg) {
|
|||
|
||||
if (qwMsg->msg) {
|
||||
code = qwStartDynamicTaskNewExec(QW_FPARAMS(), ctx, qwMsg);
|
||||
qwMsg->msg = NULL;
|
||||
goto _return;
|
||||
}
|
||||
|
||||
|
@ -1063,6 +1064,10 @@ _return:
|
|||
QW_UNLOCK(QW_WRITE, &ctx->lock);
|
||||
}
|
||||
|
||||
if (qwMsg->msg) {
|
||||
qDestroyOperatorParam(qwMsg->msg);
|
||||
}
|
||||
|
||||
input.code = code;
|
||||
code = qwHandlePostPhaseEvents(QW_FPARAMS(), QW_PHASE_POST_FETCH, &input, NULL);
|
||||
|
||||
|
|
|
@ -43,6 +43,9 @@ typedef struct SScalarCtx {
|
|||
#define SCL_DATA_TYPE_DUMMY_HASH 9000
|
||||
#define SCL_DEFAULT_OP_NUM 10
|
||||
|
||||
#define SCL_NEED_SRC_TABLE_FUNC(_type) ((_type) == FUNCTION_TYPE_TIMETRUNCATE)
|
||||
#define SCL_NEED_SRC_TABLE_OP(_type) ((_type) == OP_TYPE_ADD || (_type) == OP_TYPE_SUB)
|
||||
|
||||
#define SCL_IS_NOTNULL_CONST_NODE(_node) ((QUERY_NODE_VALUE == (_node)->type) || (QUERY_NODE_NODE_LIST == (_node)->type))
|
||||
#define SCL_IS_CONST_NODE(_node) \
|
||||
((NULL == (_node)) || SCL_IS_NOTNULL_CONST_NODE(_node))
|
||||
|
|
|
@ -335,7 +335,7 @@ void sclDowngradeValueType(SValueNode *valueNode) {
|
|||
}
|
||||
case TSDB_DATA_TYPE_DOUBLE: {
|
||||
float f = valueNode->datum.d;
|
||||
if (FLT_EQUAL(f, valueNode->datum.d)) {
|
||||
if (DBL_EQUAL(f, valueNode->datum.d)) {
|
||||
valueNode->node.resType.type = TSDB_DATA_TYPE_FLOAT;
|
||||
*(float *)&valueNode->typeData = f;
|
||||
break;
|
||||
|
@ -1209,6 +1209,40 @@ EDealRes sclRewriteNonConstOperator(SNode **pNode, SScalarCtx *ctx) {
|
|||
return DEAL_RES_CONTINUE;
|
||||
}
|
||||
|
||||
void sclGetValueNodeSrcTable(SNode* pNode, char** ppSrcTable, bool* multiTable) {
|
||||
if (*multiTable) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (QUERY_NODE_NODE_LIST == nodeType(pNode)) {
|
||||
SNodeListNode* pList = (SNodeListNode*)pNode;
|
||||
SNode* pTmp = NULL;
|
||||
FOREACH(pTmp, pList->pNodeList) {
|
||||
sclGetValueNodeSrcTable(pTmp, ppSrcTable, multiTable);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (QUERY_NODE_VALUE != nodeType(pNode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SValueNode* pValue = (SValueNode*)pNode;
|
||||
if (pValue->node.srcTable[0]) {
|
||||
if (*ppSrcTable) {
|
||||
if (strcmp(*ppSrcTable, pValue->node.srcTable)) {
|
||||
*multiTable = true;
|
||||
*ppSrcTable = NULL;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
*ppSrcTable = pValue->node.srcTable;
|
||||
}
|
||||
}
|
||||
|
||||
EDealRes sclRewriteFunction(SNode **pNode, SScalarCtx *ctx) {
|
||||
SFunctionNode *node = (SFunctionNode *)*pNode;
|
||||
SNode *tnode = NULL;
|
||||
|
@ -1217,10 +1251,16 @@ EDealRes sclRewriteFunction(SNode **pNode, SScalarCtx *ctx) {
|
|||
return DEAL_RES_CONTINUE;
|
||||
}
|
||||
|
||||
char* srcTable = NULL;
|
||||
bool multiTable = false;
|
||||
FOREACH(tnode, node->pParameterList) {
|
||||
if (!SCL_IS_CONST_NODE(tnode)) {
|
||||
return DEAL_RES_CONTINUE;
|
||||
}
|
||||
|
||||
if (SCL_NEED_SRC_TABLE_FUNC(node->funcType)) {
|
||||
sclGetValueNodeSrcTable(tnode, &srcTable, &multiTable);
|
||||
}
|
||||
}
|
||||
|
||||
SScalarParam output = {0};
|
||||
|
@ -1241,6 +1281,9 @@ EDealRes sclRewriteFunction(SNode **pNode, SScalarCtx *ctx) {
|
|||
|
||||
res->translate = true;
|
||||
|
||||
if (srcTable) {
|
||||
tstrncpy(res->node.srcTable, srcTable, TSDB_TABLE_NAME_LEN);
|
||||
}
|
||||
tstrncpy(res->node.aliasName, node->node.aliasName, TSDB_COL_NAME_LEN);
|
||||
res->node.resType.type = output.columnData->info.type;
|
||||
res->node.resType.bytes = output.columnData->info.bytes;
|
||||
|
@ -1393,8 +1436,18 @@ EDealRes sclRewriteOperator(SNode **pNode, SScalarCtx *ctx) {
|
|||
return DEAL_RES_ERROR;
|
||||
}
|
||||
|
||||
char* srcTable = NULL;
|
||||
bool multiTable = false;
|
||||
if (SCL_NEED_SRC_TABLE_OP(node->opType)) {
|
||||
sclGetValueNodeSrcTable(node->pLeft, &srcTable, &multiTable);
|
||||
sclGetValueNodeSrcTable(node->pRight, &srcTable, &multiTable);
|
||||
}
|
||||
|
||||
res->translate = true;
|
||||
|
||||
if (srcTable) {
|
||||
tstrncpy(res->node.srcTable, srcTable, TSDB_TABLE_NAME_LEN);
|
||||
}
|
||||
tstrncpy(res->node.aliasName, node->node.aliasName, TSDB_COL_NAME_LEN);
|
||||
res->node.resType = node->node.resType;
|
||||
if (colDataIsNull_s(output.columnData, 0)) {
|
||||
|
|
|
@ -65,7 +65,8 @@ int32_t setChkInDecimalHash(const void* pLeft, const void* pRight) {
|
|||
}
|
||||
|
||||
int32_t setChkNotInDecimalHash(const void* pLeft, const void* pRight) {
|
||||
return NULL == taosHashGet((SHashObj *)pRight, pLeft, 16) ? 1 : 0;
|
||||
const SDecimalCompareCtx *pCtxL = pLeft, *pCtxR = pRight;
|
||||
return NULL == taosHashGet((SHashObj *)(pCtxR->pData), pCtxL->pData, tDataTypes[pCtxL->type].bytes) ? 1 : 0;
|
||||
}
|
||||
|
||||
int32_t compareChkInString(const void *pLeft, const void *pRight) {
|
||||
|
@ -187,7 +188,7 @@ int32_t compareDoubleVal(const void *pLeft, const void *pRight) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (FLT_EQUAL(p1, p2)) {
|
||||
if (DBL_EQUAL(p1, p2)) {
|
||||
return 0;
|
||||
}
|
||||
return FLT_GREATER(p1, p2) ? 1 : -1;
|
||||
|
|
|
@ -908,6 +908,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_VTABLE_SCAN_INTERNAL_ERROR, "Virtual table scan
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_VTABLE_SCAN_INVALID_DOWNSTREAM, "Virtual table scan invalid downstream operator type")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_VTABLE_PRIMTS_HAS_REF, "Virtual table prim timestamp column should not has ref column")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_VTABLE_NOT_VIRTUAL_SUPER_TABLE, "Create virtual child table must use virtual super table")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_VTABLE_NOT_SUPPORT_DATA_TYPE, "Virtual table not support decimal type")
|
||||
#ifdef TAOS_ERROR_C
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -170,12 +170,13 @@ uint32_t taosDoubleHash(const char *key, uint32_t UNUSED_PARAM(len)) {
|
|||
return 0x7fc00000;
|
||||
}
|
||||
|
||||
if (FLT_EQUAL(f, 0.0)) {
|
||||
if (DBL_EQUAL(f, 0.0)) {
|
||||
return 0;
|
||||
}
|
||||
if (fabs(f) < DBL_MAX / BASE - DLT) {
|
||||
int32_t t = (int32_t)(round(BASE * (f + DLT)));
|
||||
return (uint32_t)t;
|
||||
uint64_t bits;
|
||||
memcpy(&bits, &f, sizeof(double));
|
||||
return (uint32_t)(bits ^ (bits >> 32));
|
||||
} else {
|
||||
return 0x7fc00000;
|
||||
}
|
||||
|
|
|
@ -338,17 +338,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a full joi
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -357,17 +346,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f)
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a full join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
|
|
|
|
@ -32,9 +32,7 @@ select b.c from a1 a full join (select __today__ as ts1, ts, f, g, 'a' c from b1
|
|||
select b.ts from a1 a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a full join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta full join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta full join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
|
|
@ -338,17 +338,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a full j
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -357,17 +346,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a full join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
|
|
|
|
@ -233,11 +233,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f,
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -246,11 +241,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f,
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
@ -703,11 +693,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f,
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -716,11 +701,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f,
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
|
Can't render this file because it contains an unexpected character in line 5 and column 49.
|
|
@ -32,9 +32,7 @@ select b.c from a1 a join (select timestamp __today__ as ts1, ts, f, g, 'a' c fr
|
|||
select b.ts from a1 a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1) a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1) a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select timestamp __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select timestamp __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
@ -107,9 +105,7 @@ select b.c from a1 a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from
|
|||
select b.ts from a1 a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1) a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1) a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select timestamp __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select timestamp __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select timestamp __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
|
||||
|
|
|
@ -233,11 +233,6 @@ taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts,
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -246,11 +241,6 @@ taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts,
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
@ -703,11 +693,6 @@ taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts,
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -716,11 +701,6 @@ taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts,
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
|
Can't render this file because it contains an unexpected character in line 5 and column 49.
|
|
@ -233,11 +233,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, t
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:01.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -246,11 +241,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, t
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:01.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
@ -703,11 +693,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, t
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:01.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -716,11 +701,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, t
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:01.000 |
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
|
Can't render this file because it contains an unexpected character in line 5 and column 49.
|
|
@ -80,27 +80,7 @@ taos> select b.c from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b o
|
|||
|
||||
taos> select b.ts from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
|
@ -267,25 +247,7 @@ taos> select b.ts from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b whe
|
|||
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select now ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
||||
|
|
|
|
@ -26,11 +26,7 @@ select a.* from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on
|
|||
select b.* from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.c from a1 a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from a1 a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select __const__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
@ -98,10 +94,7 @@ select b.* from a1 a , (select __const__ as ts1, ts, f, g, 'a' from b1) b where
|
|||
select b.c from a1 a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from a1 a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select __const__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
|
||||
|
|
|
@ -80,27 +80,7 @@ taos> select b.c from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b
|
|||
|
||||
taos> select b.ts from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
|
@ -267,25 +247,7 @@ taos> select b.ts from a1 a , (select now() as ts1, ts, f, g, 'a' c from b1) b w
|
|||
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select now() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
||||
|
|
|
|
@ -233,11 +233,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (se
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -246,7 +241,7 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f)
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
|
@ -703,11 +698,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a , (selec
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -716,7 +706,7 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f)
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
|
|
|
|
@ -32,9 +32,8 @@ select b.c from a1 a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b o
|
|||
select b.ts from a1 a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
@ -107,9 +106,8 @@ select b.c from a1 a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b wher
|
|||
select b.ts from a1 a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
|
||||
|
|
|
@ -233,11 +233,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a join (
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -246,7 +241,7 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
|
@ -703,11 +698,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a , (sel
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today() as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -716,7 +706,7 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select today() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
|
|
|
|
@ -1,811 +0,0 @@
|
|||
|
||||
taos> use test;
|
||||
Database changed.
|
||||
|
||||
taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
|
||||
taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
|
||||
taos> select a.*, b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
|
||||
ts | f | g | ts |
|
||||
================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:01.000 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
|
||||
taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
|
||||
taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
|
||||
taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
|
||||
ts | f | g | ts1 | ts | f | g | c |
|
||||
==============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:01.000 | 102 | 1012 |
|
||||
2025-03-05 00:00:00.000 | 103 | 1013 |
|
||||
2025-03-05 00:00:02.000 | 104 | 1014 |
|
||||
|
||||
taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
|
||||
ts1 | ts | f | g | c |
|
||||
========================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.ts1,a.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
|
||||
taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
ts | f | g | ts1 | ts | f | g | 'a' |
|
||||
==============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:01.000 | 102 | 1012 |
|
||||
2025-03-05 00:00:00.000 | 103 | 1013 |
|
||||
2025-03-05 00:00:02.000 | 104 | 1014 |
|
||||
|
||||
taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
========================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:01.000 |
|
||||
2025-03-05 00:00:00.000 |
|
||||
2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts | f | g | ts1 | ts | f | g | 'a' |
|
||||
==============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
========================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
|
||||
taos> select b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g | 'a' |
|
||||
==============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
========================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
|
||||
taos> select b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:01.000 |
|
||||
2025-03-05 00:00:00.000 |
|
||||
2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:01.000 |
|
||||
2025-03-05 00:00:00.000 |
|
||||
2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts="2025-03-04 00:00:00.000" where tb.ts="2025-03-04 00:00:00.000" order by tb.val;
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>"2025-03-04 00:00:00.000" where tb.ts>"2025-03-04 00:00:00.000";
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today() + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
ts | val | tg2 | ts | val | tg2 |
|
||||
============================================================================================================
|
||||
2025-03-05 00:00:03.000 | 204 | 2 | 2025-03-05 00:00:03.000 | 404 | 2 |
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
||||
ts | f | g | 'a' | ts | f | g |
|
||||
====================================================================================================================
|
||||
| 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
|
||||
ts1 | f | g | 'a' | ts | f | g |
|
||||
====================================================================================================================
|
||||
| 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
||||
ts | f | g | 'a' |
|
||||
==============================================================
|
||||
| 301 | 3011 | a |
|
||||
| 302 | 3012 | a |
|
||||
| 303 | 3013 | a |
|
||||
| 304 | 3014 | a |
|
||||
|
||||
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
|
||||
ts1 | f | g | 'a' |
|
||||
==============================================================
|
||||
| 301 | 3011 | a |
|
||||
| 302 | 3012 | a |
|
||||
| 303 | 3013 | a |
|
||||
| 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
|
||||
ts |
|
||||
============================
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
|
||||
ts1 | ts | f | g | 'a' | ts | f | g |
|
||||
==============================================================================================================================================
|
||||
| 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
========================================================================================
|
||||
| 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
| 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
| 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
| 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts1 from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
|
||||
ts1 |
|
||||
============================
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' | ts | f | g |
|
||||
==============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 |
|
||||
|
||||
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:01.000 | 102 | 1012 |
|
||||
2025-03-05 00:00:00.000 | 103 | 1013 |
|
||||
2025-03-05 00:00:02.000 | 104 | 1014 |
|
||||
|
||||
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
========================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:01.000 |
|
||||
2025-03-05 00:00:00.000 |
|
||||
2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' | ts | f | g |
|
||||
==============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
========================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts1 | ts | f | g | 'a' | ts | f | g |
|
||||
==============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
========================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;;
|
||||
ts | val | tg2 | ts | val | tg2 |
|
||||
==============================================================================================================
|
||||
| 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
| 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
| 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
| 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
| 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
| 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
| 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
| 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts="2025-03-04 00:00:00.000" where tb.ts="2025-03-04 00:00:00.000" order by tb.val;
|
||||
ts | val | tg2 | ts | val | tg2 |
|
||||
==============================================================================================================
|
||||
| 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
| 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
| 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
| 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
| 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
| 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
| 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
| 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>"2025-03-04 00:00:00.000" where tb.ts>"2025-03-04 00:00:00.000";
|
||||
|
||||
taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b where a.ts = b.ts1;
|
||||
taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
|
||||
taos> select b.ts1 from a1 a , (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
|
||||
taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
|
||||
taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
|
||||
taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts1 from a1 a , (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts;
|
||||
taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
ts | f | g | ts1 | ts | f | g | 'a' |
|
||||
==============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:01.000 | 102 | 1012 |
|
||||
2025-03-05 00:00:00.000 | 103 | 1013 |
|
||||
2025-03-05 00:00:02.000 | 104 | 1014 |
|
||||
|
||||
taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
========================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:01.000 |
|
||||
2025-03-05 00:00:00.000 |
|
||||
2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts | f | g | ts1 | ts | f | g | 'a' |
|
||||
==============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
========================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
|
||||
taos> select b.ts from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g | 'a' |
|
||||
==============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
========================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
|
||||
taos> select b.ts from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:01.000 |
|
||||
2025-03-05 00:00:00.000 |
|
||||
2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:01.000 |
|
||||
2025-03-05 00:00:00.000 |
|
||||
2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts="2025-03-04 00:00:00.000" order by tb.val;
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>"2025-03-04 00:00:00.000" ;
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
||||
ts | f | g | 'a' | ts | f | g |
|
||||
====================================================================================================================
|
||||
| 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
|
||||
ts1 | f | g | 'a' | ts | f | g |
|
||||
====================================================================================================================
|
||||
| 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
||||
ts | f | g | 'a' |
|
||||
==============================================================
|
||||
| 301 | 3011 | a |
|
||||
| 302 | 3012 | a |
|
||||
| 303 | 3013 | a |
|
||||
| 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
|
||||
ts |
|
||||
============================
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
||||
taos> select b.ts1 from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
|
||||
ts1 |
|
||||
============================
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
|
||||
ts1 | ts | f | g | 'a' | ts | f | g |
|
||||
==============================================================================================================================================
|
||||
| 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
| 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
========================================================================================
|
||||
| 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
| 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
| 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
| 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts1 from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
|
||||
ts1 |
|
||||
============================
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' | ts | f | g |
|
||||
==============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 |
|
||||
|
||||
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:01.000 | 102 | 1012 |
|
||||
2025-03-05 00:00:00.000 | 103 | 1013 |
|
||||
2025-03-05 00:00:02.000 | 104 | 1014 |
|
||||
|
||||
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
========================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:01.000 |
|
||||
2025-03-05 00:00:00.000 |
|
||||
2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' | ts | f | g |
|
||||
==============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
========================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts1 | ts | f | g | 'a' | ts | f | g |
|
||||
==============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
========================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
|
||||
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta where ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
|
||||
ts | val | tg2 | ts | val | tg2 |
|
||||
==============================================================================================================
|
||||
| 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
| 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
| 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
| 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
| 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
| 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
| 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
| 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts="2025-03-04 00:00:00.000" order by tb.val;
|
||||
ts | val | tg2 | ts | val | tg2 |
|
||||
==============================================================================================================
|
||||
| 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
| 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
| 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
| 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
| 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
| 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
| 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
| 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
|
||||
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>"2025-03-04 00:00:00.000" ;
|
||||
|
Can't render this file because it contains an unexpected character in line 5 and column 39.
|
|
@ -1,969 +0,0 @@
|
|||
|
||||
taos> use test;
|
||||
Database changed.
|
||||
|
||||
taos> select * from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
ts | f | g | ts | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from a1 a join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
|
||||
ts | f | g | ts1 | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select a.* from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
ts | f | g | 'a' |
|
||||
============================================================
|
||||
2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.* from a1 a join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
|
||||
ts1 | f | g | 'a' |
|
||||
============================================================
|
||||
2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select a.*, b.ts from a1 a join (select today as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
|
||||
ts | f | g | ts |
|
||||
================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:01.000 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select b.c from a1 a join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts from a1 a join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
|
||||
ts | f | g | ts1 | ts | f | g | 'a' |
|
||||
============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
======================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
|
||||
ts | f | g | ts1 | ts | f | g | c |
|
||||
============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:01.000 | 102 | 1012 |
|
||||
2025-03-05 00:00:00.000 | 103 | 1013 |
|
||||
2025-03-05 00:00:02.000 | 104 | 1014 |
|
||||
|
||||
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
|
||||
ts1 | ts | f | g | c |
|
||||
======================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.ts1,a.ts from a1 a join (select today as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
|
||||
ts1 | ts |
|
||||
====================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
ts | f | g | ts1 | ts | f | g | 'a' |
|
||||
============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:01.000 | 102 | 1012 |
|
||||
2025-03-05 00:00:00.000 | 103 | 1013 |
|
||||
2025-03-05 00:00:02.000 | 104 | 1014 |
|
||||
|
||||
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
======================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:01.000 |
|
||||
2025-03-05 00:00:00.000 |
|
||||
2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts | f | g | ts1 | ts | f | g | 'a' |
|
||||
============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
======================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
|
||||
taos> select b.ts from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g | 'a' |
|
||||
============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
======================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
|
||||
taos> select b.ts from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:01.000 |
|
||||
2025-03-05 00:00:00.000 |
|
||||
2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:01.000 |
|
||||
2025-03-05 00:00:00.000 |
|
||||
2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
|
||||
ts | val | tg2 | ts | val | tg2 |
|
||||
============================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 |
|
||||
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 |
|
||||
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 |
|
||||
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 |
|
||||
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 |
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val;
|
||||
ts | val | tg2 | ts | val | tg2 |
|
||||
============================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 |
|
||||
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 |
|
||||
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 |
|
||||
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 |
|
||||
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 |
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today where tb.ts>today;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today() + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
ts | val | tg2 | ts | val | tg2 |
|
||||
============================================================================================================
|
||||
2025-03-05 00:00:03.000 | 204 | 2 | 2025-03-05 00:00:03.000 | 404 | 2 |
|
||||
|
||||
taos> select * from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
||||
ts | f | g | 'a' | ts | f | g |
|
||||
==================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select * from (select today as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
|
||||
ts1 | f | g | 'a' | ts | f | g |
|
||||
==================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select a.* from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
||||
ts | f | g | 'a' |
|
||||
============================================================
|
||||
2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.* from (select today as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
|
||||
ts1 | f | g | 'a' |
|
||||
============================================================
|
||||
2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from (select today as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts from (select today as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
|
||||
ts1 | ts | f | g | 'a' | ts | f | g |
|
||||
============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
======================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
|
||||
ts1 |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' | ts | f | g |
|
||||
============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 |
|
||||
|
||||
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:01.000 | 102 | 1012 |
|
||||
2025-03-05 00:00:00.000 | 103 | 1013 |
|
||||
2025-03-05 00:00:02.000 | 104 | 1014 |
|
||||
|
||||
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
======================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:01.000 |
|
||||
2025-03-05 00:00:00.000 |
|
||||
2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' | ts | f | g |
|
||||
============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
======================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts1 | ts | f | g | 'a' | ts | f | g |
|
||||
============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
======================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
||||
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
||||
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;;
|
||||
ts | val | tg2 | ts | val | tg2 |
|
||||
============================================================================================================
|
||||
2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
|
||||
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val;
|
||||
ts | val | tg2 | ts | val | tg2 |
|
||||
============================================================================================================
|
||||
2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
|
||||
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today where tb.ts>today;
|
||||
|
||||
taos> select * from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
ts | f | g | ts | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from a1 a , (select today as ts1, f, g, 'a' from b1) b where a.ts = b.ts1;
|
||||
ts | f | g | ts1 | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select a.* from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
ts | f | g | 'a' |
|
||||
============================================================
|
||||
2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from a1 a , (select today as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts from a1 a , (select today as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select b.ts1 from a1 a , (select today as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
|
||||
ts1 |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
|
||||
ts | f | g | ts1 | ts | f | g | 'a' |
|
||||
============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
======================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts1 from a1 a , (select today as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts;
|
||||
ts1 |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
ts | f | g | ts1 | ts | f | g | 'a' |
|
||||
============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:01.000 | 102 | 1012 |
|
||||
2025-03-05 00:00:00.000 | 103 | 1013 |
|
||||
2025-03-05 00:00:02.000 | 104 | 1014 |
|
||||
|
||||
taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
======================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:01.000 |
|
||||
2025-03-05 00:00:00.000 |
|
||||
2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts | f | g | ts1 | ts | f | g | 'a' |
|
||||
============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
======================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
|
||||
taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g | 'a' |
|
||||
============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
======================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
|
||||
taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:01.000 |
|
||||
2025-03-05 00:00:00.000 |
|
||||
2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:01.000 |
|
||||
2025-03-05 00:00:00.000 |
|
||||
2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
|
||||
ts | val | tg2 | ts | val | tg2 |
|
||||
============================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 |
|
||||
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 |
|
||||
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 |
|
||||
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 |
|
||||
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 |
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today order by tb.val;
|
||||
ts | val | tg2 | ts | val | tg2 |
|
||||
============================================================================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 |
|
||||
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 |
|
||||
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 |
|
||||
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 |
|
||||
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 |
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today ;
|
||||
|
||||
taos> select * from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
||||
ts | f | g | 'a' | ts | f | g |
|
||||
==================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select * from (select today as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
|
||||
ts1 | f | g | 'a' | ts | f | g |
|
||||
==================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select a.* from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
||||
ts | f | g | 'a' |
|
||||
============================================================
|
||||
2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from (select today as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts from (select today as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
|
||||
ts1 |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
|
||||
ts1 | ts | f | g | 'a' | ts | f | g |
|
||||
============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
======================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
|
||||
ts1 |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' | ts | f | g |
|
||||
============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 |
|
||||
|
||||
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
2025-03-04 00:00:01.000 | 102 | 1012 |
|
||||
2025-03-05 00:00:00.000 | 103 | 1013 |
|
||||
2025-03-05 00:00:02.000 | 104 | 1014 |
|
||||
|
||||
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
======================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
|
||||
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
a |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
2025-03-04 00:00:01.000 |
|
||||
2025-03-05 00:00:00.000 |
|
||||
2025-03-05 00:00:02.000 |
|
||||
|
||||
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' | ts | f | g |
|
||||
============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
======================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts1 | ts | f | g | 'a' | ts | f | g |
|
||||
============================================================================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts | f | g |
|
||||
======================================================
|
||||
2025-03-04 00:00:00.000 | 101 | 1011 |
|
||||
|
||||
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts1 | ts | f | g | 'a' |
|
||||
======================================================================================
|
||||
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
||||
c |
|
||||
======
|
||||
a |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
2025-03-04 00:00:00.000 |
|
||||
|
||||
taos> select * from (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta where ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
||||
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
||||
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
|
||||
ts | val | tg2 | ts | val | tg2 |
|
||||
============================================================================================================
|
||||
2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
|
||||
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today order by tb.val;
|
||||
ts | val | tg2 | ts | val | tg2 |
|
||||
============================================================================================================
|
||||
2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
|
||||
2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
|
||||
|
||||
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today ;
|
||||
|
|
|
@ -188,22 +188,8 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left ant
|
|||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left anti join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left anti join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
|
|
|
|
@ -32,9 +32,7 @@ select b.c from a1 a left anti join (select __today__ as ts1, ts, f, g, 'a' c fr
|
|||
select b.ts from a1 a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left anti join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left anti join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left anti join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
|
|
@ -188,22 +188,8 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left a
|
|||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left anti join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left anti join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
|
|
|
|
@ -226,38 +226,6 @@ taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a left join
|
|||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -474,17 +442,5 @@ taos> select tb.val,tb.tg2,ta.* from (select now ts, last(f) val, tg2 from stb w
|
|||
403 | 2 | NULL | NULL | NULL |
|
||||
404 | 2 | NULL | NULL | NULL |
|
||||
|
||||
taos> select tb.val,tb.tg2,ta.* from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now where tb.ts=now order by tb.val;
|
||||
val | tg2 | ts | val | tg2 |
|
||||
==================================================================================
|
||||
301 | 1 | NULL | NULL | NULL |
|
||||
302 | 1 | NULL | NULL | NULL |
|
||||
303 | 1 | NULL | NULL | NULL |
|
||||
304 | 1 | NULL | NULL | NULL |
|
||||
401 | 2 | NULL | NULL | NULL |
|
||||
402 | 2 | NULL | NULL | NULL |
|
||||
403 | 2 | NULL | NULL | NULL |
|
||||
404 | 2 | NULL | NULL | NULL |
|
||||
|
||||
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now where tb.ts>now;
|
||||
|
||||
|
|
|
|
@ -27,10 +27,6 @@ select b.* from a1 a left join (select __const__ as ts1, ts, f, g, 'a' from b1)
|
|||
select b.c from a1 a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from a1 a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left join (select __const__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left join (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
@ -61,7 +57,6 @@ select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from b1) b left join
|
|||
select tb.val,tb.tg1,ta.* from (select __const__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb left join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
select tb.val,tb.tg2,ta.* from (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
select tb.val,tb.tg2,ta.* from (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
|
||||
select tb.val,tb.tg2,ta.* from (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=__const__ where tb.ts=__const__ order by tb.val;
|
||||
select * from (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>__const__ where tb.ts>__const__;
|
||||
|
||||
|
||||
|
|
|
@ -226,38 +226,6 @@ taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a left joi
|
|||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -474,17 +442,5 @@ taos> select tb.val,tb.tg2,ta.* from (select now() ts, last(f) val, tg2 from stb
|
|||
403 | 2 | NULL | NULL | NULL |
|
||||
404 | 2 | NULL | NULL | NULL |
|
||||
|
||||
taos> select tb.val,tb.tg2,ta.* from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now() where tb.ts=now() order by tb.val;
|
||||
val | tg2 | ts | val | tg2 |
|
||||
==================================================================================
|
||||
301 | 1 | NULL | NULL | NULL |
|
||||
302 | 1 | NULL | NULL | NULL |
|
||||
303 | 1 | NULL | NULL | NULL |
|
||||
304 | 1 | NULL | NULL | NULL |
|
||||
401 | 2 | NULL | NULL | NULL |
|
||||
402 | 2 | NULL | NULL | NULL |
|
||||
403 | 2 | NULL | NULL | NULL |
|
||||
404 | 2 | NULL | NULL | NULL |
|
||||
|
||||
taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now() where tb.ts>now();
|
||||
|
||||
|
|
|
|
@ -305,14 +305,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left joi
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -321,14 +313,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f)
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
|
|
|
|
@ -32,9 +32,7 @@ select b.c from a1 a left join (select __today__ as ts1, ts, f, g, 'a' c from b1
|
|||
select b.ts from a1 a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
|
|
@ -305,14 +305,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left j
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -321,14 +313,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
NULL |
|
||||
NULL |
|
||||
NULL |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
|
|
|
|
@ -194,11 +194,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left sem
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -207,11 +202,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f)
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left semi join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left semi join (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
@ -224,7 +214,7 @@ taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where
|
|||
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
|
||||
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val;
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc, val) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val;
|
||||
ts | val | tg2 | ts | val | tg2 |
|
||||
============================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
|
||||
|
|
|
|
@ -32,14 +32,12 @@ select b.c from a1 a left semi join (select __today__ as ts1, ts, f, g, 'a' c fr
|
|||
select b.ts from a1 a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left semi join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left semi join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left semi join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by ta.ts, ta.val, tb.val;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=__today__ where tb.ts=__today__ order by tb.val;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc, val) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=__today__ where tb.ts=__today__ order by tb.val;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>__today__ where tb.ts>__today__;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left semi join (select __today__ + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
||||
|
|
|
@ -194,11 +194,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left s
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -207,11 +202,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left semi join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left semi join (select today() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
|
@ -224,7 +214,7 @@ taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where
|
|||
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
|
||||
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
|
||||
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select today() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today() where tb.ts=today() order by tb.val;
|
||||
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select today() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc, val) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today() where tb.ts=today() order by tb.val;
|
||||
ts | val | tg2 | ts | val | tg2 |
|
||||
============================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
|
||||
|
|
|
|
@ -0,0 +1,880 @@
|
|||
|
||||
taos> use test;
|
||||
Database changed.
|
||||
|
||||
taos> select * from a1 a join (select today + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
ts | f | g | ts | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
ts | f | g | ts | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts, 1d);
|
||||
ts | f | g | ts | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts + 1s, 1d);
|
||||
ts | f | g | ts | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from (select ts + 2s as ts,f from a1) a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
ts | f | ts | f | g | 'a' |
|
||||
====================================================================================================
|
||||
__tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
|
||||
__tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
|
||||
__tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
|
||||
__tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from a1 a join (select case when 1 > 0 then timestamp '__today__ 00:00:00.000' else timestamp '__tomorrow__ 00:00:00.000' end as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
ts | f | g | ts | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b on a.ts = b.ts + 1d + 1s;
|
||||
ts | f | g | ts | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 301 | 3011 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 302 | 3012 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 303 | 3013 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts + 1d + 1s, 1d) + 2s;
|
||||
ts | f | g | ts | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 301 | 3011 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 302 | 3012 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 303 | 3013 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from a1 a, (select today + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
ts | f | g | ts | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
ts | f | g | ts | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts, 1d);
|
||||
ts | f | g | ts | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts + 1s, 1d);
|
||||
ts | f | g | ts | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from (select ts + 2s as ts,f from a1) a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
ts | f | ts | f | g | 'a' |
|
||||
====================================================================================================
|
||||
__tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
|
||||
__tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
|
||||
__tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
|
||||
__tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from a1 a, (select case when 1 > 0 then timestamp '__today__ 00:00:00.000' else timestamp '__tomorrow__ 00:00:00.000' end as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
ts | f | g | ts | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b where a.ts = b.ts + 1d + 1s;
|
||||
ts | f | g | ts | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 301 | 3011 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 302 | 3012 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 303 | 3013 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts + 1d + 1s, 1d) + 2s;
|
||||
ts | f | g | ts | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 301 | 3011 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 302 | 3012 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 303 | 3013 | a |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 304 | 3014 | a |
|
||||
|
||||
taos> select * from a1 a, (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts order by b.ts, b.f desc;
|
||||
ts | f | g | ts | f | g | 'a' |
|
||||
==================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
|
||||
|
||||
taos> select count(*) from a1 a, (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts group by b.ts order by b.ts;
|
||||
count(*) |
|
||||
========================
|
||||
4 |
|
||||
|
||||
taos> select b.ts, count(*) from a1 a left join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts group by b.ts order by b.ts;
|
||||
ts | count(*) |
|
||||
==================================================
|
||||
NULL | 3 |
|
||||
__today__ 00:00:00.000 | 4 |
|
||||
|
||||
taos> select * from (select * from a1 order by ts desc) a join (select today as ts1, * from b1 order by ts1 desc) b on a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> /*table+subq*/
|
||||
taos> select * from a1 a join (select * from b1 order by ts) b on a.ts = b.ts;
|
||||
ts | f | g | ts | f | g |
|
||||
============================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from a1 a join (select * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
ts | f | g | ts | f | g |
|
||||
============================================================================================================
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> /*table+const subq*/
|
||||
taos> select * from a1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from a1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from a1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from a1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from a1 a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> /*subq+subq*/
|
||||
taos> select * from (select * from a1 order by ts) a join (select * from b1 order by ts) b on a.ts = b.ts;
|
||||
ts | f | g | ts | f | g |
|
||||
============================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from (select * from a1 order by ts) a join (select * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
ts | f | g | ts | f | g |
|
||||
============================================================================================================
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select * from a1 order by ts desc) a join (select * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
ts | f | g | ts | f | g |
|
||||
============================================================================================================
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> /*subq+const subq*/
|
||||
taos> select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> /*const subq+const subq*/
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> /*functions*/
|
||||
taos> select * from a1 a join (select to_timestamp('__today__', 'yyyy-mm-dd') as ts1, * from b1) b on a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from a1 a join (select to_timestamp('__today__', 'yyyy-mm-dd') + 1s as ts1, * from b1) b on a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from a1 a join (select to_unixtimestamp('__today__ 00:00:00.000', 1) as ts1, * from b1) b on a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from a1 a join (select to_unixtimestamp('__today__ 00:00:00.000', 1) + 1s as ts1, * from b1) b on a.ts = b.ts1;
|
||||
ts | f | g | ts1 | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> /*view*/
|
||||
taos> select * from view1 a join (select * from b1 order by ts) b on a.ts = b.ts;
|
||||
ts1 | ts | f | g | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from view1 a join (select * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
ts1 | ts | f | g | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from view1 a join (select * from b1 order by ts) b on a.ts1 = b.ts;
|
||||
ts1 | ts | f | g | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from view1 a join (select * from b1 order by ts desc) b on a.ts1 = b.ts;
|
||||
ts1 | ts | f | g | ts | f | g |
|
||||
======================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
|
||||
taos> select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 where a.ts1 is null;
|
||||
|
||||
taos> select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 where a.ts1 is not null;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
||||
taos> select * from view1 a, (select today() as ts1, * from b1 order by f) b where a.ts1 = b.ts1;
|
||||
ts1 | ts | f | g | ts1 | ts | f | g |
|
||||
================================================================================================================================================================
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
|
||||
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
use test;
|
||||
|
||||
select * from a1 a join (select today + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts, 1d);
|
||||
select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts + 1s, 1d);
|
||||
select * from (select ts + 2s as ts,f from a1) a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
select * from a1 a join (select case when 1 > 0 then timestamp '__today__ 00:00:00.000' else timestamp '__tomorrow__ 00:00:00.000' end as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
||||
select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b on a.ts = b.ts + 1d + 1s;
|
||||
select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts + 1d + 1s, 1d) + 2s;
|
||||
|
||||
select * from a1 a, (select today + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts, 1d);
|
||||
select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts + 1s, 1d);
|
||||
select * from (select ts + 2s as ts,f from a1) a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
select * from a1 a, (select case when 1 > 0 then timestamp '__today__ 00:00:00.000' else timestamp '__tomorrow__ 00:00:00.000' end as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
||||
select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b where a.ts = b.ts + 1d + 1s;
|
||||
select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts + 1d + 1s, 1d) + 2s;
|
||||
|
||||
select * from a1 a, (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts order by b.ts, b.f desc;
|
||||
select count(*) from a1 a, (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts group by b.ts order by b.ts;
|
||||
select b.ts, count(*) from a1 a left join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts group by b.ts order by b.ts;
|
||||
select * from (select * from a1 order by ts desc) a join (select today as ts1, * from b1 order by ts1 desc) b on a.ts = b.ts1;
|
||||
|
||||
/*table+subq*/
|
||||
select * from a1 a join (select * from b1 order by ts) b on a.ts = b.ts;
|
||||
select * from a1 a join (select * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
|
||||
/*table+const subq*/
|
||||
select * from a1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;
|
||||
select * from a1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
|
||||
select * from a1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1;
|
||||
select * from a1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1;
|
||||
select * from a1 a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1;
|
||||
|
||||
|
||||
/*subq+subq*/
|
||||
select * from (select * from a1 order by ts) a join (select * from b1 order by ts) b on a.ts = b.ts;
|
||||
select * from (select * from a1 order by ts) a join (select * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
|
||||
select * from (select * from a1 order by ts desc) a join (select * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
|
||||
/*subq+const subq*/
|
||||
select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;
|
||||
select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
|
||||
select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;
|
||||
select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
|
||||
select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1;
|
||||
select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1;
|
||||
select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1;
|
||||
|
||||
select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1;
|
||||
select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1;
|
||||
select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1;
|
||||
|
||||
/*const subq+const subq*/
|
||||
select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;
|
||||
select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
|
||||
select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;
|
||||
select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
|
||||
|
||||
select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts;
|
||||
select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts;
|
||||
|
||||
select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts;
|
||||
select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts;
|
||||
|
||||
select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts;
|
||||
select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts;
|
||||
|
||||
|
||||
select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1;
|
||||
select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1;
|
||||
select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1;
|
||||
|
||||
select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1;
|
||||
select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1;
|
||||
select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1;
|
||||
|
||||
select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1;
|
||||
select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1;
|
||||
select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1;
|
||||
|
||||
|
||||
select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
|
||||
select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
|
||||
select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts;
|
||||
|
||||
/*functions*/
|
||||
select * from a1 a join (select to_timestamp('__today__', 'yyyy-mm-dd') as ts1, * from b1) b on a.ts = b.ts1;
|
||||
select * from a1 a join (select to_timestamp('__today__', 'yyyy-mm-dd') + 1s as ts1, * from b1) b on a.ts = b.ts1;
|
||||
select * from a1 a join (select to_unixtimestamp('__today__ 00:00:00.000', 1) as ts1, * from b1) b on a.ts = b.ts1;
|
||||
select * from a1 a join (select to_unixtimestamp('__today__ 00:00:00.000', 1) + 1s as ts1, * from b1) b on a.ts = b.ts1;
|
||||
|
||||
/*view*/
|
||||
select * from view1 a join (select * from b1 order by ts) b on a.ts = b.ts;
|
||||
select * from view1 a join (select * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
select * from view1 a join (select * from b1 order by ts) b on a.ts1 = b.ts;
|
||||
select * from view1 a join (select * from b1 order by ts desc) b on a.ts1 = b.ts;
|
||||
|
||||
select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;
|
||||
select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;
|
||||
select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts;
|
||||
select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts;
|
||||
|
||||
select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1;
|
||||
select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1;
|
||||
select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1;
|
||||
select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1;
|
||||
select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1;
|
||||
select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1;
|
||||
|
||||
select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 where a.ts1 is null;
|
||||
select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 where a.ts1 is not null;
|
||||
select * from view1 a, (select today() as ts1, * from b1 order by f) b where a.ts1 = b.ts1;
|
|
@ -266,14 +266,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a right jo
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -282,14 +274,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f)
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a right join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
|
|
|
|
@ -32,9 +32,7 @@ select b.c from a1 a right join (select __today__ as ts1, ts, f, g, 'a' c from b
|
|||
select b.ts from a1 a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a right join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta right join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
||||
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta right join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
||||
|
|
|
@ -266,14 +266,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a right
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
||||
ts |
|
||||
==========================
|
||||
|
@ -282,14 +274,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by
|
|||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
__today__ 00:00:00.000 |
|
||||
__today__ 00:00:01.000 |
|
||||
__tomorrow__ 00:00:00.000 |
|
||||
__tomorrow__ 00:00:02.000 |
|
||||
|
||||
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a right join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
||||
ts |
|
||||
==========================
|
||||
|
|
|
|
@ -63,6 +63,8 @@ class TDTestCase(TBase):
|
|||
tdSql.execute(f"insert into b2 using stb tags(1, 2, 4) values('{self.tomorrow_ts}', 403, 4013);")
|
||||
tdSql.execute(f"insert into b2 using stb tags(1, 2, 4) values('{self.tomorrow_ts}' + 3s, 404, 4014);")
|
||||
|
||||
tdSql.execute(f"create view view1 as select today() as ts1, * from a1;")
|
||||
|
||||
def replace_string(self, input_file, output_file, old_str, new_str):
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
with open(f"{script_dir}/joinConst/{input_file}", 'r') as f_in, open(f"{script_dir}/joinConst/{output_file}", 'w') as f_out:
|
||||
|
@ -148,22 +150,68 @@ class TDTestCase(TBase):
|
|||
tdLog.printNoPrefix(f"==========step:nocheck test")
|
||||
tdSql.execute("select * from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;")
|
||||
tdSql.execute("select * from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;")
|
||||
tdSql.execute("select b.* from a1 a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;")
|
||||
tdSql.execute("select * from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;")
|
||||
tdSql.execute("select b.* from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;")
|
||||
tdSql.execute("select * from (select __const__ as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;")
|
||||
tdSql.execute("select b.* from (select __const__ as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;")
|
||||
tdSql.execute("select * from a1 a , (select __const__ as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;")
|
||||
tdSql.execute("select b.* from a1 a , (select __const__ as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;")
|
||||
tdSql.execute("select * from (select __const__ as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;")
|
||||
tdSql.execute("select b.* from (select __const__ as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;")
|
||||
tdSql.execute("select b.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;")
|
||||
tdSql.execute("select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;")
|
||||
tdSql.execute("select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;")
|
||||
tdSql.execute("select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;")
|
||||
tdSql.execute("select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;")
|
||||
tdSql.execute("select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;")
|
||||
tdSql.execute("select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;")
|
||||
tdSql.execute("select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;")
|
||||
tdSql.execute("select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;")
|
||||
tdSql.execute("select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;")
|
||||
tdSql.execute("select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;")
|
||||
tdSql.execute("select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;")
|
||||
tdSql.execute("select tb.val,tb.tg2,ta.* from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now() where tb.ts=now() order by tb.val;")
|
||||
|
||||
def test_abnormal_case(self):
|
||||
tdLog.printNoPrefix(f"==========step:abnormal case test")
|
||||
tdSql.error(f"select * from a1 a join (select '{self.today_ts}' as ts from b1) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select * from a1 a join (select '{self.today_ts}' + 1s as ts from b1) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;")
|
||||
tdSql.error(f"select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;")
|
||||
tdSql.error(f"select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;")
|
||||
tdSql.error(f"select * from a1 a left asof join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;")
|
||||
tdSql.error(f"select * from a1 a left window join (select now as ts1, ts, f, g, 'a' c from b1) b window_offset(-1s, 1s);")
|
||||
tdSql.error(f"select * from a1 a join (select timestamp '{self.today_ts}' + 1d as ts, f, g, 'a' from b1) b on timetruncate(a.ts + 1s, 1d) = timetruncate(b.ts, 1d);")
|
||||
tdSql.error(f"select * from a1 a join (select timestamp '{self.today_ts}' + 1d as ts, f, g, 'a' from b1) b on a.ts + 1s = timetruncate(b.ts, 1d);")
|
||||
tdSql.error(f"select t1.* from sta t1, (select _wstart as ts, count(*) from sta partition by tbname interval(1d)) t2 where t1.ts = t2.ts;")
|
||||
tdSql.error(f"select * from (select tg1, sum(f) s from sta group by tg1) t1, sta t2 where t1.tg1 = t2.tg1;")
|
||||
tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today as ts1, * from b1 order by f) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select * from (select * from a1 order by f) a join (select today as ts1, * from b1 order by f desc) b on a.ts = b.ts1;")
|
||||
tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today as ts1, * from b1 order by f) b on a.ts = b.ts1;")
|
||||
tdSql.error(f"select * from a1 a join (select * from b1 order by f) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select * from a1 a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select * from (select * from a1 order by ts) a join (select * from b1 order by f) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select * from (select * from a1 order by ts desc) a join (select * from b1 order by f) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select * from (select * from a1 order by f) a join (select * from b1 order by f) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1;")
|
||||
tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1;")
|
||||
tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1;")
|
||||
tdSql.error(f"select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;")
|
||||
tdSql.error(f"select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts;")
|
||||
tdSql.error(f"select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts;")
|
||||
tdSql.error(f"select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts;")
|
||||
|
||||
def test_others_case(self, testCase):
|
||||
tdLog.printNoPrefix(f"==========step:{testCase} test")
|
||||
self.replace_string(f'{testCase}.in', f'{testCase}.in.tmp1', '__today__', f'{self.today_date}')
|
||||
self.replace_string(f'{testCase}.in.tmp1', f'{testCase}.in.tmp2', '__tomorrow__', f'{self.tomorrow_date}')
|
||||
self.replace_string(f'{testCase}.csv', f'{testCase}.csv.tmp1', '__today__', f'{self.today_date}')
|
||||
self.replace_string2(f'{testCase}.csv.tmp1', f'{testCase}.csv.tmp2', '__tomorrow__', f'{self.tomorrow_date}')
|
||||
# read sql from .sql file and execute
|
||||
self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.in.tmp2")
|
||||
self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.csv.tmp2")
|
||||
tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase)
|
||||
|
||||
def run(self):
|
||||
tdLog.debug(f"start to excute {__file__}")
|
||||
|
@ -182,6 +230,9 @@ class TDTestCase(TBase):
|
|||
self.test_today_case("left_semi")
|
||||
self.test_today_case("left_anti")
|
||||
|
||||
self.test_others_case("others")
|
||||
|
||||
self.test_nocheck_case()
|
||||
self.test_abnormal_case()
|
||||
|
||||
tdLog.success(f"{__file__} successfully executed")
|
||||
|
|
|
@ -3018,7 +3018,7 @@ taos> select stateduration(u_tinyint_col, "GT", 20, 1a) from test_vtable_select.
|
|||
taos> select twa(int_col) from test_vtable_select.vtb_virtual_stb limit 50;
|
||||
twa(int_col) |
|
||||
============================
|
||||
-353350886.922845 |
|
||||
-353350600.12852 |
|
||||
|
||||
taos> select abs(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
abs(int_tag) |
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,6 @@
|
|||
taos> select _wstart, _wend, first(*), last(*), count(*) from test_vtable_select.vtb_virtual_stb state_window(bool_col) order by _wstart limit 100 ;
|
||||
_wstart | _wend | first(ts) | first(u_tinyint_col) | first(u_smallint_col) | first(u_int_col) | first(u_bigint_col) | first(tinyint_col) | first(smallint_col) | first(int_col) | first(bigint_col) | first(float_col) | first(double_col) | first(bool_col) | first(binary_16_col) | first(binary_32_col) | first(nchar_16_col) | first(nchar_32_col) | last(ts) | last(u_tinyint_col) | last(u_smallint_col) | last(u_int_col) | last(u_bigint_col) | last(tinyint_col) | last(smallint_col) | last(int_col) | last(bigint_col) | last(float_col) | last(double_col) | last(bool_col) | last(binary_16_col) | last(binary_32_col) | last(nchar_16_col) | last(nchar_32_col) | count(*) |
|
||||
==================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
|
||||
1970-01-01 08:00:00.000 | 2020-10-01 00:00:49.995 | 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | NULL | NULL | NULL | -650873068 | -9223372036854775808 | 99528.7 | NULL | NULL | NULL | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 2020-10-01 00:00:45.975 | 183 | 26437 | 1670071451 | NULL | NULL | NULL | -785713543 | -9223372036854775808 | 24230.5 | NULL | NULL | NULL | Taiyuan - Santa Clara | 四。San Jose | 帕洛阿托 - Palo Alto | 0 |
|
||||
2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | 1825145387 | 80 | 32519 | -650873068 | -9223372036854775808 | 99528.7 | 73495720.958304 | true | San Diego | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | 1825145387 | 80 | 32519 | -650873068 | -9223372036854775808 | 99528.7 | 73495720.958304 | true | San Diego | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 1 |
|
||||
2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | 44 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 三。San Diego | NULL | 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | 44 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 三。San Diego | NULL | 2 |
|
||||
2020-10-01 00:00:00.006 | 2020-10-01 00:00:00.009 | 2020-10-01 00:00:00.006 | 49 | 51523 | NULL | 654411 | -91 | NULL | -140653792 | -9223372036854775808 | NULL | 4540042.841226 | true | NULL | Shanghai - Los Angles | 六。Campbell | NULL | 2020-10-01 00:00:00.008 | 74 | 51523 | NULL | 1158746468 | -91 | NULL | -439167365 | -9223372036854775808 | NULL | -16761361.20062 | true | NULL | Shanghai - Los Angles | 六。Campbell | NULL | 4 |
|
||||
|
@ -102,6 +101,7 @@ taos> select _wstart, _wend, first(*), last(*), count(*) from test_vtable_select
|
|||
2020-10-01 00:00:00.639 | 2020-10-01 00:00:00.642 | 2020-10-01 00:00:00.639 | 71 | 23769 | 1047447204 | 902724244 | 79 | -15245 | -556439232 | -9223372036854775808 | -14500.9 | 2431931.650446 | true | Palo Alto | Tianjin - Mountain View | 一。San Franc | 圣克拉拉 - Santa Clara | 2020-10-01 00:00:00.640 | 71 | 23769 | 1047447204 | 902724244 | 79 | -15245 | -556439232 | -9223372036854775808 | -14500.9 | 2431931.650446 | true | Palo Alto | Tianjin - Mountain View | 一。San Franc | 圣克拉拉 - Santa Clara | 4 |
|
||||
2020-10-01 00:00:00.645 | 2020-10-01 00:00:00.645 | 2020-10-01 00:00:00.645 | NULL | 50372 | 1756705093 | NULL | 4 | 11012 | NULL | -9223372036854775808 | -28602.3 | NULL | false | Mountain View | NULL | 二。Los Angle | 圣地亚哥 - San Diego | 2020-10-01 00:00:00.645 | NULL | 50372 | 1756705093 | NULL | 4 | 11012 | NULL | -9223372036854775808 | -28602.3 | NULL | false | Mountain View | NULL | 二。Los Angle | 圣地亚哥 - San Diego | 2 |
|
||||
2020-10-01 00:00:00.648 | 2020-10-01 00:00:00.648 | 2020-10-01 00:00:00.648 | 36 | 40209 | NULL | 2011281951 | 87 | NULL | 237103738 | -9223372036854775808 | NULL | -60794244.376766 | true | NULL | Taiyuan - Santa Clara | 一。San Franc | NULL | 2020-10-01 00:00:00.648 | 36 | 40209 | NULL | 2011281951 | 87 | NULL | 237103738 | -9223372036854775808 | NULL | -60794244.376766 | true | NULL | Taiyuan - Santa Clara | 一。San Franc | NULL | 2 |
|
||||
2020-10-01 00:00:00.651 | 2020-10-01 00:00:00.651 | 2020-10-01 00:00:00.651 | NULL | 24193 | NULL | NULL | -86 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 七。Mountain | NULL | 2020-10-01 00:00:00.651 | NULL | 24193 | NULL | NULL | -86 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 七。Mountain | NULL | 2 |
|
||||
|
||||
taos> select _wstart, _wend, first(bool_col), last(bool_col), count(bool_col) from test_vtable_select.vtb_virtual_stb state_window(bool_col) order by _wstart limit 100 ;
|
||||
_wstart | _wend | first(bool_col) | last(bool_col) | count(bool_col) |
|
||||
|
@ -210,7 +210,6 @@ taos> select _wstart, _wend, first(bool_col), last(bool_col), count(bool_col) fr
|
|||
taos> select _wstart, _wend, first(bool_col), first(u_tinyint_col), last(bool_col), last(u_tinyint_col), count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb state_window(bool_col) order by _wstart limit 100;
|
||||
_wstart | _wend | first(bool_col) | first(u_tinyint_col) | last(bool_col) | last(u_tinyint_col) | count(u_tinyint_col) |
|
||||
============================================================================================================================================================
|
||||
1970-01-01 08:00:00.000 | 2020-10-01 00:00:19.998 | NULL | 29 | NULL | 137 | 0 |
|
||||
2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | true | 29 | true | 29 | 1 |
|
||||
2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.003 | false | NULL | false | NULL | 0 |
|
||||
2020-10-01 00:00:00.006 | 2020-10-01 00:00:00.009 | true | 49 | true | 74 | 4 |
|
||||
|
@ -310,11 +309,11 @@ taos> select _wstart, _wend, first(bool_col), first(u_tinyint_col), last(bool_co
|
|||
2020-10-01 00:00:00.639 | 2020-10-01 00:00:00.642 | true | 71 | true | 71 | 2 |
|
||||
2020-10-01 00:00:00.645 | 2020-10-01 00:00:00.645 | false | NULL | false | NULL | 0 |
|
||||
2020-10-01 00:00:00.648 | 2020-10-01 00:00:00.648 | true | 36 | true | 36 | 2 |
|
||||
2020-10-01 00:00:00.651 | 2020-10-01 00:00:00.651 | false | NULL | false | NULL | 0 |
|
||||
|
||||
taos> select _wstart, _wend, first(bool_col), first(u_tinyint_col), first(u_smallint_col), last(bool_col), last(u_tinyint_col), last(u_smallint_col), count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb state_window(bool_col) order by _wstart limit 100 ;
|
||||
_wstart | _wend | first(bool_col) | first(u_tinyint_col) | first(u_smallint_col) | last(bool_col) | last(u_tinyint_col) | last(u_smallint_col) | count(u_tinyint_col) |
|
||||
===========================================================================================================================================================================================================
|
||||
1970-01-01 08:00:00.000 | 2020-10-01 00:00:29.997 | NULL | 29 | 13238 | NULL | 72 | 28494 | 0 |
|
||||
2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | true | 29 | 13238 | true | 29 | 13238 | 1 |
|
||||
2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.003 | false | NULL | 30154 | false | NULL | 30154 | 0 |
|
||||
2020-10-01 00:00:00.006 | 2020-10-01 00:00:00.009 | true | 49 | 51523 | true | 74 | 51523 | 4 |
|
||||
|
@ -414,4 +413,5 @@ taos> select _wstart, _wend, first(bool_col), first(u_tinyint_col), first(u_smal
|
|||
2020-10-01 00:00:00.639 | 2020-10-01 00:00:00.642 | true | 71 | 23769 | true | 71 | 23769 | 2 |
|
||||
2020-10-01 00:00:00.645 | 2020-10-01 00:00:00.645 | false | NULL | 50372 | false | NULL | 50372 | 0 |
|
||||
2020-10-01 00:00:00.648 | 2020-10-01 00:00:00.648 | true | 36 | 40209 | true | 36 | 40209 | 2 |
|
||||
2020-10-01 00:00:00.651 | 2020-10-01 00:00:00.651 | false | NULL | 24193 | false | NULL | 24193 | 0 |
|
||||
|
||||
|
|
|
@ -129,7 +129,6 @@ select avg(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
|||
select count(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
select count(*) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
select elapsed(ts) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
select leastsquares(int_tag, 0, 1) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
select spread(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
select stddev(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
select sum(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
|
@ -150,11 +149,8 @@ select min(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
|||
select mode(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
select tail(int_tag, 20) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
select unique(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
select csum(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
select derivative(int_tag, 5a, 1) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
select diff(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
select irate(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
select mavg(int_tag, 100) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
select statecount(int_tag, "GT", 20) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
select stateduration(int_tag, "GT", 20, 1a) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
||||
select twa(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5;
|
|
@ -1,83 +1,83 @@
|
|||
select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10;
|
||||
select u_tinyint_col from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10;
|
||||
select u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10;
|
||||
select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10;
|
||||
select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10;
|
||||
select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10;
|
||||
select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1 slimit 10 limit 10;
|
||||
select u_tinyint_col from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1 slimit 10 limit 10;
|
||||
select u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1 slimit 10 limit 10;
|
||||
select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1 slimit 10 limit 10;
|
||||
select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1 slimit 10 limit 10;
|
||||
select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1, 2, int_tag slimit 10 limit 10;
|
||||
|
||||
select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10;
|
||||
select u_tinyint_col + 1 from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10;
|
||||
select u_tinyint_col + 1, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10;
|
||||
select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10;
|
||||
select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10;
|
||||
select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10;
|
||||
select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1 slimit 10 limit 10;
|
||||
select u_tinyint_col + 1 from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1 slimit 10 limit 10;
|
||||
select u_tinyint_col + 1, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1 slimit 10 limit 10;
|
||||
select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1 slimit 10 limit 10;
|
||||
select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1 slimit 10 limit 10;
|
||||
select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1, 2, int_tag slimit 10 limit 10;
|
||||
|
||||
select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10;
|
||||
select u_tinyint_col, tinyint_col from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10;
|
||||
select u_tinyint_col, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10;
|
||||
select avg(u_int_col), avg(tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10;
|
||||
select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10;
|
||||
select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10;
|
||||
select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1 slimit 10 limit 10;
|
||||
select u_tinyint_col, tinyint_col from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1 slimit 10 limit 10;
|
||||
select u_tinyint_col, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1 slimit 10 limit 10;
|
||||
select avg(u_int_col), avg(tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1 slimit 10 limit 10;
|
||||
select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1 slimit 10 limit 10;
|
||||
select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1, 2, int_tag slimit 10 limit 10;
|
||||
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(10s) slimit 10 limit 10;
|
||||
select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col interval(10s) slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(10s) slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) slimit 10 limit 10;
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(10s) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col interval(10s) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(10s) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) order by 1,2,3,4 slimit 10 limit 10;
|
||||
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col state_window(bool_col) slimit 10 limit 10;
|
||||
select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col state_window(bool_col) slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col state_window(bool_col) slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) slimit 10 limit 10;
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10;
|
||||
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col session(ts, 10a) slimit 10 limit 10;
|
||||
select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col session(ts, 10a) slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col session(ts, 10a) slimit 10 limit 10;
|
||||
select _wstart, _wend, tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) slimit 10 limit 10;
|
||||
select _wstart, _wend, tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) slimit 10 limit 10;
|
||||
select _wstart, _wend, tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) slimit 10 limit 10;
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10;
|
||||
|
||||
select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 slimit 10 limit 10;
|
||||
select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 slimit 10 limit 10;
|
||||
select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 slimit 10 limit 10;
|
||||
select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 slimit 10 limit 10;
|
||||
select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 order by 1,2,3,4 slimit 10 limit 10;
|
||||
|
||||
select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 slimit 10 limit 10;
|
||||
select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 slimit 10 limit 10;
|
||||
select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 slimit 10 limit 10;
|
||||
select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 slimit 10 limit 10;
|
||||
select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 order by 1,2,3,4 slimit 10 limit 10;
|
||||
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col count_window(10) slimit 10 limit 10;
|
||||
select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col count_window(10) slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col count_window(10) slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col count_window(10) slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col count_window(10) slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col count_window(10) slimit 10 limit 10;
|
||||
select _wstart, _wend, bool_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by bool_col count_window(10) slimit 10 limit 10;
|
||||
select _wstart, _wend, count(*) from (select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1) count_window(10) order by 1,2,3 limit 10;
|
||||
select _wstart, _wend, count(*) from (select * from test_vtable_select.vtb_virtual_stb partition by tinyint_col order by 1) count_window(10) order by 1,2,3 limit 10;
|
||||
select _wstart, _wend, count(*) from (select * from test_vtable_select.vtb_virtual_stb partition by bool_col order by 1) count_window(10) order by 1,2,3 limit 10;
|
||||
select _wstart, _wend, count(*) from (select * from test_vtable_select.vtb_virtual_stb partition by bool_col order by 1) count_window(10) order by 1,2,3 limit 10;
|
||||
select _wstart, _wend, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from (select * from test_vtable_select.vtb_virtual_stb partition by bool_col order by 1) count_window(10) order by 1,2,3,4 limit 10;
|
||||
select _wstart, _wend, count(*), count(u_int_col),count(u_tinyint_col) from (select * from test_vtable_select.vtb_virtual_stb partition by bool_col order by 1) count_window(10) order by 1,2,3,4 limit 10;
|
||||
select _wstart, _wend, count(*), count(u_int_col) from (select * from test_vtable_select.vtb_virtual_stb partition by bool_col order by 1) count_window(10) order by 1,2,3,4 limit 10;
|
||||
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 10 limit 10;
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 2 limit 10;
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 2 limit 5;
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 20 limit 2;
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 20 limit 5;
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 10 limit 2;
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 10 limit 10;
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 2 limit 10;
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 2 limit 5;
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 20 limit 2;
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 20 limit 5;
|
||||
select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 10 limit 2;
|
||||
|
||||
select count(*) from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10;
|
||||
select int_tag from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10;
|
||||
select int_tag, count(*) from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10;
|
||||
select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10;
|
||||
select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10;
|
||||
select * from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10;
|
||||
select count(*) from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1 slimit 10 limit 10;
|
||||
select int_tag from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1 slimit 10 limit 10;
|
||||
select int_tag, count(*) from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1 slimit 10 limit 10;
|
||||
select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1 slimit 10 limit 10;
|
||||
select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1 slimit 10 limit 10;
|
||||
select * from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1, 2, int_tag slimit 10 limit 10;
|
||||
|
||||
select count(*) from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10;
|
||||
select tbname from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10;
|
||||
select tbname, count(*) from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10;
|
||||
select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10;
|
||||
select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10;
|
||||
select * from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10;
|
||||
select count(*) from test_vtable_select.vtb_virtual_stb partition by tbname order by 1 slimit 10 limit 10;
|
||||
select tbname from test_vtable_select.vtb_virtual_stb partition by tbname order by 1 slimit 10 limit 10;
|
||||
select tbname, count(*) from test_vtable_select.vtb_virtual_stb partition by tbname order by 1 slimit 10 limit 10;
|
||||
select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tbname order by 1 slimit 10 limit 10;
|
||||
select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by tbname order by 1 slimit 10 limit 10;
|
||||
select * from test_vtable_select.vtb_virtual_stb partition by tbname order by 1, 2, int_tag slimit 10 limit 10;
|
|
@ -328,6 +328,9 @@ class TDTestCase(TBase):
|
|||
# 1.6. change column length when column reference exists
|
||||
tdSql.error("alter vtable vtb_virtual_ntb0 modify column nchar_16_col nchar(32);")
|
||||
|
||||
# 1.7. add column with decimal type
|
||||
tdSql.error("alter vtable vtb_virtual_ntb0 add column extra_decimal decimal(38,38)")
|
||||
|
||||
# 2. child table
|
||||
# 2.1. change column reference with wrong type
|
||||
tdSql.error("alter vtable vtb_virtual_ctb0 alter column int_col set vtb_org_child_19.tinyint_col")
|
||||
|
@ -343,6 +346,12 @@ class TDTestCase(TBase):
|
|||
tdSql.execute("alter stable vtb_virtual_stb modify column nchar_16_col nchar(32);")
|
||||
tdSql.error("select nchar_16_col from vtb_virtual_ctb0;")
|
||||
|
||||
# 3.3. add column with decimal type
|
||||
tdSql.error("alter stable vtb_virtual_stb add column extra_decimal decimal(38,38)")
|
||||
|
||||
# 3.4. add tag with decimal type
|
||||
tdSql.error("alter stable vtb_virtual_stb add tag extra_decimal_tag decimal(38,38)")
|
||||
|
||||
|
||||
def run(self):
|
||||
tdLog.debug(f"start to excute {__file__}")
|
||||
|
|
|
@ -58,9 +58,9 @@ class TDTestCase(TBase):
|
|||
if (priv_orgtb != "none"):
|
||||
tdSql.execute(f"grant {priv_orgtb} on test_vctable_auth_alter.test_vtable_auth_org_table_2 to test_vct_user_alter;")
|
||||
|
||||
sleep(1)
|
||||
sleep(2)
|
||||
|
||||
tdLog.info(f"priv_db: {priv_db}, priv_tb1: {priv_vtb}, priv_tb2: {priv_orgtb}")
|
||||
tdLog.info(f"priv_db: {priv_db}, priv_stb: {priv_vtb}, priv_ctb: {priv_orgtb}")
|
||||
testSql.execute("use test_vctable_auth_alter;")
|
||||
if (priv_db == "read"):
|
||||
if (priv_vtb == "write" or priv_vtb == "all"):
|
||||
|
|
|
@ -702,6 +702,77 @@ class TDTestCase(TBase):
|
|||
"geo_32_col FROM vtb_org_child_18.geo_32_col)"
|
||||
"USING vtb_virtual_stb TAGS (13, false, 13, 13, 'vchild13', 'vchild13')")
|
||||
|
||||
# 11. create virtual table using decimal
|
||||
# 11.1 super table
|
||||
# 11.1.1 decimal column
|
||||
tdSql.error(f"CREATE STABLE `vtb_virtual_stb_error` ("
|
||||
"ts timestamp, "
|
||||
"u_tinyint_col tinyint unsigned, "
|
||||
"u_smallint_col smallint unsigned, "
|
||||
"u_int_col int unsigned, "
|
||||
"u_bigint_col bigint unsigned, "
|
||||
"tinyint_col tinyint, "
|
||||
"smallint_col smallint, "
|
||||
"int_col int, "
|
||||
"bigint_col bigint, "
|
||||
"float_col float, "
|
||||
"double_col double, "
|
||||
"bool_col bool, "
|
||||
"binary_16_col binary(16),"
|
||||
"binary_32_col binary(32),"
|
||||
"nchar_16_col nchar(16),"
|
||||
"nchar_32_col nchar(32),"
|
||||
"varbinary_16_col varbinary(16),"
|
||||
"varbinary_32_col varbinary(32),"
|
||||
"geo_16_col geometry(16),"
|
||||
"geo_32_col geometry(32),"
|
||||
"decimal_col decimal(38,38)"
|
||||
") TAGS ("
|
||||
"int_tag int,"
|
||||
"bool_tag bool,"
|
||||
"float_tag float,"
|
||||
"double_tag double,"
|
||||
"nchar_32_tag nchar(32),"
|
||||
"binary_32_tag binary(32))"
|
||||
"VIRTUAL 1")
|
||||
# 11.1.2 decimal tag
|
||||
tdSql.error(f"CREATE STABLE `vtb_virtual_stb_error` ("
|
||||
"ts timestamp, "
|
||||
"u_tinyint_col tinyint unsigned, "
|
||||
"u_smallint_col smallint unsigned, "
|
||||
"u_int_col int unsigned, "
|
||||
"u_bigint_col bigint unsigned, "
|
||||
"tinyint_col tinyint, "
|
||||
"smallint_col smallint, "
|
||||
"int_col int, "
|
||||
"bigint_col bigint, "
|
||||
"float_col float, "
|
||||
"double_col double, "
|
||||
"bool_col bool, "
|
||||
"binary_16_col binary(16),"
|
||||
"binary_32_col binary(32),"
|
||||
"nchar_16_col nchar(16),"
|
||||
"nchar_32_col nchar(32),"
|
||||
"varbinary_16_col varbinary(16),"
|
||||
"varbinary_32_col varbinary(32),"
|
||||
"geo_16_col geometry(16),"
|
||||
"geo_32_col geometry(32)"
|
||||
") TAGS ("
|
||||
"int_tag int,"
|
||||
"bool_tag bool,"
|
||||
"float_tag float,"
|
||||
"double_tag double,"
|
||||
"nchar_32_tag nchar(32),"
|
||||
"binary_32_tag binary(32)),"
|
||||
"decimal_tag decimal(38,38)"
|
||||
"VIRTUAL 1")
|
||||
|
||||
# 11.2 virtual normal table
|
||||
tdSql.error("CREATE VTABLE `error_vtb_virtual_ntb8` ("
|
||||
"ts timestamp FROM vtb_org_normal_0.ts, "
|
||||
"u_tinyint_col tinyint unsigned from vtb_org_normal_0.u_tinyint_col, "
|
||||
"u_smallint_col smallint unsigned from vtb_org_normal_1.u_smallint_col, "
|
||||
"decimal_col decimal(38,38))")
|
||||
def run(self):
|
||||
tdLog.debug(f"start to excute {__file__}")
|
||||
|
||||
|
|
|
@ -257,12 +257,12 @@ class TDTestCase(TBase):
|
|||
#self.test_normal_query("test_vstable_select_test_function")
|
||||
|
||||
self.test_normal_query("test_vstable_select_test_interval")
|
||||
#self.test_normal_query("test_vstable_select_test_state")
|
||||
self.test_normal_query("test_vstable_select_test_state")
|
||||
self.test_normal_query("test_vstable_select_test_session")
|
||||
#self.test_normal_query("test_vstable_select_test_event")
|
||||
self.test_normal_query("test_vstable_select_test_event")
|
||||
self.test_normal_query("test_vstable_select_test_count")
|
||||
|
||||
#self.test_normal_query("test_vstable_select_test_partition")
|
||||
self.test_normal_query("test_vstable_select_test_partition")
|
||||
self.test_normal_query("test_vstable_select_test_group")
|
||||
self.test_normal_query("test_vstable_select_test_orderby")
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
,,y,army,./pytest.sh python3 ./test.py -f query/function/concat.py
|
||||
,,y,army,./pytest.sh python3 ./test.py -f query/function/cast.py
|
||||
,,y,army,./pytest.sh python3 ./test.py -f query/test_join.py
|
||||
,,y,army,./pytest.sh python3 ./test.py -f query/test_join_const.py
|
||||
,,y,army,./pytest.sh python3 ./test.py -f query/test_compare.py
|
||||
,,y,army,./pytest.sh python3 ./test.py -f query/test_case_when.py
|
||||
,,y,army,./pytest.sh python3 ./test.py -f insert/test_column_tag_boundary.py
|
||||
|
@ -342,6 +343,11 @@
|
|||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/decimal2.py -Q 3
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/decimal2.py -Q 2
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/decimal2.py -Q 1
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/decimal3.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/decimal3.py -Q 4
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/decimal3.py -Q 3
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/decimal3.py -Q 2
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/decimal3.py -Q 1
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tbnameIn.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tbnameIn.py -R
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tbnameIn.py -Q 2
|
||||
|
|
|
@ -28,11 +28,14 @@ class AtomicCounter:
|
|||
|
||||
getcontext().prec = 40
|
||||
|
||||
def get_decimal(val, scale: int) -> Decimal:
|
||||
def get_decimal(val, scale: int):
|
||||
if val == 'NULL':
|
||||
return None
|
||||
getcontext().prec = 100
|
||||
return Decimal(val).quantize(Decimal("1." + "0" * scale), ROUND_HALF_UP)
|
||||
try:
|
||||
return Decimal(val).quantize(Decimal("1." + "0" * scale), ROUND_HALF_UP)
|
||||
except:
|
||||
tdLog.exit(f"faield to convert to decimal for v: {val} scale: {scale}")
|
||||
|
||||
syntax_error = -2147473920
|
||||
invalid_column = -2147473918
|
||||
|
@ -52,6 +55,7 @@ unary_op_test = True
|
|||
binary_op_in_where_test = True
|
||||
test_decimal_funcs = False
|
||||
cast_func_test_round = 10
|
||||
in_op_test_round = 10
|
||||
|
||||
class DecimalTypeGeneratorConfig:
|
||||
def __init__(self):
|
||||
|
@ -308,8 +312,8 @@ class DecimalColumnExpr:
|
|||
calc_res = float(v_from_calc_in_py)
|
||||
failed = not math.isclose(query_res, calc_res, abs_tol=1e-7)
|
||||
else:
|
||||
query_res = Decimal(v_from_query)
|
||||
calc_res = Decimal(v_from_calc_in_py)
|
||||
query_res = get_decimal(v_from_query, self.res_type_.scale())
|
||||
calc_res = get_decimal(v_from_calc_in_py, self.res_type_.scale())
|
||||
failed = query_res != calc_res
|
||||
if failed:
|
||||
tdLog.exit(
|
||||
|
@ -438,13 +442,13 @@ class DataType:
|
|||
if self.type == TypeEnum.BIGINT:
|
||||
return str(secrets.randbelow(9223372036854775808) - 4611686018427387904)
|
||||
if self.type == TypeEnum.FLOAT or self.type == TypeEnum.DOUBLE:
|
||||
return str(random.random())
|
||||
return str(random.uniform(-1e10, 1e10))
|
||||
if (
|
||||
self.type == TypeEnum.VARCHAR
|
||||
or self.type == TypeEnum.NCHAR
|
||||
or self.type == TypeEnum.VARBINARY
|
||||
):
|
||||
return f"'{str(random.random())[0:self.length]}'"
|
||||
return f"'{str(random.uniform(-1e20, 1e20))[0:self.length]}'"
|
||||
if self.type == TypeEnum.TIMESTAMP:
|
||||
return str(secrets.randbelow(9223372036854775808))
|
||||
if self.type == TypeEnum.UTINYINT:
|
||||
|
@ -461,6 +465,29 @@ class DataType:
|
|||
return "'POINT(1.0 1.0)'"
|
||||
raise Exception(f"unsupport type {self.type}")
|
||||
|
||||
def generate_sized_val(self, prec: int, scale: int) -> str:
|
||||
weight = prec - scale
|
||||
if self.type == TypeEnum.BOOL:
|
||||
return ['true', 'false'][secrets.randbelow(2)]
|
||||
if self.type == TypeEnum.TINYINT or self.type == TypeEnum.SMALLINT or self.type == TypeEnum.INT or self.type == TypeEnum.BIGINT or self.type == TypeEnum.TIMESTAMP:
|
||||
return str(secrets.randbelow(10 * weight * 2) - 10 * weight)
|
||||
if self.type == TypeEnum.FLOAT or self.type == TypeEnum.DOUBLE:
|
||||
return str(random.uniform(-10 * weight, 10 * weight))
|
||||
if (
|
||||
self.type == TypeEnum.VARCHAR
|
||||
or self.type == TypeEnum.NCHAR
|
||||
or self.type == TypeEnum.VARBINARY
|
||||
):
|
||||
return f"'{str(random.uniform(-(10 * weight + 1), 10 * weight - 1))}'"
|
||||
if self.type == TypeEnum.UTINYINT or self.type == TypeEnum.USMALLINT or self.type == TypeEnum.UINT or self.type == TypeEnum.UBIGINT:
|
||||
return str(secrets.randbelow(10 * weight * 2))
|
||||
if self.type == TypeEnum.JSON:
|
||||
return f'{{"key": "{secrets.token_urlsafe(10)}"}}'
|
||||
if self.type == TypeEnum.GEOMETRY:
|
||||
return "'POINT(1.0 1.0)'"
|
||||
raise Exception(f"unsupport type {self.type}")
|
||||
|
||||
|
||||
def check(self, values, offset: int):
|
||||
return True
|
||||
|
||||
|
@ -481,6 +508,8 @@ class DataType:
|
|||
return get_decimal(val, self.scale())
|
||||
elif isinstance(val, str):
|
||||
val = val.strip("'")
|
||||
if len(val) == 0:
|
||||
return 0
|
||||
return val
|
||||
|
||||
def get_typed_val(self, val):
|
||||
|
@ -513,6 +542,19 @@ class DataType:
|
|||
TypeEnum.DECIMAL,
|
||||
TypeEnum.DECIMAL64,
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def generate_random_type_for(dt: int):
|
||||
if dt == TypeEnum.DECIMAL:
|
||||
prec = random.randint(1, DecimalType.DECIMAL_MAX_PRECISION)
|
||||
return DecimalType(dt, prec, random.randint(0, prec))
|
||||
elif dt == TypeEnum.DECIMAL64:
|
||||
prec = random.randint(1, DecimalType.DECIMAL64_MAX_PRECISION)
|
||||
return DecimalType(dt, prec, random.randint(0, prec))
|
||||
elif dt == TypeEnum.BINARY or dt == TypeEnum.VARCHAR:
|
||||
return DataType(dt, random.randint(16, 255), 0)
|
||||
else:
|
||||
return DataType(dt, 0, 0)
|
||||
|
||||
class DecimalType(DataType):
|
||||
DECIMAL_MAX_PRECISION = 38
|
||||
|
@ -668,6 +710,25 @@ class Column:
|
|||
else:
|
||||
return len(self.saved_vals[tbname])
|
||||
|
||||
def seq_scan_col(self, tbname: str, idx: int):
|
||||
if self.is_constant_col():
|
||||
return self.get_constant_val_for_execute(), False
|
||||
elif len(self.saved_vals) > 1:
|
||||
keys = list(self.saved_vals.keys())
|
||||
for i, key in enumerate(keys):
|
||||
l = len(self.saved_vals[key])
|
||||
if idx < l:
|
||||
return self.get_typed_val_for_execute(self.saved_vals[key][idx]), True
|
||||
else:
|
||||
idx -= l
|
||||
|
||||
return 1, False
|
||||
else:
|
||||
if idx > len(self.saved_vals[tbname]) - 1:
|
||||
return 1, False
|
||||
v = self.get_typed_val_for_execute(self.saved_vals[tbname][idx])
|
||||
return v, True
|
||||
|
||||
@staticmethod
|
||||
def comp_key(key1, key2):
|
||||
if key1 is None:
|
||||
|
@ -921,23 +982,11 @@ class DecimalCastTypeGenerator:
|
|||
else:
|
||||
return DataType.get_decimal_op_types()
|
||||
|
||||
def do_generate_type(self, dt: int) ->DataType:
|
||||
if dt == TypeEnum.DECIMAL:
|
||||
prec = random.randint(1, DecimalType.DECIMAL_MAX_PRECISION)
|
||||
return DecimalType(dt, prec, random.randint(0, prec))
|
||||
elif dt == TypeEnum.DECIMAL64:
|
||||
prec = random.randint(1, DecimalType.DECIMAL64_MAX_PRECISION)
|
||||
return DecimalType(dt, prec, random.randint(0, prec))
|
||||
elif dt == TypeEnum.BINARY or dt == TypeEnum.VARCHAR:
|
||||
return DataType(dt, random.randint(16, 255), 0)
|
||||
else:
|
||||
return DataType(dt, 0, 0)
|
||||
|
||||
def generate(self, num: int) -> List[DataType]:
|
||||
res: list[DataType] = []
|
||||
for _ in range(num):
|
||||
dt = random.choice(self.get_possible_output_types())
|
||||
dt = self.do_generate_type(dt)
|
||||
dt = DataType.generate_random_type_for(dt)
|
||||
res.append(dt)
|
||||
res = list(set(res))
|
||||
return res
|
||||
|
@ -1303,10 +1352,12 @@ class DecimalBinaryOperator(DecimalColumnExpr):
|
|||
return super().generate(format_params)
|
||||
|
||||
def should_skip_for_decimal(self, cols: list):
|
||||
left_col = cols[0]
|
||||
right_col = cols[1]
|
||||
left_col: Column = cols[0]
|
||||
right_col: Column = cols[1]
|
||||
if not left_col.type_.is_decimal_type() and not right_col.type_.is_decimal_type():
|
||||
return True
|
||||
if not right_col.is_constant_col() and (self.op_ == '%' or self.op_ == '/'):
|
||||
return True
|
||||
if self.op_ != "%":
|
||||
return False
|
||||
## TODO wjm why skip decimal % float/double? it's wrong now.
|
||||
|
@ -1556,21 +1607,104 @@ class DecimalUnaryOperator(DecimalColumnExpr):
|
|||
def generate_res_type(self):
|
||||
self.res_type_ = self.col_type_ = self.params_[0].type_
|
||||
|
||||
def execute_minus(self, params) -> Decimal:
|
||||
def execute_minus(self, params):
|
||||
if params[0] is None:
|
||||
return 'NULL'
|
||||
return -Decimal(params[0])
|
||||
|
||||
class DecimalBinaryOperatorIn(DecimalBinaryOperator):
|
||||
def __init__(self, op: str):
|
||||
super().__init__(op)
|
||||
self.op_ = op
|
||||
super().__init__("{0} " + self.op_ + " ({1})", self.execute_op, op)
|
||||
|
||||
def execute(self, left, right):
|
||||
if self.op_.lower()() == "in":
|
||||
return left in right
|
||||
if self.op_.lower() == "not in":
|
||||
return left not in right
|
||||
def generate_res_type(self):
|
||||
self.query_col = self.params_[0]
|
||||
self.res_type_ = DataType(TypeEnum.BOOL)
|
||||
|
||||
def execute_op(self, params):
|
||||
list_exprs: DecimalListExpr = self.params_[1]
|
||||
v, vs = list_exprs.get_converted_vs(params)
|
||||
if v is None:
|
||||
return False
|
||||
b = False
|
||||
if self.op_.lower() == 'in':
|
||||
b = v in vs
|
||||
#if b:
|
||||
#tdLog.debug(f"eval {v} in {list_exprs} got: {b}")
|
||||
else:
|
||||
b = v not in vs
|
||||
#if not b:
|
||||
#tdLog.debug(f"eval {v} not in {list_exprs} got: {b}")
|
||||
return b
|
||||
|
||||
def check(self, res, tbname: str):
|
||||
idx = 0
|
||||
v, has_next = self.query_col.seq_scan_col(tbname, idx)
|
||||
calc_res = []
|
||||
while has_next:
|
||||
keep: bool = self.execute_op(v)
|
||||
if keep:
|
||||
calc_res.append(v)
|
||||
idx += 1
|
||||
v, has_next = self.query_col.seq_scan_col(tbname, idx)
|
||||
calc_res = sorted(calc_res)
|
||||
res = [get_decimal(e, self.query_col.type_.scale()) for e in res]
|
||||
res = sorted(res)
|
||||
for v, calc_v in zip(res, calc_res):
|
||||
if v != calc_v:
|
||||
tdLog.exit(f"check failed for {self}, query got: {v}, expect: {calc_v}, len_query: {len(res)}, len_calc: {len(calc_res)}")
|
||||
return True
|
||||
|
||||
class DecimalListExpr:
|
||||
def __init__(self, num: int, col: Column):
|
||||
self.elements_ = []
|
||||
self.num_ = num
|
||||
self.types_ = []
|
||||
self.converted_vs_ = None
|
||||
self.output_float_ = False
|
||||
self.col_in_: Column = col
|
||||
|
||||
@staticmethod
|
||||
def get_all_possible_types():
|
||||
types = DataType.get_decimal_op_types()
|
||||
types.remove(TypeEnum.DECIMAL)
|
||||
types.remove(TypeEnum.DECIMAL64)
|
||||
return types
|
||||
|
||||
def has_output_double_type(self) -> bool:
|
||||
for t in self.types_:
|
||||
if t.is_real_type() or t.is_varchar_type():
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_converted_vs(self, v):
|
||||
if self.converted_vs_ is None:
|
||||
vs = []
|
||||
for t, saved_v in zip(self.types_, self.elements_):
|
||||
vs.append(t.get_typed_val_for_execute(saved_v, True))
|
||||
if self.has_output_double_type():
|
||||
self.converted_vs_ = [float(e) for e in vs]
|
||||
self.output_float_= True
|
||||
else:
|
||||
self.converted_vs_ = [Decimal(e) for e in vs]
|
||||
if v is None:
|
||||
return None, self.converted_vs_
|
||||
if self.output_float_:
|
||||
return float(v), self.converted_vs_
|
||||
else:
|
||||
return Decimal(v), self.converted_vs_
|
||||
|
||||
def generate(self):
|
||||
types = self.get_all_possible_types()
|
||||
for _ in range(self.num_):
|
||||
type = random.choice(types)
|
||||
dt = DataType.generate_random_type_for(type)
|
||||
self.types_.append(dt)
|
||||
v = dt.generate_sized_val(self.col_in_.type_.prec(), self.col_in_.type_.scale())
|
||||
self.elements_.append(v)
|
||||
|
||||
def __str__(self):
|
||||
return f"{','.join([e for e in self.elements_])}"
|
||||
|
||||
class TDTestCase:
|
||||
updatecfgDict = {
|
||||
|
@ -2152,44 +2286,64 @@ class TDTestCase:
|
|||
if tdSql.errno != invalid_operation and tdSql.errno != scalar_convert_err:
|
||||
tdLog.exit(f"expected err not occured for sql: {sql}, expect: {invalid_operation} or {scalar_convert_err}, but got {tdSql.errno}")
|
||||
|
||||
def check_decimal_in_op(self, tbname: str, tb_cols: list):
|
||||
for i in range(in_op_test_round):
|
||||
inOp: DecimalBinaryOperatorIn = DecimalBinaryOperatorIn('in')
|
||||
notInOp: DecimalBinaryOperatorIn = DecimalBinaryOperatorIn('not in')
|
||||
for col in tb_cols:
|
||||
if not col.type_.is_decimal_type():
|
||||
continue
|
||||
list_expr: DecimalListExpr = DecimalListExpr(random.randint(1, 10), col)
|
||||
list_expr.generate()
|
||||
expr = inOp.generate((col, list_expr))
|
||||
sql = f'select {col} from {self.db_name}.{tbname} where {expr}'
|
||||
res = TaosShell().query(sql)
|
||||
if len(res) > 0:
|
||||
res = res[0]
|
||||
inOp.check(res, tbname)
|
||||
|
||||
expr = notInOp.generate((col, list_expr))
|
||||
sql = f'select {col} from {self.db_name}.{tbname} where {expr}'
|
||||
res = TaosShell().query(sql)
|
||||
if len(res) > 0:
|
||||
res = res[0]
|
||||
notInOp.check(res, tbname)
|
||||
|
||||
def test_decimal_operators(self):
|
||||
tdLog.debug("start to test decimal operators")
|
||||
self.test_decimal_unsupported_types()
|
||||
## tables: meters, nt
|
||||
## columns: c1, c2, c3, c4, c5, c7, c8, c9, c10, c99, c100
|
||||
binary_operators = DecimalBinaryOperator.get_all_binary_ops()
|
||||
if True:
|
||||
self.test_decimal_unsupported_types()
|
||||
## tables: meters, nt
|
||||
## columns: c1, c2, c3, c4, c5, c7, c8, c9, c10, c99, c100
|
||||
binary_operators = DecimalBinaryOperator.get_all_binary_ops()
|
||||
|
||||
## decimal operator with constants of all other types
|
||||
self.run_in_thread(
|
||||
operator_test_round,
|
||||
self.check_decimal_binary_expr_with_const_col_results,
|
||||
(
|
||||
## decimal operator with constants of all other types
|
||||
self.run_in_thread(
|
||||
operator_test_round,
|
||||
self.check_decimal_binary_expr_with_const_col_results,
|
||||
(
|
||||
self.db_name,
|
||||
self.norm_table_name,
|
||||
self.norm_tb_columns,
|
||||
Column.get_decimal_oper_const_cols,
|
||||
DecimalBinaryOperator.get_all_binary_ops,
|
||||
),
|
||||
)
|
||||
|
||||
## test decimal column op decimal column
|
||||
for _ in range(operator_test_round):
|
||||
self.check_decimal_binary_expr_with_col_results(
|
||||
self.db_name, self.norm_table_name, self.norm_tb_columns, binary_operators)
|
||||
|
||||
unary_operators = DecimalUnaryOperator.get_all_unary_ops()
|
||||
self.check_decimal_unary_expr_results(
|
||||
self.db_name,
|
||||
self.norm_table_name,
|
||||
self.norm_tb_columns,
|
||||
Column.get_decimal_oper_const_cols,
|
||||
DecimalBinaryOperator.get_all_binary_ops,
|
||||
),
|
||||
)
|
||||
unary_operators,)
|
||||
|
||||
## test decimal column op decimal column
|
||||
for i in range(operator_test_round):
|
||||
self.check_decimal_binary_expr_with_col_results(
|
||||
self.db_name, self.norm_table_name, self.norm_tb_columns, binary_operators)
|
||||
|
||||
unary_operators = DecimalUnaryOperator.get_all_unary_ops()
|
||||
self.check_decimal_unary_expr_results(
|
||||
self.db_name,
|
||||
self.norm_table_name,
|
||||
self.norm_tb_columns,
|
||||
unary_operators,)
|
||||
|
||||
|
||||
def test_decimal_last_first_func(self):
|
||||
pass
|
||||
|
||||
def test_query_decimal_with_sma(self):
|
||||
pass
|
||||
self.check_decimal_in_op(self.norm_table_name, self.norm_tb_columns)
|
||||
self.check_decimal_in_op(self.stable_name, self.stb_columns)
|
||||
|
||||
def check_decimal_where_with_binary_expr_with_const_col_results(
|
||||
self,
|
||||
|
|
|
@ -32,7 +32,10 @@ def get_decimal(val, scale: int) -> Decimal:
|
|||
if val == 'NULL':
|
||||
return None
|
||||
getcontext().prec = 100
|
||||
return Decimal(val).quantize(Decimal("1." + "0" * scale), ROUND_HALF_UP)
|
||||
try:
|
||||
return Decimal(val).quantize(Decimal("1." + "0" * scale), ROUND_HALF_UP)
|
||||
except Exception as e:
|
||||
tdLog.exit(f"failed to convert {val} to decimal, {e}")
|
||||
|
||||
syntax_error = -2147473920
|
||||
invalid_column = -2147473918
|
||||
|
@ -46,6 +49,7 @@ decimal_test_query = True
|
|||
decimal_insert_validator_test = False
|
||||
operator_test_round = 1
|
||||
tb_insert_rows = 1000
|
||||
ctb_num = 10
|
||||
binary_op_with_const_test = False
|
||||
binary_op_with_col_test = False
|
||||
unary_op_test = False
|
||||
|
@ -160,6 +164,23 @@ class DecimalColumnAggregator:
|
|||
self.none_num: int = 0
|
||||
self.first = None
|
||||
self.last = None
|
||||
self.firsts = []
|
||||
self.lasts = []
|
||||
for i in range(ctb_num):
|
||||
self.firsts.append(None)
|
||||
self.lasts.append(None)
|
||||
def is_stb(self):
|
||||
return self.firsts[1] is not None
|
||||
|
||||
def get_last(self):
|
||||
if self.is_stb():
|
||||
return self.lasts
|
||||
return self.last
|
||||
|
||||
def get_first(self):
|
||||
if self.is_stb():
|
||||
return self.firsts
|
||||
return self.first
|
||||
|
||||
def add_value(self, value: str, scale: int):
|
||||
self.count += 1
|
||||
|
@ -171,7 +192,10 @@ class DecimalColumnAggregator:
|
|||
v: Decimal = get_decimal(value, scale)
|
||||
if self.first is None:
|
||||
self.first = v
|
||||
if self.firsts[int((self.count - 1) / tb_insert_rows)] is None:
|
||||
self.firsts[int((self.count - 1) / tb_insert_rows)] = v
|
||||
self.last = v
|
||||
self.lasts[int((self.count - 1) / tb_insert_rows)] = v
|
||||
self.sum += v
|
||||
if v > self.max:
|
||||
self.max = v
|
||||
|
@ -275,7 +299,7 @@ class DecimalColumnExpr:
|
|||
continue
|
||||
else:
|
||||
break
|
||||
dec_from_query = Decimal(v_from_query)
|
||||
dec_from_query = get_decimal(v_from_query, self.query_col.type_.scale())
|
||||
dec_from_calc = self.get_query_col_val(tbname, j)
|
||||
if dec_from_query != dec_from_calc:
|
||||
tdLog.exit(f"filter with {self} failed, query got: {dec_from_query}, expect {dec_from_calc}, param: {params}")
|
||||
|
@ -994,7 +1018,7 @@ class DecimalFunction(DecimalColumnExpr):
|
|||
def check_results(self, query_col_res: List) -> bool:
|
||||
return False
|
||||
|
||||
def check_for_agg_func(self, query_col_res: List, tbname: str, func):
|
||||
def check_for_agg_func(self, query_col_res: List, tbname: str, func, is_stb: bool = False):
|
||||
col_expr = self.query_col
|
||||
for i in range(col_expr.get_cardinality(tbname)):
|
||||
col_val = col_expr.get_val_for_execute(tbname, i)
|
||||
|
@ -1122,18 +1146,30 @@ class DecimalAggFunction(DecimalFunction):
|
|||
else:
|
||||
return self.get_func_res() == Decimal(query_col_res[0])
|
||||
|
||||
class DecimalLastRowFunction(DecimalAggFunction):
|
||||
def __init__(self):
|
||||
super().__init__("last_row({0})", DecimalLastRowFunction.execute_last_row, "last_row")
|
||||
self.res_ = None
|
||||
def get_func_res(self):
|
||||
decimal_type:DecimalType = self.query_col.type_
|
||||
return decimal_type.aggregator.last
|
||||
class DecimalFirstLastFunction(DecimalAggFunction):
|
||||
def __init__(self, format: str, func, name):
|
||||
super().__init__(format, func, name)
|
||||
def generate_res_type(self):
|
||||
self.res_type_ = self.query_col.type_
|
||||
def check_results(self, query_col_res):
|
||||
if len(query_col_res) == 0:
|
||||
tdLog.exit(f"query got no output: {self}, py calc: {self.get_func_res()}")
|
||||
else:
|
||||
v = Decimal(query_col_res[0])
|
||||
decimal_type: DecimalType = self.query_col.type_
|
||||
if decimal_type.aggregator.is_stb():
|
||||
return v in self.get_func_res()
|
||||
else:
|
||||
return self.get_func_res() == v
|
||||
|
||||
class DecimalLastRowFunction(DecimalFirstLastFunction):
|
||||
def __init__(self):
|
||||
super().__init__("last_row({0})", DecimalLastRowFunction.execute_last_row, "last_row")
|
||||
def get_func_res(self):
|
||||
decimal_type: DecimalType = self.query_col.type_
|
||||
return decimal_type.aggregator.get_last()
|
||||
def execute_last_row(self, params):
|
||||
if params[0] is not None:
|
||||
self.res_ = Decimal(params[0])
|
||||
pass
|
||||
|
||||
class DecimalCacheLastRowFunction(DecimalAggFunction):
|
||||
def __init__(self):
|
||||
|
@ -1148,27 +1184,22 @@ class DecimalCacheLastRowFunction(DecimalAggFunction):
|
|||
class DecimalCacheLastFunction(DecimalAggFunction):
|
||||
pass
|
||||
|
||||
class DecimalFirstFunction(DecimalAggFunction):
|
||||
class DecimalFirstFunction(DecimalFirstLastFunction):
|
||||
def __init__(self):
|
||||
super().__init__("first({0})", DecimalFirstFunction.execute_first, "first")
|
||||
self.res_ = None
|
||||
def get_func_res(self):
|
||||
decimal_type: DecimalType = self.query_col.type_
|
||||
return decimal_type.aggregator.first
|
||||
def generate_res_type(self):
|
||||
self.res_type_ = self.query_col.type_
|
||||
return decimal_type.aggregator.get_first()
|
||||
def execute_first(self, params):
|
||||
pass
|
||||
|
||||
class DecimalLastFunction(DecimalAggFunction):
|
||||
class DecimalLastFunction(DecimalFirstLastFunction):
|
||||
def __init__(self):
|
||||
super().__init__("last({0})", DecimalLastFunction.execute_last, "last")
|
||||
self.res_ = None
|
||||
def get_func_res(self):
|
||||
decimal_type:DecimalType = self.query_col.type_
|
||||
return decimal_type.aggregator.last
|
||||
def generate_res_type(self):
|
||||
self.res_type_ = self.query_col.type_
|
||||
return decimal_type.aggregator.get_last()
|
||||
def execute_last(self, params):
|
||||
pass
|
||||
|
||||
|
@ -1207,19 +1238,12 @@ class DecimalMinFunction(DecimalAggFunction):
|
|||
def get_func_res(self) -> Decimal:
|
||||
decimal_type: DecimalType = self.query_col.type_
|
||||
return decimal_type.aggregator.min
|
||||
return self.min_
|
||||
|
||||
def generate_res_type(self) -> DataType:
|
||||
self.res_type_ = self.query_col.type_
|
||||
|
||||
def execute_min(self, params):
|
||||
if params[0] is None:
|
||||
return
|
||||
if self.min_ is None:
|
||||
self.min_ = Decimal(params[0])
|
||||
else:
|
||||
self.min_ = min(self.min_, Decimal(params[0]))
|
||||
return self.min_
|
||||
pass
|
||||
|
||||
class DecimalMaxFunction(DecimalAggFunction):
|
||||
def __init__(self):
|
||||
|
@ -1234,13 +1258,7 @@ class DecimalMaxFunction(DecimalAggFunction):
|
|||
self.res_type_ = self.query_col.type_
|
||||
|
||||
def execute_max(self, params):
|
||||
if params[0] is None:
|
||||
return
|
||||
if self.max_ is None:
|
||||
self.max_ = Decimal(params[0])
|
||||
else:
|
||||
self.max_ = max(self.max_, Decimal(params[0]))
|
||||
return self.max_
|
||||
pass
|
||||
|
||||
class DecimalSumFunction(DecimalAggFunction):
|
||||
def __init__(self):
|
||||
|
@ -1249,24 +1267,15 @@ class DecimalSumFunction(DecimalAggFunction):
|
|||
def get_func_res(self) -> Decimal:
|
||||
decimal_type: DecimalType = self.query_col.type_
|
||||
return decimal_type.aggregator.sum
|
||||
return self.sum_
|
||||
def generate_res_type(self) -> DataType:
|
||||
self.res_type_ = self.query_col.type_
|
||||
self.res_type_.set_prec(DecimalType.DECIMAL_MAX_PRECISION)
|
||||
def execute_sum(self, params):
|
||||
if params[0] is None:
|
||||
return
|
||||
if self.sum_ is None:
|
||||
self.sum_ = Decimal(params[0])
|
||||
else:
|
||||
self.sum_ += Decimal(params[0])
|
||||
return self.sum_
|
||||
pass
|
||||
|
||||
class DecimalAvgFunction(DecimalAggFunction):
|
||||
def __init__(self):
|
||||
super().__init__("avg({0})", DecimalAvgFunction.execute_avg, "avg")
|
||||
self.count_: Decimal = 0
|
||||
self.sum_: Decimal = None
|
||||
def get_func_res(self) -> Decimal:
|
||||
decimal_type: DecimalType = self.query_col.type_
|
||||
return get_decimal(
|
||||
|
@ -1280,14 +1289,7 @@ class DecimalAvgFunction(DecimalAggFunction):
|
|||
count_type = DataType(TypeEnum.BIGINT, 8, 0)
|
||||
self.res_type_ = DecimalBinaryOperator.calc_decimal_prec_scale(sum_type, count_type, "/")
|
||||
def execute_avg(self, params):
|
||||
if params[0] is None:
|
||||
return
|
||||
if self.sum_ is None:
|
||||
self.sum_ = Decimal(params[0])
|
||||
else:
|
||||
self.sum_ += Decimal(params[0])
|
||||
self.count_ += 1
|
||||
return self.get_func_res()
|
||||
pass
|
||||
|
||||
class DecimalBinaryOperator(DecimalColumnExpr):
|
||||
def __init__(self, format, executor, op: str):
|
||||
|
@ -1594,7 +1596,7 @@ class TDTestCase:
|
|||
self.c_table_prefix = "t"
|
||||
self.tag_name_prefix = "t"
|
||||
self.db_name = "test"
|
||||
self.c_table_num = 10
|
||||
self.c_table_num = ctb_num
|
||||
self.no_decimal_col_tb_name = "tt"
|
||||
self.stb_columns = []
|
||||
self.stream_name = "stream1"
|
||||
|
@ -1975,9 +1977,9 @@ class TDTestCase:
|
|||
#self.no_decimal_table_test()
|
||||
self.test_insert_decimal_values()
|
||||
self.test_query_decimal()
|
||||
self.test_decimal_and_tsma()
|
||||
self.test_decimal_and_view()
|
||||
self.test_decimal_and_stream()
|
||||
#self.test_decimal_and_tsma()
|
||||
#self.test_decimal_and_view()
|
||||
#self.test_decimal_and_stream()
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
|
@ -2396,7 +2398,7 @@ class TDTestCase:
|
|||
res = TaosShell().query(sql)
|
||||
if len(res) > 0:
|
||||
res = res[0]
|
||||
func.check_for_agg_func(res, tbname, func)
|
||||
func.check_for_agg_func(res, tbname, func, tbname == self.stable_name)
|
||||
|
||||
def test_decimal_cast_func(self, dbname, tbname, tb_cols: List[Column]):
|
||||
for col in tb_cols:
|
||||
|
@ -2416,13 +2418,8 @@ class TDTestCase:
|
|||
self.log_test("start to test decimal functions")
|
||||
if not test_decimal_funcs:
|
||||
return
|
||||
self.test_decimal_agg_funcs(
|
||||
self.db_name,
|
||||
self.norm_table_name,
|
||||
self.norm_tb_columns,
|
||||
DecimalFunction.get_decimal_agg_funcs,
|
||||
)
|
||||
##self.test_decimal_agg_funcs( self.db_name, self.stable_name, self.stb_columns, DecimalFunction.get_decimal_agg_funcs)
|
||||
self.test_decimal_agg_funcs( self.db_name, self.norm_table_name, self.norm_tb_columns, DecimalFunction.get_decimal_agg_funcs)
|
||||
self.test_decimal_agg_funcs( self.db_name, self.stable_name, self.stb_columns, DecimalFunction.get_decimal_agg_funcs)
|
||||
self.test_decimal_cast_func(self.db_name, self.norm_table_name, self.norm_tb_columns)
|
||||
|
||||
def test_query_decimal(self):
|
||||
|
@ -2431,11 +2428,11 @@ class TDTestCase:
|
|||
return
|
||||
#self.test_decimal_operators()
|
||||
self.test_query_decimal_where_clause()
|
||||
self.test_decimal_functions()
|
||||
self.test_query_decimal_order_clause()
|
||||
self.test_query_decimal_case_when()
|
||||
self.test_query_decimal_group_by_clause()
|
||||
self.test_query_decimal_having_clause()
|
||||
#self.test_decimal_functions()
|
||||
#self.test_query_decimal_order_clause()
|
||||
#self.test_query_decimal_case_when()
|
||||
#self.test_query_decimal_group_by_clause()
|
||||
#self.test_query_decimal_having_clause()
|
||||
|
||||
|
||||
event = threading.Event()
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -70,7 +70,6 @@ def get_local_classes_in_order(file_path):
|
|||
def dynamicLoadModule(fileName):
|
||||
moduleName = fileName.replace(".py", "").replace(os.sep, ".")
|
||||
return importlib.import_module(moduleName, package='..')
|
||||
|
||||
#
|
||||
# run case on previous cluster
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue