05-Virtual Tables¶
¶
Alter: virtual normal table
1. add column
2. drop column
3. change column reference
4. change column type length
5. change column name
¶
Alter: virtual child table
1. change column reference
2. change tag value
¶
Alter: virtual super table
1. add column
2. drop column
3. change column type length
4. add tag
5. drop tag
6. change tag name
7. change tag length
¶
Alter: virtual stable create child table
1. add column
2. drop column
¶
Alter: virtual table errors
1. normal table
2. child table
3. super table
¶
Auth: alter virtual normal table
test "alter", "select", "none", "all" each auth user alter opration
¶
Auth: alter virtual child table
test "alter", "select", "none", "all" each auth user alter opration
¶
Auth: create virtual normal table
test "insert", "select", "none", "all" each auth user create opration
¶
Auth: create virtual child table
test "insert", "select", "none", "all" each auth user create opration
¶
Auth: select virtual normal table
test "write", "read", "none", "all" each auth user select opration
¶
Auth: select virtual child table
test "write", "read", "none", "all" each auth user select opration
¶
Batch set tag values on multiple virtual child tables in one ALTER VTABLE statement
ALTER VTABLE
vtable1 SET TAG tag1=value1, tag2=value2, ...
vtable2 SET TAG tag1=value3, tag2=value4, ...
¶
Set tag values on virtual child tables via USING vstable with optional WHERE clause
ALTER VTABLE USING vstable SET TAG tag1=value1, tag2=value2, ... WHERE condition
¶
Create: virtual super table
test create virtual super tables
¶
Create: virtual child table
1.create virtual child table and don't use 'FROM' to specify the origin table
2.create virtual child table and use 'FROM' to specify the origin table
¶
Create: virtual normal table
test create virtual normal tables
¶
Create: virtual table errors
1. create virtual child table using non-virtual super table
2. create child table using virtual super table
3. create virtual child table using non-exist super table
4. column definition different from referenced column
5. set data source for primary timestamp column
6. data source column does not exist
7. data source table does not exist
8. data source table has composite primary key
9. data source is tag
10. create virtual child table using from to specify some columns and do not use from for other columns
11. create virtual table using decimal
¶
Create: decimal create boundaries and reference validation
1. validate virtual stable decimal precision and scale boundaries
2. validate virtual normal table decimal reference matching
3. validate virtual child table decimal reference matching
4. verify decimal precision and scale metadata are persisted on creation
¶
Alter: decimal add, drop, and set reference
1. validate add column on virtual normal tables with and without references
2. validate alter set keeps decimal precision and scale rules
3. validate drop column removes decimal metadata
4. validate virtual stable add and drop decimal columns propagate to child tables
¶
Meta: describe, show create, and ins_columns for decimal virtual tables
1. verify describe keeps the current decimal virtual-table result shape
2. verify show create renders DECIMAL with references
3. verify information_schema reports precision and scale for decimal columns
4. verify non-decimal columns keep null precision and scale
¶
Query: decimal projection, merge, and null-path behavior
1. validate select * on virtual normal and child tables with decimal columns
2. validate multi-source decimal projection on virtual normal tables
3. validate virtual stable merge across multiple child mappings
4. validate local decimal columns remain null or empty without data sources
¶
Query: decimal filters, aggregates, and advanced operators
1. validate decimal equality, range, and mixed-type filters
2. validate aggregate, first, and last on decimal columns
3. validate stable-level group aggregates across child mappings
4. validate limit, order by, distinct, subquery, union all, and arithmetic expressions
¶
Meta: decimal precision values and restart persistence
1. validate extreme precision and scale decimal values query correctly
2. validate decimal metadata survives taosd restart
3. validate decimal queries still return exact values after restart
¶
Drop: virtual child table
test drop virtual child tables
¶
Drop: virtual normal table
test drop virtual normal tables
¶
Drop: virtual super table
test drop virtual super table
¶
Drop: virtual table errors
test drop virtual not exists
¶
Insert: virtual table
1. Create db
2. Create supper table and sub table
3. Create virtual supper table and sub table
4. Create normal virtual table and normal table
5. Insert data into virtual super table or virtual sub table or virtual normal table, it should be return error
¶
Virtual super/child table max column
test create and query virtual super/child tables with max column num
¶
Virtual normal table max column
test create and query virtual normal tables with max column num
¶
Virtual table exceed max column
test create virtual tables exceed max column num
¶
Virtual normal table wide origin table
test create and query virtual normal tables when org tables have 4096 columns
(1 ts + 4095 double) and total mapped columns reach 32767
¶
Virtual table max column exceed ref mapping
test create and query virtual tables mapping each column from distinct tables
¶
Virtual table max column except
1. create virtual super table with max columns (exceed max)
2. create virtual super table with max bytes per row
3. create virtual normal table with max columns (exceed max)
4. create virtual normal table with max bytes per row
¶
Query: vtable col len > src col len
Virtual table binary(64)/nchar(64) referencing source binary(32)/nchar(32).
Should return actual source data without any issue.
¶
Query: vtable col len = src col len
Virtual table binary(32)/nchar(32) referencing source binary(32)/nchar(32).
Should return actual source data.
¶
Query: vtable col len < src col len (KEY SCENARIO - no truncation)
Virtual table binary(8)/nchar(8) referencing source binary(32)/nchar(32).
Should return actual source data WITHOUT truncation.
¶
Query: vtable with mixed references and different lengths
Virtual table with binary(16) referencing src_ntb_32.binary_col(32)
and binary(32) referencing src_ntb_16.binary_col(16).
¶
Query: data consistency across all three vtable definitions
All three virtual tables (gt, eq, lt) reference the same source data
and should return identical results.
¶
Query: cast function on virtual table with mismatched lengths
Test cast function works correctly on virtual tables
with different column length definitions.
¶
Scenario 1: vtable col > src col (GT - Greater Than)
Verify that when virtual table column is LARGER than source column,
the full source data is returned without any padding or truncation.
Setup: vtable BINARY(64) > src BINARY(32), vtable NCHAR(64) > src NCHAR(32)
¶
Scenario 2: vtable col = src col (EQ - Equal)
Verify that when virtual table column is EQUAL to source column,
the full source data is returned without any truncation.
Setup: vtable BINARY(32) = src BINARY(32), vtable NCHAR(32) = src NCHAR(32)
¶
Scenario 3: vtable col < src col (LT - Less Than) - KEY SCENARIO
This is the KEY test for the no-truncation feature.
Verify that when virtual table column is SMALLER than source column,
the full source data is STILL returned WITHOUT TRUNCATION.
Setup: vtable BINARY(8) < src BINARY(32), vtable NCHAR(8) < src NCHAR(32)
Expected: Data longer than BINARY(8) must still be returned in full.
The 'This is exactly 23 bytes!' string (23 bytes) must NOT be truncated
to 8 bytes even though vtable defines BINARY(8).
¶
Consistency: All three scenarios return identical data
Verify that GT, EQ, and LT scenarios all return EXACTLY the same data.
This confirms the no-truncation feature works correctly across all cases.
¶
Edge case: empty string handling
Verify that empty strings are handled correctly in virtual tables.
Empty strings should have LENGTH=0 and CHAR_LENGTH=0.
¶
Edge case: single character handling
Verify that single characters are handled correctly in virtual tables.
¶
Edge case: NULL value handling
Verify that NULL values are handled correctly in virtual tables.
¶
Unicode: emoji characters
Verify that emoji characters are handled correctly in virtual tables.
¶
Unicode: special symbols
Verify that special symbols are handled correctly in virtual tables.
¶
Unicode: mixed ASCII and CJK characters
Verify that mixed ASCII and CJK characters are handled correctly.
¶
VARCHAR: no truncation in virtual table
Verify that VARCHAR data is not truncated in virtual tables.
¶
VARBINARY: no truncation in virtual table
Verify that VARBINARY data is not truncated in virtual tables.
¶
Virtual super table: data consistency
Verify that virtual super table returns correct data without truncation.
¶
Virtual super table: aggregate functions
Verify aggregate functions work correctly on virtual super tables.
¶
Consistency: source table vs virtual table
Verify that data is identical between source and virtual table.
¶
String function: operations on Unicode data
Verify string functions work correctly on Unicode data.
¶
String function: CONCAT with NCHAR/BINARY
Verify CONCAT works correctly with NCHAR/BINARY columns.
¶
NULL handling: with string functions
Verify string functions handle NULL values correctly.
¶
NULL handling: with aggregate functions
Verify aggregate functions handle NULL values correctly.
¶
Performance: basic query on 10K-row virtual table
1. COUNT on 10K rows
2. projection with LIMIT
3. time range filter
¶
Performance: aggregation queries on 10K-row virtual table
1. SUM aggregation
2. AVG aggregation
3. MIN/MAX aggregation
4. FIRST/LAST aggregation
5. GROUP BY aggregation
¶
Performance: filter queries on 10K-row virtual table
1. equality filter
2. range filter
3. LIKE filter on string column
4. combined numeric filter
¶
Performance: query on 100-column virtual table
1. SELECT * full projection
2. partial projection (10 columns)
3. aggregation on 10 columns
¶
Performance: query on 500-column virtual table
1. SELECT * full projection
2. partial projection (50 columns)
¶
Performance: cross-database reference query
1. cross-db count
2. cross-db aggregation
3. cross-db filter
¶
Performance: repeated query stability
Execute the same aggregation query 10 times on 10K-row vtable,
verify results are consistent across iterations.
¶
Performance: string function queries on virtual table
1. length / char_length
2. lower / upper
3. concat
4. substring
¶
Performance: interval (time window) query on virtual table
1. 1-second interval windows
2. 10-second interval windows
¶
Performance: virtual table with columns from 5 different source tables
1. full projection
2. aggregation across all referenced columns
¶
Performance: virtual child table and super table queries
1. single virtual child table query
2. virtual super table aggregation (all children)
¶
Query: virtual stable query plan
1. test select super table agg's plan
¶
Query: v-table query plan
1. test vtable query plan when eliminate virtual table scan operator
¶
Query: v-table query plan
1. test vtable query plan when pushdown time range
¶
Query: virtual table ts subquery explain plan
1. validate explain/analyze plan with ts scalar-subquery range conditions
2. validate multi-origin virtual table can push ts scalar-subquery conditions to every origin scan
3. validate analyze output shows origin table scans only read filtered rows
4. validate filtered `first/last(...)` scalar subqueries keep the same pushdown shape
¶
Query: v-table query plan
1. test vtable query plan when replace tbname with const value
¶
Query: virtual stable query plan
1. test select virtual super table window's plan
¶
Query: after alter super/child table
test virtual table select after alter stable
¶
Query: after alter normal table
test virtual table select after alter normal table
¶
Query: after alter
test query after alter origin tables
¶
Query: after drop
test query after drop tables
¶
State window pseudo columns respect referenced-column filters.
A normal virtual table state-window query that only selects pseudo
columns used to build an invalid empty merge path and could also lose
the referenced-column filter during virtual-scan optimization.
¶
Event window empty result should not crash.
Validate the optimized virtual-table event window path when start/end
predicates never form any window. The query should return zero rows
and must not raise out-of-range executor errors.
¶
Optimized event window keeps final _wend consistent.
Compare baseline and optimized event-window query paths for the same
window definition, and verify the last window's `_wstart` and `_wend`
remain identical between both paths.
¶
Event window TRUE_FOR should follow duration/count definition.
Build baseline event-window results without TRUE_FOR, then apply
duration/count predicates in test code and compare with SQL results of
each TRUE_FOR expression.
¶
Aggregate: COUNT(*), COUNT(col) on vtable with col len < ref len
Description:
Test COUNT(*) and COUNT(column) aggregate functions on virtual table.
Validates that COUNT correctly counts all rows and non-NULL values
when the virtual table column length is smaller than the source.
¶
Aggregate: SUM, AVG on int/float columns of vtable
Description:
Test SUM and AVG aggregate functions on virtual table.
Validates that SUM and AVG correctly compute values on int and float
columns of virtual tables with smaller column lengths.
¶
Aggregate: MIN, MAX on int and binary columns of vtable
Description:
Test MIN and MAX aggregate functions on virtual table.
Validates that MIN and MAX correctly find minimum and maximum values
on both numeric and string columns of virtual tables.
¶
Aggregate: SPREAD, STDDEV on vtable
Description:
Test SPREAD and STDDEV aggregate functions on virtual table.
Validates that SPREAD (max-min) and STDDEV (standard deviation)
work correctly on virtual table columns.
¶
Aggregate: HYPERLOGLOG on binary column of vtable
Description:
Test HYPERLOGLOG approximate distinct count on virtual table.
Validates that HYPERLOGLOG returns an approximate count of distinct
values for binary columns in virtual tables.
¶
Aggregate: multiple aggregate functions in single SELECT on vtable
Description:
Test multiple aggregate functions in a single SELECT.
Validates that combining COUNT, SUM, AVG, MIN, MAX, and SPREAD in
one query returns correct results on virtual tables.
¶
Selection: FIRST, LAST on vtable with col len < ref len
Description:
Test FIRST and LAST selection functions on virtual table.
Validates that FIRST returns the first value and LAST returns the
last value by timestamp for virtual table columns.
¶
Selection: TOP, BOTTOM on int column of vtable
Description:
Test TOP and BOTTOM selection functions on virtual table.
Validates that TOP(k) returns the k largest values and BOTTOM(k)
returns the k smallest values from virtual table columns.
¶
Selection: LAST_ROW on vtable
Description:
Test LAST_ROW selection function on virtual table.
Validates that LAST_ROW returns the last row's value for virtual
table columns with smaller lengths than source.
¶
Selection: SAMPLE on binary column of vtable
Description:
Test SAMPLE selection function on virtual table.
Validates that SAMPLE(k) returns k randomly sampled values from
virtual table binary columns.
¶
String: LOWER, UPPER on vtable binary col with col len < ref len
Description:
Test LOWER and UPPER string functions on virtual table.
Validates that LOWER converts to lowercase and UPPER converts to
uppercase for binary columns in virtual tables.
¶
String: CONCAT, CONCAT_WS on vtable
Description:
Test CONCAT and CONCAT_WS string functions on virtual table.
Validates that string concatenation functions work correctly on
virtual table columns with smaller lengths than source.
¶
String: SUBSTR on vtable nchar col with col len < ref len
Description:
Test SUBSTR string function on virtual table.
Validates that SUBSTR extracts substrings correctly from nchar
columns in virtual tables.
¶
String: LTRIM, RTRIM on vtable
Description:
Test LTRIM and RTRIM string functions on virtual table.
Validates that LTRIM removes leading whitespace and RTRIM removes
trailing whitespace from virtual table binary columns.
¶
String: LENGTH, CHAR_LENGTH on vtable
Description:
Test LENGTH and CHAR_LENGTH string functions on virtual table.
Validates that LENGTH and CHAR_LENGTH return correct string lengths
for binary and nchar columns in virtual tables.
¶
String: REPLACE on vtable binary col
Description:
Test REPLACE string function on virtual table.
Validates that REPLACE correctly substitutes substrings in binary
columns of virtual tables.
¶
String: ASCII, POSITION on vtable binary col
Description:
Test ASCII and POSITION string functions on virtual table.
Validates that ASCII returns character codes and POSITION finds
substring positions in virtual table binary columns.
¶
Math: ABS, CEIL, FLOOR, ROUND on vtable float col
Description:
Test ABS, CEIL, FLOOR, ROUND math functions on virtual table.
Validates that math functions work correctly on float columns in
virtual tables.
¶
Conversion: CAST int to binary, int to nchar on vtable
Description:
Test CAST conversion function on virtual table.
Validates that CAST correctly converts int columns to binary and
nchar types in virtual tables.
¶
Math: arithmetic expressions on vtable int/float cols
Description:
Test arithmetic expressions on virtual table.
Validates that arithmetic operations (+, -, *, /) work correctly
on int and float columns of virtual tables.
¶
Filter: = and <> on binary col of vtable with col len < ref len
Description:
Test equality and inequality filters on virtual table.
Validates that = and <> operators work correctly on binary columns
in virtual tables with smaller lengths than source.
¶
Filter: LIKE on binary col of vtable
Description:
Test LIKE pattern matching filter on virtual table.
Validates that LIKE with wildcards works correctly on binary columns
in virtual tables.
¶
Filter: IN on binary col of vtable
Description:
Test IN list filter on virtual table.
Validates that IN operator correctly matches values in a list for
binary columns in virtual tables.
¶
Filter: BETWEEN on int col of vtable
Description:
Test BETWEEN range filter on virtual table.
Validates that BETWEEN operator correctly filters numeric values
in virtual tables.
¶
Filter: IS NULL / IS NOT NULL on vtable
Description:
Test IS NULL and IS NOT NULL filters on virtual table.
Validates that NULL checks work correctly on virtual table columns
with smaller lengths than source.
¶
Filter: combined WHERE conditions on vtable
Description:
Test combined AND/OR filter conditions on virtual table.
Validates that multiple filter conditions combined with AND work
correctly on virtual tables.
¶
Query: ORDER BY, LIMIT, OFFSET on vtable
Description:
Test ORDER BY, LIMIT, and OFFSET on virtual table.
Validates that result ordering and pagination work correctly on
virtual tables with smaller column lengths.
¶
Query: DISTINCT on vtable binary col
Description:
Test DISTINCT keyword on virtual table.
Validates that DISTINCT correctly deduplicates values from virtual
table binary columns.
¶
Query: CASE WHEN on vtable
Description:
Test CASE WHEN conditional expression on virtual table.
Validates that CASE WHEN expressions evaluate correctly on virtual
table columns.
¶
Subquery: scalar subquery with vtable
Description:
Test scalar subquery on virtual table.
Validates that scalar subqueries (returning a single value) work
correctly with virtual tables.
¶
Subquery: table subquery (FROM subquery) with vtable
Description:
Test table subquery (FROM subquery) on virtual table.
Validates that subqueries in FROM clause work correctly with
virtual tables.
¶
Subquery: nested subquery (3 levels) with vtable
Description:
Test nested subqueries (3 levels) on virtual table.
Validates that deeply nested subqueries work correctly with
virtual tables.
¶
Subquery: string functions inside subquery on vtable
Description:
Test string functions inside subquery on virtual table.
Validates that string functions like LOWER work correctly inside
subqueries on virtual tables.
¶
Subquery: aggregate in subquery, filter in outer on vtable
Description:
Test aggregate in subquery with filter in outer query.
Validates that using aggregate functions in subqueries with filters
in outer queries works on virtual tables.
¶
Subquery: window function result used in outer query
Description:
Test window function in subquery on virtual table.
Validates that INTERVAL window results can be used in outer queries
on virtual tables.
¶
Subquery: JOIN inside subquery
Description:
Test JOIN inside subquery on virtual table.
Validates that JOIN operations inside subqueries work correctly
with virtual tables.
¶
Subquery: UNION ALL inside subquery
Description:
Test UNION ALL inside subquery on virtual table.
Validates that UNION ALL operations inside subqueries work correctly
with virtual tables.
¶
JOIN: vtable JOIN regular table on timestamp
Description:
Test JOIN between virtual table and regular table.
Validates that joining a virtual table with a regular table on
timestamp works correctly.
¶
JOIN: two vtables joined on timestamp (expect error - not supported)
Description:
Test JOIN between two virtual tables (negative case).
Validates that joining two virtual tables returns an error as this
is not currently supported.
¶
UNION ALL: combine results from vtable queries
Description:
Test UNION ALL combining vtable query results.
Validates that UNION ALL correctly combines results from multiple
virtual table queries without deduplication.
¶
UNION: deduplicate results from vtable queries
Description:
Test UNION deduplicating vtable query results.
Validates that UNION correctly combines and deduplicates results
from multiple virtual table queries.
¶
GROUP BY: aggregate with GROUP BY on vtable
Description:
Test GROUP BY with aggregate on virtual table.
Validates that GROUP BY clause with aggregate functions works
correctly on virtual tables.
¶
PARTITION BY: on virtual super table
Description:
Test PARTITION BY on virtual super table.
Validates that PARTITION BY clause works correctly on virtual
super tables for data partitioning.
¶
Window: INTERVAL on vtable
Description:
Test INTERVAL window function on virtual table.
Validates that time-based windowing with INTERVAL works correctly
on virtual tables.
¶
Window: INTERVAL with FILL on vtable (requires time range)
Description:
Test INTERVAL with FILL on virtual table.
Validates that INTERVAL window with FILL clause for missing values
works correctly on virtual tables.
¶
Window: SESSION on vtable
Description:
Test SESSION window function on virtual table.
Validates that session-based windowing works correctly on virtual
tables.
¶
Query: SELECT * from virtual super table
Description:
Test SELECT * on virtual super table.
Validates that SELECT * returns all rows correctly from virtual
super tables.
¶
Query: aggregate on virtual super table
Description:
Test aggregate functions on virtual super table.
Validates that aggregate functions like COUNT, FIRST, LAST work
correctly on virtual super tables.
¶
Query: INTERVAL on virtual super table
Description:
Test INTERVAL window on virtual super table.
Validates that INTERVAL window function works correctly on virtual
super tables.
¶
Query: subquery on virtual super table
Description:
Test subquery on virtual super table.
Validates that subqueries work correctly on virtual super tables.
¶
Query: SELECT * from individual virtual child tables
Description:
Test SELECT * on virtual child tables.
Validates that SELECT * returns correct data from individual
virtual child tables.
¶
Query: aggregate on individual virtual child tables
Description:
Test aggregate functions on virtual child tables.
Validates that COUNT and SUM work correctly on individual virtual
child tables.
¶
Query: string functions on virtual child table
Description:
Test string functions on virtual child tables.
Validates that LOWER and LENGTH work correctly on individual
virtual child tables.
¶
Verify SELECT * returns all columns correctly from vtable
Description:
Test that SELECT * on a virtual table with column lengths smaller
than the referenced source columns returns all data correctly.
Validates that the TMAX(vtb_bytes, ref_bytes) fix works end-to-end.
¶
Verify data returned from vtable matches source table exactly
Description:
Test that querying binary and nchar columns from the virtual table
returns identical data to querying the source table directly.
This validates the virtual table correctly references source data.
¶
Verify COUNT(*) returns same results from vtable and source table
Description:
Test that COUNT(*) aggregate function returns consistent results
when querying the virtual table versus the source table directly.
This validates that the virtual table correctly references all rows.
¶
Query: v-ctable crossdb query
1. test vctable select child table cross db projection
2. test vctable select child table cross db projection filter
3. test vctable select child table cross db projection timerange filter
4. test vctable select child table cross db function
5. test vctable select child table cross db interval
6. test vctable select child table cross db state in mode 0
7. test vctable select child table cross db state in mode 1
8. test vctable select child table cross db state in mode 2
9. test vctable select child table cross db session
10. test vctable select child table cross db event
11. test vctable select child table cross db count
12. test vctable select child table cross db partition
13. test vctable select child table cross db group
14. test vctable select child table cross db orderby
¶
Query: v-ntable crossdb query
1. test vntable select normal table cross db projection
2. test vntable select normal table cross db projection filter
3. test vntable select normal table cross db projection timerange filter
4. test vntable select normal table cross db function
5. test vntable select normal table cross db interval
6. test vntable select normal table cross db state mode 0
7. test vntable select normal table cross db state mode 1
8. test vntable select normal table cross db state mode 2
9. test vntable select normal table cross db session
10. test vntable select normal table cross db event
11. test vntable select normal table cross db count
12. test vntable select normal table cross db partition
13. test vntable select normal table cross db group
14. test vntable select normal table cross db orderby
¶
Query: virtual stable from different db
1. test vstable select super table agg
2. test vstable select super table agg with tag condition
3. test vstable select super table agg with time condition
4. test vstable select super table agg with partition expression
¶
Query: virtual stable from different db
1. test vstable select super table agg with sma
¶
Query: v-stable crossdb function query
1. test vstable select super table cross db projection function
¶
Query: v-stable crossdb group query
1. test vstable select super table cross db partition
2. test vstable select super table cross db group
3. test vstable select super table cross db orderby
¶
Query: v-stable crossdb porject query
1. test vstable select super table cross db projection
2. test vstable select super table cross db projection filter
3. test vstable select super table cross db projection timerange filter
¶
Query: v-stable crossdb window query
1. test vstable select super table cross db interval
2. test vstable select super table cross db session
3. test vstable select super table cross db event
4. test vstable select super table cross db count
5. test vstable select super table same db state in mode 0
6. test vstable select super table same db state in mode 1
7. test vstable select super table same db state in mode 2
¶
Query: v-table query
1. test vtable query when eliminate virtual table scan operator
2. test vtable query when select column without reference
¶
Optimized interval scan should reject source-column type drift.
Verify the virtual super table interval optimization still returns
`TSDB_CODE_VTABLE_COLUMN_TYPE_MISMATCH` after a referenced source
table is recreated with the same column name but a different type.
¶
Optimized event window should reject source-column type drift.
Verify the optimized virtual super table event-window path still
returns `TSDB_CODE_VTABLE_COLUMN_TYPE_MISMATCH` after a referenced
source table is recreated with the same column name but a different
type.
¶
Optimized session window should reject source-column type drift.
Verify the optimized virtual super table session-window path still
returns `TSDB_CODE_VTABLE_COLUMN_TYPE_MISMATCH` after a referenced
source table is recreated with the same column name but a different
type.
¶
Optimized state window should reject source-column type drift.
Verify the optimized virtual super table state-window path still
returns `TSDB_CODE_VTABLE_COLUMN_TYPE_MISMATCH` after a referenced
source table is recreated with the same column name but a different
type.
¶
Optimized aggregate should reject source-column type drift.
Verify the optimized virtual super table aggregate path still returns
`TSDB_CODE_VTABLE_COLUMN_TYPE_MISMATCH` after a referenced source
table is recreated with the same column name but a different type.
¶
Optimized partitioned aggregate should reject source-column type drift.
Verify the optimized virtual super table partitioned aggregate path
still returns `TSDB_CODE_VTABLE_COLUMN_TYPE_MISMATCH` after a
referenced source table is recreated with the same column name but a
different type.
¶
Query: virtual child table
1. test vctable select child table projection
2. test vctable select child table projection filter
3. test vctable select child table projection timerange filter
4. test vctable select child table interval
5. test vctable select child table session
6. test vctable select child table event
7. test vctable select child table count
8. test vctable select child table state in mode 0
9. test vctable select child table state in mode 1
10. test vctable select child table state in mode 2
11. test vctable select child table partition
12. test vctable select child table group
13. test vctable select child table orderby
¶
Query: virtual normal table
1. test vntable select normal table projection
2. test vntable select normal table projection filter
3. test vntable select normal table projection timerange filter
4. test vntable select normal table interval
5. test vntable select normal table session
6. test vntable select normal table event
7. test vntable select normal table count
8. test vntable select child table state in mode 0
9. test vntable select child table state in mode 1
10. test vntable select child table state in mode 2
11. test vntable select normal table partition
12. test vntable select normal table group
13. test vntable select normal table orderby
¶
Query: virtual stable from same db
1. test vstable select super table agg
2. test vstable select super table agg with tag condition
3. test vstable select super table agg with time condition
4. test vstable select super table agg with partition expression
¶
Query: virtual stable from same db
1. test vstable select super table agg with sma
¶
Query: virtual stable from same db group
1. test vstable select super table partition
2. test vstable select super table group
3. test vstable select super table orderby
¶
Query: virtual stable from same db
1. test vstable select super table projection
2. test vstable select super table projection filter
3. test vstable select super table projection timerange filter
4. test vstable select super table function
¶
Query: virtual stable from same db
1. test vstable select super table same db interval
2. test vstable select super table same db session
3. test vstable select super table same db event
4. test vstable select super table same db count
5. test vstable select super table same db state in mode 0
6. test vstable select super table same db state in mode 1
7. test vstable select super table same db state in mode 2
¶
Query: virtual table with same reference column
1. test vtable select normal table projection with same reference column
2. test vtable select child table projection with same reference column
3. test vtable select super table projection with same reference column
¶
Query: virtual table ts filter with renamed origin ts column
1. validate direct ts range filter when origin ts column is not named ts
2. validate scalar-subquery ts range filter on virtual normal/child/super tables
3. validate scalar-subquery ts range filter on multi-origin virtual normal table
4. validate scalar subqueries using filtered `first/last(...)` timestamps
¶
Query: virtual table with null value
1. test vtable select normal table projection with null value
2. test vtable select child table projection with null value
3. test vtable select super table projection with null value
¶
Query: old schema (bugfix)
schema is old when origin table's column has same prefix during virtual supertable query
¶
Query: show create virtual table
1. test show create virtual super table
2. test show create virtual normal table
3. test show create virtual child table
¶
Query: show tag (bugfix)
1. Create db
2. Create supper table and sub table
3. Create virtual supper table and sub table
4. Show tag of virtual table and check the result
¶
Stress: repeated virtual table create/drop cycles
Repeatedly create and drop a virtual table (50 cycles),
verifying query correctness at each cycle.
¶
Stress: repeated query execution on same virtual table
Execute the same aggregation query 100 times, verifying
result consistency at every iteration.
¶
Stress: large result set handling
1. full table scan on 10K rows
2. multiple aggregations
3. group by with many groups
¶
Stress: create and query many virtual tables
Create 50 virtual tables referencing 10 source tables,
query each one, then drop them all.
¶
Stress: complex query patterns on virtual tables
1. subquery
2. union all
3. multiple conditions with OR
4. order by with limit
¶
Stress: mixed DDL and DML operations
Interleave create/query/drop operations across 20 iterations,
dropping older tables as new ones are created.
¶
Stress: memory cleanup verification
Repeatedly create/query/drop virtual tables (30 cycles)
on a 5K-row source, then verify final query still returns
correct results.
¶
Stress: simulated concurrent access
Rapidly alternate queries across 5 virtual tables
for 50 iterations, verifying correctness each time.
¶
Create: virtual child table with old tag ref syntax (FROM table.tag)
Test the legacy tag reference syntax where FROM precedes the column_ref
in the TAGS clause: TAGS (FROM table.tag, ...)
¶
Create: virtual child table with specific tag ref syntax (tag_name FROM table.tag)
Test the new specific tag reference syntax where the tag name is explicitly
specified: TAGS (tag_name FROM table.tag, ...)
¶
Create: virtual child table with positional tag ref syntax (table.tag / db.table.tag)
Test the new positional tag reference syntax where the tag column is
specified by table.tag (2-part) or db.table.tag (3-part).
¶
Create: virtual child table with mixed tag ref syntax
Test mixing literal values, old FROM syntax, new specific syntax,
and new positional syntax in a single TAGS clause.
¶
Create: virtual child table with tag refs + different col ref styles
Test tag references combined with positional column references
(no FROM keyword for columns).
¶
Create: virtual child table with cross-database tag references
Test tag references that point to child tables in a different database.
¶
Create: verify tag references via SHOW CREATE VTABLE
Verify that tag references are correctly stored and returned by
SHOW CREATE VTABLE command.
¶
Create: verify tag references via DESCRIBE
Verify that DESCRIBE on a virtual child table with tag references
returns the expected schema.
¶
Create: virtual child table with specific tag names in TAGS clause
Test tag references when specific tag names are listed before TAGS
keyword: USING vstb (tag1, tag2, ...) TAGS (...)
¶
Create: virtual child table tag ref error cases
Test various error conditions for tag column references:
1. Tag ref column does not exist in source table
2. Tag ref table does not exist
3. Tag ref type mismatch (non-tag column used as tag)
4. Positional tag ref - column does not exist
5. Positional tag ref - table does not exist
6. Tag type mismatch between virtual and source
7. 3-part positional with non-existent db
8. Tag ref from normal table (not child table)
¶
Create: tag ref must point to actual tag column, not data column
Verify that when a tag reference points to a column that exists
but is not a tag column, the error message clearly indicates
that the referenced column is not a tag column.
¶
Query: select data from virtual child table with tag references
Verify that data can be queried from virtual child tables that
were created with tag column references.
¶
Query: show tags from virtual child table with tag references
Verify that SHOW TAGS works correctly for virtual child tables
that have tag column references.
¶
Create: drop and recreate virtual child table with tag refs
Verify that virtual child tables with tag references can be
dropped and recreated without issues.
¶
Create: virtual child table with all literal tags (no tag refs)
Verify backward compatibility: creating virtual child tables with
only literal tag values (no tag references) still works correctly.
¶
Validate: same-db normal table referencing (all valid)
Query ins_virtual_tables_referencing for a virtual normal table
that references columns from a same-db normal table.
All references should be valid (err_code = 0).
¶
Validate: same-db child table referencing (all valid)
Query ins_virtual_tables_referencing for a virtual child table
that references columns from a same-db child table.
All references should be valid (err_code = 0).
¶
Validate: cross-db normal table referencing (all valid)
Query ins_virtual_tables_referencing for a virtual normal table
that references columns from a cross-db normal table.
All references should be valid (err_code = 0).
¶
Validate: check column content correctness
Verify that the virtual_db_name, virtual_table_name, virtual_col_name,
src_db_name, src_table_name, src_column_name columns are populated correctly.
¶
Validate: source column dropped => err_code = TSDB_CODE_PAR_INVALID_REF_COLUMN
Drop a column from the source super table that is referenced by a
virtual child table. The validation should report INVALID_REF_COLUMN.
¶
Validate: source table dropped => err_code = TSDB_CODE_PAR_TABLE_NOT_EXIST
Drop the source normal table referenced by a virtual normal table.
The validation should report TABLE_NOT_EXIST.
¶
Validate: source database dropped => err_code = TSDB_CODE_MND_DB_NOT_EXIST
Drop the source database referenced by a cross-db virtual table.
The validation should report DB_NOT_EXIST.
¶
Validate: full scan without filter
Query ins_virtual_tables_referencing without any WHERE filter.
Should return rows for all virtual tables in the database.
¶
Validate: filter by virtual_table_name
Query ins_virtual_tables_referencing with virtual_table_name filter.
Verify the optimized path returns correct results.
¶
Validate: err_msg is populated when err_code != 0
When a column reference is invalid, the err_msg column should contain
a non-empty error description string.
¶
Validate: virtual table with mixed valid and invalid column references
Create a virtual normal table with multiple column references.
Drop only one source column. Verify that valid references have err_code=0
while the invalid one has the correct error code.
¶
Validate: virtual table referencing multiple source tables
Create a virtual normal table that references columns from 3 different
source tables. Verify all references are valid, then drop source tables
one by one and verify corresponding references become invalid.
¶
Validate: virtual super table with multiple virtual child tables
Create multiple virtual child tables under the same virtual super table,
each referencing different source child tables. Verify all references
are correct and independent.
¶
Validate: virtual table referencing multiple columns from same source
Create a virtual table that references 6 columns from same source table.
Verify all references are valid, then drop columns one by one and verify
corresponding references become invalid.
¶
Validate: virtual table with mixed same-db and cross-db sources
Create a virtual table that references both same-database tables
and cross-database tables. Verify different error codes when
dropping same-db tables vs cross-db database.
¶
Validate: virtual table referencing multiple cross-databases
Create a virtual table that references tables from 2 different
cross-databases. Drop one cross-database and verify partial
references become invalid.
¶
Validate: virtual child table referencing cross-db source child table
Create a virtual child table that references a source child table
from a cross-database super table. Verify the reference is valid
and metadata is correct.
¶
Validate: virtual normal table mixing normal table and child table sources
Create a virtual normal table that references columns from both
a normal table and a super table's child table. Verify all
references are valid and source table types are correct.
¶
Validate: virtual super table with children from different source super tables
Create a virtual super table with multiple virtual child tables,
each referencing child tables from different source super tables.
Verify references are independent and correct.
¶
Validate: virtual table with complex column types (GEOMETRY, VARBINARY, NCHAR)
Create a virtual table that references columns with complex types
including GEOMETRY, VARBINARY, and NCHAR. Verify all references
are valid and type mappings are correct.
¶
Validate: SHOW VTABLE VALIDATE FOR basic syntax
Test the basic syntax of SHOW VTABLE VALIDATE FOR with simple table name.
¶
Validate: SHOW VTABLE VALIDATE FOR with database prefix
Test SHOW VTABLE VALIDATE FOR with full qualified table name (dbname.tablename).
¶
Validate: SHOW VTABLE VALIDATE FOR cross-database virtual table
Test SHOW VTABLE VALIDATE FOR on a virtual table that references
cross-database tables.
¶
Validate: SHOW VTABLE VALIDATE FOR virtual child table
Test SHOW VTABLE VALIDATE FOR on a virtual child table.
¶
Validate: SHOW VTABLE VALIDATE FOR nonexistent table
Test SHOW VTABLE VALIDATE FOR on a table that doesn't exist.
Should return empty result or error.
¶
Validate: SHOW VTABLE VALIDATE FOR on normal table (non-virtual)
Execute SHOW VTABLE VALIDATE FOR on a normal table.
Verify it returns error (not a virtual child table).
¶
Validate: SHOW VTABLE VALIDATE FOR result columns
Verify that SHOW VTABLE VALIDATE FOR returns the expected columns
with correct names and order.
¶
Validate: SHOW VTABLE VALIDATE FOR with invalid references
Test SHOW VTABLE VALIDATE FOR on a virtual table where some
references are invalid (dropped source table/column).
¶
Validate: SHOW VTABLE VALIDATE FOR case sensitivity
Test if table names in SHOW VTABLE VALIDATE FOR are case-sensitive.
¶
Validate: SHOW VTABLE VALIDATE FOR without USE database
Test SHOW VTABLE VALIDATE FOR when no database is selected.
Should require database context or full qualified name.
¶
Validate: SHOW VTABLE VALIDATE FOR when source column is dropped
Create a virtual table referencing multiple columns from source table,
then drop one referenced column. Verify SHOW command reports INVALID_REF_COLUMN
for the dropped column while other columns remain valid.
¶
Validate: SHOW VTABLE VALIDATE FOR when source column type is changed
Create a virtual table referencing source column, then alter column type.
Verify SHOW command reports error for type mismatch.
¶
Validate: SHOW VTABLE VALIDATE FOR when source column is renamed
Create a virtual table referencing source column, then rename the column.
Verify SHOW command reports column not found error.
¶
Validate: SHOW VTABLE VALIDATE FOR with partial column drops
Create a virtual table referencing 6 columns, drop 2 of them.
Verify SHOW correctly reports 2 errors and 4 valid references.
¶
Validate: SHOW VTABLE VALIDATE FOR when new column added to source
Create a virtual table, then add a new column to source table.
Verify SHOW command is not affected (new column not referenced).
¶
Validate: SHOW VTABLE VALIDATE FOR when all referenced columns dropped
Create a virtual table referencing all columns, then drop all of them.
Verify SHOW reports all references as invalid.
¶
Validate: SHOW VTABLE VALIDATE FOR when source table is dropped
Create a virtual table, then drop the source table.
Verify SHOW reports TABLE_NOT_EXIST error.
¶
Validate: SHOW VTABLE VALIDATE FOR when source table is truncated
Create a virtual table, then truncate the source table (delete all data).
Verify SHOW still reports valid (truncate doesn't change schema).
¶
Validate: SHOW VTABLE VALIDATE FOR when source table is renamed
Create a virtual table, then rename the source table.
Verify SHOW reports table not found error.
¶
Validate: SHOW VTABLE VALIDATE FOR when source super table is dropped
Create a virtual child table referencing source child table,
then drop the source super table (cascades to child tables).
Verify SHOW reports table not found error.
¶
Validate: SHOW VTABLE VALIDATE FOR when source child table is dropped
Create a virtual child table referencing source child table,
then drop only the source child table (not the stable).
Verify SHOW reports table not found error.
¶
Validate: SHOW VTABLE VALIDATE FOR when cross-database is dropped
Create a virtual table referencing cross-database table,
then drop the cross-database.
Verify SHOW reports DB_NOT_EXIST error.
¶
Validate: SHOW VTABLE VALIDATE FOR when cross-db table is dropped
Create a virtual table referencing cross-database table,
then drop the source table in cross-database.
Verify SHOW reports TABLE_NOT_EXIST error.
¶
Validate: SHOW VTABLE VALIDATE FOR with multiple cross-db, partial failure
Create a virtual table referencing tables from 2 different cross-databases,
then drop one cross-database.
Verify SHOW reports partial failure.
¶
Validate: SHOW VTABLE VALIDATE FOR when cross-db column is dropped
Create a virtual table referencing column in cross-database table,
then drop that column.
Verify SHOW reports INVALID_REF_COLUMN error.
¶
Validate: SHOW VTABLE VALIDATE FOR on nonexistent table
Execute SHOW VTABLE VALIDATE FOR on a table that doesn't exist.
Verify it returns 0 rows without error.
¶
Validate: SHOW VTABLE VALIDATE FOR on normal table (non-virtual)
Execute SHOW VTABLE VALIDATE FOR on a normal table.
Verify it returns error (not a virtual child table).
¶
Validate: SHOW VTABLE VALIDATE FOR on system table
Execute SHOW VTABLE VALIDATE FOR on a system table.
Verify it returns error (system tables are not virtual child tables).
¶
Validate: SHOW VTABLE VALIDATE FOR with wrong database context
Switch to a different database, then try SHOW VTABLE VALIDATE FOR
without database prefix. Verify it returns 0 rows or error.
¶
Validate: SHOW VTABLE VALIDATE FOR with multiple error types
Create a virtual table referencing 3 source tables,
then drop table1, drop column from table2, keep table3.
Verify SHOW correctly reports multiple error types.
¶
Validate: SHOW VTABLE VALIDATE FOR with cascading failure
Create a virtual child table referencing source child table,
then drop the source super table (cascades to child).
Verify SHOW correctly reports cascading failure.
¶
Validate: SHOW VTABLE VALIDATE FOR empty virtual table (no column references)
Test SHOW VTABLE VALIDATE FOR on a virtual table that has no column references.
Should return 0 rows.
¶
Validate: SHOW VTABLE VALIDATE FOR virtual table with many columns
Create a virtual table referencing many columns (e.g., 20 columns)
and verify all references are validated correctly.
¶
Validate: SHOW VTABLE VALIDATE FOR error message content
Verify that err_msg column contains meaningful error description
when err_code is non-zero.
¶
Validate: SHOW VTABLE VALIDATE FOR concurrent queries
Execute SHOW VTABLE VALIDATE FOR concurrently from multiple
connections and verify consistent results.
¶
Validate: SHOW VTABLE VALIDATE FOR virtual super table
Test SHOW VTABLE VALIDATE FOR on a virtual super table (VSTB).
Should return 0 rows since super table has no actual data.
¶
Validate: SHOW VTABLE VALIDATE FOR called multiple times
Verify that calling SHOW VTABLE VALIDATE FOR multiple times
on the same table returns consistent results.
¶
Validate: SHOW VTABLE VALIDATE FOR after ALTER source table
Alter source table (ADD COLUMN) and verify that existing
virtual table references remain valid.
¶
Validate: SHOW VTABLE VALIDATE FOR with special column names
Test SHOW VTABLE VALIDATE FOR on virtual table with special
column names (e.g., containing underscores, numbers).
¶
Validate: SHOW VTABLE VALIDATE FOR result ordering
Verify that SHOW VTABLE VALIDATE FOR returns results in
a consistent order (e.g., by column definition order).