Commit graph

6758 commits

Author SHA1 Message Date
Kaili Xu
908abd44c8
fix(rbac): access control[manual-only] (#35213) 2026-04-27 14:57:54 +08:00
Kaili Xu
fde63d139e
feat(mac): sod mandatory and mac[manual-only] (#35121) 2026-04-22 20:26:42 +08:00
Jinqing Kuang
b403f3dfd1
fix(stream): handle notify output for nested diff external window (#35146) 2026-04-21 09:52:04 +08:00
Pan Wei
4bd8dfe637
fix: remove queryBufferSize and cacheLazyLoadThreshold in code and docs (#35176)
* docs: remove queryBufferSize configuration description

* refactor: remove deprecated queryBufferSize and cacheLazyLoadThreshold configs

Both configs were dead code with no actual effect:
- queryBufferSize/tsQueryBufferSize/tsQueryBufferSizeBytes: explicitly
  documented as 'not effective yet'; checkForQueryBuf/releaseQueryBuf
  were defined but never called anywhere
- tsCacheLazyLoadThreshold/cacheLazyLoadThreshold: registered and read
  from config but never referenced in any business logic

Remove variable declarations, definitions, config registrations, config
loading, associated functions, cfg file examples, docs, and test entries.
2026-04-20 17:42:14 +08:00
Alex Duan
29cc3ea913
fix: memory leak while taos_query blocked then terminal signal received (#35064) 2026-04-14 15:01:03 +08:00
xinsheng Ren
034afe9c60
fix: Improve the externalwindow documentation while fixing the bug in the group_concat function (#35078) 2026-04-10 10:21:28 +08:00
Pan Wei
f6c8577ee5
fix:query return error unknown error 65535 issue (#35003)
* fix(scalar): prevent crash when IN expression has invalid type from unhandled node

Root cause: sclGetNodeType() silently set *type = -1 and returned
TSDB_CODE_SUCCESS for unhandled node types. This propagated -1 as
ctx->type.selfType, which was then cast to (uint32_t)-1 = 4294967295
and used as an index into tDataTypes[], causing an out-of-bounds
crash in scalarGenerateSetFromList().

The bug was triggered by semantically odd SQL such as:
  ifnull(b not between vb and a, n in (...)) in (today(), today(), now())
where a boolean result is compared against a timestamp list.

Fixes:
1. sclGetNodeType(): return TSDB_CODE_QRY_INVALID_INPUT for unhandled
   node types instead of silently setting type = -1.
2. sclInitParam(): validate selfType before using it as list element
   type to prevent OOB access in vectorGetConvertType(-1, ...).
3. scalarGenerateSetFromList(): add IS_INVALID_TYPE() guard at entry
   as a defensive check against any future invalid-type paths.

Add regression test: test_scalar_invalid_type.py

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: case when and decimal query crash issues

* fix: CAST to JSON returns Unknown error 65535; mavg/csum/diff with constant arg returns invalid input

- builtins.c: reject CAST(expr AS JSON) in translateCast() with
  TSDB_CODE_CAST_TO_JSON_NOT_ALLOWED instead of silently passing
  validation and failing at execution with TSDB_CODE_FAILED (-1)
- scalar.c: add QUERY_NODE_LEFT_VALUE case in sclGetNodeType() so
  rewritten constant operands (ASSIGN operator left side) resolve
  their type from ctx->type.opResType instead of hitting the
  'unsupported node type' fallthrough (error 0x070F invalid input)
- executorInt.c: create dummy column for the first arg of indefinite-
  rows functions when it is a constant, preventing NULL pData[0]
- test_fun_sca_cast.py: add do_cast_to_json_invalid() covering all
  19 sql-fuzzing repro queries for the CAST-to-JSON bug

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: sclGetNodeType missing cases cause invalid input in query/subquery

Add missing node type cases to sclGetNodeType() that were hit after
ed9de01 changed the fallthrough from silent type=-1 to hard error:

1. QUERY_NODE_LEFT_VALUE (27): return ctx->type.opResType, used when
   the planner rewrites constants into ASSIGN(LEFT_VALUE, VALUE)
   operators for scalarSup pre-processing (e.g. mavg(2.0, 3))

2. QUERY_NODE_REMOTE_VALUE_LIST (61): read resType from SExprNode,
   used when IN subquery RHS is a remote value list node

3. QUERY_NODE_REMOTE_VALUE / QUERY_NODE_REMOTE_ZERO_ROWS /
   QUERY_NODE_REMOTE_ROW: read resType from embedded SValueNode,
   defensive coverage for other remote node types

Also extend doSetInputDataBlock() dummy-column creation to cover
the first constant argument of indefinite-rows functions (mavg, csum,
diff) so pInput->pData[0] is not NULL at function execution time.

Fixes: select distinct t1,'abc',tbname from st1 -> invalid input
Fixes: 1 in (select 1 from st1) -> invalid input
Fixes: mavg(cast(2 as float), 3) -> invalid input

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Remove QUERY_NODE_LEFT_VALUE case from switch statement

Removed handling for QUERY_NODE_LEFT_VALUE case in scalar.c

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-07 07:55:15 +08:00
Mario Peng
3cd981d475
fix(stream): tolerate existing output table on submit;fix stream out-column timestamp precision checks (#35044) 2026-04-03 16:01:16 +08:00
Jing Sima
e95e6a47f7
fix: [6930747799] Virtual table support decimal. (#35026) 2026-04-03 15:56:30 +08:00
Pan Wei
8456ef3f0a
fix: case when and decimal query crash issues (#34991)
* fix(scalar): prevent crash when IN expression has invalid type from unhandled node

Root cause: sclGetNodeType() silently set *type = -1 and returned
TSDB_CODE_SUCCESS for unhandled node types. This propagated -1 as
ctx->type.selfType, which was then cast to (uint32_t)-1 = 4294967295
and used as an index into tDataTypes[], causing an out-of-bounds
crash in scalarGenerateSetFromList().

The bug was triggered by semantically odd SQL such as:
  ifnull(b not between vb and a, n in (...)) in (today(), today(), now())
where a boolean result is compared against a timestamp list.

Fixes:
1. sclGetNodeType(): return TSDB_CODE_QRY_INVALID_INPUT for unhandled
   node types instead of silently setting type = -1.
2. sclInitParam(): validate selfType before using it as list element
   type to prevent OOB access in vectorGetConvertType(-1, ...).
3. scalarGenerateSetFromList(): add IS_INVALID_TYPE() guard at entry
   as a defensive check against any future invalid-type paths.

Add regression test: test_scalar_invalid_type.py

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: case when and decimal query crash issues

* fix: sclGetNodeType missing cases cause invalid input in query/subquery

Add missing node type cases to sclGetNodeType() that were hit after
ed9de01 changed the fallthrough from silent type=-1 to hard error:

1. QUERY_NODE_LEFT_VALUE (27): return ctx->type.opResType, used when
   the planner rewrites constants into ASSIGN(LEFT_VALUE, VALUE)
   operators for scalarSup pre-processing (e.g. mavg(2.0, 3))

2. QUERY_NODE_REMOTE_VALUE_LIST (61): read resType from SExprNode,
   used when IN subquery RHS is a remote value list node

3. QUERY_NODE_REMOTE_VALUE / QUERY_NODE_REMOTE_ZERO_ROWS /
   QUERY_NODE_REMOTE_ROW: read resType from embedded SValueNode,
   defensive coverage for other remote node types

Also extend doSetInputDataBlock() dummy-column creation to cover
the first constant argument of indefinite-rows functions (mavg, csum,
diff) so pInput->pData[0] is not NULL at function execution time.

Fixes: select distinct t1,'abc',tbname from st1 -> invalid input
Fixes: 1 in (select 1 from st1) -> invalid input
Fixes: mavg(cast(2 as float), 3) -> invalid input

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-31 15:13:16 +08:00
Jinqing Kuang
27a537829b
feat(query): support external windows (#34933) 2026-03-29 09:38:08 +08:00
Jing Sima
717537cbf5
fix: [6927860029] Fix core when virtual table's type and origin table's type mistmatch. (#34929) 2026-03-27 15:28:10 +08:00
Jing Sima
3c0542d08d
fix: Fix vstb session wrong ans. (#34945) 2026-03-27 14:35:14 +08:00
Pan Wei
d651b52eae
fix: windows timezone value wrong issue (#34892) 2026-03-23 13:41:43 +08:00
Minglei Jin
c1a21a7c3b
feat(subq/some): some/any/exists for stream subq (#34860) 2026-03-22 18:21:54 +08:00
Yihao Deng
43dca0dae9
enh: add reference verification capabilities between virtual tables and source tables, including reference relationship storage, source table change verification, reference relationship query and virtual table availability verification functions (#34740) 2026-03-21 11:49:50 +08:00
WANG MINGMING
7394319536
fix(taosd): add logic in altering table for tmq/stream (#34809) 2026-03-21 11:38:22 +08:00
Simon Guan
8b70d7f42b Merge branch '3.0' into merge/mainto3.0 2026-03-20 10:11:46 +08:00
Tony Zhang
44433187db
enh: explain (#34764) 2026-03-20 10:08:49 +08:00
dapan1121
42f03e896a Merge remote-tracking branch 'origin/main' into merge/mainto3.0 2026-03-20 09:58:36 +08:00
Minglei Jin
4466557cd0
feat(stream/subquery/in): support in with stream subquery (#34773) 2026-03-20 09:37:37 +08:00
WANG MINGMING
ec2eceb35b
fix(taosd): core dump in addTagPseudoColumnData for pTag if there are pressures (#34838) 2026-03-19 17:16:51 +08:00
Simon Guan
7037ddad4c Merge branch 'main' into merge/mainto3.0 2026-03-18 14:21:39 +08:00
Jinqing Kuang
ba212ea461
fix: guard hash interval agg without loaded ts column (#34819) 2026-03-18 09:26:55 +08:00
Simon Guan
473011663f fix: conflicts 2026-03-17 14:26:38 +08:00
Jing Sima
b5b816e53d
fix: [6916092549] Fix mem leak. (#34795) 2026-03-17 14:01:18 +08:00
Yihao Deng
9d746e0730
fix compile error (#34803) 2026-03-17 13:49:08 +08:00
Yihao Deng
4c94cbe5da
enh: add safefunc (#34436) 2026-03-16 20:27:15 +08:00
Zhixiao Bao
e29fadda2e
feat: support secure delete option. (#34591) 2026-03-16 20:26:22 +08:00
Simon Guan
350e43a19c fix: conflicts 2026-03-16 17:30:27 +08:00
Minglei Jin
49a1c6908a
calc subq to runner (#34457) 2026-03-16 14:10:31 +08:00
Jinqing Kuang
62701efa0b
fix(stream): handle const boundary in external window range (#34669) 2026-03-14 17:25:53 +08:00
Simon Guan
b8f11c5912 fix: conflicts 2026-03-12 09:41:15 +08:00
WANG MINGMING
6ade4e468c
opti(stream): remove old logic of stream (#34642) 2026-03-12 09:11:00 +08:00
Haojun Liao
216b352ef5
feat(TDgpt): TDgpt can run on windows. (#34716) 2026-03-11 09:57:27 +08:00
Jing Sima
984b31aa72
fix: [6872094106] Fix double free and mem leak in createSortHandleFromParam. (#34725) 2026-03-11 09:22:02 +08:00
Jing Sima
0606cf7ee8
enh: [6492510964] Virtual super table window optimize for interval/session/event (#34690) 2026-03-09 17:05:53 +08:00
Simon Guan
1e1c92e4ae
merge: from main to 3.0 branch #34720 2026-03-09 17:04:21 +08:00
Pan Wei
ca2c419ed4
fix: fix return code handling issue (#34713) 2026-03-09 13:41:41 +08:00
Haojun Liao
156da4e68f
feat(TDgpt): support multiple input data columns for anomaly detection. (#34606) 2026-03-06 17:48:39 +08:00
Pan Wei
30c4ea4986
feat: support any/some/all/exists with subqueries (#34632) 2026-03-06 14:45:30 +08:00
Simon Guan
08007692be fix: conflicts 2026-03-04 14:44:07 +08:00
Simon Guan
687b62c30a
merge: from 3.3.8 to main #34633 2026-03-04 14:32:55 +08:00
Mario Peng
624607cfa6
fix: stmt vtable query core (#34640) 2026-03-04 14:23:45 +08:00
Simon Guan
0e3f2133cc fix: conflicts 2026-03-04 11:52:22 +08:00
WANG MINGMING
ec97502307
fix(tmq): case error in sometimes (#34619)
Closes:
- https://project.feishu.cn/taosdata_td/defect/detail/6853668142
- https://project.feishu.cn/taosdata_td/defect/detail/6779896671
- https://project.feishu.cn/taosdata_td/defect/detail/6779921206


Changes:

* fix(tmq): case error in sometimes

* fix(tmq): fix cases error in sometimes

* fix(tmq): walEndVer is 0 && avoid return error when transform vnode

* fix(tmq): case error in sometimes

* fix(tmq): case error in sometimes

* fix(tmq): case error in sometimes

* fix(tmq): case error in sometimes
2026-03-03 17:58:05 +08:00
Jing Sima
c4de5c1a22
fix: [6841998099] guard tag pseudo column fill in dynamic vstb not-load path. (#34624) 2026-03-03 10:52:33 +08:00
Jinqing Kuang
6061a28aa9
fix: enforce agg filter for external window stream output (#34630) 2026-03-02 09:28:00 +08:00
xinsheng Ren
96cc0572bf
fix: code review (#34623) 2026-02-28 11:21:02 +08:00
WANG MINGMING
a44a2a12a1
enh(tmq): optimize logic of tmq of query (#34303) 2026-02-26 17:06:07 +08:00