Commit graph

4110 commits

Author SHA1 Message Date
Jing Sima
e95e6a47f7
fix: [6930747799] Virtual table support decimal. (#35026) 2026-04-03 15:56:30 +08:00
Pan Wei
21a5fe4dc9
fix(parser,scalar): fix crash in sclfunc.c:4748 caused by window funcs in query without FROM (#35043) 2026-04-02 14:28:39 +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
WANG MINGMING
195b7a8f5a
fix(stream): heap use after free (#34990) 2026-03-30 20:35:48 +08:00
dongming chen
9eb653a33f
feat: restore on one vnode (#34984) 2026-03-30 18:31:43 +08:00
Mario Peng
25a76f0496
enh:stream nodelay create out table (#34954) 2026-03-29 11:22:27 +08:00
Jinqing Kuang
27a537829b
feat(query): support external windows (#34933) 2026-03-29 09:38:08 +08:00
Mario Peng
28a88ebc14
fix: stmt2 memleak (#34932) 2026-03-26 10:16:26 +08:00
Jing Sima
f947ef4713
fix: [6789525493] Fix tsma drop with if exists. (#34858) 2026-03-26 09:56:17 +08:00
guichuan zhang
4c970bbef0
fix(xnode): support granting system privileges to xnode/agent and object privileges to xnode tasks (#34901)
Closes [6658956251](https://project.feishu.cn/taosdata_td/feature/detail/6658956251)
2026-03-25 08:57:26 +08:00
Jinqing Kuang
b9eb340111
feat(stream): implement idle trigger for stream partitions (#34902)
- Add IDLE_TIMEOUT(duration_time) option to STREAM_OPTIONS for
  configuring partition idle detection (valid range: [1s, 10d])
- Add IDLE and RESUME event types to EVENT_TYPE option
- Track per-partition last-receive time using monotonic clock to
  detect idle state transitions (ACTIVE -> IDLE -> ACTIVE)
- Trigger IDLE event once when a partition exceeds idle timeout;
  trigger RESUME event immediately when idle partition receives data
- Provide _tidlestart/_tidleend placeholders for idle/resume
  computation SQL (ns precision; incompatible with _twstart/_twend)
- Add idle/resume fields to notification payload: idleStart,
  idleEnd, idleDurationMs; IDLE and RESUME share the same triggerId
- Add system test: test/cases/18-StreamProcessing/04-Options/
  test_idle_trigger.py covering basic detection, resume, multiple
  partitions, timeout config, placeholder values, event combinations
- Update zh/en SQL reference and advanced-usage docs; add IDLE,
  IDLE_TIMEOUT, RESUME to reserved keywords list (3.3.4.0+)

Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 10:14:40 +08:00
Simon Guan
e2e9efd903 Merge branch '3.0' into merge/mainto3.0 2026-03-22 21:23:58 +08:00
Simon Guan
1f130ae0ba Merge branch 'main' into merge/mainto3.0 2026-03-22 21:23:52 +08:00
Yihao Deng
791758985b
enh: add support for CAST and SUBSTR functions on BLOB type (#34886) 2026-03-21 21:16:30 +08:00
Tony Zhang
6f547e0b3e
fix(parser): set agg in unionall to useless error (#34874) 2026-03-21 12:14:41 +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
Zhixiao Bao
d0c6d74502
feat: last cache shard-bits (#34857) 2026-03-20 13:56:20 +08:00
Bomin Zhang
1138439542
feat: batch tag value update (#34564) 2026-03-18 14:19:15 +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
163aa941de
feat(stream): add natural time units support for PERIOD trigger (#34766)
Implement week/month/year units for stream PERIOD trigger with natural
boundary alignment and offset support.

Key changes:
- Parser: Add validation for natural time units (w/n/y) and offset parameter
- Time utilities: Add getDuration() support for week/month/year units
- TriggerTask: Implement window calculation with natural boundary alignment
  - Week: align to Monday 00:00:00
  - Month: align to 1st of month 00:00:00
  - Year: align to Jan 1st 00:00:00
- Add offset support: PERIOD(1w, 1d) shifts window by 1 day
- Unit tests: Parser validation, time utilities, TriggerTask window calculation
- System tests: End-to-end tests for week/month/year units with offset
- Documentation: Update user manual with natural time unit examples

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 15:43:36 +08:00
guichuan zhang
14a743d063
fix(xnode): force show xnode task clause order by id (#34759)
Closes [6856696160](https://project.feishu.cn/taosdata_td/defect/detail/6856696160)
2026-03-12 19:47:23 +08:00
Simon Guan
b8f11c5912 fix: conflicts 2026-03-12 09:41:15 +08:00
Kaili Xu
0435899ec4
enh: support grammar of 3.3[manual-only] (#34743) 2026-03-11 14:13:00 +08:00
Simon Guan
1e1c92e4ae
merge: from main to 3.0 branch #34720 2026-03-09 17:04:21 +08:00
WANG MINGMING
f2bae7e798
enh(tmq): support for vtable (#34587) 2026-03-09 10:49:14 +08:00
Haojun Liao
156da4e68f
feat(TDgpt): support multiple input data columns for anomaly detection. (#34606) 2026-03-06 17:48:39 +08:00
Kaili Xu
45c0826791
fix: privilege, error prompt and memory leak (#34675) 2026-03-06 16:04:33 +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
Mario Peng
624607cfa6
fix: stmt vtable query core (#34640) 2026-03-04 14:23:45 +08:00
Jing Sima
98f661fd11
fix: [6843756344] Fix vtable slot key not found when column do not have reference. (#34644) 2026-03-04 14:20:29 +08:00
Jing Sima
170a51b94f
fix: [6587137697] Forbid query ins_virtual_child_columns. (#34567) 2026-03-02 15:28:34 +08:00
Bomin Zhang
6aa3696e09
feat: add option to enable/disable advanced security (#34602) 2026-03-02 09:18:32 +08:00
Simon Guan
d26a0ee67a fix: conflicts 2026-02-26 14:06:02 +08:00
Jinqing Kuang
1e082a00b8
fix(stream): fix ci case issues (#34516) 2026-02-23 20:46:41 +08:00
Mario Peng
45774e18ed
fix: stmt query decimal (#34558) 2026-02-23 13:58:36 +08:00
guichuan zhang
a4696b6230
fix(xnode): fix grant check error in mndXnode mod & add via/labels/created_by params for xnode task validation (#34553)
* fix(xnode): fix grant check error in mndXnode mod

Closes [6793469478](https://project.feishu.cn/taosdata_td/defect/detail/6793469478)

* fix(xnode): add via/labels/created_by params for xnode task validation

Closes [6793548966](https://project.feishu.cn/taosdata_td/defect/detail/6793548966)

* chore: fix spell error

* chore: update raw data len for task/job encoder

* chore: add test case
2026-02-11 23:34:22 +08:00
Mario Peng
3be71178d8
fix: docs stmt2 demo (#34531) 2026-02-06 19:56:27 +08:00
Kaili Xu
f280873585
fix(rbac): catalog sub task and view/stream privileges[manual-only] (#34506) 2026-02-06 15:30:48 +08:00
wangmm0220
7ce68a3f23 fix(taosd): conflicts from main 2026-02-06 11:21:26 +08:00
Simon Guan
4325344de4
merge: from 3.3.8 to main #34494 2026-02-05 19:53:08 +08:00
Kaili Xu
0713c22872
fix(rbac): refactor docs, permission error, db owner and audit table[manual-only] (#34498) 2026-02-05 16:14:02 +08:00
Zhixiao Bao
7cf18bb71a
fix: cases cases/11-Functions/01-Scalar/test_scalar_crypto.py failed. (#34508) 2026-02-05 14:49:48 +08:00
Jing Sima
912ceb6cee fix merge conflict. 2026-02-05 14:06:56 +08:00
Tony Zhang
2e4b4bc62e
feat: support surrounding time for fill (#34414) 2026-02-05 11:33:28 +08:00