chore: merge 3.0

This commit is contained in:
Haojun Liao 2025-03-19 17:36:16 +08:00
commit 2668894878
79 changed files with 5008 additions and 5261 deletions

View File

@ -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
```

View File

@ -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.

View File

@ -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.

View File

@ -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 |

View File

@ -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 中无法进行时间线相关的运算。

View File

@ -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 配置对象中的自动提交回调函数。

View File

@ -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 |

View File

@ -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);

View File

@ -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);
/**

View File

@ -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

View File

@ -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 {

View File

@ -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);

View File

@ -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;

View File

@ -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;
}

View File

@ -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:

View File

@ -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);

View File

@ -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;
}

View File

@ -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 {

View File

@ -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;
}

View File

@ -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;

View File

@ -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,

View File

@ -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);

View File

@ -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};

View File

@ -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) {

View File

@ -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)) {

View File

@ -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:

View File

@ -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);

View File

@ -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))

View File

@ -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)) {

View File

@ -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;

View File

@ -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

View File

@ -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;
}

View File

@ -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 |
==========================

1 taos> use test;
338 NULL | ============================================================================================================
339 __today__ 00:00:01.000 | __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
340 NULL | __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__tomorrow__ 00:00:00.000 |
NULL |
__tomorrow__ 00:00:02.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 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;
ts | val | tg1 | ts | val | tg1 |
============================================================================================================
NULL | NULL | NULL | __today__ 00:00:00.000 | 404 | 1 |
__tomorrow__ 00:00:03.000 | 204 | 1 | NULL | NULL | NULL |
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 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
341 NULL | NULL | NULL | __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
342 NULL | NULL | NULL | __today__ 00:00:00.000 | 404 | 2 | __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
343 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
346 ts | val | tg2 | ts | val | tg2 | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
347 ============================================================================================================ __today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL |
348 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
__today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL |
__today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL |
__tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
349 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL | __tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL |
350 __tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL | __tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
351 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 full 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; __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |

View File

@ -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;

View File

@ -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 |
==========================

1 taos> use test;
338 NULL | ============================================================================================================
339 __today__ 00:00:01.000 | __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
340 NULL | __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__tomorrow__ 00:00:00.000 |
NULL |
__tomorrow__ 00:00:02.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 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;
ts | val | tg1 | ts | val | tg1 |
============================================================================================================
NULL | NULL | NULL | __today__ 00:00:00.000 | 404 | 1 |
__tomorrow__ 00:00:03.000 | 204 | 1 | NULL | NULL | NULL |
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 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
341 NULL | NULL | NULL | __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
342 NULL | NULL | NULL | __today__ 00:00:00.000 | 404 | 2 | __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
343 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
346 ts | val | tg2 | ts | val | tg2 | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
347 ============================================================================================================ __today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL |
348 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
__today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL |
__today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL |
__tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
349 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL | __tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL |
350 __tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL | __tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
351 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 full 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; __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |

View File

@ -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.

View File

@ -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;

View File

@ -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.

View File

@ -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.

View File

@ -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;

1 taos> use test;
80 __tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 | __today__ 00:00:00.000 | 101 | 1011 |
81 taos> select * from (select now as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; __today__ 00:00:01.000 | 102 | 1012 |
82 taos> select * from (select now as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1; __tomorrow__ 00:00:00.000 | 103 | 1013 |
83 taos> select a.* from (select now as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; __tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from (select now as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
taos> select b.* from (select now as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
taos> select b.c from (select now as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
taos> select b.ts from (select now as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
taos> select b.ts1 from (select now as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
c |
======
a |
84 a | taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
85 a | c |
86 a | ======
247
248
249
250
251
252
253

View File

@ -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;

View File

@ -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;

1 taos> use test;
80 __tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 | __today__ 00:00:00.000 | 101 | 1011 |
81 taos> select * from (select now() as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; __today__ 00:00:01.000 | 102 | 1012 |
82 taos> select * from (select now() as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1; __tomorrow__ 00:00:00.000 | 103 | 1013 |
83 taos> select a.* from (select now() as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; __tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from (select now() as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
taos> select b.* from (select now() as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
taos> select b.c from (select now() as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
taos> select b.ts from (select now() as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
taos> select * from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
taos> select b.* from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
taos> select b.ts1 from (select now() as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
c |
======
a |
84 a | taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
85 a | c |
86 a | ======
247
248
249
250
251
252
253

View File

@ -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 |

1 taos> use test;
233 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
234 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
235 __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 | 403 | 2 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
236 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; __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
237 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; 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;
238 ts | val | tg2 | ts | val | tg2 | 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;
241 taos> select * from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; __tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
242 ts | f | g | 'a' | ts | f | g | taos> select * from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
243 ================================================================================================================== ts | f | g | 'a' | ts | f | g |
244 __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 | ==================================================================================================================
245 __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
246 __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 |
247 __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 |
698 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts; __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
699 ts1 | ts | f | g | 'a' | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
700 ====================================================================================== __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 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;
701 c | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
702 ====== taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
703 a | c |
706 a |
707 taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts; a |
708 ts1 | a |
709 ========================== taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
710 __today__ 00:00:00.000 | ts1 |
711 __today__ 00:00:00.000 | ==========================
712 __today__ 00:00:00.000 |

View File

@ -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;

View File

@ -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 taos> use test;
233 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
234 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
235 __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 | 403 | 2 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
236 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(); __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
237 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; 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();
238 ts | val | tg2 | ts | val | tg2 | 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;
241 taos> select * from (select today() as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; __tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
242 ts | f | g | 'a' | ts | f | g | taos> select * from (select today() as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
243 ================================================================================================================== ts | f | g | 'a' | ts | f | g |
244 __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 | ==================================================================================================================
245 __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
246 __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 |
247 __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 |
698 taos> select b.* from (select today() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts; __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
699 ts1 | ts | f | g | 'a' | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
700 ====================================================================================== __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 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;
701 c | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
702 ====== taos> select b.c from (select today() as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
703 a | c |
706 a |
707 taos> select b.ts1 from (select today() as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts; a |
708 ts1 | a |
709 ========================== taos> select b.ts1 from (select today() as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
710 __today__ 00:00:00.000 | ts1 |
711 __today__ 00:00:00.000 | ==========================
712 __today__ 00:00:00.000 |

View File

@ -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.

View File

@ -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 ;
1 taos> use test;
2 Database changed.
3 taos> select * from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
4 ts | f | g | ts | f | g | 'a' |
5 ==================================================================================================================
6 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
7 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a |
8 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a |
9 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a |
10 taos> select * from a1 a join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
11 ts | f | g | ts1 | f | g | 'a' |
12 ==================================================================================================================
13 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
14 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a |
15 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a |
16 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a |
17 taos> select a.* from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
18 ts | f | g |
19 ======================================================
20 2025-03-04 00:00:00.000 | 101 | 1011 |
21 2025-03-04 00:00:00.000 | 101 | 1011 |
22 2025-03-04 00:00:00.000 | 101 | 1011 |
23 2025-03-04 00:00:00.000 | 101 | 1011 |
24 taos> select b.* from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
25 ts | f | g | 'a' |
26 ============================================================
27 2025-03-04 00:00:00.000 | 301 | 3011 | a |
28 2025-03-04 00:00:00.000 | 302 | 3012 | a |
29 2025-03-04 00:00:00.000 | 303 | 3013 | a |
30 2025-03-04 00:00:00.000 | 304 | 3014 | a |
31 taos> select b.* from a1 a join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
32 ts1 | f | g | 'a' |
33 ============================================================
34 2025-03-04 00:00:00.000 | 301 | 3011 | a |
35 2025-03-04 00:00:00.000 | 302 | 3012 | a |
36 2025-03-04 00:00:00.000 | 303 | 3013 | a |
37 2025-03-04 00:00:00.000 | 304 | 3014 | a |
38 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;
39 ts | f | g | ts |
40 ================================================================================
41 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 |
42 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:01.000 |
43 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:00.000 |
44 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:02.000 |
45 taos> select b.c from a1 a join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
46 c |
47 ======
48 a |
49 a |
50 a |
51 a |
52 taos> select b.ts from a1 a join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
53 ts |
54 ==========================
55 2025-03-04 00:00:00.000 |
56 2025-03-04 00:00:00.000 |
57 2025-03-04 00:00:00.000 |
58 2025-03-04 00:00:00.000 |
59 taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
60 ts | f | g | ts1 | ts | f | g | 'a' |
61 ============================================================================================================================================
62 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 |
63 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 |
64 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 |
65 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 |
66 taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
67 ts | f | g |
68 ======================================================
69 2025-03-04 00:00:00.000 | 101 | 1011 |
70 2025-03-04 00:00:00.000 | 101 | 1011 |
71 2025-03-04 00:00:00.000 | 101 | 1011 |
72 2025-03-04 00:00:00.000 | 101 | 1011 |
73 taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
74 ts1 | ts | f | g | 'a' |
75 ======================================================================================
76 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
77 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
78 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
79 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
80 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;
81 c |
82 ======
83 a |
84 a |
85 a |
86 a |
87 taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
88 ts | f | g | ts1 | ts | f | g | c |
89 ============================================================================================================================================
90 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 |
91 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 |
92 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 |
93 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 |
94 taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
95 ts | f | g |
96 ======================================================
97 2025-03-04 00:00:00.000 | 101 | 1011 |
98 2025-03-04 00:00:01.000 | 102 | 1012 |
99 2025-03-05 00:00:00.000 | 103 | 1013 |
100 2025-03-05 00:00:02.000 | 104 | 1014 |
101 taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
102 ts1 | ts | f | g | c |
103 ======================================================================================
104 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
105 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
106 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
107 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
108 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;
109 ts1 | ts |
110 ====================================================
111 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 |
112 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 |
113 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 |
114 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 |
115 taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
116 ts | f | g | ts1 | ts | f | g | 'a' |
117 ============================================================================================================================================
118 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 |
119 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 |
120 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 |
121 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 |
122 taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
123 ts | f | g |
124 ======================================================
125 2025-03-04 00:00:00.000 | 101 | 1011 |
126 2025-03-04 00:00:01.000 | 102 | 1012 |
127 2025-03-05 00:00:00.000 | 103 | 1013 |
128 2025-03-05 00:00:02.000 | 104 | 1014 |
129 taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
130 ts1 | ts | f | g | 'a' |
131 ======================================================================================
132 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
133 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
134 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
135 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
136 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;
137 c |
138 ======
139 a |
140 a |
141 a |
142 a |
143 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;
144 ts |
145 ==========================
146 2025-03-04 00:00:00.000 |
147 2025-03-04 00:00:01.000 |
148 2025-03-05 00:00:00.000 |
149 2025-03-05 00:00:02.000 |
150 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;
151 ts | f | g | ts1 | ts | f | g | 'a' |
152 ============================================================================================================================================
153 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 |
154 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;
155 ts | f | g |
156 ======================================================
157 2025-03-04 00:00:00.000 | 101 | 1011 |
158 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;
159 ts1 | ts | f | g | 'a' |
160 ======================================================================================
161 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
162 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;
163 c |
164 ======
165 a |
166 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;
167 ts |
168 ==========================
169 2025-03-04 00:00:00.000 |
170 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;
171 ts | f | g | ts1 | ts | f | g | 'a' |
172 ============================================================================================================================================
173 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 |
174 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;
175 ts | f | g |
176 ======================================================
177 2025-03-04 00:00:00.000 | 101 | 1011 |
178 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;
179 ts1 | ts | f | g | 'a' |
180 ======================================================================================
181 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
182 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;
183 c |
184 ======
185 a |
186 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;
187 ts |
188 ==========================
189 2025-03-04 00:00:00.000 |
190 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;
191 ts |
192 ==========================
193 2025-03-04 00:00:00.000 |
194 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;
195 ts |
196 ==========================
197 2025-03-04 00:00:00.000 |
198 2025-03-04 00:00:01.000 |
199 2025-03-05 00:00:00.000 |
200 2025-03-05 00:00:02.000 |
201 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;
202 ts |
203 ==========================
204 2025-03-04 00:00:00.000 |
205 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;
206 ts |
207 ==========================
208 2025-03-04 00:00:00.000 |
209 2025-03-04 00:00:01.000 |
210 2025-03-05 00:00:00.000 |
211 2025-03-05 00:00:02.000 |
212 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;
213 ts |
214 ==========================
215 2025-03-04 00:00:00.000 |
216 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;
217 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;
218 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;
219 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;
220 ts | val | tg2 | ts | val | tg2 |
221 ============================================================================================================
222 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 |
223 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 |
224 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 |
225 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 |
226 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 |
227 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 |
228 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 |
229 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 |
230 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;
231 ts | val | tg2 | ts | val | tg2 |
232 ============================================================================================================
233 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 |
234 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 |
235 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 |
236 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 |
237 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 |
238 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 |
239 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 |
240 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 |
241 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;
242 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;
243 ts | val | tg2 | ts | val | tg2 |
244 ============================================================================================================
245 2025-03-05 00:00:03.000 | 204 | 2 | 2025-03-05 00:00:03.000 | 404 | 2 |
246 taos> select * from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
247 ts | f | g | 'a' | ts | f | g |
248 ==================================================================================================================
249 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
250 2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
251 2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
252 2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
253 taos> select * from (select today as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
254 ts1 | f | g | 'a' | ts | f | g |
255 ==================================================================================================================
256 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
257 2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
258 2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
259 2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
260 taos> select a.* from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
261 ts | f | g |
262 ======================================================
263 2025-03-04 00:00:00.000 | 101 | 1011 |
264 2025-03-04 00:00:00.000 | 101 | 1011 |
265 2025-03-04 00:00:00.000 | 101 | 1011 |
266 2025-03-04 00:00:00.000 | 101 | 1011 |
267 taos> select b.* from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
268 ts | f | g | 'a' |
269 ============================================================
270 2025-03-04 00:00:00.000 | 301 | 3011 | a |
271 2025-03-04 00:00:00.000 | 302 | 3012 | a |
272 2025-03-04 00:00:00.000 | 303 | 3013 | a |
273 2025-03-04 00:00:00.000 | 304 | 3014 | a |
274 taos> select b.* from (select today as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
275 ts1 | f | g | 'a' |
276 ============================================================
277 2025-03-04 00:00:00.000 | 301 | 3011 | a |
278 2025-03-04 00:00:00.000 | 302 | 3012 | a |
279 2025-03-04 00:00:00.000 | 303 | 3013 | a |
280 2025-03-04 00:00:00.000 | 304 | 3014 | a |
281 taos> select b.c from (select today as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
282 c |
283 ======
284 a |
285 a |
286 a |
287 a |
288 taos> select b.ts from (select today as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
289 ts |
290 ==========================
291 2025-03-04 00:00:00.000 |
292 2025-03-04 00:00:00.000 |
293 2025-03-04 00:00:00.000 |
294 2025-03-04 00:00:00.000 |
295 taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
296 ts1 | ts | f | g | 'a' | ts | f | g |
297 ============================================================================================================================================
298 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 |
299 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 |
300 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 |
301 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 |
302 taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
303 ts | f | g |
304 ======================================================
305 2025-03-04 00:00:00.000 | 101 | 1011 |
306 2025-03-04 00:00:00.000 | 101 | 1011 |
307 2025-03-04 00:00:00.000 | 101 | 1011 |
308 2025-03-04 00:00:00.000 | 101 | 1011 |
309 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
310 ts1 | ts | f | g | 'a' |
311 ======================================================================================
312 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
313 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
314 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
315 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
316 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;
317 c |
318 ======
319 a |
320 a |
321 a |
322 a |
323 taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
324 ts1 |
325 ==========================
326 2025-03-04 00:00:00.000 |
327 2025-03-04 00:00:00.000 |
328 2025-03-04 00:00:00.000 |
329 2025-03-04 00:00:00.000 |
330 taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
331 ts1 | ts | f | g | 'a' | ts | f | g |
332 ============================================================================================================================================
333 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 |
334 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 |
335 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 |
336 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 |
337 taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
338 ts | f | g |
339 ======================================================
340 2025-03-04 00:00:00.000 | 101 | 1011 |
341 2025-03-04 00:00:01.000 | 102 | 1012 |
342 2025-03-05 00:00:00.000 | 103 | 1013 |
343 2025-03-05 00:00:02.000 | 104 | 1014 |
344 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
345 ts1 | ts | f | g | 'a' |
346 ======================================================================================
347 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
348 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
349 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
350 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
351 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;
352 c |
353 ======
354 a |
355 a |
356 a |
357 a |
358 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;
359 ts |
360 ==========================
361 2025-03-04 00:00:00.000 |
362 2025-03-04 00:00:01.000 |
363 2025-03-05 00:00:00.000 |
364 2025-03-05 00:00:02.000 |
365 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;
366 ts1 | ts | f | g | 'a' | ts | f | g |
367 ============================================================================================================================================
368 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 |
369 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;
370 ts | f | g |
371 ======================================================
372 2025-03-04 00:00:00.000 | 101 | 1011 |
373 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;
374 ts1 | ts | f | g | 'a' |
375 ======================================================================================
376 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
377 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;
378 c |
379 ======
380 a |
381 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;
382 ts |
383 ==========================
384 2025-03-04 00:00:00.000 |
385 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;
386 ts1 | ts | f | g | 'a' | ts | f | g |
387 ============================================================================================================================================
388 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 |
389 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;
390 ts | f | g |
391 ======================================================
392 2025-03-04 00:00:00.000 | 101 | 1011 |
393 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;
394 ts1 | ts | f | g | 'a' |
395 ======================================================================================
396 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
397 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;
398 c |
399 ======
400 a |
401 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;
402 ts |
403 ==========================
404 2025-03-04 00:00:00.000 |
405 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;
406 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;
407 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;;
408 ts | val | tg2 | ts | val | tg2 |
409 ============================================================================================================
410 2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
411 2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
412 2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
413 2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
414 2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
415 2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
416 2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
417 2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
418 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;
419 ts | val | tg2 | ts | val | tg2 |
420 ============================================================================================================
421 2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
422 2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
423 2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
424 2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
425 2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
426 2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
427 2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
428 2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
429 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;
430 taos> select * from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts;
431 ts | f | g | ts | f | g | 'a' |
432 ==================================================================================================================
433 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
434 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a |
435 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a |
436 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a |
437 taos> select * from a1 a , (select today as ts1, f, g, 'a' from b1) b where a.ts = b.ts1;
438 ts | f | g | ts1 | f | g | 'a' |
439 ==================================================================================================================
440 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
441 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a |
442 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a |
443 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a |
444 taos> select a.* from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts;
445 ts | f | g |
446 ======================================================
447 2025-03-04 00:00:00.000 | 101 | 1011 |
448 2025-03-04 00:00:00.000 | 101 | 1011 |
449 2025-03-04 00:00:00.000 | 101 | 1011 |
450 2025-03-04 00:00:00.000 | 101 | 1011 |
451 taos> select b.* from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts;
452 ts | f | g | 'a' |
453 ============================================================
454 2025-03-04 00:00:00.000 | 301 | 3011 | a |
455 2025-03-04 00:00:00.000 | 302 | 3012 | a |
456 2025-03-04 00:00:00.000 | 303 | 3013 | a |
457 2025-03-04 00:00:00.000 | 304 | 3014 | a |
458 taos> select b.c from a1 a , (select today as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
459 c |
460 ======
461 a |
462 a |
463 a |
464 a |
465 taos> select b.ts from a1 a , (select today as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
466 ts |
467 ==========================
468 2025-03-04 00:00:00.000 |
469 2025-03-04 00:00:00.000 |
470 2025-03-04 00:00:00.000 |
471 2025-03-04 00:00:00.000 |
472 taos> select b.ts1 from a1 a , (select today as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
473 ts1 |
474 ==========================
475 2025-03-04 00:00:00.000 |
476 2025-03-04 00:00:00.000 |
477 2025-03-04 00:00:00.000 |
478 2025-03-04 00:00:00.000 |
479 taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
480 ts | f | g | ts1 | ts | f | g | 'a' |
481 ============================================================================================================================================
482 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 |
483 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 |
484 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 |
485 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 |
486 taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
487 ts | f | g |
488 ======================================================
489 2025-03-04 00:00:00.000 | 101 | 1011 |
490 2025-03-04 00:00:00.000 | 101 | 1011 |
491 2025-03-04 00:00:00.000 | 101 | 1011 |
492 2025-03-04 00:00:00.000 | 101 | 1011 |
493 taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
494 ts1 | ts | f | g | 'a' |
495 ======================================================================================
496 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
497 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
498 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
499 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
500 taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts;
501 c |
502 ======
503 a |
504 a |
505 a |
506 a |
507 taos> select b.ts1 from a1 a , (select today as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts;
508 ts1 |
509 ==========================
510 2025-03-04 00:00:00.000 |
511 2025-03-04 00:00:00.000 |
512 2025-03-04 00:00:00.000 |
513 2025-03-04 00:00:00.000 |
514 taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
515 ts | f | g | ts1 | ts | f | g | 'a' |
516 ============================================================================================================================================
517 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 |
518 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 |
519 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 |
520 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 |
521 taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
522 ts | f | g |
523 ======================================================
524 2025-03-04 00:00:00.000 | 101 | 1011 |
525 2025-03-04 00:00:01.000 | 102 | 1012 |
526 2025-03-05 00:00:00.000 | 103 | 1013 |
527 2025-03-05 00:00:02.000 | 104 | 1014 |
528 taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
529 ts1 | ts | f | g | 'a' |
530 ======================================================================================
531 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
532 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
533 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
534 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
535 taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
536 c |
537 ======
538 a |
539 a |
540 a |
541 a |
542 taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
543 ts |
544 ==========================
545 2025-03-04 00:00:00.000 |
546 2025-03-04 00:00:01.000 |
547 2025-03-05 00:00:00.000 |
548 2025-03-05 00:00:02.000 |
549 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;
550 ts | f | g | ts1 | ts | f | g | 'a' |
551 ============================================================================================================================================
552 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 |
553 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;
554 ts | f | g |
555 ======================================================
556 2025-03-04 00:00:00.000 | 101 | 1011 |
557 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;
558 ts1 | ts | f | g | 'a' |
559 ======================================================================================
560 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
561 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;
562 c |
563 ======
564 a |
565 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;
566 ts |
567 ==========================
568 2025-03-04 00:00:00.000 |
569 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;
570 ts | f | g | ts1 | ts | f | g | 'a' |
571 ============================================================================================================================================
572 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 |
573 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;
574 ts | f | g |
575 ======================================================
576 2025-03-04 00:00:00.000 | 101 | 1011 |
577 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;
578 ts1 | ts | f | g | 'a' |
579 ======================================================================================
580 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
581 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;
582 c |
583 ======
584 a |
585 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;
586 ts |
587 ==========================
588 2025-03-04 00:00:00.000 |
589 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;
590 ts |
591 ==========================
592 2025-03-04 00:00:00.000 |
593 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;
594 ts |
595 ==========================
596 2025-03-04 00:00:00.000 |
597 2025-03-04 00:00:01.000 |
598 2025-03-05 00:00:00.000 |
599 2025-03-05 00:00:02.000 |
600 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;
601 ts |
602 ==========================
603 2025-03-04 00:00:00.000 |
604 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;
605 ts |
606 ==========================
607 2025-03-04 00:00:00.000 |
608 2025-03-04 00:00:01.000 |
609 2025-03-05 00:00:00.000 |
610 2025-03-05 00:00:02.000 |
611 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;
612 ts |
613 ==========================
614 2025-03-04 00:00:00.000 |
615 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;
616 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;
617 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;
618 ts | val | tg2 | ts | val | tg2 |
619 ============================================================================================================
620 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 |
621 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 |
622 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 |
623 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 |
624 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 |
625 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 |
626 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 |
627 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 |
628 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;
629 ts | val | tg2 | ts | val | tg2 |
630 ============================================================================================================
631 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 |
632 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 |
633 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 |
634 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 |
635 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 |
636 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 |
637 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 |
638 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 |
639 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 ;
640 taos> select * from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
641 ts | f | g | 'a' | ts | f | g |
642 ==================================================================================================================
643 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
644 2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
645 2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
646 2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
647 taos> select * from (select today as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
648 ts1 | f | g | 'a' | ts | f | g |
649 ==================================================================================================================
650 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
651 2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
652 2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
653 2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
654 taos> select a.* from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
655 ts | f | g |
656 ======================================================
657 2025-03-04 00:00:00.000 | 101 | 1011 |
658 2025-03-04 00:00:00.000 | 101 | 1011 |
659 2025-03-04 00:00:00.000 | 101 | 1011 |
660 2025-03-04 00:00:00.000 | 101 | 1011 |
661 taos> select b.* from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
662 ts | f | g | 'a' |
663 ============================================================
664 2025-03-04 00:00:00.000 | 301 | 3011 | a |
665 2025-03-04 00:00:00.000 | 302 | 3012 | a |
666 2025-03-04 00:00:00.000 | 303 | 3013 | a |
667 2025-03-04 00:00:00.000 | 304 | 3014 | a |
668 taos> select b.c from (select today as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
669 c |
670 ======
671 a |
672 a |
673 a |
674 a |
675 taos> select b.ts from (select today as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
676 ts |
677 ==========================
678 2025-03-04 00:00:00.000 |
679 2025-03-04 00:00:00.000 |
680 2025-03-04 00:00:00.000 |
681 2025-03-04 00:00:00.000 |
682 taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
683 ts1 |
684 ==========================
685 2025-03-04 00:00:00.000 |
686 2025-03-04 00:00:00.000 |
687 2025-03-04 00:00:00.000 |
688 2025-03-04 00:00:00.000 |
689 taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
690 ts1 | ts | f | g | 'a' | ts | f | g |
691 ============================================================================================================================================
692 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 |
693 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 |
694 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 |
695 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 |
696 taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
697 ts | f | g |
698 ======================================================
699 2025-03-04 00:00:00.000 | 101 | 1011 |
700 2025-03-04 00:00:00.000 | 101 | 1011 |
701 2025-03-04 00:00:00.000 | 101 | 1011 |
702 2025-03-04 00:00:00.000 | 101 | 1011 |
703 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
704 ts1 | ts | f | g | 'a' |
705 ======================================================================================
706 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
707 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
708 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
709 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
710 taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
711 c |
712 ======
713 a |
714 a |
715 a |
716 a |
717 taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
718 ts1 |
719 ==========================
720 2025-03-04 00:00:00.000 |
721 2025-03-04 00:00:00.000 |
722 2025-03-04 00:00:00.000 |
723 2025-03-04 00:00:00.000 |
724 taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
725 ts1 | ts | f | g | 'a' | ts | f | g |
726 ============================================================================================================================================
727 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 |
728 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 |
729 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 |
730 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 |
731 taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
732 ts | f | g |
733 ======================================================
734 2025-03-04 00:00:00.000 | 101 | 1011 |
735 2025-03-04 00:00:01.000 | 102 | 1012 |
736 2025-03-05 00:00:00.000 | 103 | 1013 |
737 2025-03-05 00:00:02.000 | 104 | 1014 |
738 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
739 ts1 | ts | f | g | 'a' |
740 ======================================================================================
741 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
742 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
743 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
744 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
745 taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
746 c |
747 ======
748 a |
749 a |
750 a |
751 a |
752 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
753 ts |
754 ==========================
755 2025-03-04 00:00:00.000 |
756 2025-03-04 00:00:01.000 |
757 2025-03-05 00:00:00.000 |
758 2025-03-05 00:00:02.000 |
759 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;
760 ts1 | ts | f | g | 'a' | ts | f | g |
761 ============================================================================================================================================
762 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 |
763 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;
764 ts | f | g |
765 ======================================================
766 2025-03-04 00:00:00.000 | 101 | 1011 |
767 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;
768 ts1 | ts | f | g | 'a' |
769 ======================================================================================
770 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
771 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;
772 c |
773 ======
774 a |
775 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;
776 ts |
777 ==========================
778 2025-03-04 00:00:00.000 |
779 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;
780 ts1 | ts | f | g | 'a' | ts | f | g |
781 ============================================================================================================================================
782 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 |
783 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;
784 ts | f | g |
785 ======================================================
786 2025-03-04 00:00:00.000 | 101 | 1011 |
787 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;
788 ts1 | ts | f | g | 'a' |
789 ======================================================================================
790 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
791 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;
792 c |
793 ======
794 a |
795 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;
796 ts |
797 ==========================
798 2025-03-04 00:00:00.000 |
799 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;
800 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;
801 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;
802 ts | val | tg2 | ts | val | tg2 |
803 ============================================================================================================
804 2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
805 2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
806 2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
807 2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
808 2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
809 2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
810 2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
811 2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
812 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;
813 ts | val | tg2 | ts | val | tg2 |
814 ============================================================================================================
815 2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
816 2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
817 2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
818 2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
819 2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
820 2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
821 2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
822 2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
823 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 ;

View File

@ -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 |
==========================

1 taos> use test;
188 __today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL | taos> select * from (select today as ts, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts;
189 __today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL | taos> select * from (select today as ts1, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts1;
190 __tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL | taos> select a.* from (select today as ts, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts;
__tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
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 anti 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 anti 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 left anti 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 |
191 ============================================================================================================ taos> select b.* from (select today as ts, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts;
192 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL | taos> select b.* from (select today as ts1, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts1;
taos> select * from (select today as ts, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts;
taos> select * from (select today as ts1, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts1;
taos> select a.* from (select today as ts, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts;
taos> select b.* from (select today as ts, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts;
taos> select b.* from (select today as ts1, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts1;
taos> select b.c from (select today as ts, f, g, 'a' c from b1) b left anti join a1 a on a.ts = b.ts;
taos> select b.ts from (select today as ts, f, g, 'a' c from b1) b left anti join a1 a on a.ts = b.ts;
193 taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b left anti join a1 a on b.ts1 = a.ts; taos> select b.c from (select today as ts, f, g, 'a' c from b1) b left anti join a1 a on a.ts = b.ts;
194 taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b left anti join a1 a on b.ts1 = a.ts; taos> select b.ts from (select today as ts, f, g, 'a' c from b1) b left anti join a1 a on a.ts = b.ts;
195 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b left anti join a1 a on b.ts1 = a.ts; taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b left anti join a1 a on b.ts1 = a.ts;

View File

@ -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;

View File

@ -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 |
==========================

1 taos> use test;
188 __today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL | taos> select * from (select today() as ts, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts;
189 __today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL | taos> select * from (select today() as ts1, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts1;
190 __tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL | taos> select a.* from (select today() as ts, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts;
__tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
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 anti 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 anti 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 left anti 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 |
191 ============================================================================================================ taos> select b.* from (select today() as ts, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts;
192 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL | taos> select b.* from (select today() as ts1, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts1;
taos> select * from (select today() as ts, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts;
taos> select * from (select today() as ts1, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts1;
taos> select a.* from (select today() as ts, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts;
taos> select b.* from (select today() as ts, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts;
taos> select b.* from (select today() as ts1, f, g, 'a' from b1) b left anti join a1 a on a.ts = b.ts1;
taos> select b.c from (select today() as ts, f, g, 'a' c from b1) b left anti join a1 a on a.ts = b.ts;
taos> select b.ts from (select today() as ts, f, g, 'a' c from b1) b left anti join a1 a on a.ts = b.ts;
193 taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b left anti join a1 a on b.ts1 = a.ts; taos> select b.c from (select today() as ts, f, g, 'a' c from b1) b left anti join a1 a on a.ts = b.ts;
194 taos> select a.* from (select today() as ts1, ts, f, g, 'a' from b1) b left anti join a1 a on b.ts1 = a.ts; taos> select b.ts from (select today() as ts, f, g, 'a' c from b1) b left anti join a1 a on a.ts = b.ts;
195 taos> select b.* from (select today() as ts1, ts, f, g, 'a' from b1) b left anti join a1 a on b.ts1 = a.ts; taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b left anti join a1 a on b.ts1 = a.ts;

View File

@ -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;

1 taos> use test;
226 NULL | 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 join (select now 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=now where tb.ts=now order by tb.val;
227 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; 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 join (select now 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>now where tb.ts>now;
228 ts | 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 left 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;
==========================
NULL |
NULL |
NULL |
NULL |
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 join (select now 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;
ts | val | tg1 | ts | val | tg1 |
============================================================================================================
__tomorrow__ 00:00:03.000 | 204 | 1 | NULL | NULL | NULL |
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 left join (select now 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 |
============================================================================================================
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
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 join (select now 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.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | NULL | NULL | NULL |
__today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__today__ 00:00:00.000 | 201 | 2 | NULL | NULL | NULL |
__today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL |
__tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
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 join (select now 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=now where tb.ts=now 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 join (select now 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>now where tb.ts>now;
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 left 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 |
============================================================================================================
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
229 taos> select a.* from (select now as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts; ts | val | tg2 | ts | val | tg2 |
230 ts | f | g | ============================================================================================================
231 ====================================================== __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
442
443
444
445
446

View File

@ -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__;

View File

@ -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();

1 taos> use test;
226 NULL | 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 join (select now() 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=now() where tb.ts=now() order by tb.val;
227 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; 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 join (select now() 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>now() where tb.ts>now();
228 ts | 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 left 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;
==========================
NULL |
NULL |
NULL |
NULL |
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 join (select now() 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;
ts | val | tg1 | ts | val | tg1 |
============================================================================================================
__tomorrow__ 00:00:03.000 | 204 | 1 | NULL | NULL | NULL |
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 left join (select now() 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 |
============================================================================================================
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
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 join (select now() 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.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | NULL | NULL | NULL |
__today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__today__ 00:00:00.000 | 201 | 2 | NULL | NULL | NULL |
__today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL |
__tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
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 join (select now() 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=now() where tb.ts=now() 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 join (select now() 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>now() where tb.ts>now();
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 left 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 |
============================================================================================================
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
229 taos> select a.* from (select now() as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts; ts | val | tg2 | ts | val | tg2 |
230 ts | f | g | ============================================================================================================
231 ====================================================== __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
442
443
444
445
446

View File

@ -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 |
==========================

1 taos> use test;
305 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 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; __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
306 ts | val | tg2 | ts | val | tg2 | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
307 ============================================================================================================ __today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
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 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
308 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL |
309 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 | __tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL |
310 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
313 __today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL | 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 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;
314 __today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL | ts | val | tg2 | ts | val | tg2 |
315 __tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL | ============================================================================================================
__tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
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 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 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
316 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
317 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
318 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |

View File

@ -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;

View File

@ -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 |
==========================

1 taos> use test;
305 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 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; __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
306 ts | val | tg2 | ts | val | tg2 | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
307 ============================================================================================================ __today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
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 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
308 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL |
309 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 | __tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL |
310 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
313 __today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL | 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 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;
314 __today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL | ts | val | tg2 | ts | val | tg2 |
315 __tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL | ============================================================================================================
__tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
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 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 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
316 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
317 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
318 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |

View File

@ -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 |

1 taos> use test;
194 __tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 | taos> select * from (select today as ts1, f, g, 'a' from b1) b left semi join a1 a on a.ts = b.ts1;
195 taos> select * from (select today as ts, f, g, 'a' from b1) b left semi join a1 a on a.ts = b.ts; ts1 | f | g | 'a' | ts | f | g |
196 ts | f | g | 'a' | ts | f | g | ==================================================================================================================
==================================================================================================================
__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 | __today__ 00:00:00.000 | 101 | 1011 |
197 taos> select * from (select today as ts1, f, g, 'a' from b1) b left semi join a1 a on a.ts = b.ts1; __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
198 ts1 | f | g | 'a' | ts | f | g | __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
199 ================================================================================================================== __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
202 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 | ts | f | g |
203 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 | ======================================================
204 taos> select a.* from (select today as ts, f, g, 'a' from b1) b left semi join a1 a on a.ts = b.ts; __today__ 00:00:00.000 | 101 | 1011 |
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
205 __today__ 00:00:00.000 | 101 | 1011 |
206 taos> select b.* from (select today as ts, f, g, 'a' from b1) b left semi join a1 a on a.ts = b.ts; __today__ 00:00:00.000 | 101 | 1011 |
207 ts | f | g | 'a' | __today__ 00:00:00.000 | 101 | 1011 |
214 ts1 | f | g | 'a' | __today__ 00:00:00.000 | 304 | 3014 | a |
215 ============================================================ taos> select b.* from (select today as ts1, f, g, 'a' from b1) b left semi join a1 a on a.ts = b.ts1;
216 __today__ 00:00:00.000 | 301 | 3011 | a | ts1 | f | g | 'a' |
217 __today__ 00:00:00.000 | 302 | 3012 | a | ============================================================
218 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 301 | 3011 | a |
219 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 302 | 3012 | a |
220 taos> select b.c from (select today as ts, f, g, 'a' c from b1) b left semi join a1 a on a.ts = b.ts; __today__ 00:00:00.000 | 303 | 3013 | a |

View File

@ -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;

View File

@ -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 |

1 taos> use test;
194 __tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 | taos> select * from (select today() as ts1, f, g, 'a' from b1) b left semi join a1 a on a.ts = b.ts1;
195 taos> select * from (select today() as ts, f, g, 'a' from b1) b left semi join a1 a on a.ts = b.ts; ts1 | f | g | 'a' | ts | f | g |
196 ts | f | g | 'a' | ts | f | g | ==================================================================================================================
==================================================================================================================
__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 | __today__ 00:00:00.000 | 101 | 1011 |
197 taos> select * from (select today() as ts1, f, g, 'a' from b1) b left semi join a1 a on a.ts = b.ts1; __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
198 ts1 | f | g | 'a' | ts | f | g | __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
199 ================================================================================================================== __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
202 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 | ts | f | g |
203 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 | ======================================================
204 taos> select a.* from (select today() as ts, f, g, 'a' from b1) b left semi join a1 a on a.ts = b.ts; __today__ 00:00:00.000 | 101 | 1011 |
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
205 __today__ 00:00:00.000 | 101 | 1011 |
206 taos> select b.* from (select today() as ts, f, g, 'a' from b1) b left semi join a1 a on a.ts = b.ts; __today__ 00:00:00.000 | 101 | 1011 |
207 ts | f | g | 'a' | __today__ 00:00:00.000 | 101 | 1011 |
214 ts1 | f | g | 'a' | __today__ 00:00:00.000 | 304 | 3014 | a |
215 ============================================================ taos> select b.* from (select today() as ts1, f, g, 'a' from b1) b left semi join a1 a on a.ts = b.ts1;
216 __today__ 00:00:00.000 | 301 | 3011 | a | ts1 | f | g | 'a' |
217 __today__ 00:00:00.000 | 302 | 3012 | a | ============================================================
218 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 301 | 3011 | a |
219 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 302 | 3012 | a |
220 taos> select b.c from (select today() as ts, f, g, 'a' c from b1) b left semi join a1 a on a.ts = b.ts; __today__ 00:00:00.000 | 303 | 3013 | a |

View File

@ -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 |
1 taos> use test;
2 Database changed.
3 taos> select * from a1 a join (select today + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts;
4 ts | f | g | ts | f | g | 'a' |
5 ==================================================================================================================
6 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
7 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
8 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
9 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
10 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;
11 ts | f | g | ts | f | g | 'a' |
12 ==================================================================================================================
13 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
14 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
15 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
16 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
17 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);
18 ts | f | g | ts | f | g | 'a' |
19 ==================================================================================================================
20 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
21 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
22 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
23 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
24 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);
25 ts | f | g | ts | f | g | 'a' |
26 ==================================================================================================================
27 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
28 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
29 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
30 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
31 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;
32 ts | f | ts | f | g | 'a' |
33 ====================================================================================================
34 __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
35 __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
36 __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
37 __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
38 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;
39 ts | f | g | ts | f | g | 'a' |
40 ==================================================================================================================
41 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
42 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
43 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
44 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
45 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;
46 ts | f | g | ts | f | g | 'a' |
47 ==================================================================================================================
48 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 301 | 3011 | a |
49 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 302 | 3012 | a |
50 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 303 | 3013 | a |
51 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 304 | 3014 | a |
52 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;
53 ts | f | g | ts | f | g | 'a' |
54 ==================================================================================================================
55 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 301 | 3011 | a |
56 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 302 | 3012 | a |
57 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 303 | 3013 | a |
58 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 304 | 3014 | a |
59 taos> select * from a1 a, (select today + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts;
60 ts | f | g | ts | f | g | 'a' |
61 ==================================================================================================================
62 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
63 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
64 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
65 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
66 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;
67 ts | f | g | ts | f | g | 'a' |
68 ==================================================================================================================
69 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
70 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
71 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
72 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
73 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);
74 ts | f | g | ts | f | g | 'a' |
75 ==================================================================================================================
76 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
77 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
78 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
79 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
80 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);
81 ts | f | g | ts | f | g | 'a' |
82 ==================================================================================================================
83 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
84 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
85 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
86 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
87 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;
88 ts | f | ts | f | g | 'a' |
89 ====================================================================================================
90 __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a |
91 __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a |
92 __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a |
93 __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
94 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;
95 ts | f | g | ts | f | g | 'a' |
96 ==================================================================================================================
97 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
98 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
99 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
100 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
101 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;
102 ts | f | g | ts | f | g | 'a' |
103 ==================================================================================================================
104 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 301 | 3011 | a |
105 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 302 | 3012 | a |
106 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 303 | 3013 | a |
107 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 304 | 3014 | a |
108 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;
109 ts | f | g | ts | f | g | 'a' |
110 ==================================================================================================================
111 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 301 | 3011 | a |
112 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 302 | 3012 | a |
113 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 303 | 3013 | a |
114 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 304 | 3014 | a |
115 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;
116 ts | f | g | ts | f | g | 'a' |
117 ==================================================================================================================
118 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
119 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
120 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
121 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
122 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;
123 count(*) |
124 ========================
125 4 |
126 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;
127 ts | count(*) |
128 ==================================================
129 NULL | 3 |
130 __today__ 00:00:00.000 | 4 |
131 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;
132 ts | f | g | ts1 | ts | f | g |
133 ======================================================================================================================================
134 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
135 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
136 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
137 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
138 taos> /*table+subq*/
139 taos> select * from a1 a join (select * from b1 order by ts) b on a.ts = b.ts;
140 ts | f | g | ts | f | g |
141 ============================================================================================================
142 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
143 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 |
144 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
145 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
146 taos> select * from a1 a join (select * from b1 order by ts desc) b on a.ts = b.ts;
147 ts | f | g | ts | f | g |
148 ============================================================================================================
149 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
150 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
151 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 |
152 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
153 taos> /*table+const subq*/
154 taos> select * from a1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;
155 ts | f | g | ts1 | ts | f | g |
156 ======================================================================================================================================
157 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
158 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
159 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
160 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
161 taos> select * from a1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;
162 ts | f | g | ts1 | ts | f | g |
163 ======================================================================================================================================
164 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
165 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
166 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
167 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
168 taos> select * from a1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1;
169 ts | f | g | ts1 | ts | f | g |
170 ======================================================================================================================================
171 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
172 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
173 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
174 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
175 taos> select * from a1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1;
176 ts | f | g | ts1 | ts | f | g |
177 ======================================================================================================================================
178 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
179 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
180 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
181 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
182 taos> select * from a1 a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1;
183 ts | f | g | ts1 | ts | f | g |
184 ======================================================================================================================================
185 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
186 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
187 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
188 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
189 taos> /*subq+subq*/
190 taos> select * from (select * from a1 order by ts) a join (select * from b1 order by ts) b on a.ts = b.ts;
191 ts | f | g | ts | f | g |
192 ============================================================================================================
193 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
194 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 |
195 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
196 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
197 taos> select * from (select * from a1 order by ts) a join (select * from b1 order by ts desc) b on a.ts = b.ts;
198 ts | f | g | ts | f | g |
199 ============================================================================================================
200 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
201 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
202 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 |
203 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
204 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;
205 ts | f | g | ts | f | g |
206 ============================================================================================================
207 __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
208 __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
209 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 |
210 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
211 taos> /*subq+const subq*/
212 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;
213 ts | f | g | ts1 | ts | f | g |
214 ======================================================================================================================================
215 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
216 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
217 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
218 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
219 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;
220 ts | f | g | ts1 | ts | f | g |
221 ======================================================================================================================================
222 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
223 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
224 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
225 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
226 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;
227 ts | f | g | ts1 | ts | f | g |
228 ======================================================================================================================================
229 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
230 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
231 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
232 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
233 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;
234 ts | f | g | ts1 | ts | f | g |
235 ======================================================================================================================================
236 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
237 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
238 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
239 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
240 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;
241 ts | f | g | ts1 | ts | f | g |
242 ======================================================================================================================================
243 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
244 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
245 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
246 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
247 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;
248 ts | f | g | ts1 | ts | f | g |
249 ======================================================================================================================================
250 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
251 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
252 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
253 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
254 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;
255 ts | f | g | ts1 | ts | f | g |
256 ======================================================================================================================================
257 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
258 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
259 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
260 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
261 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;
262 ts | f | g | ts1 | ts | f | g |
263 ======================================================================================================================================
264 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
265 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
266 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
267 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
268 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;
269 ts | f | g | ts1 | ts | f | g |
270 ======================================================================================================================================
271 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
272 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
273 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
274 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
275 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;
276 ts | f | g | ts1 | ts | f | g |
277 ======================================================================================================================================
278 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
279 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
280 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
281 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
282 taos> /*const subq+const subq*/
283 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;
284 ts1 | ts | f | g | ts1 | ts | f | g |
285 ================================================================================================================================================================
286 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
287 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
288 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
289 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
290 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;
291 ts1 | ts | f | g | ts1 | ts | f | g |
292 ================================================================================================================================================================
293 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
294 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
295 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
296 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
297 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;
298 ts1 | ts | f | g | ts1 | ts | f | g |
299 ================================================================================================================================================================
300 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
301 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
302 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
303 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
304 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;
305 ts1 | ts | f | g | ts1 | ts | f | g |
306 ================================================================================================================================================================
307 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
308 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
309 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
310 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
311 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;
312 ts1 | ts | f | g | ts1 | ts | f | g |
313 ================================================================================================================================================================
314 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
315 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
316 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
317 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
318 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;
319 ts1 | ts | f | g | ts1 | ts | f | g |
320 ================================================================================================================================================================
321 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
322 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
323 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
324 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
325 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;
326 ts1 | ts | f | g | ts1 | ts | f | g |
327 ================================================================================================================================================================
328 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
329 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
330 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
331 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
332 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;
333 ts1 | ts | f | g | ts1 | ts | f | g |
334 ================================================================================================================================================================
335 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
336 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
337 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
338 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
339 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;
340 ts1 | ts | f | g | ts1 | ts | f | g |
341 ================================================================================================================================================================
342 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
343 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
344 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
345 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
346 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;
347 ts1 | ts | f | g | ts1 | ts | f | g |
348 ================================================================================================================================================================
349 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
350 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
351 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
352 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
353 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;
354 ts1 | ts | f | g | ts1 | ts | f | g |
355 ================================================================================================================================================================
356 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
357 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
358 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
359 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
360 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
361 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
362 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
363 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
364 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
365 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
366 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
367 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
368 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
369 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
370 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
371 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
372 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;
373 ts1 | ts | f | g | ts1 | ts | f | g |
374 ================================================================================================================================================================
375 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
376 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
377 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
378 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
379 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
380 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
381 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
382 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
383 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
384 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
385 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
386 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
387 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
388 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
389 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
390 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
391 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;
392 ts1 | ts | f | g | ts1 | ts | f | g |
393 ================================================================================================================================================================
394 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
395 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
396 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
397 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
398 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
399 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
400 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
401 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
402 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
403 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
404 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
405 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
406 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
407 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
408 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
409 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
410 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;
411 ts1 | ts | f | g | ts1 | ts | f | g |
412 ================================================================================================================================================================
413 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
414 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
415 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
416 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
417 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
418 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
419 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
420 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
421 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
422 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
423 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
424 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
425 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
426 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
427 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
428 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
429 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;
430 ts1 | ts | f | g | ts1 | ts | f | g |
431 ================================================================================================================================================================
432 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
433 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
434 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
435 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
436 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
437 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
438 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
439 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
440 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
441 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
442 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
443 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
444 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
445 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
446 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
447 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
448 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;
449 ts1 | ts | f | g | ts1 | ts | f | g |
450 ================================================================================================================================================================
451 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
452 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
453 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
454 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
455 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
456 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
457 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
458 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
459 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
460 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
461 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
462 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
463 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
464 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
465 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
466 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
467 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;
468 ts1 | ts | f | g | ts1 | ts | f | g |
469 ================================================================================================================================================================
470 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
471 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
472 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
473 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
474 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
475 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
476 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
477 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
478 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
479 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
480 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
481 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
482 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
483 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
484 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
485 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
486 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;
487 ts1 | ts | f | g | ts1 | ts | f | g |
488 ================================================================================================================================================================
489 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
490 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
491 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
492 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
493 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
494 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
495 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
496 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
497 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
498 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
499 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
500 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
501 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
502 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
503 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
504 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
505 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;
506 ts1 | ts | f | g | ts1 | ts | f | g |
507 ================================================================================================================================================================
508 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
509 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
510 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
511 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
512 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
513 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
514 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
515 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
516 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
517 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
518 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
519 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
520 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
521 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
522 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
523 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
524 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;
525 ts1 | ts | f | g | ts1 | ts | f | g |
526 ================================================================================================================================================================
527 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
528 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
529 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
530 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
531 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;
532 ts1 | ts | f | g | ts1 | ts | f | g |
533 ================================================================================================================================================================
534 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
535 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
536 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
537 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
538 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;
539 ts1 | ts | f | g | ts1 | ts | f | g |
540 ================================================================================================================================================================
541 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
542 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
543 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
544 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
545 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;
546 ts1 | ts | f | g | ts1 | ts | f | g |
547 ================================================================================================================================================================
548 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
549 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
550 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
551 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
552 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;
553 ts1 | ts | f | g | ts1 | ts | f | g |
554 ================================================================================================================================================================
555 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
556 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
557 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
558 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
559 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;
560 ts1 | ts | f | g | ts1 | ts | f | g |
561 ================================================================================================================================================================
562 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
563 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
564 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
565 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
566 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;
567 ts1 | ts | f | g | ts1 | ts | f | g |
568 ================================================================================================================================================================
569 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
570 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
571 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
572 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
573 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;
574 ts1 | ts | f | g | ts1 | ts | f | g |
575 ================================================================================================================================================================
576 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
577 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
578 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
579 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
580 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;
581 ts1 | ts | f | g | ts1 | ts | f | g |
582 ================================================================================================================================================================
583 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
584 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
585 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
586 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
587 taos> /*functions*/
588 taos> select * from a1 a join (select to_timestamp('__today__', 'yyyy-mm-dd') as ts1, * from b1) b on a.ts = b.ts1;
589 ts | f | g | ts1 | ts | f | g |
590 ======================================================================================================================================
591 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
592 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
593 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
594 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
595 taos> select * from a1 a join (select to_timestamp('__today__', 'yyyy-mm-dd') + 1s as ts1, * from b1) b on a.ts = b.ts1;
596 ts | f | g | ts1 | ts | f | g |
597 ======================================================================================================================================
598 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 |
599 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 |
600 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
601 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
602 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;
603 ts | f | g | ts1 | ts | f | g |
604 ======================================================================================================================================
605 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
606 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
607 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
608 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
609 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;
610 ts | f | g | ts1 | ts | f | g |
611 ======================================================================================================================================
612 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 |
613 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 |
614 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
615 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
616 taos> /*view*/
617 taos> select * from view1 a join (select * from b1 order by ts) b on a.ts = b.ts;
618 ts1 | ts | f | g | ts | f | g |
619 ======================================================================================================================================
620 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
621 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 |
622 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
623 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
624 taos> select * from view1 a join (select * from b1 order by ts desc) b on a.ts = b.ts;
625 ts1 | ts | f | g | ts | f | g |
626 ======================================================================================================================================
627 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
628 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
629 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 |
630 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
631 taos> select * from view1 a join (select * from b1 order by ts) b on a.ts1 = b.ts;
632 ts1 | ts | f | g | ts | f | g |
633 ======================================================================================================================================
634 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
635 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | 301 | 3011 |
636 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | 301 | 3011 |
637 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | 301 | 3011 |
638 taos> select * from view1 a join (select * from b1 order by ts desc) b on a.ts1 = b.ts;
639 ts1 | ts | f | g | ts | f | g |
640 ======================================================================================================================================
641 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 |
642 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | 301 | 3011 |
643 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | 301 | 3011 |
644 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | 301 | 3011 |
645 taos> select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;
646 ts1 | ts | f | g | ts1 | ts | f | g |
647 ================================================================================================================================================================
648 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
649 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
650 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
651 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
652 taos> select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;
653 ts1 | ts | f | g | ts1 | ts | f | g |
654 ================================================================================================================================================================
655 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
656 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
657 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
658 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
659 taos> select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts;
660 ts1 | ts | f | g | ts1 | ts | f | g |
661 ================================================================================================================================================================
662 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
663 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
664 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
665 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
666 taos> select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts;
667 ts1 | ts | f | g | ts1 | ts | f | g |
668 ================================================================================================================================================================
669 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
670 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
671 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
672 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
673 taos> select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1;
674 ts1 | ts | f | g | ts1 | ts | f | g |
675 ================================================================================================================================================================
676 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
677 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
678 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
679 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
680 taos> select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1;
681 ts1 | ts | f | g | ts1 | ts | f | g |
682 ================================================================================================================================================================
683 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
684 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
685 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
686 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
687 taos> select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1;
688 ts1 | ts | f | g | ts1 | ts | f | g |
689 ================================================================================================================================================================
690 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
691 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
692 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
693 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
694 taos> select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1;
695 ts1 | ts | f | g | ts1 | ts | f | g |
696 ================================================================================================================================================================
697 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
698 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
699 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
700 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
701 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
702 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
703 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
704 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
705 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
706 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
707 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
708 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
709 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
710 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
711 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
712 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
713 taos> select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1;
714 ts1 | ts | f | g | ts1 | ts | f | g |
715 ================================================================================================================================================================
716 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
717 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
718 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
719 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
720 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
721 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
722 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
723 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
724 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
725 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
726 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
727 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
728 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
729 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
730 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
731 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
732 taos> select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1;
733 ts1 | ts | f | g | ts1 | ts | f | g |
734 ================================================================================================================================================================
735 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
736 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
737 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
738 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
739 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
740 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
741 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
742 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
743 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
744 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
745 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
746 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
747 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
748 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
749 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
750 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
751 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;
752 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;
753 ts1 | ts | f | g | ts1 | ts | f | g |
754 ================================================================================================================================================================
755 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
756 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
757 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
758 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
759 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
760 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
761 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
762 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
763 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
764 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
765 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
766 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
767 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
768 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
769 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
770 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
771 taos> select * from view1 a, (select today() as ts1, * from b1 order by f) b where a.ts1 = b.ts1;
772 ts1 | ts | f | g | ts1 | ts | f | g |
773 ================================================================================================================================================================
774 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
775 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
776 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
777 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
778 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
779 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
780 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
781 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
782 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
783 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
784 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
785 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |
786 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 |
787 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 |
788 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 |
789 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 |

View File

@ -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;

View File

@ -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 |
==========================

1 taos> use test;
266 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 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; __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
267 ts | val | tg2 | ts | val | tg2 | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
268 ============================================================================================================ 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 right 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;
NULL | NULL | NULL | __today__ 00:00:00.000 | 304 | 1 |
NULL | NULL | NULL | __today__ 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 right 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
269 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 | ts | val | tg2 | ts | val | tg2 |
270 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 | ============================================================================================================
271 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
274 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 right 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; __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
275 ts | val | tg2 | ts | val | tg2 | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
276 ============================================================================================================ __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
277 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 right 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; __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
278 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 right 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; __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
279 ts | val | tg2 | ts | val | 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 right 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;

View File

@ -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;

View File

@ -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 |
==========================

1 taos> use test;
266 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 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; __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
267 ts | val | tg2 | ts | val | tg2 | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
268 ============================================================================================================ 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 right 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;
NULL | NULL | NULL | __today__ 00:00:00.000 | 304 | 1 |
NULL | NULL | NULL | __today__ 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 right 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
269 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 | ts | val | tg2 | ts | val | tg2 |
270 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 | ============================================================================================================
271 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
274 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 right 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; __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
275 ts | val | tg2 | ts | val | tg2 | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
276 ============================================================================================================ __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
277 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 right 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(); __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
278 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 right 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; __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
279 ts | val | tg2 | ts | val | 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 right 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();

View File

@ -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")

View File

@ -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

View File

@ -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 |

View File

@ -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;

View File

@ -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;

View File

@ -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__}")

View 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"):

View File

@ -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__}")

View 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")

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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
#