diff --git a/docs/en/12-taos-sql/05-insert.md b/docs/en/12-taos-sql/05-insert.md index 462e7fc0ae..32227a2214 100644 --- a/docs/en/12-taos-sql/05-insert.md +++ b/docs/en/12-taos-sql/05-insert.md @@ -1,7 +1,7 @@ --- title: Insert sidebar_label: Insert -description: This document describes how to insert data into TDengine. +description: This document describes the SQL commands and syntax for inserting data into TDengine. --- ## Syntax diff --git a/docs/en/12-taos-sql/13-tmq.md b/docs/en/12-taos-sql/13-tmq.md index d14b6da2d3..16dc9efd62 100644 --- a/docs/en/12-taos-sql/13-tmq.md +++ b/docs/en/12-taos-sql/13-tmq.md @@ -1,5 +1,5 @@ --- -title: Data Subscription +title: Data Subscription SQL Reference sidebar_label: Data Subscription description: This document describes the SQL statements related to the data subscription component of TDengine. --- diff --git a/docs/en/12-taos-sql/14-stream.md b/docs/en/12-taos-sql/14-stream.md index e1bf18c854..337660a36c 100644 --- a/docs/en/12-taos-sql/14-stream.md +++ b/docs/en/12-taos-sql/14-stream.md @@ -1,5 +1,5 @@ --- -title: Stream Processing +title: Stream Processing SQL Reference sidebar_label: Stream Processing description: This document describes the SQL statements related to the stream processing component of TDengine. --- @@ -148,7 +148,7 @@ T = latest event time - watermark The window closing time for each batch of data that arrives at the system is updated using the preceding formula, and all windows are closed whose closing time is less than T. If the triggering method is WINDOW_CLOSE or MAX_DELAY, the aggregate result for the window is pushed. -Stream processing strategy for expired data +## Stream processing strategy for expired data The data in expired windows is tagged as expired. TDengine stream processing provides two methods for handling such data: 1. Drop the data. This is the default and often only handling method for most stream processing engines. @@ -157,6 +157,14 @@ The data in expired windows is tagged as expired. TDengine stream processing pro In both of these methods, configuring the watermark is essential for obtaining accurate results (if expired data is dropped) and avoiding repeated triggers that affect system performance (if expired data is recalculated). +## Stream processing strategy for modifying data + +TDengine provides two ways to handle modified data, which are specified by the IGNORE UPDATE option: + +1. Check whether the data has been modified, i.e. IGNORE UPDATE 0, and recalculate the corresponding window if the data has been modified. + +2. Do not check whether the data has been modified, and calculate all the data as incremental data, i.e. IGNORE UPDATE 1, the default configuration. + ## Supported functions All [scalar functions](../function/#scalar-functions) are available in stream processing. All [Aggregate functions](../function/#aggregate-functions) and [Selection functions](../function/#selection-functions) are available in stream processing, except the followings: diff --git a/docs/en/12-taos-sql/26-udf.md b/docs/en/12-taos-sql/26-udf.md index f86b535927..dec9ca217d 100644 --- a/docs/en/12-taos-sql/26-udf.md +++ b/docs/en/12-taos-sql/26-udf.md @@ -1,5 +1,5 @@ --- -title: User-Defined Functions (UDF) +title: User-Defined Functions (UDF) SQL Reference sidebar_label: User-Defined Functions description: This document describes the SQL statements related to user-defined functions (UDF) in TDengine. --- diff --git a/docs/en/14-reference/07-tdinsight/index.md b/docs/en/14-reference/07-tdinsight/index.md index cada05d738..1bc983262e 100644 --- a/docs/en/14-reference/07-tdinsight/index.md +++ b/docs/en/14-reference/07-tdinsight/index.md @@ -1,5 +1,5 @@ --- -title: TDinsight - Grafana-based Zero-Dependency Monitoring Solution for TDengine +title: TDinsight sidebar_label: TDinsight description: This document describes TDinsight, a monitoring solution for TDengine. --- diff --git a/docs/en/25-application/01-telegraf.md b/docs/en/25-application/01-telegraf.md index a6db826fa3..f8784e9ab9 100644 --- a/docs/en/25-application/01-telegraf.md +++ b/docs/en/25-application/01-telegraf.md @@ -1,5 +1,5 @@ --- -title: Quickly Build IT DevOps Visualization System with TDengine + Telegraf + Grafana +title: IT Visualization with TDengine + Telegraf + Grafana sidebar_label: TDengine + Telegraf + Grafana description: This document describes how to create an IT visualization system by integrating TDengine with Telegraf and Grafana. --- diff --git a/docs/examples/rust/nativeexample/examples/query.rs b/docs/examples/rust/nativeexample/examples/query.rs new file mode 100644 index 0000000000..dfe55e8749 --- /dev/null +++ b/docs/examples/rust/nativeexample/examples/query.rs @@ -0,0 +1,66 @@ +use taos::*; + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + let dsn = "taos://localhost:6030"; + let builder = TaosBuilder::from_dsn(dsn)?; + + let taos = builder.build()?; + + // ANCHOR: create_db_and_table + let db = "power"; + // create database + taos.exec_many([ + format!("DROP DATABASE IF EXISTS `{db}`"), + format!("CREATE DATABASE `{db}`"), + format!("USE `{db}`"), + ]) + .await?; + + // create table + taos.exec_many([ + // create super table + "CREATE TABLE `meters` (`ts` TIMESTAMP, `current` FLOAT, `voltage` INT, `phase` FLOAT) \ + TAGS (`groupid` INT, `location` BINARY(24))", + ]).await?; + // ANCHOR_END: create_db_and_table + + // ANCHOR: insert_data + let inserted = taos.exec("INSERT INTO " + + "power.d1001 USING power.meters TAGS(2,'California.SanFrancisco') " + + "VALUES " + + "(NOW + 1a, 10.30000, 219, 0.31000) " + + "(NOW + 2a, 12.60000, 218, 0.33000) " + + "(NOW + 3a, 12.30000, 221, 0.31000) " + + "power.d1002 USING power.meters TAGS(3, 'California.SanFrancisco') " + + "VALUES " + + "(NOW + 1a, 10.30000, 218, 0.25000) ").await?; + + println!("inserted: {} rows", inserted); + // ANCHOR_END: insert_data + + // ANCHOR: query_data + let mut result = taos.query("SELECT * FROM power.meters").await?; + + for field in result.fields() { + println!("got field: {}", field.name()); + } + + let mut rows = result.rows(); + let mut nrows = 0; + while let Some(row) = rows.try_next().await? { + for (col, (name, value)) in row.enumerate() { + println!( + "[{}] got value in col {} (named `{:>8}`): {}", + nrows, col, name, value + ); + } + nrows += 1; + } + // ANCHOR_END: query_data + + // ANCHOR: query_with_req_id + let result = taos.query_with_req_id("SELECT * FROM power.meters", 0).await?; + // ANCHOR_END: query_with_req_id + +} diff --git a/docs/examples/rust/nativeexample/examples/schemaless.rs b/docs/examples/rust/nativeexample/examples/schemaless.rs new file mode 100644 index 0000000000..44ce0fe694 --- /dev/null +++ b/docs/examples/rust/nativeexample/examples/schemaless.rs @@ -0,0 +1,80 @@ +use taos_query::common::SchemalessPrecision; +use taos_query::common::SchemalessProtocol; +use taos_query::common::SmlDataBuilder; + +use crate::AsyncQueryable; +use crate::AsyncTBuilder; +use crate::TaosBuilder; + +async fn put() -> anyhow::Result<()> { + std::env::set_var("RUST_LOG", "taos=debug"); + pretty_env_logger::init(); + let dsn = + std::env::var("TDENGINE_ClOUD_DSN").unwrap_or("http://localhost:6041".to_string()); + log::debug!("dsn: {:?}", &dsn); + + let client = TaosBuilder::from_dsn(dsn)?.build().await?; + + let db = "power"; + + client.exec(format!("drop database if exists {db}")).await?; + + client + .exec(format!("create database if not exists {db}")) + .await?; + + // should specify database before insert + client.exec(format!("use {db}")).await?; + + // SchemalessProtocol::Line + let data = [ + "meters,groupid=2,location=California.SanFrancisco current=10.3000002f64,voltage=219i32,phase=0.31f64 1626006833639000000", + ] + .map(String::from) + .to_vec(); + + let sml_data = SmlDataBuilder::default() + .protocol(SchemalessProtocol::Line) + .precision(SchemalessPrecision::Millisecond) + .data(data.clone()) + .ttl(1000) + .req_id(100u64) + .build()?; + assert_eq!(client.put(&sml_data).await?, ()); + + // SchemalessProtocol::Telnet + let data = [ + "meters.current 1648432611249 10.3 location=California.SanFrancisco group=2", + ] + .map(String::from) + .to_vec(); + + let sml_data = SmlDataBuilder::default() + .protocol(SchemalessProtocol::Telnet) + .precision(SchemalessPrecision::Millisecond) + .data(data.clone()) + .ttl(1000) + .req_id(200u64) + .build()?; + assert_eq!(client.put(&sml_data).await?, ()); + + // SchemalessProtocol::Json + let data = [ + r#"[{"metric": "meters.current", "timestamp": 1681345954000, "value": 10.3, "tags": {"location": "California.SanFrancisco", "groupid": 2}}, {"metric": "meters.voltage", "timestamp": 1648432611249, "value": 219, "tags": {"location": "California.LosAngeles", "groupid": 1}}, {"metric": "meters.current", "timestamp": 1648432611250, "value": 12.6, "tags": {"location": "California.SanFrancisco", "groupid": 2}}, {"metric": "meters.voltage", "timestamp": 1648432611250, "value": 221, "tags": {"location": "California.LosAngeles", "groupid": 1}}]"# + ] + .map(String::from) + .to_vec(); + + let sml_data = SmlDataBuilder::default() + .protocol(SchemalessProtocol::Json) + .precision(SchemalessPrecision::Millisecond) + .data(data.clone()) + .ttl(1000) + .req_id(300u64) + .build()?; + assert_eq!(client.put(&sml_data).await?, ()); + + client.exec(format!("drop database if exists {db}")).await?; + + Ok(()) +} diff --git a/docs/examples/rust/nativeexample/examples/stmt.rs b/docs/examples/rust/nativeexample/examples/stmt.rs new file mode 100644 index 0000000000..0194eccdf1 --- /dev/null +++ b/docs/examples/rust/nativeexample/examples/stmt.rs @@ -0,0 +1,37 @@ +use taos::*; + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + let taos = TaosBuilder::from_dsn("taos://")?.build().await?; + + taos.exec("DROP DATABASE IF EXISTS power").await?; + taos.create_database("power").await?; + taos.use_database("power").await?; + taos.exec("CREATE STABLE IF NOT EXISTS meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)").await?; + + let mut stmt = Stmt::init(&taos).await?; + stmt.prepare("INSERT INTO ? USING meters TAGS(?, ?) VALUES(?, ?, ?, ?)").await?; + + const NUM_TABLES: usize = 10; + const NUM_ROWS: usize = 10; + for i in 0..NUM_TABLES { + let table_name = format!("d{}", i); + let tags = vec![Value::VarChar("California.SanFransico".into()), Value::Int(2)]; + stmt.set_tbname_tags(&table_name, &tags).await?; + for j in 0..NUM_ROWS { + let values = vec![ + ColumnView::from_millis_timestamp(vec![1648432611249 + j as i64]), + ColumnView::from_floats(vec![10.3 + j as f32]), + ColumnView::from_ints(vec![219 + j as i32]), + ColumnView::from_floats(vec![0.31 + j as f32]), + ]; + stmt.bind(&values).await?; + } + stmt.add_batch().await?; + } + + // execute. + let rows = stmt.execute().await?; + assert_eq!(rows, NUM_TABLES * NUM_ROWS); + Ok(()) +} diff --git a/docs/examples/rust/nativeexample/examples/tmq.rs b/docs/examples/rust/nativeexample/examples/tmq.rs new file mode 100644 index 0000000000..764c0c1fc8 --- /dev/null +++ b/docs/examples/rust/nativeexample/examples/tmq.rs @@ -0,0 +1,166 @@ +use std::time::Duration; +use std::str::FromStr; + +use taos::*; + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + pretty_env_logger::formatted_timed_builder() + .filter_level(log::LevelFilter::Info) + .init(); + use taos_query::prelude::*; + let dsn = "taos://localhost:6030".to_string(); + log::info!("dsn: {}", dsn); + let mut dsn = Dsn::from_str(&dsn)?; + + let taos = TaosBuilder::from_dsn(&dsn)?.build().await?; + + // prepare database and table + taos.exec_many([ + "drop topic if exists topic_meters", + "drop database if exists power", + "create database if not exists power WAL_RETENTION_PERIOD 86400", + "use power", + + "CREATE STABLE IF NOT EXISTS power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))", + + "create table if not exists power.d001 using power.meters tags(1,'location')", + + ]) + .await?; + + taos.exec_many([ + "drop database if exists db2", + "create database if not exists db2 wal_retention_period 3600", + "use db2", + ]) + .await?; + + // ANCHOR: create_topic + taos.exec_many([ + "CREATE TOPIC IF NOT EXISTS topic_meters AS SELECT ts, current, voltage, phase, groupid, location FROM power.meters", + ]) + .await?; + // ANCHOR_END: create_topic + + // ANCHOR: create_consumer + dsn.params.insert("group.id".to_string(), "abc".to_string()); + dsn.params.insert("auto.offset.reset".to_string(), "earliest".to_string()); + + let builder = TmqBuilder::from_dsn(&dsn)?; + let mut consumer = builder.build().await?; + // ANCHOR_END: create_consumer + + // ANCHOR: subscribe + consumer.subscribe(["topic_meters"]).await?; + // ANCHOR_END: subscribe + + // ANCHOR: consume + { + let mut stream = consumer.stream_with_timeout(Timeout::from_secs(1)); + + while let Some((offset, message)) = stream.try_next().await? { + + let topic: &str = offset.topic(); + let database = offset.database(); + let vgroup_id = offset.vgroup_id(); + log::debug!( + "topic: {}, database: {}, vgroup_id: {}", + topic, + database, + vgroup_id + ); + + match message { + MessageSet::Meta(meta) => { + log::info!("Meta"); + let raw = meta.as_raw_meta().await?; + taos.write_raw_meta(&raw).await?; + + let json = meta.as_json_meta().await?; + let sql = json.to_string(); + if let Err(err) = taos.exec(sql).await { + println!("maybe error: {}", err); + } + } + MessageSet::Data(data) => { + log::info!("Data"); + while let Some(data) = data.fetch_raw_block().await? { + log::debug!("data: {:?}", data); + } + } + MessageSet::MetaData(meta, data) => { + log::info!("MetaData"); + let raw = meta.as_raw_meta().await?; + taos.write_raw_meta(&raw).await?; + + let json = meta.as_json_meta().await?; + let sql = json.to_string(); + if let Err(err) = taos.exec(sql).await { + println!("maybe error: {}", err); + } + + while let Some(data) = data.fetch_raw_block().await? { + log::debug!("data: {:?}", data); + } + } + } + consumer.commit(offset).await?; + } + } + // ANCHOR_END: consume + + // ANCHOR: assignments + let assignments = consumer.assignments().await.unwrap(); + log::info!("assignments: {:?}", assignments); + // ANCHOR_END: assignments + + // seek offset + for topic_vec_assignment in assignments { + let topic = &topic_vec_assignment.0; + let vec_assignment = topic_vec_assignment.1; + for assignment in vec_assignment { + let vgroup_id = assignment.vgroup_id(); + let current = assignment.current_offset(); + let begin = assignment.begin(); + let end = assignment.end(); + log::debug!( + "topic: {}, vgroup_id: {}, current offset: {} begin {}, end: {}", + topic, + vgroup_id, + current, + begin, + end + ); + // ANCHOR: seek_offset + let res = consumer.offset_seek(topic, vgroup_id, end).await; + if res.is_err() { + log::error!("seek offset error: {:?}", res); + let a = consumer.assignments().await.unwrap(); + log::error!("assignments: {:?}", a); + } + // ANCHOR_END: seek_offset + } + + let topic_assignment = consumer.topic_assignment(topic).await; + log::debug!("topic assignment: {:?}", topic_assignment); + } + + // after seek offset + let assignments = consumer.assignments().await.unwrap(); + log::info!("after seek offset assignments: {:?}", assignments); + + // ANCHOR: unsubscribe + consumer.unsubscribe().await; + // ANCHOR_END: unsubscribe + + tokio::time::sleep(Duration::from_secs(1)).await; + + taos.exec_many([ + "drop database db2", + "drop topic topic_meters", + "drop database power", + ]) + .await?; + Ok(()) +} diff --git a/docs/zh/12-taos-sql/14-stream.md b/docs/zh/12-taos-sql/14-stream.md index 2ed3c9afae..125f868758 100644 --- a/docs/zh/12-taos-sql/14-stream.md +++ b/docs/zh/12-taos-sql/14-stream.md @@ -201,9 +201,9 @@ TDengine 对于过期数据提供两种处理方式,由 IGNORE EXPIRED 选项 TDengine 对于修改数据提供两种处理方式,由 IGNORE UPDATE 选项指定: -1. 检查数据是否被修改,即 IGNORE UPDATE 0:默认配置,如果被修改,则重新计算对应窗口。 +1. 检查数据是否被修改,即 IGNORE UPDATE 0,如果数据被修改,则重新计算对应窗口。 -2. 不检查数据是否被修改,全部按增量数据计算,即 IGNORE UPDATE 1。 +2. 不检查数据是否被修改,全部按增量数据计算,即 IGNORE UPDATE 1,默认配置。 ## 写入已存在的超级表 diff --git a/include/common/tcommon.h b/include/common/tcommon.h index d68ba1534a..c84185c120 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -392,6 +392,7 @@ typedef struct STUidTagInfo { #define CALCULATE_START_TS_COLUMN_INDEX 4 #define CALCULATE_END_TS_COLUMN_INDEX 5 #define TABLE_NAME_COLUMN_INDEX 6 +#define PRIMARY_KEY_COLUMN_INDEX 7 // stream create table block column #define UD_TABLE_NAME_COLUMN_INDEX 0 diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h index 290c90fde9..d13cc1405b 100644 --- a/include/common/tdatablock.h +++ b/include/common/tdatablock.h @@ -268,7 +268,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** pReq, const SSDataBlock* pData bool alreadyAddGroupId(char* ctbName); bool isAutoTableName(char* ctbName); -void buildCtbNameAddGroupId(char* ctbName, uint64_t groupId); +void buildCtbNameAddGroupId(const char* stbName, char* ctbName, uint64_t groupId); char* buildCtbNameByGroupId(const char* stbName, uint64_t groupId); int32_t buildCtbNameByGroupIdImpl(const char* stbName, uint64_t groupId, char* pBuf); diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 829632b682..479097580a 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -2566,6 +2566,8 @@ typedef struct { int8_t igUpdate; int64_t lastTs; SArray* pVgroupVerList; + // 3.3.0.0 + SArray* pCols; // array of SField } SCMCreateStreamReq; typedef struct { diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index cbf38102de..f199e572fd 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -578,6 +578,7 @@ typedef struct SWindowPhysiNode { int64_t watermark; int64_t deleteMark; int8_t igExpired; + int8_t destHasPrimayKey; bool mergeDataBlock; } SWindowPhysiNode; diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index cdbeda0012..22c5e74910 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -85,6 +85,7 @@ typedef struct SColumnNode { char colName[TSDB_COL_NAME_LEN]; int16_t dataBlockId; int16_t slotId; + int16_t numOfPKs; bool tableHasPk; bool isPk; } SColumnNode; diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h index 707d70b71b..a78fc4d2a6 100644 --- a/include/libs/planner/planner.h +++ b/include/libs/planner/planner.h @@ -44,6 +44,8 @@ typedef struct SPlanContext { const char* pUser; bool sysInfo; int64_t allocatorId; + bool destHasPrimaryKey; + bool sourceHasPrimaryKey; } SPlanContext; // Create the physical plan for the query, according to the AST. diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 0b192d5593..47783953c4 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -76,6 +76,7 @@ typedef struct STableComInfo { uint8_t numOfTags; // the number of tags in schema uint8_t precision; // the number of precision col_id_t numOfColumns; // the number of columns + int16_t numOfPKs; int32_t rowSize; // row size of the schema } STableComInfo; diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index 5f3761d7b7..138fad0ddb 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -61,7 +61,7 @@ typedef struct SStreamTask SStreamTask; typedef struct SStreamQueue SStreamQueue; typedef struct SStreamTaskSM SStreamTaskSM; -#define SSTREAM_TASK_VER 3 +#define SSTREAM_TASK_VER 4 #define SSTREAM_TASK_INCOMPATIBLE_VER 1 #define SSTREAM_TASK_NEED_CONVERT_VER 2 #define SSTREAM_TASK_SUBTABLE_CHANGED_VER 3 @@ -355,6 +355,8 @@ typedef struct SMetaHbInfo SMetaHbInfo; typedef struct SDispatchMsgInfo { SStreamDispatchReq* pData; // current dispatch data int8_t dispatchMsgType; + int64_t checkpointId;// checkpoint id msg + int32_t transId; // transId for current checkpoint int16_t msgType; // dispatch msg type int32_t retryCount; // retry send data count int64_t startTs; // dispatch start time, record total elapsed time for dispatch diff --git a/include/util/taoserror.h b/include/util/taoserror.h index affa1f0345..2389079fd2 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -766,6 +766,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_SECOND_COL_PK TAOS_DEF_ERROR_CODE(0, 0x2672) #define TSDB_CODE_PAR_COL_PK_TYPE TAOS_DEF_ERROR_CODE(0, 0x2673) #define TSDB_CODE_PAR_INVALID_PK_OP TAOS_DEF_ERROR_CODE(0, 0x2674) +#define TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL TAOS_DEF_ERROR_CODE(0, 0x2675) #define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF) //planner @@ -805,6 +806,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_SML_INVALID_DB_CONF TAOS_DEF_ERROR_CODE(0, 0x3003) #define TSDB_CODE_SML_NOT_SAME_TYPE TAOS_DEF_ERROR_CODE(0, 0x3004) #define TSDB_CODE_SML_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x3005) +#define TSDB_CODE_SML_NOT_SUPPORT_PK TAOS_DEF_ERROR_CODE(0, 0x3006) //tsma #define TSDB_CODE_TSMA_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x3100) diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 6bcdb4e973..79c079f871 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -310,6 +310,16 @@ int32_t smlJoinMeasureTag(SSmlLineInfo *elements){ return TSDB_CODE_SUCCESS; } +static bool smlIsPKTable(STableMeta *pTableMeta){ + for(int i = 0; i < pTableMeta->tableInfo.numOfColumns; i++){ + if(pTableMeta->schema[i].flags & COL_IS_KEY){ + return true; + } + } + + return false; +} + int32_t smlProcessSuperTable(SSmlHandle *info, SSmlLineInfo *elements) { bool isSameMeasure = IS_SAME_SUPER_TABLE; if(isSameMeasure) { @@ -328,6 +338,11 @@ int32_t smlProcessSuperTable(SSmlHandle *info, SSmlLineInfo *elements) { info->currSTableMeta = sMeta->tableMeta; info->maxTagKVs = sMeta->tags; info->maxColKVs = sMeta->cols; + + if(smlIsPKTable(sMeta->tableMeta)){ + terrno = TSDB_CODE_SML_NOT_SUPPORT_PK; + return -1; + } return 0; } @@ -1063,6 +1078,12 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { goto end; } } else if (code == TSDB_CODE_SUCCESS) { + + if(smlIsPKTable(pTableMeta)){ + code = TSDB_CODE_SML_NOT_SUPPORT_PK; + goto end; + } + hashTmp = taosHashInit(pTableMeta->tableInfo.numOfTags, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); for (uint16_t i = pTableMeta->tableInfo.numOfColumns; diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 4104a27b4d..1b25904c0c 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1633,6 +1633,22 @@ void changeByteEndian(char* pData){ } } +static void tmqGetRawDataRowsPrecisionFromRes(void *pRetrieve, void** rawData, int64_t *rows, int32_t *precision){ + if(*(int64_t*)pRetrieve == 0){ + *rawData = ((SRetrieveTableRsp*)pRetrieve)->data; + *rows = htobe64(((SRetrieveTableRsp*)pRetrieve)->numOfRows); + if(precision != NULL){ + *precision = ((SRetrieveTableRsp*)pRetrieve)->precision; + } + }else if(*(int64_t*)pRetrieve == 1){ + *rawData = ((SRetrieveTableRspForTmq*)pRetrieve)->data; + *rows = htobe64(((SRetrieveTableRspForTmq*)pRetrieve)->numOfRows); + if(precision != NULL){ + *precision = ((SRetrieveTableRspForTmq*)pRetrieve)->precision; + } + } +} + static void tmqBuildRspFromWrapperInner(SMqPollRspWrapper* pWrapper, SMqClientVg* pVg, int64_t* numOfRows, SMqRspObj* pRspObj) { (*numOfRows) = 0; tstrncpy(pRspObj->topic, pWrapper->topicHandle->topicName, TSDB_TOPIC_FNAME_LEN); @@ -1655,13 +1671,7 @@ static void tmqBuildRspFromWrapperInner(SMqPollRspWrapper* pWrapper, SMqClientVg void* rawData = NULL; int64_t rows = 0; // deal with compatibility - if(*(int64_t*)pRetrieve == 0){ - rawData = ((SRetrieveTableRsp*)pRetrieve)->data; - rows = htobe64(((SRetrieveTableRsp*)pRetrieve)->numOfRows); - }else if(*(int64_t*)pRetrieve == 1){ - rawData = ((SRetrieveTableRspForTmq*)pRetrieve)->data; - rows = htobe64(((SRetrieveTableRspForTmq*)pRetrieve)->numOfRows); - } + tmqGetRawDataRowsPrecisionFromRes(pRetrieve, &rawData, &rows, NULL); pVg->numOfRows += rows; (*numOfRows) += rows; @@ -2634,18 +2644,22 @@ SReqResultInfo* tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4) { pRspObj->resIter++; if (pRspObj->resIter < pRspObj->rsp.blockNum) { - SRetrieveTableRspForTmq* pRetrieveTmq = - (SRetrieveTableRspForTmq*)taosArrayGetP(pRspObj->rsp.blockData, pRspObj->resIter); if (pRspObj->rsp.withSchema) { doFreeReqResultInfo(&pRspObj->resInfo); SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(pRspObj->rsp.blockSchema, pRspObj->resIter); setResSchemaInfo(&pRspObj->resInfo, pSW->pSchema, pSW->nCols); } - pRspObj->resInfo.pData = (void*)pRetrieveTmq->data; - pRspObj->resInfo.numOfRows = htobe64(pRetrieveTmq->numOfRows); + void* pRetrieve = taosArrayGetP(pRspObj->rsp.blockData, pRspObj->resIter); + void* rawData = NULL; + int64_t rows = 0; + int32_t precision = 0; + tmqGetRawDataRowsPrecisionFromRes(pRetrieve, &rawData, &rows, &precision); + + pRspObj->resInfo.pData = rawData; + pRspObj->resInfo.numOfRows = rows; pRspObj->resInfo.current = 0; - pRspObj->resInfo.precision = pRetrieveTmq->precision; + pRspObj->resInfo.precision = precision; // TODO handle the compressed case pRspObj->resInfo.totalRows += pRspObj->resInfo.numOfRows; diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index d2164b024b..69b2a2e6a3 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -535,8 +535,8 @@ int32_t blockDataUpdatePkRange(SSDataBlock* pDataBlock, int32_t pkColumnIndex, b if (asc) { if (IS_NUMERIC_TYPE(pColInfoData->info.type)) { - pDataBlock->info.pks[0].val = *(int32_t*) skey; - pDataBlock->info.pks[1].val = *(int32_t*) ekey; + GET_TYPED_DATA(pDataBlock->info.pks[0].val, int64_t, pColInfoData->info.type, skey); + GET_TYPED_DATA(pDataBlock->info.pks[1].val, int64_t, pColInfoData->info.type, ekey); } else { // todo refactor memcpy(pDataBlock->info.pks[0].pData, varDataVal(skey), varDataLen(skey)); pDataBlock->info.pks[0].nData = varDataLen(skey); @@ -546,8 +546,8 @@ int32_t blockDataUpdatePkRange(SSDataBlock* pDataBlock, int32_t pkColumnIndex, b } } else { if (IS_NUMERIC_TYPE(pColInfoData->info.type)) { - pDataBlock->info.pks[0].val = *(int32_t*) ekey; - pDataBlock->info.pks[1].val = *(int32_t*) skey; + GET_TYPED_DATA(pDataBlock->info.pks[0].val, int64_t, pColInfoData->info.type, ekey); + GET_TYPED_DATA(pDataBlock->info.pks[1].val, int64_t, pColInfoData->info.type, skey); } else { // todo refactor memcpy(pDataBlock->info.pks[0].pData, varDataVal(ekey), varDataLen(ekey)); pDataBlock->info.pks[0].nData = varDataLen(ekey); @@ -1491,6 +1491,18 @@ SSDataBlock* createOneDataBlock(const SSDataBlock* pDataBlock, bool copyData) { blockDataAppendColInfo(pBlock, &colInfo); } + // prepare the pk buffer if necessary + if (IS_VAR_DATA_TYPE(pDataBlock->info.pks[0].type)) { + SValue* pVal = &pBlock->info.pks[0]; + + pVal->type = pDataBlock->info.pks[0].type; + pVal->pData = taosMemoryCalloc(1, pDataBlock->info.pks[0].nData); + + pVal = &pBlock->info.pks[1]; + pVal->type = pDataBlock->info.pks[1].type; + pVal->pData = taosMemoryCalloc(1, pDataBlock->info.pks[1].nData); + } + if (copyData) { int32_t code = blockDataEnsureCapacity(pBlock, pDataBlock->info.rows); if (code != TSDB_CODE_SUCCESS) { @@ -2188,10 +2200,14 @@ _end: return TSDB_CODE_SUCCESS; } -void buildCtbNameAddGroupId(char* ctbName, uint64_t groupId) { +void buildCtbNameAddGroupId(const char* stbName, char* ctbName, uint64_t groupId){ char tmp[TSDB_TABLE_NAME_LEN] = {0}; - snprintf(tmp, TSDB_TABLE_NAME_LEN, "_%" PRIu64, groupId); - ctbName[TSDB_TABLE_NAME_LEN - strlen(tmp) - 1] = 0; // put groupId to the end + if (stbName == NULL){ + snprintf(tmp, TSDB_TABLE_NAME_LEN, "_%"PRIu64, groupId); + }else{ + snprintf(tmp, TSDB_TABLE_NAME_LEN, "_%s_%"PRIu64, stbName, groupId); + } + ctbName[TSDB_TABLE_NAME_LEN - strlen(tmp) - 1] = 0; // put stbname + groupId to the end strcat(ctbName, tmp); } @@ -2201,6 +2217,7 @@ bool isAutoTableName(char* ctbName) { return (strlen(ctbName) == 34 && ctbName[0 bool alreadyAddGroupId(char* ctbName) { size_t len = strlen(ctbName); + if (len == 0) return false; size_t _location = len - 1; while (_location > 0) { if (ctbName[_location] < '0' || ctbName[_location] > '9') { diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 991c17c5cc..1585c12ac1 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -593,12 +593,16 @@ static int32_t tRowMergeImpl(SArray *aRowP, STSchema *pTSchema, int32_t iStart, for (int32_t iCol = 0; iCol < pTSchema->numOfCols; iCol++) { SColVal *pColVal = NULL; - for (int32_t iRow = 0; iRow < nRow; iRow++) { + for (int32_t iRow = nRow - 1; iRow >= 0; --iRow) { SColVal *pColValT = tRowIterNext(aIter[iRow]); + while (pColValT->cid < pTSchema->columns[iCol].colId) { + pColValT = tRowIterNext(aIter[iRow]); + } // todo: take strategy according to the flag if (COL_VAL_IS_VALUE(pColValT)) { pColVal = pColValT; + break; } else if (COL_VAL_IS_NULL(pColValT)) { if (pColVal == NULL) { pColVal = pColValT; @@ -1061,7 +1065,6 @@ _exit: static int32_t tRowKVUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *aColData, int32_t nColData, int32_t flag) { int32_t code = 0; - SKVIdx *pKVIdx = (SKVIdx *)pRow->data; uint8_t *pv = NULL; int32_t iColData = 0; SColData *pColData = &aColData[iColData]; @@ -1069,6 +1072,14 @@ static int32_t tRowKVUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *aCo STColumn *pTColumn = &pTSchema->columns[iTColumn]; int32_t iCol = 0; + // primary keys + uint8_t *data = pRow->data; + SPrimaryKeyIndex index; + for (int32_t i = 0; i < pRow->numOfPKs; i++) { + data += tGetPrimaryKeyIndex(data, &index); + } + + SKVIdx *pKVIdx = (SKVIdx *)data; if (pRow->flag & KV_FLG_LIT) { pv = pKVIdx->idx + pKVIdx->nCol; } else if (pRow->flag & KV_FLG_MID) { @@ -1190,11 +1201,16 @@ void tRowGetKey(SRow *row, SRowKey *key) { for (int32_t i = 0; i < row->numOfPKs; i++) { key->pks[i].type = indices[i].type; + uint8_t *tdata = data + indices[i].offset; + if (row->flag >> 4) { + tdata += tGetI16v(tdata, NULL); + } + if (IS_VAR_DATA_TYPE(indices[i].type)) { - key->pks[i].pData = data + indices[i].offset; + key->pks[i].pData = tdata; key->pks[i].pData += tGetU32v(key->pks[i].pData, &key->pks[i].nData); } else { - memcpy(&key->pks[i].val, data + indices[i].offset, tDataTypes[indices[i].type].bytes); + memcpy(&key->pks[i].val, tdata, tDataTypes[indices[i].type].bytes); } } } @@ -1238,7 +1254,8 @@ int32_t tValueCompare(const SValue *tv1, const SValue *tv2) { T_COMPARE_SCALAR_VALUE(uint64_t, &tv1->val, &tv2->val); case TSDB_DATA_TYPE_GEOMETRY: case TSDB_DATA_TYPE_BINARY: { - return strcmp((const char *)tv1->pData, (const char *)tv2->pData); + int32_t ret = strncmp((const char *)tv1->pData, (const char *)tv2->pData, TMIN(tv1->nData, tv2->nData)); + return ret ? ret : (tv1->nData < tv2->nData ? -1 : (tv1->nData > tv2->nData ? 1 : 0)); } case TSDB_DATA_TYPE_NCHAR: { int32_t ret = tasoUcs4Compare((TdUcs4 *)tv1->pData, (TdUcs4 *)tv2->pData, @@ -1286,7 +1303,7 @@ int32_t tRowKeyCompare(const void *p1, const void *p2) { return 0; } -int32_t tRowKeyAssign(SRowKey *pDst, SRowKey* pSrc) { +int32_t tRowKeyAssign(SRowKey *pDst, SRowKey *pSrc) { pDst->ts = pSrc->ts; pDst->numOfPKs = pSrc->numOfPKs; @@ -1298,8 +1315,8 @@ int32_t tRowKeyAssign(SRowKey *pDst, SRowKey* pSrc) { if (IS_NUMERIC_TYPE(pVal->type)) { pVal->val = pSrc->pks[i].val; } else { - memcpy(pVal->pData, pSrc->pks[i].pData, pVal->nData); pVal->nData = pSrc->pks[i].nData; + memcpy(pVal->pData, pSrc->pks[i].pData, pVal->nData); } } } @@ -2867,8 +2884,12 @@ int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t byt char *data) { int32_t code = 0; if (data == NULL) { - for (int32_t i = 0; i < nRows; ++i) { - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0); + if (pColData->cflag & COL_IS_KEY) { + code = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL; + } else { + for (int32_t i = 0; i < nRows; ++i) { + code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0); + } } goto _exit; } @@ -2877,8 +2898,13 @@ int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t byt for (int32_t i = 0; i < nRows; ++i) { int32_t offset = *((int32_t *)lengthOrbitmap + i); if (offset == -1) { - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0); - if (code) goto _exit; + if (pColData->cflag & COL_IS_KEY) { + code = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL; + goto _exit; + } + if ((code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0))) { + goto _exit; + } } else { if (varDataTLen(data + offset) > bytes) { uError("var data length invalid, varDataTLen(data + offset):%d <= bytes:%d", (int)varDataTLen(data + offset), @@ -2900,6 +2926,10 @@ int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t byt allValue = false; } } + if ((pColData->cflag & COL_IS_KEY) && !allValue) { + code = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL; + goto _exit; + } if (allValue) { // optimize (todo) @@ -2938,6 +2968,10 @@ int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind, int32 if (IS_VAR_DATA_TYPE(pColData->type)) { // var-length data type for (int32_t i = 0; i < pBind->num; ++i) { if (pBind->is_null && pBind->is_null[i]) { + if (pColData->cflag & COL_IS_KEY) { + code = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL; + goto _exit; + } code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0); if (code) goto _exit; } else if (pBind->length[i] > buffMaxLen) { @@ -2960,6 +2994,11 @@ int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind, int32 allValue = true; } + if ((pColData->cflag & COL_IS_KEY) && !allValue) { + code = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL; + goto _exit; + } + if (allValue) { // optimize (todo) for (int32_t i = 0; i < pBind->num; ++i) { @@ -2989,91 +3028,6 @@ _exit: return code; } -#ifdef BUILD_NO_CALL -static int32_t tColDataSwapValue(SColData *pColData, int32_t i, int32_t j) { - int32_t code = 0; - - if (IS_VAR_DATA_TYPE(pColData->type)) { - int32_t nData1 = pColData->aOffset[i + 1] - pColData->aOffset[i]; - int32_t nData2 = (j < pColData->nVal - 1) ? pColData->aOffset[j + 1] - pColData->aOffset[j] - : pColData->nData - pColData->aOffset[j]; - uint8_t *pData = taosMemoryMalloc(TMAX(nData1, nData2)); - if (pData == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _exit; - } - - if (nData1 > nData2) { - memcpy(pData, pColData->pData + pColData->aOffset[i], nData1); - memcpy(pColData->pData + pColData->aOffset[i], pColData->pData + pColData->aOffset[j], nData2); - // memmove(pColData->pData + pColData->aOffset[i] + nData2, pColData->pData + pColData->aOffset[i] + nData1, - // pColData->aOffset[j] - pColData->aOffset[i + 1]); - memmove(pColData->pData + pColData->aOffset[i] + nData2, pColData->pData + pColData->aOffset[i + 1], - pColData->aOffset[j] - pColData->aOffset[i + 1]); - memcpy(pColData->pData + pColData->aOffset[j] + nData2 - nData1, pData, nData1); - } else { - memcpy(pData, pColData->pData + pColData->aOffset[j], nData2); - memcpy(pColData->pData + pColData->aOffset[j] + nData2 - nData1, pColData->pData + pColData->aOffset[i], nData1); - // memmove(pColData->pData + pColData->aOffset[j] + nData2 - nData1, pColData->pData + pColData->aOffset[i] + - // nData1, - // pColData->aOffset[j] - pColData->aOffset[i + 1]); - memmove(pColData->pData + pColData->aOffset[i] + nData2, pColData->pData + pColData->aOffset[i + 1], - pColData->aOffset[j] - pColData->aOffset[i + 1]); - memcpy(pColData->pData + pColData->aOffset[i], pData, nData2); - } - for (int32_t k = i + 1; k <= j; ++k) { - pColData->aOffset[k] = pColData->aOffset[k] + nData2 - nData1; - } - - taosMemoryFree(pData); - } else { - uint64_t val; - memcpy(&val, &pColData->pData[TYPE_BYTES[pColData->type] * i], TYPE_BYTES[pColData->type]); - memcpy(&pColData->pData[TYPE_BYTES[pColData->type] * i], &pColData->pData[TYPE_BYTES[pColData->type] * j], - TYPE_BYTES[pColData->type]); - memcpy(&pColData->pData[TYPE_BYTES[pColData->type] * j], &val, TYPE_BYTES[pColData->type]); - } - -_exit: - return code; -} - -static void tColDataSwap(SColData *pColData, int32_t i, int32_t j) { - ASSERT(i < j); - ASSERT(j < pColData->nVal); - - switch (pColData->flag) { - case HAS_NONE: - case HAS_NULL: - break; - case (HAS_NULL | HAS_NONE): { - uint8_t bv = GET_BIT1(pColData->pBitMap, i); - SET_BIT1(pColData->pBitMap, i, GET_BIT1(pColData->pBitMap, j)); - SET_BIT1(pColData->pBitMap, j, bv); - } break; - case HAS_VALUE: { - tColDataSwapValue(pColData, i, j); - } break; - case (HAS_VALUE | HAS_NONE): - case (HAS_VALUE | HAS_NULL): { - uint8_t bv = GET_BIT1(pColData->pBitMap, i); - SET_BIT1(pColData->pBitMap, i, GET_BIT1(pColData->pBitMap, j)); - SET_BIT1(pColData->pBitMap, j, bv); - tColDataSwapValue(pColData, i, j); - } break; - case (HAS_VALUE | HAS_NULL | HAS_NONE): { - uint8_t bv = GET_BIT2(pColData->pBitMap, i); - SET_BIT2(pColData->pBitMap, i, GET_BIT2(pColData->pBitMap, j)); - SET_BIT2(pColData->pBitMap, j, bv); - tColDataSwapValue(pColData, i, j); - } break; - default: - ASSERT(0); - break; - } -} -#endif - static int32_t tColDataCopyRowCell(SColData *pFromColData, int32_t iFromRow, SColData *pToColData, int32_t iToRow) { int32_t code = TSDB_CODE_SUCCESS; @@ -3157,11 +3111,27 @@ static int32_t tColDataCopyRowAppend(SColData *aFromColData, int32_t iFromRow, S return code; } +static FORCE_INLINE void tColDataArrGetRowKey(SColData *aColData, int32_t nColData, int32_t iRow, SRowKey *key) { + SColVal cv; + + key->ts = ((TSKEY *)aColData[0].pData)[iRow]; + key->numOfPKs = 0; + + for (int i = 1; i < nColData; i++) { + if (aColData[i].cflag & COL_IS_KEY) { + ASSERT(aColData->flag == HAS_VALUE); + tColDataGetValue4(&aColData[i], iRow, &cv); + key->pks[key->numOfPKs++] = cv.value; + } else { + break; + } + } +} + static int32_t tColDataMergeSortMerge(SColData *aColData, int32_t start, int32_t mid, int32_t end, int32_t nColData) { SColData *aDstColData = NULL; - TSKEY *aKey = (TSKEY *)aColData[0].pData; - - int32_t i = start, j = mid + 1, k = 0; + int32_t i = start, j = mid + 1, k = 0; + SRowKey keyi, keyj; if (end > start) { aDstColData = taosMemoryCalloc(1, sizeof(SColData) * nColData); @@ -3171,30 +3141,25 @@ static int32_t tColDataMergeSortMerge(SColData *aColData, int32_t start, int32_t if (aDstColData == NULL) { return TSDB_CODE_OUT_OF_MEMORY; } - /* - for (int32_t i = 0; i < nColData; i++) { - tColDataCopy(&aColData[i], &aDstColData[i], tColDataDefaultMalloc, NULL); - } - */ } + tColDataArrGetRowKey(aColData, nColData, i, &keyi); + tColDataArrGetRowKey(aColData, nColData, j, &keyj); while (i <= mid && j <= end) { - if (aKey[i] <= aKey[j]) { - // tColDataCopyRow(aColData, i++, aDstColData, k++); + if (tRowKeyCompare(&keyi, &keyj) <= 0) { tColDataCopyRowAppend(aColData, i++, aDstColData, nColData); + tColDataArrGetRowKey(aColData, nColData, i, &keyi); } else { - // tColDataCopyRow(aColData, j++, aDstColData, k++); tColDataCopyRowAppend(aColData, j++, aDstColData, nColData); + tColDataArrGetRowKey(aColData, nColData, j, &keyj); } } while (i <= mid) { - // tColDataCopyRow(aColData, i++, aDstColData, k++); tColDataCopyRowAppend(aColData, i++, aDstColData, nColData); } while (j <= end) { - // tColDataCopyRow(aColData, j++, aDstColData, k++); tColDataCopyRowAppend(aColData, j++, aDstColData, nColData); } @@ -3441,12 +3406,16 @@ static void tColDataMergeImpl(SColData *pColData, int32_t iStart, int32_t iEnd / } static void tColDataMerge(SColData *aColData, int32_t nColData) { int32_t iStart = 0; + SRowKey keyStart, keyEnd; + for (;;) { if (iStart >= aColData[0].nVal - 1) break; + tColDataArrGetRowKey(aColData, nColData, iStart, &keyStart); int32_t iEnd = iStart + 1; while (iEnd < aColData[0].nVal) { - if (((TSKEY *)aColData[0].pData)[iEnd] != ((TSKEY *)aColData[0].pData)[iStart]) break; + tColDataArrGetRowKey(aColData, nColData, iEnd, &keyEnd); + if (tRowKeyCompare(&keyStart, &keyEnd) != 0) break; iEnd++; } @@ -3460,6 +3429,7 @@ static void tColDataMerge(SColData *aColData, int32_t nColData) { iStart++; } } + void tColDataSortMerge(SArray *colDataArr) { int32_t nColData = TARRAY_SIZE(colDataArr); SColData *aColData = (SColData *)TARRAY_DATA(colDataArr); @@ -3473,11 +3443,17 @@ void tColDataSortMerge(SArray *colDataArr) { int8_t doSort = 0; int8_t doMerge = 0; // scan ------- - TSKEY *aKey = (TSKEY *)aColData[0].pData; + SRowKey lastKey; + tColDataArrGetRowKey(aColData, nColData, 0, &lastKey); for (int32_t iVal = 1; iVal < aColData[0].nVal; ++iVal) { - if (aKey[iVal] > aKey[iVal - 1]) { + SRowKey key; + tColDataArrGetRowKey(aColData, nColData, iVal, &key); + + int32_t c = tRowKeyCompare(&lastKey, &key); + if (c < 0) { + lastKey = key; continue; - } else if (aKey[iVal] < aKey[iVal - 1]) { + } else if (c > 0) { doSort = 1; break; } else { @@ -3491,11 +3467,17 @@ void tColDataSortMerge(SArray *colDataArr) { } if (doMerge != 1) { + tColDataArrGetRowKey(aColData, nColData, 0, &lastKey); for (int32_t iVal = 1; iVal < aColData[0].nVal; ++iVal) { - if (aKey[iVal] == aKey[iVal - 1]) { + SRowKey key; + tColDataArrGetRowKey(aColData, nColData, iVal, &key); + + int32_t c = tRowKeyCompare(&lastKey, &key); + if (c == 0) { doMerge = 1; break; } + lastKey = key; } } diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index f70ad7674e..8512464657 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -51,8 +51,8 @@ #define ENCODESQL() \ do { \ + if (tEncodeI32(&encoder, pReq->sqlLen) < 0) return -1; \ if (pReq->sqlLen > 0 && pReq->sql != NULL) { \ - if (tEncodeI32(&encoder, pReq->sqlLen) < 0) return -1; \ if (tEncodeBinary(&encoder, pReq->sql, pReq->sqlLen) < 0) return -1; \ } \ } while (0) @@ -3025,7 +3025,7 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) { ENCODESQL(); - if (tEncodeI32(&encoder, pReq->withArbitrator) < 0) return -1; + if (tEncodeI8(&encoder, pReq->withArbitrator) < 0) return -1; tEndEncode(&encoder); @@ -3140,7 +3140,7 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) { if (tEncodeI32(&encoder, pReq->walRetentionSize) < 0) return -1; if (tEncodeI32(&encoder, pReq->keepTimeOffset) < 0) return -1; ENCODESQL(); - if (tEncodeI32(&encoder, pReq->withArbitrator) < 0) return -1; + if (tEncodeI8(&encoder, pReq->withArbitrator) < 0) return -1; tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -7648,6 +7648,16 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS if (tEncodeI64(&encoder, p->ver) < 0) return -1; } + int32_t colSize = taosArrayGetSize(pReq->pCols); + if (tEncodeI32(&encoder, colSize) < 0) return -1; + for (int32_t i = 0; i < colSize; ++i) { + SField *pField = taosArrayGet(pReq->pCols, i); + if (tEncodeI8(&encoder, pField->type) < 0) return -1; + if (tEncodeI8(&encoder, pField->flags) < 0) return -1; + if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; + if (tEncodeCStr(&encoder, pField->name) < 0) return -1; + } + tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -7753,6 +7763,27 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea } } } + int32_t colSize = 0; + if (tDecodeI32(&decoder, &colSize) < 0) return -1; + if (colSize > 0) { + pReq->pCols = taosArrayInit(colSize, sizeof(SField)); + if (pReq->pCols == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + + for (int32_t i = 0; i < colSize; ++i) { + SField field = {0}; + if (tDecodeI8(&decoder, &field.type) < 0) return -1; + if (tDecodeI8(&decoder, &field.flags) < 0) return -1; + if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; + if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; + if (taosArrayPush(pReq->pCols, &field) == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + } + } tEndDecode(&decoder); tDecoderClear(&decoder); @@ -7833,6 +7864,7 @@ void tFreeSCMCreateStreamReq(SCMCreateStreamReq *pReq) { taosArrayDestroy(pReq->pTags); taosArrayDestroy(pReq->fillNullCols); taosArrayDestroy(pReq->pVgroupVerList); + taosArrayDestroy(pReq->pCols); } int32_t tEncodeSRSmaParam(SEncoder *pCoder, const SRSmaParam *pRSmaParam) { diff --git a/source/dnode/mnode/impl/inc/mndArbGroup.h b/source/dnode/mnode/impl/inc/mndArbGroup.h index ed852cf581..fcd11310e7 100644 --- a/source/dnode/mnode/impl/inc/mndArbGroup.h +++ b/source/dnode/mnode/impl/inc/mndArbGroup.h @@ -35,6 +35,7 @@ int32_t mndSetCreateArbGroupRedoLogs(STrans *pTrans, SArbGroup *pGroup); int32_t mndSetCreateArbGroupUndoLogs(STrans *pTrans, SArbGroup *pGroup); int32_t mndSetCreateArbGroupCommitLogs(STrans *pTrans, SArbGroup *pGroup); +int32_t mndSetDropArbGroupPrepareLogs(STrans *pTrans, SArbGroup *pGroup); int32_t mndSetDropArbGroupCommitLogs(STrans *pTrans, SArbGroup *pGroup); bool mndUpdateArbGroupByHeartBeat(SArbGroup *pGroup, SVArbHbRspMember *pRspMember, int64_t nowMs, int32_t dnodeId, diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index a63157445b..924af2b0a7 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -160,6 +160,7 @@ typedef struct { ETrnConflct conflict; ETrnExec exec; EOperType oper; + bool changeless; int32_t code; int32_t failedTimes; void* rpcRsp; diff --git a/source/dnode/mnode/impl/inc/mndTrans.h b/source/dnode/mnode/impl/inc/mndTrans.h index 8689df98af..8c9ca87fb1 100644 --- a/source/dnode/mnode/impl/inc/mndTrans.h +++ b/source/dnode/mnode/impl/inc/mndTrans.h @@ -81,6 +81,7 @@ void mndTransSetDbName(STrans *pTrans, const char *dbname, const char *stbnam void mndTransSetArbGroupId(STrans *pTrans, int32_t groupId); void mndTransSetSerial(STrans *pTrans); void mndTransSetParallel(STrans *pTrans); +void mndTransSetChangeless(STrans *pTrans); void mndTransSetOper(STrans *pTrans, EOperType oper); int32_t mndTransCheckConflict(SMnode *pMnode, STrans *pTrans); #ifndef BUILD_NO_CALL diff --git a/source/dnode/mnode/impl/src/mndArbGroup.c b/source/dnode/mnode/impl/src/mndArbGroup.c index e056e698f3..92ab5274e4 100644 --- a/source/dnode/mnode/impl/src/mndArbGroup.c +++ b/source/dnode/mnode/impl/src/mndArbGroup.c @@ -260,6 +260,14 @@ int32_t mndSetCreateArbGroupCommitLogs(STrans *pTrans, SArbGroup *pGroup) { return 0; } +int32_t mndSetDropArbGroupPrepareLogs(STrans *pTrans, SArbGroup *pGroup) { + SSdbRaw *pRedoRaw = mndArbGroupActionEncode(pGroup); + if (pRedoRaw == NULL) return -1; + if (mndTransAppendPrepareLog(pTrans, pRedoRaw) != 0) return -1; + if (sdbSetRawStatus(pRedoRaw, SDB_STATUS_DROPPING) != 0) return -1; + return 0; +} + static int32_t mndSetDropArbGroupRedoLogs(STrans *pTrans, SArbGroup *pGroup) { SSdbRaw *pRedoRaw = mndArbGroupActionEncode(pGroup); if (pRedoRaw == NULL) return -1; @@ -535,10 +543,10 @@ static int32_t mndProcessArbCheckSyncTimer(SRpcMsg *pReq) { int32_t vgId = arbGroupDup.vgId; int64_t nowMs = taosGetTimestampMs(); - bool member0IsTimeout = mndCheckArbMemberHbTimeout(&arbGroupDup, 0, nowMs); - bool member1IsTimeout = mndCheckArbMemberHbTimeout(&arbGroupDup, 1, nowMs); - SArbAssignedLeader* pAssignedLeader = &arbGroupDup.assignedLeader; - int32_t currentAssignedDnodeId = pAssignedLeader->dnodeId; + bool member0IsTimeout = mndCheckArbMemberHbTimeout(&arbGroupDup, 0, nowMs); + bool member1IsTimeout = mndCheckArbMemberHbTimeout(&arbGroupDup, 1, nowMs); + SArbAssignedLeader *pAssignedLeader = &arbGroupDup.assignedLeader; + int32_t currentAssignedDnodeId = pAssignedLeader->dnodeId; // 1. has assigned && is sync => send req if (currentAssignedDnodeId != 0 && arbGroupDup.isSync == true) { @@ -667,9 +675,16 @@ static int32_t mndProcessArbUpdateGroupReq(SRpcMsg *pReq) { memcpy(newGroup.assignedLeader.token, req.assignedLeader.token, TSDB_ARB_TOKEN_SIZE); newGroup.version = req.version; - SMnode *pMnode = pReq->info.node; + SMnode *pMnode = pReq->info.node; + SArbGroup *pOldGroup = sdbAcquire(pMnode->pSdb, SDB_ARBGROUP, &newGroup.vgId); + if (!pOldGroup) { + mInfo("vgId:%d, arb skip to update arbgroup, since no obj found", newGroup.vgId); + return 0; + } + sdbRelease(pMnode->pSdb, pOldGroup); + if (mndArbGroupUpdateTrans(pMnode, &newGroup) != 0) { - mError("vgId:%d, arb failed to update arbgroup, since %s", req.vgId, terrstr()); + mError("vgId:%d, arb failed to update arbgroup, since %s", newGroup.vgId, terrstr()); ret = -1; } diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 52671f6b66..ed9333f480 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -292,16 +292,16 @@ static void storeOffsetRows(SMnode *pMnode, SMqHbReq *req, SMqConsumerObj *pCons static int32_t buildMqHbRsp(SRpcMsg *pMsg, SMqHbRsp *rsp){ int32_t tlen = tSerializeSMqHbRsp(NULL, 0, rsp); if (tlen <= 0){ - return TSDB_CODE_OUT_OF_MEMORY; + return TSDB_CODE_TMQ_INVALID_MSG; } void *buf = rpcMallocCont(tlen); if (buf == NULL) { return TSDB_CODE_OUT_OF_MEMORY; } - if(tSerializeSMqHbRsp(buf, tlen, rsp) != 0){ + if(tSerializeSMqHbRsp(buf, tlen, rsp) <= 0){ rpcFreeCont(buf); - return TSDB_CODE_OUT_OF_MEMORY; + return TSDB_CODE_TMQ_INVALID_MSG; } pMsg->info.rsp = buf; pMsg->info.rspLen = tlen; @@ -316,7 +316,7 @@ static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) { SMqConsumerObj *pConsumer = NULL; if (tDeserializeSMqHbReq(pMsg->pCont, pMsg->contLen, &req) < 0) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = TSDB_CODE_TMQ_INVALID_MSG; goto end; } diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index a1f3a24661..527105a7b8 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -1209,6 +1209,25 @@ static int32_t mndSetDropDbPrepareLogs(SMnode *pMnode, STrans *pTrans, SDbObj *p if (mndTransAppendPrepareLog(pTrans, pRedoRaw) != 0) return -1; if (sdbSetRawStatus(pRedoRaw, SDB_STATUS_DROPPING) != 0) return -1; + SSdb *pSdb = pMnode->pSdb; + void *pIter = NULL; + + while (1) { + SArbGroup *pArbGroup = NULL; + pIter = sdbFetch(pSdb, SDB_ARBGROUP, pIter, (void **)&pArbGroup); + if (pIter == NULL) break; + + if (pArbGroup->dbUid == pDb->uid) { + if (mndSetDropArbGroupPrepareLogs(pTrans,pArbGroup) != 0) { + sdbCancelFetch(pSdb, pIter); + sdbRelease(pSdb, pArbGroup); + return -1; + } + } + + sdbRelease(pSdb, pArbGroup); + } + return 0; } diff --git a/source/dnode/mnode/impl/src/mndDef.c b/source/dnode/mnode/impl/src/mndDef.c index 3f69c7def3..091edc6ab0 100644 --- a/source/dnode/mnode/impl/src/mndDef.c +++ b/source/dnode/mnode/impl/src/mndDef.c @@ -72,7 +72,9 @@ int32_t tEncodeSStreamObj(SEncoder *pEncoder, const SStreamObj *pObj) { if (tEncodeI32(pEncoder, innerSz) < 0) return -1; for (int32_t j = 0; j < innerSz; j++) { SStreamTask *pTask = taosArrayGetP(pArray, j); - pTask->ver = SSTREAM_TASK_VER; + if (pTask->ver < SSTREAM_TASK_SUBTABLE_CHANGED_VER){ + pTask->ver = SSTREAM_TASK_VER; + } if (tEncodeStreamTask(pEncoder, pTask) < 0) return -1; } } diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 7ee1b36916..79c62df766 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -1104,14 +1104,16 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) { } else if (createReq.tagVer > 0 || createReq.colVer > 0) { int32_t tagDelta = createReq.tagVer - pStb->tagVer; int32_t colDelta = createReq.colVer - pStb->colVer; - int32_t verDelta = tagDelta + colDelta; mInfo("stb:%s, already exist while create, input tagVer:%d colVer:%d, exist tagVer:%d colVer:%d", createReq.name, createReq.tagVer, createReq.colVer, pStb->tagVer, pStb->colVer); if (tagDelta <= 0 && colDelta <= 0) { mInfo("stb:%s, schema version is not incremented and nothing needs to be done", createReq.name); code = 0; goto _OVER; - } else if ((tagDelta == 1 || colDelta == 1) && (verDelta == 1)) { + } else if ((tagDelta == 1 && colDelta == 0) || + (tagDelta == 0 && colDelta == 1) || + (pStb->colVer == 1 && createReq.colVer > 1) || + (pStb->tagVer == 1 && createReq.tagVer > 1)) { isAlter = true; mInfo("stb:%s, schema version is only increased by 1 number, do alter operation", createReq.name); } else { diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 60b522f6fa..de9f626b78 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -287,6 +287,45 @@ static int32_t mndCheckCreateStreamReq(SCMCreateStreamReq *pCreate) { return 0; } +static int32_t createSchemaByFields(const SArray* pFields, SSchemaWrapper* pWrapper) { + pWrapper->nCols = taosArrayGetSize(pFields); + pWrapper->pSchema = taosMemoryCalloc(pWrapper->nCols, sizeof(SSchema)); + if (NULL == pWrapper->pSchema) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + SNode* pNode; + int32_t index = 0; + for(int32_t i = 0; i < pWrapper->nCols; i++) { + SField* pField = (SField*)taosArrayGet(pFields, i); + if (TSDB_DATA_TYPE_NULL == pField->type) { + pWrapper->pSchema[index].type = TSDB_DATA_TYPE_VARCHAR; + pWrapper->pSchema[index].bytes = VARSTR_HEADER_SIZE; + } else { + pWrapper->pSchema[index].type = pField->type; + pWrapper->pSchema[index].bytes = pField->bytes; + } + pWrapper->pSchema[index].colId = index + 1; + strcpy(pWrapper->pSchema[index].name, pField->name); + pWrapper->pSchema[index].flags = pField->flags; + index += 1; + } + + return TSDB_CODE_SUCCESS; +} + +static bool hasPrimaryKey(SSchemaWrapper* pWrapper) { + if (pWrapper->nCols < 2) { + return false; + } + for (int32_t i = 1; i < pWrapper->nCols; i++) { + if(pWrapper->pSchema[i].flags & COL_IS_KEY) { + return true; + } + } + return false; +} + static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, SCMCreateStreamReq *pCreate) { SNode *pAst = NULL; SQueryPlan *pPlan = NULL; @@ -352,8 +391,8 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, goto FAIL; } - // extract output schema from ast - if (qExtractResultSchema(pAst, (int32_t *)&pObj->outputSchema.nCols, &pObj->outputSchema.pSchema) != 0) { + // create output schema + if (createSchemaByFields(pCreate->pCols, &pObj->outputSchema) != TSDB_CODE_SUCCESS) { goto FAIL; } @@ -389,6 +428,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, pObj->outputSchema.pSchema = pFullSchema; } + bool hasKey = hasPrimaryKey(&pObj->outputSchema); SPlanContext cxt = { .pAstRoot = pAst, .topicQuery = false, @@ -398,6 +438,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, .igExpired = pObj->conf.igExpired, .deleteMark = pObj->deleteMark, .igCheckUpdate = pObj->igCheckUpdate, + .destHasPrimaryKey = hasKey, }; // using ast and param to build physical plan @@ -434,7 +475,9 @@ int32_t mndPersistTaskDeployReq(STrans *pTrans, SStreamTask *pTask) { SEncoder encoder; tEncoderInit(&encoder, NULL, 0); - pTask->ver = SSTREAM_TASK_VER; + if (pTask->ver < SSTREAM_TASK_SUBTABLE_CHANGED_VER){ + pTask->ver = SSTREAM_TASK_VER; + } tEncodeStreamTask(&encoder, pTask); int32_t size = encoder.pos; @@ -2153,41 +2196,60 @@ int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq) { SStreamObj *pStream = mndGetStreamObj(pMnode, req.streamId); if (pStream == NULL) { - mError("failed to find the stream:0x%" PRIx64 " not handle the checkpoint req", req.streamId); - terrno = TSDB_CODE_MND_STREAM_NOT_EXIST; - taosThreadMutexUnlock(&execInfo.lock); + mWarn("failed to find the stream:0x%" PRIx64 ", not handle the checkpoint req, try to acquire in buf", req.streamId); - return -1; + // not in meta-store yet, try to acquire the task in exec buffer + // the checkpoint req arrives too soon before the completion of the create stream trans. + STaskId id = {.streamId = req.streamId, .taskId = req.taskId}; + void* p = taosHashGet(execInfo.pTaskMap, &id, sizeof(id)); + if (p == NULL) { + mError("failed to find the stream:0x%" PRIx64 " in buf, not handle the checkpoint req", req.streamId); + terrno = TSDB_CODE_MND_STREAM_NOT_EXIST; + taosThreadMutexUnlock(&execInfo.lock); + return -1; + } else { + mDebug("s-task:0x%" PRIx64 "-0x%x in buf not in mnode/meta, create stream trans may not complete yet", + req.streamId, req.taskId); + } } - int32_t numOfTasks = mndGetNumOfStreamTasks(pStream); + int32_t numOfTasks = (pStream == NULL)? 0: mndGetNumOfStreamTasks(pStream); + SArray **pReqTaskList = (SArray **)taosHashGet(execInfo.pTransferStateStreams, &req.streamId, sizeof(req.streamId)); if (pReqTaskList == NULL) { SArray *pList = taosArrayInit(4, sizeof(int32_t)); - doAddTaskId(pList, req.taskId, pStream->uid, numOfTasks); + doAddTaskId(pList, req.taskId, req.streamId, numOfTasks); taosHashPut(execInfo.pTransferStateStreams, &req.streamId, sizeof(int64_t), &pList, sizeof(void *)); pReqTaskList = (SArray **)taosHashGet(execInfo.pTransferStateStreams, &req.streamId, sizeof(req.streamId)); } else { - doAddTaskId(*pReqTaskList, req.taskId, pStream->uid, numOfTasks); + doAddTaskId(*pReqTaskList, req.taskId, req.streamId, numOfTasks); } int32_t total = taosArrayGetSize(*pReqTaskList); if (total == numOfTasks) { // all tasks has send the reqs int64_t checkpointId = mndStreamGenChkpId(pMnode); - mDebug("stream:0x%" PRIx64 " all tasks req, start checkpointId:%" PRId64, pStream->uid, checkpointId); + mInfo("stream:0x%" PRIx64 " all tasks req checkpoint, start checkpointId:%" PRId64, req.streamId, checkpointId); - // TODO:handle error - int32_t code = mndProcessStreamCheckpointTrans(pMnode, pStream, checkpointId, 0, false); + if (pStream != NULL) { // TODO:handle error + int32_t code = mndProcessStreamCheckpointTrans(pMnode, pStream, checkpointId, 0, false); + } else { + // todo: wait for the create stream trans completed, and launch the checkpoint trans + // SStreamObj *pStream = mndGetStreamObj(pMnode, req.streamId); + // sleep(500ms) + } // remove this entry taosHashRemove(execInfo.pTransferStateStreams, &req.streamId, sizeof(int64_t)); int32_t numOfStreams = taosHashGetSize(execInfo.pTransferStateStreams); - mDebug("stream:0x%" PRIx64 " removed, remain streams:%d fill-history not completed", pStream->uid, numOfStreams); + mDebug("stream:0x%" PRIx64 " removed, remain streams:%d fill-history not completed", req.streamId, numOfStreams); + } + + if (pStream != NULL) { + mndReleaseStream(pMnode, pStream); } - mndReleaseStream(pMnode, pStream); taosThreadMutexUnlock(&execInfo.lock); { diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 3af372a432..41ff45038f 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -739,6 +739,8 @@ void mndTransSetSerial(STrans *pTrans) { pTrans->exec = TRN_EXEC_SERIAL; } void mndTransSetParallel(STrans *pTrans) { pTrans->exec = TRN_EXEC_PARALLEL; } +void mndTransSetChangeless(STrans *pTrans) { pTrans->changeless = true; } + void mndTransSetOper(STrans *pTrans, EOperType oper) { pTrans->oper = oper; } static int32_t mndTransSync(SMnode *pMnode, STrans *pTrans) { @@ -855,6 +857,58 @@ int32_t mndTransCheckConflict(SMnode *pMnode, STrans *pTrans) { return 0; } +static bool mndTransActionsOfSameType(SArray *pActions) { + int32_t size = taosArrayGetSize(pActions); + ETrnAct lastActType = TRANS_ACTION_NULL; + bool same = true; + for (int32_t i = 0; i < size; ++i) { + STransAction *pAction = taosArrayGet(pActions, i); + if (i > 0) { + if (lastActType != pAction->actionType) { + same = false; + break; + } + } + lastActType = pAction->actionType; + } + return same; +} + +static int32_t mndTransCheckParallelActions(SMnode *pMnode, STrans *pTrans) { + if (pTrans->exec == TRN_EXEC_PARALLEL) { + if (mndTransActionsOfSameType(pTrans->redoActions) == false) { + terrno = TSDB_CODE_MND_TRANS_INVALID_STAGE; + mError("trans:%d, types of parallel redo actions are not the same", pTrans->id); + return -1; + } + + if (pTrans->policy == TRN_POLICY_ROLLBACK) { + if (mndTransActionsOfSameType(pTrans->undoActions) == false) { + terrno = TSDB_CODE_MND_TRANS_INVALID_STAGE; + mError("trans:%d, types of parallel undo actions are not the same", pTrans->id); + return -1; + } + } + } + + return 0; +} + +static int32_t mndTransCheckCommitActions(SMnode *pMnode, STrans *pTrans) { + if (!pTrans->changeless && taosArrayGetSize(pTrans->commitActions) <= 0) { + terrno = TSDB_CODE_MND_TRANS_CLOG_IS_NULL; + mError("trans:%d, commit actions of non-changeless trans are empty", pTrans->id); + return -1; + } + if (mndTransActionsOfSameType(pTrans->commitActions) == false) { + terrno = TSDB_CODE_MND_TRANS_INVALID_STAGE; + mError("trans:%d, types of commit actions are not the same", pTrans->id); + return -1; + } + + return 0; +} + int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) { if (pTrans == NULL) return -1; @@ -862,9 +916,11 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) { return -1; } - if (taosArrayGetSize(pTrans->commitActions) <= 0) { - terrno = TSDB_CODE_MND_TRANS_CLOG_IS_NULL; - mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); + if (mndTransCheckParallelActions(pMnode, pTrans) != 0) { + return -1; + } + + if (mndTransCheckCommitActions(pMnode, pTrans) != 0) { return -1; } @@ -1281,24 +1337,25 @@ static int32_t mndTransExecuteActions(SMnode *pMnode, STrans *pTrans, SArray *pA static int32_t mndTransExecuteRedoActions(SMnode *pMnode, STrans *pTrans, bool topHalf) { int32_t code = mndTransExecuteActions(pMnode, pTrans, pTrans->redoActions, topHalf); - if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { - mError("failed to execute redoActions since:%s, code:0x%x", terrstr(), terrno); + if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS && code != TSDB_CODE_MND_TRANS_CTX_SWITCH) { + mError("trans:%d, failed to execute redoActions since:%s, code:0x%x, topHalf:%d", pTrans->id, terrstr(), terrno, + topHalf); } return code; } static int32_t mndTransExecuteUndoActions(SMnode *pMnode, STrans *pTrans, bool topHalf) { int32_t code = mndTransExecuteActions(pMnode, pTrans, pTrans->undoActions, topHalf); - if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { - mError("failed to execute undoActions since %s", terrstr()); + if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS && code != TSDB_CODE_MND_TRANS_CTX_SWITCH) { + mError("trans:%d, failed to execute undoActions since %s. topHalf:%d", pTrans->id, terrstr(), topHalf); } return code; } static int32_t mndTransExecuteCommitActions(SMnode *pMnode, STrans *pTrans, bool topHalf) { int32_t code = mndTransExecuteActions(pMnode, pTrans, pTrans->commitActions, topHalf); - if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { - mError("failed to execute commitActions since %s", terrstr()); + if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS && code != TSDB_CODE_MND_TRANS_CTX_SWITCH) { + mError("trans:%d, failed to execute commitActions since %s. topHalf:%d", pTrans->id, terrstr(), topHalf); } return code; } diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index 571f17fab6..2ee9af0486 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -2342,24 +2342,7 @@ int32_t mndAddVgroupBalanceToTrans(SMnode *pMnode, SVgObj *pVgroup, STrans *pTra return -1; } - if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, pVgroup) != 0) { - mError("trans:%d, vgid:%d failed to be balanced to dnode:%d", pTrans->id, vgid, dnodeId); - return -1; - } - mndReleaseDb(pMnode, pDb); - - SSdbRaw *pRaw = mndVgroupActionEncode(pVgroup); - if (pRaw == NULL) { - mError("trans:%d, vgid:%d failed to encode action to dnode:%d", pTrans->id, vgid, dnodeId); - return -1; - } - if (mndTransAppendCommitlog(pTrans, pRaw) != 0) { - sdbFreeRaw(pRaw); - mError("trans:%d, vgid:%d failed to append commit log dnode:%d", pTrans->id, vgid, dnodeId); - return -1; - } - (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); } else { mInfo("trans:%d, vgid:%d cant be balanced to dnode:%d, exist:%d, online:%d", pTrans->id, vgid, dnodeId, exist, online); diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 761e74b9cf..a082d33a02 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -758,9 +758,11 @@ typedef struct SBlockDataInfo { // todo: move away typedef struct { SArray *pUid; + SArray *pFirstTs; + SArray *pLastTs; + SArray *pCount; SArray *pFirstKey; SArray *pLastKey; - SArray *pCount; } SSttTableRowsInfo; typedef struct SSttBlockLoadInfo { @@ -836,7 +838,7 @@ struct SLDataIter { STimeWindow timeWindow; SVersionRange verRange; SSttBlockLoadInfo *pBlockLoadInfo; - SRowKey startRowKey; // current row key + SRowKey* pStartRowKey; // current row key __compar_fn_t comparFn; bool ignoreEarlierTs; struct SSttFileReader *pReader; @@ -870,7 +872,7 @@ typedef struct SMergeTreeConf { } SMergeTreeConf; typedef struct SSttDataInfoForTable { - SArray *pTimeWindowList; + SArray *pKeyRangeList; int64_t numOfRows; } SSttDataInfoForTable; @@ -893,11 +895,17 @@ typedef enum { } EExecMode; typedef struct { - TSKEY ts; + SRowKey rowKey; int8_t dirty; SColVal colVal; } SLastCol; +typedef struct { + TSKEY ts; + int8_t dirty; + SColVal colVal; +} SLastColV1; + int32_t tsdbOpenCache(STsdb *pTsdb); void tsdbCloseCache(STsdb *pTsdb); int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *row); diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index d564c5a36e..30b7e685a1 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -234,9 +234,9 @@ int32_t tsdbCacheNewTable(STsdb* pTsdb, int64_t uid, tb_uid_t suid, SSchemaWrapp int32_t tsdbCacheDropTable(STsdb* pTsdb, int64_t uid, tb_uid_t suid, SSchemaWrapper* pSchemaRow); int32_t tsdbCacheDropSubTables(STsdb* pTsdb, SArray* uids, tb_uid_t suid); int32_t tsdbCacheNewSTableColumn(STsdb* pTsdb, SArray* uids, int16_t cid, int8_t col_type); -int32_t tsdbCacheDropSTableColumn(STsdb* pTsdb, SArray* uids, int16_t cid, int8_t col_type); +int32_t tsdbCacheDropSTableColumn(STsdb* pTsdb, SArray* uids, int16_t cid, bool hasPrimayKey); int32_t tsdbCacheNewNTableColumn(STsdb* pTsdb, int64_t uid, int16_t cid, int8_t col_type); -int32_t tsdbCacheDropNTableColumn(STsdb* pTsdb, int64_t uid, int16_t cid, int8_t col_type); +int32_t tsdbCacheDropNTableColumn(STsdb* pTsdb, int64_t uid, int16_t cid, bool hasPrimayKey); int32_t tsdbCompact(STsdb* pTsdb, SCompactInfo* pInfo); int32_t tsdbRetention(STsdb* tsdb, int64_t now, int32_t sync); int tsdbScanAndConvertSubmitMsg(STsdb* pTsdb, SSubmitReq2* pMsg); diff --git a/source/dnode/vnode/src/meta/metaSnapshot.c b/source/dnode/vnode/src/meta/metaSnapshot.c index 702e524e38..6b57db28cf 100644 --- a/source/dnode/vnode/src/meta/metaSnapshot.c +++ b/source/dnode/vnode/src/meta/metaSnapshot.c @@ -79,6 +79,7 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) { int32_t nKey = 0; int32_t nData = 0; STbDbKey key; + SMetaInfo info; *ppData = NULL; for (;;) { @@ -91,7 +92,8 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) { goto _exit; } - if (key.version < pReader->sver) { + if (key.version < pReader->sver // + || metaGetInfo(pReader->pMeta, key.uid, &info, NULL) == TSDB_CODE_NOT_FOUND) { tdbTbcMoveToNext(pReader->pTbc); continue; } diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 3c032f193a..17adf80f06 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -449,18 +449,20 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { tsdbCacheNewSTableColumn(pTsdb, uids, cid, col_type); } else if (deltaCol == -1) { int16_t cid = -1; - int8_t col_type = -1; + bool hasPrimaryKey = false; + if (onCols >= 2) { + hasPrimaryKey = (oStbEntry.stbEntry.schemaRow.pSchema[1].flags & COL_IS_KEY) ? true : false; + } for (int i = 0, j = 0; i < nCols && j < onCols; ++i, ++j) { if (pReq->schemaRow.pSchema[i].colId != oStbEntry.stbEntry.schemaRow.pSchema[j].colId) { cid = oStbEntry.stbEntry.schemaRow.pSchema[j].colId; - col_type = oStbEntry.stbEntry.schemaRow.pSchema[j].type; break; } } if (cid != -1) { metaGetSubtables(pMeta, pReq->suid, uids); - tsdbCacheDropSTableColumn(pTsdb, uids, cid, col_type); + tsdbCacheDropSTableColumn(pTsdb, uids, cid, hasPrimaryKey); } } if (uids) taosArrayDestroy(uids); @@ -1478,6 +1480,11 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl terrno = TSDB_CODE_VND_COL_SUBSCRIBED; goto _err; } + bool hasPrimayKey = false; + if (pSchema->nCols >= 2) { + hasPrimayKey = pSchema->pSchema[1].flags & COL_IS_KEY ? true : false; + } + pSchema->version++; tlen = (pSchema->nCols - iCol - 1) * sizeof(SSchema); if (tlen) { @@ -1489,9 +1496,8 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl if (!TSDB_CACHE_NO(pMeta->pVnode->config)) { int16_t cid = pColumn->colId; - int8_t col_type = pColumn->type; - (void)tsdbCacheDropNTableColumn(pMeta->pVnode->pTsdb, entry.uid, cid, col_type); + (void)tsdbCacheDropNTableColumn(pMeta->pVnode->pTsdb, entry.uid, cid, hasPrimayKey); } break; case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES: diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 4f76b6cec9..aaba344b3c 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -101,10 +101,7 @@ int32_t tqInitialize(STQ* pTq) { return -1; } - if (streamMetaLoadAllTasks(pTq->pStreamMeta) < 0) { - return -1; - } - + /*int32_t code = */streamMetaLoadAllTasks(pTq->pStreamMeta); return 0; } diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c index ade7958f8a..d43846bcf4 100644 --- a/source/dnode/vnode/src/tq/tqSink.c +++ b/source/dnode/vnode/src/tq/tqSink.c @@ -71,8 +71,8 @@ int32_t tqBuildDeleteReq(STQ* pTq, const char* stbFullName, const SSDataBlock* p if (varTbName != NULL && varTbName != (void*)-1) { name = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN); memcpy(name, varDataVal(varTbName), varDataLen(varTbName)); - if (newSubTableRule && !isAutoTableName(name) && !alreadyAddGroupId(name) && groupId != 0) { - buildCtbNameAddGroupId(name, groupId); + if (newSubTableRule && !isAutoTableName(name) && !alreadyAddGroupId(name) && groupId != 0 && stbFullName) { + buildCtbNameAddGroupId(stbFullName, name, groupId); } } else if (stbFullName) { name = buildCtbNameByGroupId(stbFullName, groupId); @@ -182,10 +182,10 @@ void setCreateTableMsgTableName(SVCreateTbReq* pCreateTableReq, SSDataBlock* pDa int64_t gid, bool newSubTableRule) { if (pDataBlock->info.parTbName[0]) { if (newSubTableRule && !isAutoTableName(pDataBlock->info.parTbName) && - !alreadyAddGroupId(pDataBlock->info.parTbName) && gid != 0) { + !alreadyAddGroupId(pDataBlock->info.parTbName) && gid != 0 && stbFullName) { pCreateTableReq->name = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN); strcpy(pCreateTableReq->name, pDataBlock->info.parTbName); - buildCtbNameAddGroupId(pCreateTableReq->name, gid); + buildCtbNameAddGroupId(stbFullName, pCreateTableReq->name, gid); // tqDebug("gen name from:%s", pDataBlock->info.parTbName); } else { pCreateTableReq->name = taosStrdup(pDataBlock->info.parTbName); @@ -324,6 +324,7 @@ int32_t doBuildAndSendSubmitMsg(SVnode* pVnode, SStreamTask* pTask, SSubmitReq2* int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, const char* id) { int32_t oldLen = taosArrayGetSize(pExisted->aRowP); int32_t newLen = taosArrayGetSize(pNew->aRowP); + int32_t numOfPk = 0; int32_t j = 0, k = 0; SArray* pFinal = taosArrayInit(oldLen + newLen, POINTER_BYTES); @@ -335,17 +336,40 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c while (j < newLen && k < oldLen) { SRow* pNewRow = taosArrayGetP(pNew->aRowP, j); SRow* pOldRow = taosArrayGetP(pExisted->aRowP, k); - if (pNewRow->ts <= pOldRow->ts) { + if (pNewRow->ts < pOldRow->ts) { taosArrayPush(pFinal, &pNewRow); j += 1; - - if (pNewRow->ts == pOldRow->ts) { - k += 1; - tRowDestroy(pOldRow); - } - } else { + } else if (pNewRow->ts > pOldRow->ts) { taosArrayPush(pFinal, &pOldRow); k += 1; + } else { + // check for the existance of primary key + if (pNewRow->numOfPKs == 0) { + taosArrayPush(pFinal, &pNewRow); + k += 1; + j += 1; + tRowDestroy(pOldRow); + } else { + numOfPk = pNewRow->numOfPKs; + + SRowKey kNew, kOld; + tRowGetKey(pNewRow, &kNew); + tRowGetKey(pOldRow, &kOld); + + int32_t ret = tRowKeyCompare(&kNew, &kOld); + if (ret <= 0) { + taosArrayPush(pFinal, &pNewRow); + j += 1; + + if (ret == 0) { + k += 1; + tRowDestroy(pOldRow); + } + } else { + taosArrayPush(pFinal, &pOldRow); + k += 1; + } + } } } @@ -363,8 +387,8 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c taosArrayDestroy(pExisted->aRowP); pExisted->aRowP = pFinal; - tqTrace("s-task:%s rows merged, final rows:%d, uid:%" PRId64 ", existed auto-create table:%d, new-block:%d", id, - (int32_t)taosArrayGetSize(pFinal), pExisted->uid, (pExisted->pCreateTbReq != NULL), + tqTrace("s-task:%s rows merged, final rows:%d, pk:%d uid:%" PRId64 ", existed auto-create table:%d, new-block:%d", + id, (int32_t)taosArrayGetSize(pFinal), numOfPk, pExisted->uid, (pExisted->pCreateTbReq != NULL), (pNew->pCreateTbReq != NULL)); tdDestroySVCreateTbReq(pNew->pCreateTbReq); @@ -672,10 +696,14 @@ int32_t setDstTableDataUid(SVnode* pVnode, SStreamTask* pTask, SSDataBlock* pDat memset(dstTableName, 0, TSDB_TABLE_NAME_LEN); buildCtbNameByGroupIdImpl(stbFullName, groupId, dstTableName); } else { - if (pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER && pTask->subtableWithoutMd5 != 1 && - !isAutoTableName(dstTableName) && !alreadyAddGroupId(dstTableName) && groupId != 0) { + if (pTask->subtableWithoutMd5 != 1 && !isAutoTableName(dstTableName) && + !alreadyAddGroupId(dstTableName) && groupId != 0) { tqDebug("s-task:%s append groupId:%" PRId64 " for generated dstTable:%s", id, groupId, dstTableName); - buildCtbNameAddGroupId(dstTableName, groupId); + if(pTask->ver == SSTREAM_TASK_SUBTABLE_CHANGED_VER){ + buildCtbNameAddGroupId(NULL, dstTableName, groupId); + }else if(pTask->ver > SSTREAM_TASK_SUBTABLE_CHANGED_VER && stbFullName) { + buildCtbNameAddGroupId(stbFullName, dstTableName, groupId); + } } } diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c index 1b67dce9b0..0f7f74f78b 100644 --- a/source/dnode/vnode/src/tqCommon/tqCommon.c +++ b/source/dnode/vnode/src/tqCommon/tqCommon.c @@ -850,12 +850,18 @@ int32_t tqStreamTaskProcessTaskResetReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { tqDebug("s-task:%s receive task-reset msg from mnode, reset status and ready for data processing", pTask->id.idStr); + taosThreadMutexLock(&pTask->lock); + // clear flag set during do checkpoint, and open inputQ for all upstream tasks if (streamTaskGetStatus(pTask)->state == TASK_STATUS__CK) { + tqDebug("s-task:%s reset task status from checkpoint, current checkpointingId:%" PRId64 ", transId:%d", + pTask->id.idStr, pTask->chkInfo.checkpointingId, pTask->chkInfo.transId); streamTaskClearCheckInfo(pTask, true); streamTaskSetStatusReady(pTask); } + taosThreadMutexUnlock(&pTask->lock); + streamMetaReleaseTask(pMeta, pTask); return TSDB_CODE_SUCCESS; } diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index c293b63f5d..3a178f7ade 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -127,12 +127,25 @@ static void tsdbClosePgCache(STsdb *pTsdb) { #define ROCKS_KEY_LEN (sizeof(tb_uid_t) + sizeof(int16_t) + sizeof(int8_t)) +enum { + LFLAG_LAST_ROW = 0, + LFLAG_LAST = 1, + LFLAG_PRIMARY_KEY = (1 << 4), +}; + typedef struct { tb_uid_t uid; int16_t cid; - int8_t ltype; + int8_t lflag; } SLastKey; +#define LAST_COL_VERSION_BASE (((int64_t)(0x1)) << 63) +#define LAST_COL_VERSION (LAST_COL_VERSION_BASE + 2) + +#define HAS_PRIMARY_KEY(k) (((k).lflag & LFLAG_PRIMARY_KEY) == LFLAG_PRIMARY_KEY) +#define IS_LAST_ROW_KEY(k) (((k).lflag & LFLAG_LAST) == LFLAG_LAST_ROW) +#define IS_LAST_KEY(k) (((k).lflag & LFLAG_LAST) == LFLAG_LAST) + static void tsdbGetRocksPath(STsdb *pTsdb, char *path) { SVnode *pVnode = pTsdb->pVnode; vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, path, TSDB_FILENAME_LEN); @@ -167,9 +180,9 @@ static int myCmp(void *state, const char *a, size_t alen, const char *b, size_t return 1; } - if (lhs->ltype < rhs->ltype) { + if (lhs->lflag < rhs->lflag) { return -1; - } else if (lhs->ltype > rhs->ltype) { + } else if (lhs->lflag > rhs->lflag) { return 1; } @@ -322,16 +335,62 @@ static void rocksMayWrite(STsdb *pTsdb, bool force, bool read, bool lock) { } } -static SLastCol *tsdbCacheDeserialize(char const *value) { +// note: new object do not own colVal's resource, just copy the pointer +static SLastCol *tsdbCacheConvertLastColV1(SLastColV1 *pLastColV1) { + SLastCol *pLastCol = taosMemoryCalloc(1, sizeof(SLastCol)); + if (pLastCol == NULL) return NULL; + pLastCol->rowKey.ts = pLastColV1->ts; + pLastCol->rowKey.numOfPKs = 0; + pLastCol->dirty = pLastColV1->dirty; + pLastCol->colVal = pLastColV1->colVal; + + return pLastCol; +} + +static SLastCol *tsdbCacheDeserializeV1(char const *value) { if (!value) { return NULL; } - SLastCol *pLastCol = (SLastCol *)value; - SColVal *pColVal = &pLastCol->colVal; + SLastColV1 *pLastColV1 = (SLastColV1 *)value; + SColVal *pColVal = &pLastColV1->colVal; if (IS_VAR_DATA_TYPE(pColVal->value.type)) { if (pColVal->value.nData > 0) { - pColVal->value.pData = (char *)value + sizeof(*pLastCol); + pColVal->value.pData = (char *)value + sizeof(*pLastColV1); + } else { + pColVal->value.pData = NULL; + } + } + + return tsdbCacheConvertLastColV1(pLastColV1); +} + +static SLastCol *tsdbCacheDeserializeV2(char const *value) { + if (!value) { + return NULL; + } + + SLastCol *pLastCol = taosMemoryMalloc(sizeof(SLastCol)); + *pLastCol = *(SLastCol *)(value); + + char* currentPos = (char *)value + sizeof(*pLastCol); + for (int8_t i = 0; i < pLastCol->rowKey.numOfPKs; i++) { + SValue* pValue = &pLastCol->rowKey.pks[i]; + if (IS_VAR_DATA_TYPE(pValue->type)) { + if (pValue->nData > 0) { + pValue->pData = currentPos; + currentPos += pValue->nData; + } else { + pValue->pData = NULL; + } + } + } + + SColVal *pColVal = &pLastCol->colVal; + if (IS_VAR_DATA_TYPE(pColVal->value.type)) { + if (pColVal->value.nData > 0) { + pColVal->value.pData = currentPos; + currentPos += pColVal->value.nData; } else { pColVal->value.pData = NULL; } @@ -340,25 +399,68 @@ static SLastCol *tsdbCacheDeserialize(char const *value) { return pLastCol; } +static SLastCol *tsdbCacheDeserialize(char const *value) { + if (!value) { + return NULL; + } + + bool hasVersion = ((*(int64_t *)value) & LAST_COL_VERSION_BASE) == LAST_COL_VERSION_BASE; + if (!hasVersion) { + return tsdbCacheDeserializeV1(value); + } + return tsdbCacheDeserializeV2(value + sizeof(int64_t)); +} + +static uint32_t tsdbCacheCopyVarData(SValue *from, SValue *to) { + ASSERT(from->nData >= 0); + if (from->nData > 0) { + memcpy(to->pData, from->pData, from->nData); + } + to->type = from->type; + to->nData = from->nData; + return from->nData; +} + static void tsdbCacheSerialize(SLastCol *pLastCol, char **value, size_t *size) { SColVal *pColVal = &pLastCol->colVal; - size_t length = sizeof(*pLastCol); + size_t length = sizeof(int64_t) + sizeof(*pLastCol); + for (int8_t i = 0; i < pLastCol->rowKey.numOfPKs; i++) { + if (IS_VAR_DATA_TYPE(pLastCol->rowKey.pks[i].type)) { + length += pLastCol->rowKey.pks[i].nData; + } + } if (IS_VAR_DATA_TYPE(pColVal->value.type)) { length += pColVal->value.nData; } - *value = taosMemoryMalloc(length); - *(SLastCol *)(*value) = *pLastCol; - if (IS_VAR_DATA_TYPE(pColVal->value.type)) { - uint8_t *pVal = pColVal->value.pData; - SColVal *pDColVal = &((SLastCol *)(*value))->colVal; - pDColVal->value.pData = *value + sizeof(*pLastCol); - if (pColVal->value.nData > 0) { - memcpy(pDColVal->value.pData, pVal, pColVal->value.nData); - } else { - pDColVal->value.pData = NULL; + // set version + *value = taosMemoryMalloc(length); + char *currentPos = *value; + *(int64_t *)currentPos = LAST_COL_VERSION; + currentPos += sizeof(int64_t); + + // copy last col + SLastCol* pToLastCol = (SLastCol *)currentPos; + *pToLastCol = *pLastCol; + currentPos += sizeof(*pLastCol); + + // copy var data pks + for (int8_t i = 0; i < pLastCol->rowKey.numOfPKs; i++) { + SValue *pFromValue = &pLastCol->rowKey.pks[i]; + if (IS_VAR_DATA_TYPE(pFromValue->type)) { + SValue *pToValue = &pToLastCol->rowKey.pks[i]; + pToValue->pData = (pFromValue->nData == 0) ? NULL : currentPos; + currentPos += tsdbCacheCopyVarData(pFromValue, pToValue); } } + + // copy var data value + if (IS_VAR_DATA_TYPE(pColVal->value.type)) { + SValue *pFromValue = &pColVal->value; + SValue *pToValue = &pToLastCol->colVal.value; + pToValue->pData = (pFromValue->nData == 0) ? NULL : currentPos; + currentPos += tsdbCacheCopyVarData(pFromValue, pToValue); + } *size = length; } @@ -459,13 +561,16 @@ static void tsdbCacheDeleter(const void *key, size_t klen, void *value, void *ud taosMemoryFree(value); } -static int32_t tsdbCacheNewTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, int8_t col_type, int8_t ltype) { +static int32_t tsdbCacheNewTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, int8_t col_type, int8_t lflag) { int32_t code = 0; SLRUCache *pCache = pTsdb->lruCache; rocksdb_writebatch_t *wb = pTsdb->rCache.writebatch; - SLastCol noneCol = {.ts = TSKEY_MIN, .colVal = COL_VAL_NONE(cid, col_type), .dirty = 1}; - SLastCol *pLastCol = &noneCol; + SRowKey noneRowKey = {0}; + noneRowKey.ts = TSKEY_MIN; + noneRowKey.numOfPKs = 0; + SLastCol noneCol = {.rowKey = noneRowKey, .colVal = COL_VAL_NONE(cid, col_type), .dirty = 1}; + SLastCol *pLastCol = &noneCol; SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol)); *pTmpLastCol = *pLastCol; @@ -477,7 +582,7 @@ static int32_t tsdbCacheNewTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, i charge += pLastCol->colVal.value.nData; } - SLastKey *pLastKey = &(SLastKey){.ltype = ltype, .uid = uid, .cid = cid}; + SLastKey *pLastKey = &(SLastKey){.lflag = lflag, .uid = uid, .cid = cid}; LRUStatus status = taosLRUCacheInsert(pCache, pLastKey, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter, NULL, TAOS_LRU_PRIORITY_LOW, &pTsdb->flushState); if (status != TAOS_LRU_STATUS_OK) { @@ -519,7 +624,7 @@ int32_t tsdbCacheCommitNoLock(STsdb *pTsdb) { return code; } -static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, int8_t col_type, int8_t ltype) { +static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, bool hasPrimaryKey) { int32_t code = 0; // build keys & multi get from rocks @@ -527,9 +632,11 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, size_t *keys_list_sizes = taosMemoryCalloc(2, sizeof(size_t)); const size_t klen = ROCKS_KEY_LEN; + int8_t lflag = hasPrimaryKey ? LFLAG_PRIMARY_KEY : 0; + char *keys = taosMemoryCalloc(2, sizeof(SLastKey)); - ((SLastKey *)keys)[0] = (SLastKey){.ltype = 1, .uid = uid, .cid = cid}; - ((SLastKey *)keys)[1] = (SLastKey){.ltype = 0, .uid = uid, .cid = cid}; + ((SLastKey *)keys)[0] = (SLastKey){.lflag = lflag | LFLAG_LAST, .uid = uid, .cid = cid}; + ((SLastKey *)keys)[1] = (SLastKey){.lflag = lflag | LFLAG_LAST_ROW, .uid = uid, .cid = cid}; keys_list[0] = keys; keys_list[1] = keys + sizeof(SLastKey); @@ -557,10 +664,13 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, if (NULL != pLastCol) { rocksdb_writebatch_delete(wb, keys_list[0], klen); } + taosMemoryFreeClear(pLastCol); + pLastCol = tsdbCacheDeserialize(values_list[1]); if (NULL != pLastCol) { rocksdb_writebatch_delete(wb, keys_list[1], klen); } + taosMemoryFreeClear(pLastCol); rocksdb_free(values_list[0]); rocksdb_free(values_list[1]); @@ -568,9 +678,7 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, bool erase = false; LRUHandle *h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[0], klen); if (h) { - SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pTsdb->lruCache, h); erase = true; - taosLRUCacheRelease(pTsdb->lruCache, h, erase); } if (erase) { @@ -580,9 +688,7 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, erase = false; h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[1], klen); if (h) { - SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pTsdb->lruCache, h); erase = true; - taosLRUCacheRelease(pTsdb->lruCache, h, erase); } if (erase) { @@ -606,13 +712,18 @@ int32_t tsdbCacheNewTable(STsdb *pTsdb, tb_uid_t uid, tb_uid_t suid, SSchemaWrap taosThreadMutexLock(&pTsdb->lruMutex); if (suid < 0) { - int nCols = pSchemaRow->nCols; + int8_t lflag = 0; + int nCols = pSchemaRow->nCols; + if (nCols >= 2) { + lflag = (pSchemaRow->pSchema[1].flags & COL_IS_KEY) ? LFLAG_PRIMARY_KEY : 0; + } + for (int i = 0; i < nCols; ++i) { int16_t cid = pSchemaRow->pSchema[i].colId; int8_t col_type = pSchemaRow->pSchema[i].type; - (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, 0); - (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, 1); + (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, lflag | LFLAG_LAST_ROW); + (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, lflag | LFLAG_LAST); } } else { STSchema *pTSchema = NULL; @@ -622,13 +733,18 @@ int32_t tsdbCacheNewTable(STsdb *pTsdb, tb_uid_t uid, tb_uid_t suid, SSchemaWrap return -1; } - int nCols = pTSchema->numOfCols; + int8_t lflag = 0; + int nCols = pTSchema->numOfCols; + if (nCols >= 2) { + lflag = (pTSchema->columns[1].flags & COL_IS_KEY) ? LFLAG_PRIMARY_KEY : 0; + } + for (int i = 0; i < nCols; ++i) { int16_t cid = pTSchema->columns[i].colId; int8_t col_type = pTSchema->columns[i].type; - (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, 0); - (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, 1); + (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, lflag | LFLAG_LAST_ROW); + (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, lflag | LFLAG_LAST); } taosMemoryFree(pTSchema); @@ -646,14 +762,17 @@ int32_t tsdbCacheDropTable(STsdb *pTsdb, tb_uid_t uid, tb_uid_t suid, SSchemaWra (void)tsdbCacheCommitNoLock(pTsdb); - if (suid < 0) { - int nCols = pSchemaRow->nCols; + if (pSchemaRow != NULL) { + bool hasPrimayKey = false; + int nCols = pSchemaRow->nCols; + if (nCols >= 2) { + hasPrimayKey = (pSchemaRow->pSchema[1].flags & COL_IS_KEY) ? true : false; + } for (int i = 0; i < nCols; ++i) { int16_t cid = pSchemaRow->pSchema[i].colId; int8_t col_type = pSchemaRow->pSchema[i].type; - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 0); - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 1); + (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, hasPrimayKey); } } else { STSchema *pTSchema = NULL; @@ -663,13 +782,16 @@ int32_t tsdbCacheDropTable(STsdb *pTsdb, tb_uid_t uid, tb_uid_t suid, SSchemaWra return -1; } - int nCols = pTSchema->numOfCols; + bool hasPrimayKey = false; + int nCols = pTSchema->numOfCols; + if (nCols >= 2) { + hasPrimayKey = (pTSchema->columns[1].flags & COL_IS_KEY) ? true : false; + } for (int i = 0; i < nCols; ++i) { int16_t cid = pTSchema->columns[i].colId; int8_t col_type = pTSchema->columns[i].type; - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 0); - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 1); + (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, hasPrimayKey); } taosMemoryFree(pTSchema); @@ -698,13 +820,17 @@ int32_t tsdbCacheDropSubTables(STsdb *pTsdb, SArray *uids, tb_uid_t suid) { for (int i = 0; i < TARRAY_SIZE(uids); ++i) { int64_t uid = ((tb_uid_t *)TARRAY_DATA(uids))[i]; - int nCols = pTSchema->numOfCols; + bool hasPrimayKey = false; + int nCols = pTSchema->numOfCols; + if (nCols >= 2) { + hasPrimayKey = (pTSchema->columns[1].flags & COL_IS_KEY) ? true : false; + } + for (int i = 0; i < nCols; ++i) { int16_t cid = pTSchema->columns[i].colId; int8_t col_type = pTSchema->columns[i].type; - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 0); - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 1); + (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, hasPrimayKey); } } @@ -732,15 +858,14 @@ int32_t tsdbCacheNewNTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, int8_t return code; } -int32_t tsdbCacheDropNTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, int8_t col_type) { +int32_t tsdbCacheDropNTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, bool hasPrimayKey) { int32_t code = 0; taosThreadMutexLock(&pTsdb->lruMutex); (void)tsdbCacheCommitNoLock(pTsdb); - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 0); - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 1); + (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, hasPrimayKey); rocksMayWrite(pTsdb, true, false, true); @@ -768,7 +893,7 @@ int32_t tsdbCacheNewSTableColumn(STsdb *pTsdb, SArray *uids, int16_t cid, int8_t return code; } -int32_t tsdbCacheDropSTableColumn(STsdb *pTsdb, SArray *uids, int16_t cid, int8_t col_type) { +int32_t tsdbCacheDropSTableColumn(STsdb *pTsdb, SArray *uids, int16_t cid, bool hasPrimayKey) { int32_t code = 0; taosThreadMutexLock(&pTsdb->lruMutex); @@ -778,8 +903,7 @@ int32_t tsdbCacheDropSTableColumn(STsdb *pTsdb, SArray *uids, int16_t cid, int8_ for (int i = 0; i < TARRAY_SIZE(uids); ++i) { int64_t uid = ((tb_uid_t *)TARRAY_DATA(uids))[i]; - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 0); - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 1); + (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, hasPrimayKey); } rocksMayWrite(pTsdb, true, false, true); @@ -794,6 +918,58 @@ typedef struct { SLastKey key; } SIdxKey; +static void tsdbCacheUpdateLastCol(SLastCol *pLastCol, SRowKey *pRowKey, SColVal *pColVal) { + uint8_t *pVal = NULL; + int nData = 0; + + // update rowkey + pLastCol->rowKey.ts = pRowKey->ts; + pLastCol->rowKey.numOfPKs = pRowKey->numOfPKs; + for (int8_t i = 0; i < pRowKey->numOfPKs; i++) { + SValue *pPKValue = &pLastCol->rowKey.pks[i]; + SValue *pNewPKValue = &pRowKey->pks[i]; + + if (IS_VAR_DATA_TYPE(pPKValue->type)) { + pVal = pPKValue->pData; + nData = pPKValue->nData; + } + *pPKValue = *pNewPKValue; + if (IS_VAR_DATA_TYPE(pPKValue->type)) { + if (nData < pPKValue->nData) { + taosMemoryFree(pVal); + pPKValue->pData = taosMemoryCalloc(1, pNewPKValue->nData); + } else { + pPKValue->pData = pVal; + } + if (pNewPKValue->nData) { + memcpy(pPKValue->pData, pNewPKValue->pData, pNewPKValue->nData); + } + } + } + + // update colval + if (IS_VAR_DATA_TYPE(pColVal->value.type)) { + nData = pLastCol->colVal.value.nData; + pVal = pLastCol->colVal.value.pData; + } + pLastCol->colVal = *pColVal; + if (IS_VAR_DATA_TYPE(pColVal->value.type)) { + if (nData < pColVal->value.nData) { + taosMemoryFree(pVal); + pLastCol->colVal.value.pData = taosMemoryCalloc(1, pColVal->value.nData); + } else { + pLastCol->colVal.value.pData = pVal; + } + if (pColVal->value.nData) { + memcpy(pLastCol->colVal.value.pData, pColVal->value.pData, pColVal->value.nData); + } + } + + if (!pLastCol->dirty) { + pLastCol->dirty = 1; + } +} + int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow) { int32_t code = 0; @@ -821,46 +997,28 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow // 3, build keys & multi get from rocks int num_keys = TARRAY_SIZE(aColVal); - TSKEY keyTs = TSDBROW_TS(pRow); SArray *remainCols = NULL; SLRUCache *pCache = pTsdb->lruCache; + STsdbRowKey tsdbRowKey = {0}; + tsdbRowGetKey(pRow, &tsdbRowKey); + SRowKey *pRowKey = &tsdbRowKey.key; + int8_t lflag = (pRowKey->numOfPKs != 0) ? LFLAG_PRIMARY_KEY : 0; + taosThreadMutexLock(&pTsdb->lruMutex); for (int i = 0; i < num_keys; ++i) { SColVal *pColVal = (SColVal *)taosArrayGet(aColVal, i); int16_t cid = pColVal->cid; - SLastKey *key = &(SLastKey){.ltype = 0, .uid = uid, .cid = cid}; + SLastKey *key = &(SLastKey){.lflag = lflag | LFLAG_LAST_ROW, .uid = uid, .cid = cid}; size_t klen = ROCKS_KEY_LEN; LRUHandle *h = taosLRUCacheLookup(pCache, key, klen); if (h) { SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pCache, h); - if (pLastCol->ts <= keyTs) { - uint8_t *pVal = NULL; - int nData = pLastCol->colVal.value.nData; - if (IS_VAR_DATA_TYPE(pColVal->value.type)) { - pVal = pLastCol->colVal.value.pData; - } - pLastCol->ts = keyTs; - pLastCol->colVal = *pColVal; - if (IS_VAR_DATA_TYPE(pColVal->value.type)) { - if (nData < pColVal->value.nData) { - taosMemoryFree(pVal); - pLastCol->colVal.value.pData = taosMemoryCalloc(1, pColVal->value.nData); - } else { - pLastCol->colVal.value.pData = pVal; - } - if (pColVal->value.nData) { - memcpy(pLastCol->colVal.value.pData, pColVal->value.pData, pColVal->value.nData); - } - } - - if (!pLastCol->dirty) { - pLastCol->dirty = 1; - } + if (tRowKeyCompare(&pLastCol->rowKey, pRowKey) != 1) { + tsdbCacheUpdateLastCol(pLastCol, pRowKey, pColVal); } - taosLRUCacheRelease(pCache, h, false); } else { if (!remainCols) { @@ -870,36 +1028,14 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow } if (COL_VAL_IS_VALUE(pColVal)) { - key->ltype = 1; + key->lflag = lflag | LFLAG_LAST; LRUHandle *h = taosLRUCacheLookup(pCache, key, klen); if (h) { SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pCache, h); - if (pLastCol->ts <= keyTs) { - uint8_t *pVal = NULL; - int nData = pLastCol->colVal.value.nData; - if (IS_VAR_DATA_TYPE(pColVal->value.type)) { - pVal = pLastCol->colVal.value.pData; - } - pLastCol->ts = keyTs; - pLastCol->colVal = *pColVal; - if (IS_VAR_DATA_TYPE(pColVal->value.type)) { - if (nData < pColVal->value.nData) { - taosMemoryFree(pVal); - pLastCol->colVal.value.pData = taosMemoryCalloc(1, pColVal->value.nData); - } else { - pLastCol->colVal.value.pData = pVal; - } - if (pColVal->value.nData) { - memcpy(pLastCol->colVal.value.pData, pColVal->value.pData, pColVal->value.nData); - } - } - - if (!pLastCol->dirty) { - pLastCol->dirty = 1; - } + if (tRowKeyCompare(&pLastCol->rowKey, pRowKey) != 1) { + tsdbCacheUpdateLastCol(pLastCol, pRowKey, pColVal); } - taosLRUCacheRelease(pCache, h, false); } else { if (!remainCols) { @@ -943,11 +1079,11 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow SLastCol *pLastCol = tsdbCacheDeserialize(values_list[i]); - if (idxKey->key.ltype == 0) { - if (NULL == pLastCol || pLastCol->ts <= keyTs) { + if (IS_LAST_ROW_KEY(idxKey->key)) { + if (NULL == pLastCol || (tRowKeyCompare(&pLastCol->rowKey, pRowKey) != 1)) { char *value = NULL; size_t vlen = 0; - tsdbCacheSerialize(&(SLastCol){.ts = keyTs, .colVal = *pColVal}, &value, &vlen); + tsdbCacheSerialize(&(SLastCol){.rowKey = *pRowKey, .colVal = *pColVal}, &value, &vlen); // SLastKey key = (SLastKey){.ltype = 0, .uid = uid, .cid = pColVal->cid}; taosThreadMutexLock(&pTsdb->rCache.rMutex); @@ -976,10 +1112,10 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow } } else { if (COL_VAL_IS_VALUE(pColVal)) { - if (NULL == pLastCol || pLastCol->ts <= keyTs) { + if (NULL == pLastCol || (tRowKeyCompare(&pLastCol->rowKey, pRowKey) != 1)) { char *value = NULL; size_t vlen = 0; - tsdbCacheSerialize(&(SLastCol){.ts = keyTs, .colVal = *pColVal}, &value, &vlen); + tsdbCacheSerialize(&(SLastCol){.rowKey = *pRowKey, .colVal = *pColVal}, &value, &vlen); // SLastKey key = (SLastKey){.ltype = 1, .uid = uid, .cid = pColVal->cid}; taosThreadMutexLock(&pTsdb->rCache.rMutex); @@ -1007,6 +1143,8 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow taosMemoryFree(value); } } + + taosMemoryFree(pLastCol); } rocksdb_free(values_list[i]); @@ -1221,7 +1359,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr SIdxKey *idxKey = taosArrayGet(remainCols, 0); if (idxKey->key.cid != PRIMARYKEY_TIMESTAMP_COL_ID) { - SLastKey *key = &(SLastKey){.ltype = ltype, .uid = uid, .cid = PRIMARYKEY_TIMESTAMP_COL_ID}; + SLastKey *key = &(SLastKey){.lflag = ltype, .uid = uid, .cid = PRIMARYKEY_TIMESTAMP_COL_ID}; taosArrayInsert(remainCols, 0, &(SIdxKey){0, *key}); } @@ -1244,7 +1382,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr for (int i = 0; i < num_keys; ++i) { SIdxKey *idxKey = taosArrayGet(remainCols, i); slotIds[i] = pr->pSlotIds[idxKey->idx]; - if (idxKey->key.ltype == CACHESCAN_RETRIEVE_LAST >> 3) { + if (idxKey->key.lflag == CACHESCAN_RETRIEVE_LAST >> 3) { if (NULL == lastTmpIndexArray) { lastTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t)); } @@ -1290,7 +1428,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr } // still null, then make up a none col value - SLastCol noneCol = {.ts = TSKEY_MIN, + SLastCol noneCol = {.rowKey.ts = TSKEY_MIN, .colVal = COL_VAL_NONE(idxKey->key.cid, pr->pSchema->columns[slotIds[i]].type)}; if (!pLastCol) { pLastCol = &noneCol; @@ -1409,6 +1547,7 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA taosArraySet(pLastArray, idxKey->idx, &lastCol); taosArrayRemove(remainCols, j); + taosMemoryFree(pLastCol); taosMemoryFree(values_list[i]); } else { ++j; @@ -1436,7 +1575,7 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache for (int i = 0; i < num_keys; ++i) { int16_t cid = ((int16_t *)TARRAY_DATA(pCidList))[i]; - SLastKey *key = &(SLastKey){.ltype = ltype, .uid = uid, .cid = cid}; + SLastKey *key = &(SLastKey){.lflag = ltype, .uid = uid, .cid = cid}; // for select last_row, last case int32_t funcType = FUNCTION_TYPE_CACHE_LAST; if (pr->pFuncTypeList != NULL && taosArrayGetSize(pr->pFuncTypeList) > i) { @@ -1444,7 +1583,7 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache } if (((pr->type & CACHESCAN_RETRIEVE_LAST) == CACHESCAN_RETRIEVE_LAST) && FUNCTION_TYPE_CACHE_LAST_ROW == funcType) { int8_t tempType = CACHESCAN_RETRIEVE_LAST_ROW | (pr->type ^ CACHESCAN_RETRIEVE_LAST); - key->ltype = (tempType & CACHESCAN_RETRIEVE_LAST) >> 3; + key->lflag = (tempType & CACHESCAN_RETRIEVE_LAST) >> 3; } LRUHandle *h = taosLRUCacheLookup(pCache, key, ROCKS_KEY_LEN); @@ -1457,7 +1596,7 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache taosLRUCacheRelease(pCache, h, false); } else { - SLastCol noneCol = {.ts = TSKEY_MIN, .colVal = COL_VAL_NONE(cid, pr->pSchema->columns[pr->pSlotIds[i]].type)}; + SLastCol noneCol = {.rowKey.ts = TSKEY_MIN, .colVal = COL_VAL_NONE(cid, pr->pSchema->columns[pr->pSlotIds[i]].type)}; taosArrayPush(pLastArray, &noneCol); @@ -1517,12 +1656,18 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE char **keys_list = taosMemoryCalloc(num_keys * 2, sizeof(char *)); size_t *keys_list_sizes = taosMemoryCalloc(num_keys * 2, sizeof(size_t)); const size_t klen = ROCKS_KEY_LEN; + + int8_t lflag = 0; + if (num_keys >= 2) { + lflag = (pTSchema->columns[1].flags & COL_IS_KEY) ? LFLAG_PRIMARY_KEY : 0; + } + for (int i = 0; i < num_keys; ++i) { int16_t cid = pTSchema->columns[i].colId; char *keys = taosMemoryCalloc(2, sizeof(SLastKey)); - ((SLastKey *)keys)[0] = (SLastKey){.ltype = 1, .uid = uid, .cid = cid}; - ((SLastKey *)keys)[1] = (SLastKey){.ltype = 0, .uid = uid, .cid = cid}; + ((SLastKey *)keys)[0] = (SLastKey){.lflag = lflag | LFLAG_LAST, .uid = uid, .cid = cid}; + ((SLastKey *)keys)[1] = (SLastKey){.lflag = lflag | LFLAG_LAST_ROW, .uid = uid, .cid = cid}; keys_list[i] = keys; keys_list[num_keys + i] = keys + sizeof(SLastKey); @@ -1554,14 +1699,18 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE for (int i = 0; i < num_keys; ++i) { SLastCol *pLastCol = tsdbCacheDeserialize(values_list[i]); taosThreadMutexLock(&pTsdb->rCache.rMutex); - if (NULL != pLastCol && (pLastCol->ts <= eKey && pLastCol->ts >= sKey)) { + if (NULL != pLastCol && (pLastCol->rowKey.ts <= eKey && pLastCol->rowKey.ts >= sKey)) { rocksdb_writebatch_delete(wb, keys_list[i], klen); } + + taosMemoryFreeClear(pLastCol); + pLastCol = tsdbCacheDeserialize(values_list[i + num_keys]); - if (NULL != pLastCol && (pLastCol->ts <= eKey && pLastCol->ts >= sKey)) { + if (NULL != pLastCol && (pLastCol->rowKey.ts <= eKey && pLastCol->rowKey.ts >= sKey)) { rocksdb_writebatch_delete(wb, keys_list[num_keys + i], klen); } taosThreadMutexUnlock(&pTsdb->rCache.rMutex); + taosMemoryFreeClear(pLastCol); rocksdb_free(values_list[i]); rocksdb_free(values_list[i + num_keys]); @@ -1575,7 +1724,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE if (pLastCol->dirty) { pLastCol->dirty = 0; } - if (pLastCol->ts <= eKey && pLastCol->ts >= sKey) { + if (pLastCol->rowKey.ts <= eKey && pLastCol->rowKey.ts >= sKey) { erase = true; } taosLRUCacheRelease(pTsdb->lruCache, h, erase); @@ -1591,7 +1740,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE if (pLastCol->dirty) { pLastCol->dirty = 0; } - if (pLastCol->ts <= eKey && pLastCol->ts >= sKey) { + if (pLastCol->rowKey.ts <= eKey && pLastCol->rowKey.ts >= sKey) { erase = true; } taosLRUCacheRelease(pTsdb->lruCache, h, erase); @@ -3083,7 +3232,7 @@ static int32_t initLastColArrayPartial(STSchema *pTSchema, SArray **ppColArray, for (int32_t i = 0; i < nCols; ++i) { int16_t slotId = slotIds[i]; - SLastCol col = {.ts = 0, .colVal = COL_VAL_NULL(pTSchema->columns[slotId].colId, pTSchema->columns[slotId].type)}; + SLastCol col = {.rowKey.ts = 0, .colVal = COL_VAL_NULL(pTSchema->columns[slotId].colId, pTSchema->columns[slotId].type)}; taosArrayPush(pColArray, &col); } *ppColArray = pColArray; @@ -3188,12 +3337,12 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC STColumn *pTColumn = &pTSchema->columns[0]; *pColVal = COL_VAL_VALUE(pTColumn->colId, ((SValue){.type = pTColumn->type, .val = rowTs})); - taosArraySet(pColArray, 0, &(SLastCol){.ts = rowTs, .colVal = *pColVal}); + taosArraySet(pColArray, 0, &(SLastCol){.rowKey.ts = rowTs, .colVal = *pColVal}); continue; } tsdbRowGetColVal(pRow, pTSchema, slotIds[iCol], pColVal); - *pCol = (SLastCol){.ts = rowTs, .colVal = *pColVal}; + *pCol = (SLastCol){.rowKey.ts = rowTs, .colVal = *pColVal}; if (IS_VAR_DATA_TYPE(pColVal->value.type) /*&& pColVal->value.nData > 0*/) { if (pColVal->value.nData > 0) { pCol->colVal.value.pData = taosMemoryMalloc(pCol->colVal.value.nData); @@ -3243,7 +3392,7 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC tsdbRowGetColVal(pRow, pTSchema, slotIds[iCol], pColVal); if (!COL_VAL_IS_VALUE(tColVal) && COL_VAL_IS_VALUE(pColVal)) { - SLastCol lastCol = {.ts = rowTs, .colVal = *pColVal}; + SLastCol lastCol = {.rowKey.ts = rowTs, .colVal = *pColVal}; if (IS_VAR_DATA_TYPE(pColVal->value.type) /* && pColVal->value.nData > 0 */) { SLastCol *pLastCol = (SLastCol *)taosArrayGet(pColArray, iCol); taosMemoryFree(pLastCol->colVal.value.pData); @@ -3367,12 +3516,12 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, STColumn *pTColumn = &pTSchema->columns[0]; *pColVal = COL_VAL_VALUE(pTColumn->colId, ((SValue){.type = pTColumn->type, .val = rowTs})); - taosArraySet(pColArray, 0, &(SLastCol){.ts = rowTs, .colVal = *pColVal}); + taosArraySet(pColArray, 0, &(SLastCol){.rowKey.ts = rowTs, .colVal = *pColVal}); continue; } tsdbRowGetColVal(pRow, pTSchema, slotIds[iCol], pColVal); - *pCol = (SLastCol){.ts = rowTs, .colVal = *pColVal}; + *pCol = (SLastCol){.rowKey.ts = rowTs, .colVal = *pColVal}; if (IS_VAR_DATA_TYPE(pColVal->value.type) /*&& pColVal->value.nData > 0*/) { if (pColVal->value.nData > 0) { pCol->colVal.value.pData = taosMemoryMalloc(pCol->colVal.value.nData); diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index 195ca59e9a..dd5da28b6b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -92,7 +92,7 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p p = (SFirstLastRes*)varDataVal(pRes[i]); - p->ts = pColVal->ts; + p->ts = pColVal->rowKey.ts; ts = p->ts; p->isNull = !COL_VAL_IS_VALUE(&pColVal->colVal); // allNullRow = p->isNull & allNullRow; @@ -399,12 +399,12 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 for (int32_t i = 0; i < pr->numOfCols; ++i) { int32_t slotId = slotIds[i]; if (slotId == -1) { - SLastCol p = {.ts = INT64_MIN, .colVal.value.type = TSDB_DATA_TYPE_BOOL, .colVal.flag = CV_FLAG_NULL}; + SLastCol p = {.rowKey.ts = INT64_MIN, .colVal.value.type = TSDB_DATA_TYPE_BOOL, .colVal.flag = CV_FLAG_NULL}; taosArrayPush(pLastCols, &p); continue; } struct STColumn* pCol = &pr->pSchema->columns[slotId]; - SLastCol p = {.ts = INT64_MIN, .colVal.value.type = pCol->type, .colVal.flag = CV_FLAG_NULL}; + SLastCol p = {.rowKey.ts = INT64_MIN, .colVal.value.type = pCol->type, .colVal.flag = CV_FLAG_NULL}; if (IS_VAR_DATA_TYPE(pCol->type)) { p.colVal.value.pData = taosMemoryCalloc(pCol->bytes, sizeof(char)); @@ -431,7 +431,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 SLastCol* p = taosArrayGet(pLastCols, k); SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, k); - if (pColVal->ts > p->ts) { + if (pColVal->rowKey.ts > p->rowKey.ts) { if (!COL_VAL_IS_VALUE(&pColVal->colVal) && HASTYPE(pr->type, CACHESCAN_RETRIEVE_LAST)) { if (!COL_VAL_IS_VALUE(&p->colVal)) { hasNotNullRow = false; @@ -443,7 +443,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 } hasRes = true; - p->ts = pColVal->ts; + p->rowKey.ts = pColVal->rowKey.ts; if (k == 0) { if (TARRAY_SIZE(pTableUidList) == 0) { taosArrayPush(pTableUidList, &uid); @@ -452,8 +452,8 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 } } - if (pColVal->ts < singleTableLastTs && HASTYPE(pr->type, CACHESCAN_RETRIEVE_LAST)) { - singleTableLastTs = pColVal->ts; + if (pColVal->rowKey.ts < singleTableLastTs && HASTYPE(pr->type, CACHESCAN_RETRIEVE_LAST)) { + singleTableLastTs = pColVal->rowKey.ts; } if (!IS_VAR_DATA_TYPE(pColVal->colVal.value.type)) { diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index 8be8fa5bd7..be15a4fecf 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -194,18 +194,8 @@ int32_t tsdbDeleteTableData(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_uid pMemTable->nDel++; pMemTable->minVer = TMIN(pMemTable->minVer, version); pMemTable->maxVer = TMAX(pMemTable->maxVer, version); - /* - if (TSDB_CACHE_LAST_ROW(pMemTable->pTsdb->pVnode->config) && tsdbKeyCmprFn(&lastKey, &pTbData->maxKey) >= 0) { - tsdbCacheDeleteLastrow(pTsdb->lruCache, pTbData->uid, eKey); - } - if (TSDB_CACHE_LAST(pMemTable->pTsdb->pVnode->config)) { - tsdbCacheDeleteLast(pTsdb->lruCache, pTbData->uid, eKey); - } - */ - // if (eKey >= pTbData->maxKey && sKey <= pTbData->maxKey) { tsdbCacheDel(pTsdb, suid, uid, sKey, eKey); - //} tsdbTrace("vgId:%d, delete data from table suid:%" PRId64 " uid:%" PRId64 " skey:%" PRId64 " eKey:%" PRId64 " at version %" PRId64, @@ -838,4 +828,4 @@ TSDBROW *tsdbTbDataIterGet(STbDataIter *pIter) { pIter->row = pIter->pNode->row; return pIter->pRow; -} \ No newline at end of file +} diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index b3dd1dec0e..e8b1f870c3 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -75,6 +75,8 @@ void *destroySttBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) { taosArrayDestroy(pLoadInfo->info.pFirstKey); taosArrayDestroy(pLoadInfo->info.pLastKey); taosArrayDestroy(pLoadInfo->info.pCount); + taosArrayDestroy(pLoadInfo->info.pFirstTs); + taosArrayDestroy(pLoadInfo->info.pLastTs); } taosArrayDestroy(pLoadInfo->aSttBlk); @@ -359,18 +361,51 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl if (i < rows) { if (pBlockLoadInfo->info.pUid == NULL) { pBlockLoadInfo->info.pUid = taosArrayInit(rows, sizeof(int64_t)); - pBlockLoadInfo->info.pFirstKey = taosArrayInit(rows, sizeof(int64_t)); - pBlockLoadInfo->info.pLastKey = taosArrayInit(rows, sizeof(int64_t)); + pBlockLoadInfo->info.pFirstTs = taosArrayInit(rows, sizeof(int64_t)); + pBlockLoadInfo->info.pLastTs = taosArrayInit(rows, sizeof(int64_t)); pBlockLoadInfo->info.pCount = taosArrayInit(rows, sizeof(int64_t)); + + pBlockLoadInfo->info.pFirstKey = taosArrayInit(rows, sizeof(SValue)); + pBlockLoadInfo->info.pLastKey = taosArrayInit(rows, sizeof(SValue)); } if (pStatisBlkArray->data[k].maxTbid.suid == suid) { taosArrayAddBatch(pBlockLoadInfo->info.pUid, tBufferGetDataAt(&block.uids, i * sizeof(int64_t)), rows - i); - taosArrayAddBatch(pBlockLoadInfo->info.pFirstKey, + taosArrayAddBatch(pBlockLoadInfo->info.pFirstTs, tBufferGetDataAt(&block.firstKeyTimestamps, i * sizeof(int64_t)), rows - i); - taosArrayAddBatch(pBlockLoadInfo->info.pLastKey, - tBufferGetDataAt(&block.lastKeyTimestamps, i * sizeof(int64_t)), rows - i); + taosArrayAddBatch(pBlockLoadInfo->info.pLastTs, tBufferGetDataAt(&block.lastKeyTimestamps, i * sizeof(int64_t)), + rows - i); taosArrayAddBatch(pBlockLoadInfo->info.pCount, tBufferGetDataAt(&block.counts, i * sizeof(int64_t)), rows - i); + + SValue vFirst = {0}, vLast = {0}; + for (int32_t f = i; f < rows; ++f) { + int32_t code = tValueColumnGet(&block.firstKeyPKs[0], f, &vFirst); + if (code) { + break; + } + + if (IS_VAR_DATA_TYPE(vFirst.type)) { + char *p = (char *)vFirst.pData; + char *pBuf = taosMemoryMalloc(vFirst.nData); + memcpy(pBuf, p, vFirst.nData); + vFirst.pData = (uint8_t *)pBuf; + } + taosArrayPush(pBlockLoadInfo->info.pFirstKey, &vFirst); + + code = tValueColumnGet(&block.lastKeyPKs[0], f, &vLast); + if (code) { + break; + } + + if (IS_VAR_DATA_TYPE(vLast.type)) { + char *p = (char *)vLast.pData; + char *pBuf = taosMemoryMalloc(vLast.nData); + memcpy(pBuf, p, vLast.nData); + vLast.pData = (uint8_t *)pBuf; + } + taosArrayPush(pBlockLoadInfo->info.pLastKey, &vLast); + } + } else { STbStatisRecord record; while (i < rows) { @@ -380,9 +415,13 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl } taosArrayPush(pBlockLoadInfo->info.pUid, &record.uid); - taosArrayPush(pBlockLoadInfo->info.pFirstKey, &record.firstKey.ts); - taosArrayPush(pBlockLoadInfo->info.pLastKey, &record.lastKey.ts); taosArrayPush(pBlockLoadInfo->info.pCount, &record.count); + + taosArrayPush(pBlockLoadInfo->info.pFirstTs, &record.firstKey.ts); + taosArrayPush(pBlockLoadInfo->info.pLastTs, &record.lastKey.ts); + + taosArrayPush(pBlockLoadInfo->info.pFirstKey, &record.firstKey.pks[0]); + taosArrayPush(pBlockLoadInfo->info.pLastKey, &record.lastKey.pks[0]); i += 1; } } @@ -452,23 +491,28 @@ static int32_t uidComparFn(const void *p1, const void *p2) { } } -static void setSttInfoForCurrentTable(SSttBlockLoadInfo *pLoadInfo, uint64_t uid, STimeWindow *pTimeWindow, +static void setSttInfoForCurrentTable(SSttBlockLoadInfo *pLoadInfo, uint64_t uid, SSttKeyRange *pRange, int64_t *numOfRows) { - if (pTimeWindow == NULL || taosArrayGetSize(pLoadInfo->info.pUid) == 0) { + if (pRange == NULL || taosArrayGetSize(pLoadInfo->info.pUid) == 0) { return; } int32_t index = taosArraySearchIdx(pLoadInfo->info.pUid, &uid, uidComparFn, TD_EQ); if (index >= 0) { - pTimeWindow->skey = *(int64_t *)taosArrayGet(pLoadInfo->info.pFirstKey, index); - pTimeWindow->ekey = *(int64_t *)taosArrayGet(pLoadInfo->info.pLastKey, index); + pRange->skey.ts = *(int64_t *)taosArrayGet(pLoadInfo->info.pFirstTs, index); + pRange->ekey.ts = *(int64_t *)taosArrayGet(pLoadInfo->info.pLastTs, index); *numOfRows += *(int64_t *)taosArrayGet(pLoadInfo->info.pCount, index); + + if (pRange->skey.numOfPKs > 0) { + memcpy(&pRange->skey.pks[0], taosArrayGet(pLoadInfo->info.pFirstKey, index), sizeof(SValue)); + memcpy(&pRange->ekey.pks[0], taosArrayGet(pLoadInfo->info.pLastKey, index), sizeof(SValue)); + } } } int32_t tLDataIterOpen2(SLDataIter *pIter, SSttFileReader *pSttFileReader, int32_t cid, int8_t backward, - SMergeTreeConf *pConf, SSttBlockLoadInfo *pBlockLoadInfo, STimeWindow *pTimeWindow, + SMergeTreeConf *pConf, SSttBlockLoadInfo *pBlockLoadInfo, SSttKeyRange *pKeyRange, int64_t *numOfRows, const char *idStr) { int32_t code = TSDB_CODE_SUCCESS; @@ -481,7 +525,7 @@ int32_t tLDataIterOpen2(SLDataIter *pIter, SSttFileReader *pSttFileReader, int32 pIter->timeWindow.ekey = pConf->timewindow.ekey; pIter->comparFn = pConf->comparFn; - tRowKeyAssign(&pIter->startRowKey, pConf->pCurRowKey); + pIter->pStartRowKey = pConf->pCurRowKey; pIter->pReader = pSttFileReader; pIter->pBlockLoadInfo = pBlockLoadInfo; @@ -500,7 +544,7 @@ int32_t tLDataIterOpen2(SLDataIter *pIter, SSttFileReader *pSttFileReader, int32 } } - setSttInfoForCurrentTable(pBlockLoadInfo, pConf->uid, pTimeWindow, numOfRows); + setSttInfoForCurrentTable(pBlockLoadInfo, pConf->uid, pKeyRange, numOfRows); // find the start block, actually we could load the position to avoid repeatly searching for the start position when // the skey is updated. @@ -629,10 +673,10 @@ static void findNextValidRow(SLDataIter *pIter, const char *idStr) { continue; } - if (ts == pIter->timeWindow.skey && pIter->startRowKey.numOfPKs > 0) { + if (ts == pIter->timeWindow.skey && pIter->pStartRowKey->numOfPKs > 0) { SRowKey key; tColRowGetKey(pData, i, &key); - int32_t ret = pkCompEx(pIter->comparFn, &key, &pIter->startRowKey); + int32_t ret = pkCompEx(pIter->comparFn, &key, pIter->pStartRowKey); if (ret < 0) { continue; } @@ -646,10 +690,10 @@ static void findNextValidRow(SLDataIter *pIter, const char *idStr) { continue; } - if (ts == pIter->timeWindow.ekey && pIter->startRowKey.numOfPKs > 0) { + if (ts == pIter->timeWindow.ekey && pIter->pStartRowKey->numOfPKs > 0) { SRowKey key; tColRowGetKey(pData, i, &key); - int32_t ret = pkCompEx(pIter->comparFn, &key, &pIter->startRowKey); + int32_t ret = pkCompEx(pIter->comparFn, &key, pIter->pStartRowKey); if (ret > 0) { continue; } @@ -825,11 +869,11 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf, SSttDataInfoF memset(pIter, 0, sizeof(SLDataIter)); - STimeWindow w = {0}; - int64_t numOfRows = 0; - int64_t cid = pSttLevel->fobjArr->data[i]->f->cid; + SSttKeyRange range = {.skey.numOfPKs = pConf->pCurRowKey->numOfPKs, .ekey.numOfPKs = pConf->pCurRowKey->numOfPKs}; + int64_t numOfRows = 0; + int64_t cid = pSttLevel->fobjArr->data[i]->f->cid; - code = tLDataIterOpen2(pIter, pSttFileReader, cid, pMTree->backward, pConf, pLoadInfo, &w, &numOfRows, + code = tLDataIterOpen2(pIter, pSttFileReader, cid, pMTree->backward, pConf, pLoadInfo, &range, &numOfRows, pMTree->idStr); if (code != TSDB_CODE_SUCCESS) { goto _end; @@ -841,7 +885,7 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf, SSttDataInfoF // let's record the time window for current table of uid in the stt files if (pSttDataInfo != NULL && numOfRows > 0) { - taosArrayPush(pSttDataInfo->pTimeWindowList, &w); + taosArrayPush(pSttDataInfo->pKeyRangeList, &range); pSttDataInfo->numOfRows += numOfRows; } } else { diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index 5469eae1cd..a8a4ced517 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -49,8 +49,8 @@ static int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, i STsdbReader* pReader); static TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader); static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, SRowKey* pKey, STsdbReader* pReader); -static int32_t doMergeRowsInSttBlock(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, SRowKey* pRowKey, - SRowMerger* pMerger, int32_t pkSrcSlot, SVersionRange* pVerRange, const char* id); +static int32_t doMergeRowsInSttBlock(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, + SRowMerger* pMerger, int32_t pkSrcSlot, SVersionRange* pVerRange, const char* id); static int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, SRowKey* pCurKey, SArray* pDelList, STsdbReader* pReader); static int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, SRow* pTSRow, @@ -107,7 +107,21 @@ int32_t pkCompEx(__compar_fn_t comparFn, SRowKey* p1, SRowKey* p2) { if (p1->numOfPKs == 0) { return 0; } else { - return comparFn(&p1->pks[0].val, &p2->pks[0].val); + if (IS_VAR_DATA_TYPE(p1->pks[0].type)) { + int32_t len = TMIN(p1->pks[0].nData, p2->pks[0].nData); + int32_t ret = strncmp((char*)p1->pks[0].pData, (char*)p2->pks[0].pData, len); + if (ret == 0) { + if (p1->pks[0].nData == p2->pks[0].nData) { + return 0; + } else { + return p1->pks[0].nData > p2->pks[0].nData ? 1 : -1; + } + } else { + return ret > 0 ? 1 : -1; + } + } else { + return comparFn(&p1->pks[0].val, &p2->pks[0].val); + } } } @@ -251,9 +265,11 @@ static STimeWindow updateQueryTimeWindow(STsdb* pTsdb, STimeWindow* pWindow) { // init file iterator static int32_t initFilesetIterator(SFilesetIter* pIter, TFileSetArray* pFileSetArray, STsdbReader* pReader) { - size_t numOfFileset = TARRAY2_SIZE(pFileSetArray); + SBlockLoadSuppInfo* pInfo = &pReader->suppInfo; + size_t numOfFileset = TARRAY2_SIZE(pFileSetArray); + bool asc = ASCENDING_TRAVERSE(pReader->info.order); - pIter->index = ASCENDING_TRAVERSE(pReader->info.order) ? -1 : numOfFileset; + pIter->index = asc ? -1 : numOfFileset; pIter->order = pReader->info.order; pIter->pFilesetList = pFileSetArray; pIter->numOfFiles = numOfFileset; @@ -267,15 +283,17 @@ static int32_t initFilesetIterator(SFilesetIter* pIter, TFileSetArray* pFileSetA } } - SSttBlockReader* pLReader = pIter->pSttBlockReader; - pLReader->order = pReader->info.order; - pLReader->window = pReader->info.window; - pLReader->verRange = pReader->info.verRange; - pLReader->numOfPks = pReader->suppInfo.numOfPks; - pLReader->pkComparFn = pReader->pkComparFn; + SSttBlockReader* pSttReader = pIter->pSttBlockReader; + pSttReader->order = pReader->info.order; + pSttReader->window = pReader->info.window; + pSttReader->verRange = pReader->info.verRange; + pSttReader->numOfPks = pReader->suppInfo.numOfPks; + pSttReader->pkComparFn = pReader->pkComparFn; + pSttReader->uid = 0; + + tMergeTreeClose(&pSttReader->mergeTree); + initRowKey(&pSttReader->currentKey, INT64_MIN, pInfo->numOfPks, pInfo->pk.type, pInfo->pk.bytes, asc); - pLReader->uid = 0; - tMergeTreeClose(&pLReader->mergeTree); tsdbDebug("init fileset iterator, total files:%d %s", pIter->numOfFiles, pReader->idStr); return TSDB_CODE_SUCCESS; } @@ -1660,11 +1678,9 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* __compar_fn_t compFn = pReader->pkComparFn; int32_t pkSrcSlot = pReader->suppInfo.pkSrcSlot; - SRowKey* pSttKey = &(SRowKey){0}; + SRowKey* pSttKey = NULL; if (hasDataInSttBlock(pBlockScanInfo) && (!pBlockScanInfo->cleanSttBlocks)) { - tRowKeyAssign(pSttKey, getCurrentKeyInSttBlock(pSttBlockReader)); - } else { - pSttKey = NULL; + pSttKey = getCurrentKeyInSttBlock(pSttBlockReader); } SRowKey k; @@ -1696,10 +1712,8 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* } } - SRowKey minKey; + SRowKey minKey = k; if (pReader->info.order == TSDB_ORDER_ASC) { - minKey = k; // chosen the minimum value - if (pfKey != NULL && pkCompEx(compFn, pfKey, &minKey) < 0) { minKey = *pfKey; } @@ -1708,8 +1722,6 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* minKey = *pSttKey; } } else { - minKey = k; - if (pfKey != NULL && pkCompEx(compFn, pfKey, &minKey) > 0) { minKey = *pfKey; } @@ -1739,8 +1751,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* if (code != TSDB_CODE_SUCCESS) { return code; } - doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pSttKey, pMerger, pkSrcSlot, &pReader->info.verRange, - pReader->idStr); + doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); } if (pkCompEx(compFn, &minKey, &k) == 0) { @@ -1837,8 +1848,7 @@ static int32_t mergeFileBlockAndSttBlock(STsdbReader* pReader, SSttBlockReader* } // pSttKey will be changed when sttBlockReader iterates to the next row, so use pKey instead. - doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pKey, pMerger, pkSrcSlot, &pReader->info.verRange, - pReader->idStr); + doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); code = tsdbRowMergerGetRow(pMerger, &pTSRow); if (code != TSDB_CODE_SUCCESS) { @@ -1866,11 +1876,9 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* TSDBROW* pRow = getValidMemRow(&pBlockScanInfo->iter, pDelList, pReader); TSDBROW* piRow = getValidMemRow(&pBlockScanInfo->iiter, pDelList, pReader); - SRowKey* pSttKey = &(SRowKey){0}; + SRowKey* pSttKey = NULL; if (hasDataInSttBlock(pBlockScanInfo) && (!pBlockScanInfo->cleanSttBlocks)) { - tRowKeyAssign(pSttKey, getCurrentKeyInSttBlock(pSttBlockReader)); - } else { - pSttKey = NULL; + pSttKey = getCurrentKeyInSttBlock(pSttBlockReader); } SRowKey* pfKey = &(SRowKey){0}; @@ -1909,10 +1917,8 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* } } - SRowKey minKey = {0}; + SRowKey minKey = k; if (ASCENDING_TRAVERSE(pReader->info.order)) { - minKey = k; // let's find the minimum - if (pkCompEx(compFn, &ik, &minKey) < 0) { // minKey > ik.key.ts) { minKey = ik; } @@ -1925,7 +1931,6 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* minKey = *pSttKey; } } else { - minKey = k; // let find the maximum ts value if (pkCompEx(compFn, &ik, &minKey) > 0) { minKey = ik; } @@ -1959,8 +1964,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* return code; } - doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pSttKey, pMerger, pkSrcSlot, &pReader->info.verRange, - pReader->idStr); + doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); } if (pkCompEx(compFn, &minKey, &ik) == 0) { @@ -2141,8 +2145,9 @@ static bool isValidFileBlockRow(SBlockData* pBlockData, int32_t rowIndex, STable } static bool initSttBlockReader(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, STsdbReader* pReader) { - bool hasData = true; - bool asc = ASCENDING_TRAVERSE(pReader->info.order); + bool hasData = true; + int32_t order = pReader->info.order; + bool asc = ASCENDING_TRAVERSE(order); // the stt block reader has been initialized for this table. if (pSttBlockReader->uid == pScanInfo->uid) { @@ -2192,7 +2197,7 @@ static bool initSttBlockReader(SSttBlockReader* pSttBlockReader, STableBlockScan .rspRows = (pReader->info.execMode == READER_EXEC_ROWS), }; - SSttDataInfoForTable info = {.pTimeWindowList = taosArrayInit(4, sizeof(STimeWindow))}; + SSttDataInfoForTable info = {.pKeyRangeList = taosArrayInit(4, sizeof(SSttKeyRange))}; int32_t code = tMergeTreeOpen2(&pSttBlockReader->mergeTree, &conf, &info); if (code != TSDB_CODE_SUCCESS) { return false; @@ -2202,44 +2207,41 @@ static bool initSttBlockReader(SSttBlockReader* pSttBlockReader, STableBlockScan initDelSkylineIterator(pScanInfo, pReader->info.order, &pReader->cost); if (conf.rspRows) { - pScanInfo->cleanSttBlocks = - isCleanSttBlock(info.pTimeWindowList, &pReader->info.window, pScanInfo, pReader->info.order); - + pScanInfo->cleanSttBlocks = isCleanSttBlock(info.pKeyRangeList, &pReader->info.window, pScanInfo, order); if (pScanInfo->cleanSttBlocks) { pScanInfo->numOfRowsInStt = info.numOfRows; - pScanInfo->sttWindow.skey = INT64_MAX; - pScanInfo->sttWindow.ekey = INT64_MIN; // calculate the time window for data in stt files - for (int32_t i = 0; i < taosArrayGetSize(info.pTimeWindowList); ++i) { - STimeWindow* pWindow = taosArrayGet(info.pTimeWindowList, i); - if (pScanInfo->sttWindow.skey > pWindow->skey) { - pScanInfo->sttWindow.skey = pWindow->skey; + for (int32_t i = 0; i < taosArrayGetSize(info.pKeyRangeList); ++i) { + SSttKeyRange* pKeyRange = taosArrayGet(info.pKeyRangeList, i); + if (pkCompEx(pReader->pkComparFn, &pScanInfo->sttRange.skey, &pKeyRange->skey) > 0) { + tRowKeyAssign(&pScanInfo->sttRange.skey, &pKeyRange->skey); } - if (pScanInfo->sttWindow.ekey < pWindow->ekey) { - pScanInfo->sttWindow.ekey = pWindow->ekey; + if (pkCompEx(pReader->pkComparFn, &pScanInfo->sttRange.ekey, &pKeyRange->ekey) < 0) { + tRowKeyAssign(&pScanInfo->sttRange.ekey, &pKeyRange->ekey); } } - pScanInfo->sttKeyInfo.status = taosArrayGetSize(info.pTimeWindowList) ? STT_FILE_HAS_DATA : STT_FILE_NO_DATA; + pScanInfo->sttKeyInfo.status = taosArrayGetSize(info.pKeyRangeList) ? STT_FILE_HAS_DATA : STT_FILE_NO_DATA; + + SRowKey* p = asc? &pScanInfo->sttRange.skey:&pScanInfo->sttRange.ekey; + tRowKeyAssign(&pScanInfo->sttKeyInfo.nextProcKey, p); - // todo set the primary key value - pScanInfo->sttKeyInfo.nextProcKey.ts = asc ? pScanInfo->sttWindow.skey : pScanInfo->sttWindow.ekey; hasData = (pScanInfo->sttKeyInfo.status == STT_FILE_HAS_DATA); } else { // not clean stt blocks - INIT_TIMEWINDOW(&pScanInfo->sttWindow); //reset the time window + INIT_KEYRANGE(&pScanInfo->sttRange); //reset the time window pScanInfo->sttBlockReturned = false; hasData = nextRowFromSttBlocks(pSttBlockReader, pScanInfo, pReader->suppInfo.pkSrcSlot, &pReader->info.verRange); } } else { pScanInfo->cleanSttBlocks = false; - INIT_TIMEWINDOW(&pScanInfo->sttWindow); // reset the time window + INIT_KEYRANGE(&pScanInfo->sttRange); // reset the time window pScanInfo->sttBlockReturned = false; hasData = nextRowFromSttBlocks(pSttBlockReader, pScanInfo, pReader->suppInfo.pkSrcSlot, &pReader->info.verRange); } - taosArrayDestroy(info.pTimeWindowList); + taosArrayDestroy(info.pKeyRangeList); int64_t el = taosGetTimestampUs() - st; pReader->cost.initSttBlockReader += (el / 1000.0); @@ -2304,29 +2306,26 @@ int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBloc } } -int32_t mergeRowsInSttBlocks(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pBlockScanInfo, - STsdbReader* pReader) { - bool copied = false; - SRow* pTSRow = NULL; - SRowKey sttKey = {0}; - int32_t pkSrcSlot = pReader->suppInfo.pkSrcSlot; - - tRowKeyAssign(&sttKey, getCurrentKeyInSttBlock(pSttBlockReader)); - +int32_t mergeRowsInSttBlocks(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, STsdbReader* pReader) { + bool copied = false; + SRow* pTSRow = NULL; + int32_t pkSrcSlot = pReader->suppInfo.pkSrcSlot; SRowMerger* pMerger = &pReader->status.merger; - TSDBROW* pRow = tMergeTreeGetRow(&pSttBlockReader->mergeTree); - TSDBROW fRow = {.iRow = pRow->iRow, .type = TSDBROW_COL_FMT, .pBlockData = pRow->pBlockData}; + // let's record the last processed key + tRowKeyAssign(&pScanInfo->lastProcKey, getCurrentKeyInSttBlock(pSttBlockReader)); + + TSDBROW* pRow = tMergeTreeGetRow(&pSttBlockReader->mergeTree); + TSDBROW fRow = {.iRow = pRow->iRow, .type = TSDBROW_COL_FMT, .pBlockData = pRow->pBlockData}; tsdbTrace("fRow ptr:%p, %d, uid:%" PRIu64 ", ts:%" PRId64 " %s", pRow->pBlockData, pRow->iRow, pSttBlockReader->uid, fRow.pBlockData->aTSKEY[fRow.iRow], pReader->idStr); - int32_t code = tryCopyDistinctRowFromSttBlock(&fRow, pSttBlockReader, pBlockScanInfo, &sttKey, pReader, &copied); + int32_t code = + tryCopyDistinctRowFromSttBlock(&fRow, pSttBlockReader, pScanInfo, &pScanInfo->lastProcKey, pReader, &copied); if (code) { return code; } - tRowKeyAssign(&pBlockScanInfo->lastProcKey, &sttKey); - if (copied) { return TSDB_CODE_SUCCESS; } else { @@ -2337,14 +2336,13 @@ int32_t mergeRowsInSttBlocks(SSttBlockReader* pSttBlockReader, STableBlockScanIn TSDBROW* pRow1 = tMergeTreeGetRow(&pSttBlockReader->mergeTree); tsdbRowMergerAdd(pMerger, pRow1, NULL); - doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, &sttKey, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); - + doMergeRowsInSttBlock(pSttBlockReader, pScanInfo, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); code = tsdbRowMergerGetRow(pMerger, &pTSRow); if (code != TSDB_CODE_SUCCESS) { return code; } - code = doAppendRowFromTSRow(pReader->resBlockInfo.pResBlock, pReader, pTSRow, pBlockScanInfo); + code = doAppendRowFromTSRow(pReader->resBlockInfo.pResBlock, pReader, pTSRow, pScanInfo); taosMemoryFree(pTSRow); tsdbRowMergerClear(pMerger); @@ -2782,23 +2780,18 @@ static void buildCleanBlockFromSttFiles(STsdbReader* pReader, STableBlockScanInf pInfo->rows = pScanInfo->numOfRowsInStt; pInfo->id.uid = pScanInfo->uid; pInfo->dataLoad = 1; - pInfo->window = pScanInfo->sttWindow; + pInfo->window.skey = pScanInfo->sttRange.skey.ts; + pInfo->window.ekey = pScanInfo->sttRange.ekey.ts; setComposedBlockFlag(pReader, true); - pScanInfo->sttKeyInfo.nextProcKey.ts = asc ? pScanInfo->sttWindow.ekey + 1 : pScanInfo->sttWindow.skey - 1; + pScanInfo->sttKeyInfo.nextProcKey.ts = asc ? pScanInfo->sttRange.ekey.ts + 1 : pScanInfo->sttRange.skey.ts - 1; pScanInfo->sttKeyInfo.status = STT_FILE_NO_DATA; - pScanInfo->lastProcKey.ts = asc ? pScanInfo->sttWindow.ekey : pScanInfo->sttWindow.skey; - if (pScanInfo->lastProcKey.numOfPKs > 0) { - ASSERT(0); -// if (IS_NUMERIC_TYPE(pKey->pks[0].type)) { -// pKey->pks[0].val = asc ? pBlockInfo->lastPk.val : pBlockInfo->firstPk.val; -// } else { -// uint8_t* p = asc ? pBlockInfo->lastPk.pData : pBlockInfo->firstPk.pData; -// pKey->pks[0].nData = asc ? pBlockInfo->lastPKLen : pBlockInfo->firstPKLen; -// memcpy(pKey->pks[0].pData, p, pKey->pks[0].nData); -// } + if (asc) { + tRowKeyAssign(&pScanInfo->lastProcKey, &pScanInfo->sttRange.ekey); + } else { + tRowKeyAssign(&pScanInfo->lastProcKey, &pScanInfo->sttRange.skey); } pScanInfo->sttBlockReturned = true; @@ -3000,18 +2993,18 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { (!asc && pBlockInfo->firstKey > keyInStt)) { if (pScanInfo->cleanSttBlocks && hasDataInSttBlock(pScanInfo)) { if (asc) { // file block is located before the stt block - ASSERT(pScanInfo->sttWindow.skey > pBlockInfo->lastKey); + ASSERT(pScanInfo->sttRange.skey.ts > pBlockInfo->lastKey); } else { // stt block is before the file block - ASSERT(pScanInfo->sttWindow.ekey < pBlockInfo->firstKey); + ASSERT(pScanInfo->sttRange.ekey.ts < pBlockInfo->firstKey); } } buildCleanBlockFromDataFiles(pReader, pScanInfo, pBlockInfo, pBlockIter->index); } else { // clean stt block if (asc) { - ASSERT(pScanInfo->sttWindow.ekey < pBlockInfo->firstKey); + ASSERT(pScanInfo->sttRange.ekey.ts < pBlockInfo->firstKey); } else { - ASSERT(pScanInfo->sttWindow.skey > pBlockInfo->lastKey); + ASSERT(pScanInfo->sttRange.skey.ts > pBlockInfo->lastKey); } // return the stt file block @@ -3668,8 +3661,10 @@ int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pSc return TSDB_CODE_SUCCESS; } -int32_t doMergeRowsInSttBlock(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, SRowKey* pRowKey, - SRowMerger* pMerger, int32_t pkSrcSlot, SVersionRange* pVerRange, const char* idStr) { +int32_t doMergeRowsInSttBlock(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, SRowMerger* pMerger, + int32_t pkSrcSlot, SVersionRange* pVerRange, const char* idStr) { + SRowKey* pRowKey = &pScanInfo->lastProcKey; + while (nextRowFromSttBlocks(pSttBlockReader, pScanInfo, pkSrcSlot, pVerRange)) { SRowKey* pNextKey = getCurrentKeyInSttBlock(pSttBlockReader); diff --git a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c index 86c6b70c92..2a7b0140df 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c @@ -130,7 +130,7 @@ STableBlockScanInfo* getTableBlockScanInfo(SSHashObj* pTableMap, uint64_t uid, c return *p; } -static int32_t initSRowKey(SRowKey* pKey, int64_t ts, int32_t numOfPks, int32_t type, int32_t len, bool asc) { +int32_t initRowKey(SRowKey* pKey, int64_t ts, int32_t numOfPks, int32_t type, int32_t len, bool asc) { pKey->numOfPKs = numOfPks; pKey->ts = ts; @@ -169,30 +169,33 @@ static int32_t initSRowKey(SRowKey* pKey, int64_t ts, int32_t numOfPks, int32_t static void initLastProcKey(STableBlockScanInfo *pScanInfo, STsdbReader* pReader) { int32_t numOfPks = pReader->suppInfo.numOfPks; - bool asc = ASCENDING_TRAVERSE(pReader->info.order); + bool asc = ASCENDING_TRAVERSE(pReader->info.order); + int8_t type = pReader->suppInfo.pk.type; + int8_t bytes = pReader->suppInfo.pk.bytes; SRowKey* pRowKey = &pScanInfo->lastProcKey; if (asc) { int64_t skey = pReader->info.window.skey; int64_t ts = (skey > INT64_MIN) ? (skey - 1) : skey; - initSRowKey(pRowKey, ts, numOfPks, pReader->suppInfo.pk.type, pReader->suppInfo.pk.bytes, asc); - initSRowKey(&pScanInfo->sttKeyInfo.nextProcKey, skey, numOfPks, pReader->suppInfo.pk.type, - pReader->suppInfo.pk.bytes, asc); + initRowKey(pRowKey, ts, numOfPks, type, bytes, asc); + initRowKey(&pScanInfo->sttKeyInfo.nextProcKey, skey, numOfPks, type, bytes, asc); } else { int64_t ekey = pReader->info.window.ekey; int64_t ts = (ekey < INT64_MAX) ? (ekey + 1) : ekey; - initSRowKey(pRowKey, ts, numOfPks, pReader->suppInfo.pk.type, pReader->suppInfo.pk.bytes, asc); - initSRowKey(&pScanInfo->sttKeyInfo.nextProcKey, ekey, numOfPks, pReader->suppInfo.pk.type, - pReader->suppInfo.pk.bytes, asc); + initRowKey(pRowKey, ts, numOfPks, type, bytes, asc); + initRowKey(&pScanInfo->sttKeyInfo.nextProcKey, ekey, numOfPks, type, bytes, asc); } + + initRowKey(&pScanInfo->sttRange.skey, INT64_MAX, numOfPks, type, bytes, asc); + initRowKey(&pScanInfo->sttRange.ekey, INT64_MIN, numOfPks, type, bytes, asc); } int32_t initTableBlockScanInfo(STableBlockScanInfo* pScanInfo, uint64_t uid, SSHashObj* pTableMap, STsdbReader* pReader) { pScanInfo->uid = uid; - INIT_TIMEWINDOW(&pScanInfo->sttWindow); + INIT_KEYRANGE(&pScanInfo->sttRange); INIT_TIMEWINDOW(&pScanInfo->filesetWindow); pScanInfo->cleanSttBlocks = false; @@ -311,7 +314,7 @@ static void doCleanupInfoForNextFileset(STableBlockScanInfo* pScanInfo) { pScanInfo->cleanSttBlocks = false; pScanInfo->numOfRowsInStt = 0; pScanInfo->sttBlockReturned = false; - INIT_TIMEWINDOW(&pScanInfo->sttWindow); + INIT_KEYRANGE(&pScanInfo->sttRange); INIT_TIMEWINDOW(&pScanInfo->filesetWindow); pScanInfo->sttKeyInfo.status = STT_FILE_READER_UNINIT; } @@ -989,39 +992,39 @@ static bool overlapWithTimeWindow(STimeWindow* p1, STimeWindow* pQueryWindow, ST } static int32_t sortUidComparFn(const void* p1, const void* p2) { - const STimeWindow* px1 = p1; - const STimeWindow* px2 = p2; - if (px1->skey == px2->skey) { - return 0; - } else { - return px1->skey < px2->skey ? -1 : 1; - } + const SSttKeyRange* px1 = p1; + const SSttKeyRange* px2 = p2; + + int32_t ret = tRowKeyCompare(&px1, px2); + return ret; } -bool isCleanSttBlock(SArray* pTimewindowList, STimeWindow* pQueryWindow, STableBlockScanInfo* pScanInfo, +bool isCleanSttBlock(SArray* pKeyRangeList, STimeWindow* pQueryWindow, STableBlockScanInfo* pScanInfo, int32_t order) { // check if it overlap with del skyline - taosArraySort(pTimewindowList, sortUidComparFn); + taosArraySort(pKeyRangeList, sortUidComparFn); - int32_t num = taosArrayGetSize(pTimewindowList); + int32_t num = taosArrayGetSize(pKeyRangeList); if (num == 0) { return false; } - STimeWindow* p = taosArrayGet(pTimewindowList, 0); - if (overlapWithTimeWindow(p, pQueryWindow, pScanInfo, order)) { + SSttKeyRange* pRange = taosArrayGet(pKeyRangeList, 0); + STimeWindow w = {.skey = pRange->skey.ts, .ekey = pRange->ekey.ts}; + if (overlapWithTimeWindow(&w, pQueryWindow, pScanInfo, order)) { return false; } for (int32_t i = 0; i < num - 1; ++i) { - STimeWindow* p1 = taosArrayGet(pTimewindowList, i); - STimeWindow* p2 = taosArrayGet(pTimewindowList, i + 1); + SSttKeyRange* p1 = taosArrayGet(pKeyRangeList, i); + SSttKeyRange* p2 = taosArrayGet(pKeyRangeList, i + 1); - if (p1->ekey >= p2->skey) { + if (p1->ekey.ts >= p2->skey.ts) { return false; } - bool overlap = overlapWithTimeWindow(p2, pQueryWindow, pScanInfo, order); + STimeWindow w2 = {.skey = p2->skey.ts, .ekey = p2->ekey.ts}; + bool overlap = overlapWithTimeWindow(&w2, pQueryWindow, pScanInfo, order); if (overlap) { return false; } diff --git a/source/dnode/vnode/src/tsdb/tsdbReadUtil.h b/source/dnode/vnode/src/tsdb/tsdbReadUtil.h index c48b7479dc..af7d00e019 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadUtil.h +++ b/source/dnode/vnode/src/tsdb/tsdbReadUtil.h @@ -32,6 +32,12 @@ extern "C" { (_w)->ekey = INT64_MIN; \ } while (0); +#define INIT_KEYRANGE(_k) \ + do { \ + (_k)->skey.ts = INT64_MAX; \ + (_k)->ekey.ts = INT64_MIN; \ + } while (0); + typedef enum { READER_STATUS_SUSPEND = 0x1, READER_STATUS_NORMAL = 0x2, @@ -78,34 +84,38 @@ typedef enum ESttKeyStatus { typedef struct SSttKeyInfo { ESttKeyStatus status; // this value should be updated when switch to the next fileset SRowKey nextProcKey; - // int64_t nextProcKey; // todo remove this attribute, since it is impossible to set correct nextProcKey - // value } SSttKeyInfo; +typedef struct SSttKeyRange { + SRowKey skey; + SRowKey ekey; +} SSttKeyRange; + // clean stt file blocks: // 1. not overlap with stt blocks in other stt files of the same fileset // 2. not overlap with delete skyline // 3. not overlap with in-memory data (mem/imem) // 4. not overlap with data file blocks typedef struct STableBlockScanInfo { - uint64_t uid; - SRowKey lastProcKey; - SSttKeyInfo sttKeyInfo; - SArray* pBlockList; // block data index list, SArray - SArray* pBlockIdxList; // SArray - SArray* pMemDelData; // SArray - SArray* pFileDelData; // SArray from each file set - SIterInfo iter; // mem buffer skip list iterator - SIterInfo iiter; // imem buffer skip list iterator - SArray* delSkyline; // delete info for this table - int32_t fileDelIndex; // file block delete index - int32_t sttBlockDelIndex; // delete index for last block - bool iterInit; // whether to initialize the in-memory skip list iterator or not - bool cleanSttBlocks; // stt block is clean in current fileset - bool sttBlockReturned; // result block returned alreay - int64_t numOfRowsInStt; - STimeWindow sttWindow; // timestamp window for current stt files - STimeWindow filesetWindow; // timestamp window for current file set + uint64_t uid; + SRowKey lastProcKey; + SSttKeyInfo sttKeyInfo; + SArray* pBlockList; // block data index list, SArray + SArray* pBlockIdxList; // SArray + SArray* pMemDelData; // SArray + SArray* pFileDelData; // SArray from each file set + SIterInfo iter; // mem buffer skip list iterator + SIterInfo iiter; // imem buffer skip list iterator + SArray* delSkyline; // delete info for this table + int32_t fileDelIndex; // file block delete index + int32_t sttBlockDelIndex; // delete index for last block + bool iterInit; // whether to initialize the in-memory skip list iterator or not + bool cleanSttBlocks; // stt block is clean in current fileset + bool sttBlockReturned; // result block returned alreay + int64_t numOfRowsInStt; + SSttKeyRange sttRange; + // STimeWindow sttWindow; // timestamp window for current stt files + STimeWindow filesetWindow; // timestamp window for current file set } STableBlockScanInfo; typedef struct SResultBlockInfo { @@ -336,6 +346,7 @@ int32_t tsdbGetRowsInSttFiles(STFileSet* pFileSet, SArray* pSttFileBlockIterArra bool isCleanSttBlock(SArray* pTimewindowList, STimeWindow* pQueryWindow, STableBlockScanInfo* pScanInfo, int32_t order); bool overlapWithDelSkyline(STableBlockScanInfo* pBlockScanInfo, const SBrinRecord* pRecord, int32_t order); int32_t pkCompEx(__compar_fn_t comparFn, SRowKey* p1, SRowKey* p2); +int32_t initRowKey(SRowKey* pKey, int64_t ts, int32_t numOfPks, int32_t type, int32_t len, bool asc); typedef struct { SArray* pTombData; diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index 2b8de9aff3..201425cf89 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c @@ -695,8 +695,8 @@ SColVal *tsdbRowIterNext(STSDBRowIter *pIter) { return &pIter->cv; } - if (pIter->iColData < pIter->pRow->pBlockData->nColData) { - tColDataGetValue(&pIter->pRow->pBlockData->aColData[pIter->iColData], pIter->pRow->iRow, &pIter->cv); + if (pIter->iColData <= pIter->pRow->pBlockData->nColData) { + tColDataGetValue(&pIter->pRow->pBlockData->aColData[pIter->iColData - 1], pIter->pRow->iRow, &pIter->cv); ++pIter->iColData; return &pIter->cv; } else { diff --git a/source/libs/executor/inc/executil.h b/source/libs/executor/inc/executil.h index 1c70fd8bb6..55b803f6d4 100644 --- a/source/libs/executor/inc/executil.h +++ b/source/libs/executor/inc/executil.h @@ -162,6 +162,7 @@ bool hasRemainResults(SGroupResInfo* pGroupResInfo); int32_t getNumOfTotalRes(SGroupResInfo* pGroupResInfo); SSDataBlock* createDataBlockFromDescNode(SDataBlockDescNode* pNode); +int32_t prepareDataBlockBuf(SSDataBlock* pDataBlock, SColMatchInfo* pMatchInfo); EDealRes doTranslateTagExpr(SNode** pNode, void* pContext); int32_t getGroupIdFromTagsVal(void* pVnode, uint64_t uid, SNodeList* pGroupNode, char* keyBuf, uint64_t* pGroupId, SStorageAPI* pAPI); diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index 991d1c216a..531a89b3f7 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -451,8 +451,10 @@ typedef struct SStreamScanInfo { SExprInfo* pPseudoExpr; int32_t numOfPseudoExpr; SExprSupp tbnameCalSup; + SExprSupp* pPartTbnameSup; SExprSupp tagCalSup; int32_t primaryTsIndex; // primary time stamp slot id + int32_t primaryKeyIndex; SReadHandle readHandle; SInterval interval; // if the upstream is an interval operator, the interval info is also kept here. SColMatchInfo matchInfo; @@ -606,6 +608,8 @@ typedef struct SStreamIntervalOperatorInfo { bool clearState; SArray* pMidPullDatas; int32_t midDelIndex; + SSHashObj* pDeletedMap; + bool destHasPrimaryKey; } SStreamIntervalOperatorInfo; typedef struct SDataGroupInfo { @@ -656,6 +660,8 @@ typedef struct SStreamSessionAggOperatorInfo { SSDataBlock* pCheckpointRes; bool clearState; bool recvGetAll; + bool destHasPrimaryKey; + SSHashObj* pPkDeleted; } SStreamSessionAggOperatorInfo; typedef struct SStreamStateAggOperatorInfo { @@ -680,6 +686,8 @@ typedef struct SStreamStateAggOperatorInfo { bool reCkBlock; SSDataBlock* pCheckpointRes; bool recvGetAll; + SSHashObj* pPkDeleted; + bool destHasPrimaryKey; } SStreamStateAggOperatorInfo; typedef struct SStreamEventAggOperatorInfo { @@ -706,6 +714,8 @@ typedef struct SStreamEventAggOperatorInfo { SSDataBlock* pCheckpointRes; SFilterInfo* pStartCondInfo; SFilterInfo* pEndCondInfo; + SSHashObj* pPkDeleted; + bool destHasPrimaryKey; } SStreamEventAggOperatorInfo; typedef struct SStreamCountAggOperatorInfo { @@ -727,6 +737,8 @@ typedef struct SStreamCountAggOperatorInfo { bool reCkBlock; bool recvGetAll; SSDataBlock* pCheckpointRes; + SSHashObj* pPkDeleted; + bool destHasPrimaryKey; } SStreamCountAggOperatorInfo; typedef struct SStreamPartitionOperatorInfo { @@ -863,10 +875,8 @@ bool isOverdue(TSKEY ts, STimeWindowAggSupp* pSup); bool isCloseWindow(STimeWindow* pWin, STimeWindowAggSupp* pSup); bool isDeletedStreamWindow(STimeWindow* pWin, uint64_t groupId, void* pState, STimeWindowAggSupp* pTwSup, SStateStore* pStore); -void appendOneRowToStreamSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid, +void appendDataToSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid, uint64_t* pGp, void* pTbName); -void appendAllColumnToStreamSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, TSKEY* pCalStartTs, - TSKEY* pCalEndTs, uint64_t* pUid, uint64_t* pGp, void* pTbName); uint64_t calGroupIdByData(SPartitionBySupporter* pParSup, SExprSupp* pExprSup, SSDataBlock* pBlock, int32_t rowId); @@ -905,7 +915,7 @@ void initDownStream(struct SOperatorInfo* downstream, SStreamAggSupporter* p void getMaxTsWins(const SArray* pAllWins, SArray* pMaxWins); void initGroupResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList); void getSessionHashKey(const SSessionKey* pKey, SSessionKey* pHashKey); -void deleteSessionWinState(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHashObj* pMapUpdate, SSHashObj* pMapDelete); +void deleteSessionWinState(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHashObj* pMapUpdate, SSHashObj* pMapDelete, SSHashObj* pPkDelete, bool needAdd); int32_t getAllSessionWindow(SSHashObj* pHashMap, SSHashObj* pStUpdated); int32_t closeSessionWindow(SSHashObj* pHashMap, STimeWindowAggSupp* pTwSup, SSHashObj* pClosed); int32_t copyUpdateResult(SSHashObj** ppWinUpdated, SArray* pUpdated, __compar_fn_t compar); @@ -955,6 +965,7 @@ bool doDeleteSessionWindow(SStreamAggSupporter* pAggSup, SSessionKey* pK void saveDeleteInfo(SArray* pWins, SSessionKey key); void removeSessionResults(SStreamAggSupporter* pAggSup, SSHashObj* pHashMap, SArray* pWins); void copyDeleteWindowInfo(SArray* pResWins, SSHashObj* pStDeleted); +void copyDeleteSessionKey(SSHashObj* source, SSHashObj* dest); bool inSlidingWindow(SInterval* pInterval, STimeWindow* pWin, SDataBlockInfo* pBlockInfo); bool inCalSlidingWindow(SInterval* pInterval, STimeWindow* pWin, TSKEY calStart, TSKEY calEnd, EStreamType blockType); diff --git a/source/libs/executor/src/dataInserter.c b/source/libs/executor/src/dataInserter.c index 88fb60fc4c..06f63f5f04 100644 --- a/source/libs/executor/src/dataInserter.c +++ b/source/libs/executor/src/dataInserter.c @@ -189,8 +189,7 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp } int64_t lastTs = TSKEY_MIN; - bool updateLastRow = false; - bool disorderTs = false; + bool needSortMerge = false; for (int32_t j = 0; j < rows; ++j) { // iterate by row taosArrayClear(pVals); @@ -217,6 +216,11 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY ASSERT(pColInfoData->info.type == pCol->type); if (colDataIsNull_s(pColInfoData, j)) { + if ((pCol->flags & COL_IS_KEY)) { + qError("Primary key column should not be null, colId:%" PRIi16 ", colType:%" PRIi8, pCol->colId, pCol->type); + terrno = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL; + goto _end; + } SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type); taosArrayPush(pVals, &cv); } else { @@ -240,19 +244,22 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp if (pColInfoData->info.type < TSDB_DATA_TYPE_MAX && pColInfoData->info.type > TSDB_DATA_TYPE_NULL) { if (colDataIsNull_s(pColInfoData, j)) { if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId) { - qError("NULL value for primary key"); + qError("Primary timestamp column should not be null"); terrno = TSDB_CODE_PAR_INCORRECT_TIMESTAMP_VAL; goto _end; } + if ((pCol->flags & COL_IS_KEY)) { + qError("Primary key column should not be null, colId:%" PRIi16 ", colType:%" PRIi8, pCol->colId, pCol->type); + terrno = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL; + goto _end; + } SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type); // should use pCol->type taosArrayPush(pVals, &cv); } else { - if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId) { - if (*(int64_t*)var == lastTs) { - updateLastRow = true; - } else if (*(int64_t*)var < lastTs) { - disorderTs = true; + if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId && !needSortMerge) { + if (*(int64_t*)var <= lastTs) { + needSortMerge = true; } else { lastTs = *(int64_t*)var; } @@ -277,17 +284,10 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp tDestroySubmitTbData(&tbData, TSDB_MSG_FLG_ENCODE); goto _end; } - if (updateLastRow) { - updateLastRow = false; - SRow** lastRow = taosArrayPop(tbData.aRowP); - tRowDestroy(*lastRow); - taosArrayPush(tbData.aRowP, &pRow); - } else { - taosArrayPush(tbData.aRowP, &pRow); - } + taosArrayPush(tbData.aRowP, &pRow); } - if (disorderTs) { + if (needSortMerge) { if ((tRowSort(tbData.aRowP) != TSDB_CODE_SUCCESS) || (terrno = tRowMerge(tbData.aRowP, (STSchema*)pTSchema, 0)) != 0) { goto _end; diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 97b9b00efb..c46b45c4ea 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -45,8 +45,8 @@ static FilterCondType checkTagCond(SNode* cond); static int32_t optimizeTbnameInCond(void* metaHandle, int64_t suid, SArray* list, SNode* pTagCond, SStorageAPI* pAPI); static int32_t optimizeTbnameInCondImpl(void* metaHandle, SArray* list, SNode* pTagCond, SStorageAPI* pStoreAPI); -static int32_t getTableList(void* pVnode, SScanPhysiNode* pScanNode, SNode* pTagCond, SNode* pTagIndexCond, - STableListInfo* pListInfo, uint8_t* digest, const char* idstr, SStorageAPI* pStorageAPI); +static int32_t getTableList(void* pVnode, SScanPhysiNode* pScanNode, SNode* pTagCond, SNode* pTagIndexCond, + STableListInfo* pListInfo, uint8_t* digest, const char* idstr, SStorageAPI* pStorageAPI); static int64_t getLimit(const SNode* pLimit) { return NULL == pLimit ? -1 : ((SLimitNode*)pLimit)->limit; } static int64_t getOffset(const SNode* pLimit) { return NULL == pLimit ? -1 : ((SLimitNode*)pLimit)->offset; } @@ -250,6 +250,34 @@ SSDataBlock* createDataBlockFromDescNode(SDataBlockDescNode* pNode) { return pBlock; } +int32_t prepareDataBlockBuf(SSDataBlock* pDataBlock, SColMatchInfo* pMatchInfo) { + SDataBlockInfo* pBlockInfo = &pDataBlock->info; + + for (int32_t i = 0; i < taosArrayGetSize(pMatchInfo->pList); ++i) { + SColMatchItem* pItem = taosArrayGet(pMatchInfo->pList, i); + if (pItem->isPk) { + SColumnInfoData* pInfoData = taosArrayGet(pDataBlock->pDataBlock, pItem->dstSlotId); + pBlockInfo->pks[0].type = pInfoData->info.type; + pBlockInfo->pks[1].type = pInfoData->info.type; + + if (IS_VAR_DATA_TYPE(pItem->dataType.type)) { + pBlockInfo->pks[0].pData = taosMemoryCalloc(1, pInfoData->info.bytes); + if (pBlockInfo->pks[0].pData == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + pBlockInfo->pks[1].pData = taosMemoryCalloc(1, pInfoData->info.bytes); + if (pBlockInfo->pks[1].pData == NULL) { + taosMemoryFreeClear(pBlockInfo->pks[0].pData); + return TSDB_CODE_OUT_OF_MEMORY; + } + } + } + } + + return TSDB_CODE_SUCCESS; +} + EDealRes doTranslateTagExpr(SNode** pNode, void* pContext) { SMetaReader* mr = (SMetaReader*)pContext; if (nodeType(*pNode) == QUERY_NODE_COLUMN) { @@ -643,7 +671,8 @@ int32_t getColInfoResultForGroupby(void* pVnode, SNodeList* group, STableListInf info->groupId = calcGroupId(keyBuf, len); if (initRemainGroups) { // groupId ~ table uid - taosHashPut(pTableListInfo->remainGroups, &(info->groupId), sizeof(info->groupId), &(info->uid), sizeof(info->uid)); + taosHashPut(pTableListInfo->remainGroups, &(info->groupId), sizeof(info->groupId), &(info->uid), + sizeof(info->uid)); } } @@ -859,7 +888,7 @@ static int32_t optimizeTbnameInCondImpl(void* pVnode, SArray* pExistedUidList, S } SSDataBlock* createTagValBlockForFilter(SArray* pColList, int32_t numOfTables, SArray* pUidTagList, void* pVnode, - SStorageAPI* pStorageAPI) { + SStorageAPI* pStorageAPI) { SSDataBlock* pResBlock = createDataBlock(); if (pResBlock == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -940,11 +969,12 @@ SSDataBlock* createTagValBlockForFilter(SArray* pColList, int32_t numOfTables, S return pResBlock; } -static int32_t doSetQualifiedUid(STableListInfo* pListInfo, SArray* pUidList, const SArray* pUidTagList, bool* pResultList, bool addUid) { +static int32_t doSetQualifiedUid(STableListInfo* pListInfo, SArray* pUidList, const SArray* pUidTagList, + bool* pResultList, bool addUid) { taosArrayClear(pUidList); STableKeyInfo info = {.uid = 0, .groupId = 0}; - int32_t numOfTables = taosArrayGetSize(pUidTagList); + int32_t numOfTables = taosArrayGetSize(pUidTagList); for (int32_t i = 0; i < numOfTables; ++i) { if (pResultList[i]) { uint64_t uid = ((STUidTagInfo*)taosArrayGet(pUidTagList, i))->uid; @@ -1144,7 +1174,7 @@ int32_t getTableList(void* pVnode, SScanPhysiNode* pScanNode, SNode* pTagCond, S if (code != 0 || status == SFLT_NOT_INDEX) { // temporarily disable it for performance sake qDebug("failed to get tableIds from index, suid:%" PRIu64, pScanNode->uid); } else { - qInfo("succ to get filter result, table num: %d", (int)taosArrayGetSize(pUidList)); + qDebug("succ to get filter result, table num: %d", (int)taosArrayGetSize(pUidList)); } } } @@ -1166,7 +1196,8 @@ int32_t getTableList(void* pVnode, SScanPhysiNode* pScanNode, SNode* pTagCond, S memcpy(pPayload + sizeof(int32_t), taosArrayGet(pUidList, 0), numOfTables * sizeof(uint64_t)); } - pStorageAPI->metaFn.putCachedTableList(pVnode, pScanNode->suid, context.digest, tListLen(context.digest), pPayload, size, 1); + pStorageAPI->metaFn.putCachedTableList(pVnode, pScanNode->suid, context.digest, tListLen(context.digest), + pPayload, size, 1); digest[0] = 1; memcpy(digest + 1, context.digest, tListLen(context.digest)); } @@ -1728,7 +1759,8 @@ SColumn extractColumnFromColumnNode(SColumnNode* pColNode) { return c; } -int32_t initQueryTableDataCond(SQueryTableDataCond* pCond, const STableScanPhysiNode* pTableScanNode, const SReadHandle* readHandle) { +int32_t initQueryTableDataCond(SQueryTableDataCond* pCond, const STableScanPhysiNode* pTableScanNode, + const SReadHandle* readHandle) { pCond->order = pTableScanNode->scanSeq[0] > 0 ? TSDB_ORDER_ASC : TSDB_ORDER_DESC; pCond->numOfCols = LIST_LENGTH(pTableScanNode->scan.pScanCols); @@ -1751,8 +1783,7 @@ int32_t initQueryTableDataCond(SQueryTableDataCond* pCond, const STableScanPhysi // allowed read stt file optimization mode pCond->notLoadData = (pTableScanNode->dataRequired == FUNC_DATA_REQUIRED_NOT_LOAD) && - (pTableScanNode->scan.node.pConditions == NULL) && - (pTableScanNode->interval == 0); + (pTableScanNode->scan.node.pConditions == NULL) && (pTableScanNode->interval == 0); int32_t j = 0; for (int32_t i = 0; i < pCond->numOfCols; ++i) { @@ -1895,7 +1926,8 @@ void getNextTimeWindow(const SInterval* pInterval, STimeWindow* tw, int32_t orde int32_t factor = GET_FORWARD_DIRECTION_FACTOR(order); slidingStart = taosTimeAdd(slidingStart, factor * pInterval->sliding, pInterval->slidingUnit, pInterval->precision); tw->skey = taosTimeAdd(slidingStart, pInterval->offset, pInterval->offsetUnit, pInterval->precision); - int64_t slidingEnd = taosTimeAdd(slidingStart, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1; + int64_t slidingEnd = + taosTimeAdd(slidingStart, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1; tw->ekey = taosTimeAdd(slidingEnd, pInterval->offset, pInterval->offsetUnit, pInterval->precision); } @@ -2140,7 +2172,7 @@ int32_t buildGroupIdMapForAllTables(STableListInfo* pTableListInfo, SReadHandle* if (groupSort && groupByTbname) { taosArraySort(pTableListInfo->pTableList, orderbyGroupIdComparFn); pTableListInfo->numOfOuputGroups = numOfTables; - } else if (groupByTbname && pScanNode->groupOrderScan){ + } else if (groupByTbname && pScanNode->groupOrderScan) { pTableListInfo->numOfOuputGroups = numOfTables; } else if (groupByTbname && tsCountAlwaysReturnValue && ((STableScanPhysiNode*)pScanNode)->needCountEmptyTable) { pTableListInfo->numOfOuputGroups = numOfTables; @@ -2151,7 +2183,8 @@ int32_t buildGroupIdMapForAllTables(STableListInfo* pTableListInfo, SReadHandle* bool initRemainGroups = false; if (QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN == nodeType(pScanNode)) { STableScanPhysiNode* pTableScanNode = (STableScanPhysiNode*)pScanNode; - if (tsCountAlwaysReturnValue && pTableScanNode->needCountEmptyTable && !(groupSort || pScanNode->groupOrderScan)) { + if (tsCountAlwaysReturnValue && pTableScanNode->needCountEmptyTable && + !(groupSort || pScanNode->groupOrderScan)) { initRemainGroups = true; } } @@ -2275,7 +2308,7 @@ void printSpecDataBlock(SSDataBlock* pBlock, const char* flag, const char* opStr } if (qDebugFlag & DEBUG_DEBUG) { char* pBuf = NULL; - char flagBuf[64]; + char flagBuf[64]; snprintf(flagBuf, sizeof(flagBuf), "%s %s", flag, opStr); qDebug("%s", dumpBlockData(pBlock, flagBuf, &pBuf, taskIdStr)); taosMemoryFree(pBuf); @@ -2284,7 +2317,7 @@ void printSpecDataBlock(SSDataBlock* pBlock, const char* flag, const char* opStr TSKEY getStartTsKey(STimeWindow* win, const TSKEY* tsCols) { return tsCols == NULL ? win->skey : tsCols[0]; } -void updateTimeWindowInfo(SColumnInfoData* pColData, STimeWindow* pWin, int64_t delta) { +void updateTimeWindowInfo(SColumnInfoData* pColData, STimeWindow* pWin, int64_t delta) { int64_t* ts = (int64_t*)pColData->pData; int64_t duration = pWin->ekey - pWin->skey + delta; @@ -2293,13 +2326,14 @@ void updateTimeWindowInfo(SColumnInfoData* pColData, STimeWindow* pWin, int64_t ts[4] = pWin->ekey + delta; // window end key } -int32_t compKeys(const SArray* pSortGroupCols, const char* oldkeyBuf, int32_t oldKeysLen, const SSDataBlock* pBlock, int32_t rowIndex) { +int32_t compKeys(const SArray* pSortGroupCols, const char* oldkeyBuf, int32_t oldKeysLen, const SSDataBlock* pBlock, + int32_t rowIndex) { SColumnDataAgg* pColAgg = NULL; const char* isNull = oldkeyBuf; const char* p = oldkeyBuf + sizeof(int8_t) * pSortGroupCols->size; for (int32_t i = 0; i < pSortGroupCols->size; ++i) { - const SColumn* pCol = (SColumn*)TARRAY_GET_ELEM(pSortGroupCols, i); + const SColumn* pCol = (SColumn*)TARRAY_GET_ELEM(pSortGroupCols, i); const SColumnInfoData* pColInfoData = TARRAY_GET_ELEM(pBlock->pDataBlock, pCol->slotId); if (pBlock->pBlockAgg) pColAgg = pBlock->pBlockAgg[pCol->slotId]; @@ -2325,8 +2359,7 @@ int32_t compKeys(const SArray* pSortGroupCols, const char* oldkeyBuf, int32_t ol return 0; } -int32_t buildKeys(char* keyBuf, const SArray* pSortGroupCols, const SSDataBlock* pBlock, - int32_t rowIndex) { +int32_t buildKeys(char* keyBuf, const SArray* pSortGroupCols, const SSDataBlock* pBlock, int32_t rowIndex) { uint32_t colNum = pSortGroupCols->size; SColumnDataAgg* pColAgg = NULL; char* isNull = keyBuf; @@ -2374,7 +2407,7 @@ uint64_t calcGroupId(char* pData, int32_t len) { } SNodeList* makeColsNodeArrFromSortKeys(SNodeList* pSortKeys) { - SNode* node; + SNode* node; SNodeList* ret = NULL; FOREACH(node, pSortKeys) { SOrderByExprNode* pSortKey = (SOrderByExprNode*)node; @@ -2390,6 +2423,6 @@ int32_t extractKeysLen(const SArray* keys) { SColumn* pCol = (SColumn*)taosArrayGet(keys, i); len += pCol->bytes; } - len += sizeof(int8_t) * keyNum; //null flag + len += sizeof(int8_t) * keyNum; // null flag return len; } diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 87b8cd366c..670771adcc 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -1255,7 +1255,7 @@ static void destroyStreamPartitionOperatorInfo(void* param) { taosMemoryFreeClear(param); } -void initParDownStream(SOperatorInfo* downstream, SPartitionBySupporter* pParSup, SExprSupp* pExpr) { +void initParDownStream(SOperatorInfo* downstream, SPartitionBySupporter* pParSup, SExprSupp* pExpr, SExprSupp* pTbnameExpr) { SStorageAPI* pAPI = &downstream->pTaskInfo->storageAPI; if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { @@ -1265,6 +1265,7 @@ void initParDownStream(SOperatorInfo* downstream, SPartitionBySupporter* pParSup SStreamScanInfo* pScanInfo = downstream->info; pScanInfo->partitionSup = *pParSup; pScanInfo->pPartScalarSup = pExpr; + pScanInfo->pPartTbnameSup = pTbnameExpr; if (!pScanInfo->pUpdateInfo) { pScanInfo->pUpdateInfo = pAPI->stateStore.updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, 0, pScanInfo->igCheckUpdate); } @@ -1408,7 +1409,7 @@ SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStr destroyStreamPartitionOperatorInfo, optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); setOperatorStreamStateFn(pOperator, streamOpReleaseState, streamOpReloadState); - initParDownStream(downstream, &pInfo->partitionSup, &pInfo->scalarSup); + initParDownStream(downstream, &pInfo->partitionSup, &pInfo->scalarSup, &pInfo->tbnameCalSup); code = appendDownstream(pOperator, &downstream, 1); return pOperator; diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index c6ebb04446..aa2a73f09f 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -387,14 +387,14 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; } - if (pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM) { - printDataBlock(p, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); - } - if (pProjectInfo->outputIgnoreGroup) { p->info.id.groupId = 0; } + if (pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM) { + printDataBlock(p, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); + } + return (p->info.rows > 0) ? p : NULL; } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 19c5fc833f..da13741a3e 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1196,23 +1196,8 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, pInfo->base.readerAPI = pTaskInfo->storageAPI.tsdReader; initResultSizeInfo(&pOperator->resultInfo, 4096); pInfo->pResBlock = createDataBlockFromDescNode(pDescNode); + prepareDataBlockBuf(pInfo->pResBlock, &pInfo->base.matchInfo); - { // todo :refactor: - SDataBlockInfo* pBlockInfo = &pInfo->pResBlock->info; - for(int32_t i = 0; i < taosArrayGetSize(pInfo->base.matchInfo.pList); ++i) { - SColMatchItem* pItem = taosArrayGet(pInfo->base.matchInfo.pList, i); - if (pItem->isPk) { - SColumnInfoData* pInfoData = taosArrayGet(pInfo->pResBlock->pDataBlock, pItem->dstSlotId); - pBlockInfo->pks[0].type = pInfoData->info.type; - pBlockInfo->pks[1].type = pInfoData->info.type; - - if (IS_VAR_DATA_TYPE(pItem->dataType.type)) { - pBlockInfo->pks[0].pData = taosMemoryCalloc(1, pInfoData->info.bytes); - pBlockInfo->pks[1].pData = taosMemoryCalloc(1, pInfoData->info.bytes); - } - } - } - } code = filterInitFromNode((SNode*)pTableScanNode->scan.node.pConditions, &pOperator->exprSupp.pFilterInfo, 0); if (code != TSDB_CODE_SUCCESS) { goto _error; @@ -1372,13 +1357,51 @@ static SSDataBlock* readPreVersionData(SOperatorInfo* pTableScanOp, uint64_t tbU return pBlock->info.rows > 0 ? pBlock : NULL; } -static uint64_t getGroupIdByCol(SStreamScanInfo* pInfo, uint64_t uid, TSKEY ts, int64_t maxVersion) { +bool comparePrimaryKey(SColumnInfoData* pCol, int32_t rowId, void* pVal) { + void* pData = colDataGetData(pCol, rowId); + if (IS_VAR_DATA_TYPE(pCol->info.type)) { + int32_t colLen = varDataLen(pData); + int32_t keyLen = varDataLen(pVal); + if (pCol->info.type == TSDB_DATA_TYPE_JSON) { + colLen = getJsonValueLen(pData); + keyLen = getJsonValueLen(pVal); + } + + if (colLen == keyLen && memcmp(pData, pVal, colLen) == 0) { + return true; + } + } else { + if (memcmp(pData, pVal, pCol->info.bytes) == 0) { + return true; + } + } + return false; +} + +bool hasPrimaryKey(SStreamScanInfo* pInfo) { + return pInfo->primaryKeyIndex != -1; +} + +static uint64_t getGroupIdByCol(SStreamScanInfo* pInfo, uint64_t uid, TSKEY ts, int64_t maxVersion, void* pVal) { SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, uid, ts, ts, maxVersion); if (!pPreRes || pPreRes->info.rows == 0) { return 0; } - ASSERT(pPreRes->info.rows == 1); - return calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, 0); + + int32_t rowId = 0; + if (hasPrimaryKey(pInfo)) { + SColumnInfoData* pPkCol = taosArrayGet(pPreRes->pDataBlock, pInfo->primaryKeyIndex); + for (; rowId < pPreRes->info.rows; rowId++) { + if (comparePrimaryKey(pPkCol, rowId, pVal)) { + break; + } + } + } + if (rowId >= pPreRes->info.rows) { + qInfo("===stream===read preversion data of primary key failed. ts:%" PRId64 ",version:%" PRId64, ts, maxVersion); + return 0; + } + return calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, rowId); } static uint64_t getGroupIdByUid(SStreamScanInfo* pInfo, uint64_t uid) { @@ -1386,9 +1409,9 @@ static uint64_t getGroupIdByUid(SStreamScanInfo* pInfo, uint64_t uid) { return tableListGetTableGroupId(pTableScanInfo->base.pTableListInfo, uid); } -static uint64_t getGroupIdByData(SStreamScanInfo* pInfo, uint64_t uid, TSKEY ts, int64_t maxVersion) { +static uint64_t getGroupIdByData(SStreamScanInfo* pInfo, uint64_t uid, TSKEY ts, int64_t maxVersion, void* pVal) { if (pInfo->partitionSup.needCalc) { - return getGroupIdByCol(pInfo, uid, ts, maxVersion); + return getGroupIdByCol(pInfo, uid, ts, maxVersion, pVal); } return getGroupIdByUid(pInfo, uid); @@ -1557,22 +1580,95 @@ static int32_t getPreSessionWindow(SStreamAggSupporter* pAggSup, TSKEY startTs, return code; } +void appendOneRowToSpecialBlockImpl(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, TSKEY* pCalStartTs, + TSKEY* pCalEndTs, uint64_t* pUid, uint64_t* pGp, void* pTbName, void* pPkData) { + SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); + SColumnInfoData* pEndTsCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX); + SColumnInfoData* pUidCol = taosArrayGet(pBlock->pDataBlock, UID_COLUMN_INDEX); + SColumnInfoData* pGpCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); + SColumnInfoData* pCalStartCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); + SColumnInfoData* pCalEndCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); + SColumnInfoData* pTableCol = taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX); + colDataSetVal(pStartTsCol, pBlock->info.rows, (const char*)pStartTs, false); + colDataSetVal(pEndTsCol, pBlock->info.rows, (const char*)pEndTs, false); + colDataSetVal(pUidCol, pBlock->info.rows, (const char*)pUid, false); + colDataSetVal(pGpCol, pBlock->info.rows, (const char*)pGp, false); + colDataSetVal(pCalStartCol, pBlock->info.rows, (const char*)pCalStartTs, false); + colDataSetVal(pCalEndCol, pBlock->info.rows, (const char*)pCalEndTs, false); + colDataSetVal(pTableCol, pBlock->info.rows, (const char*)pTbName, pTbName == NULL); + if (taosArrayGetSize(pBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX) { + SColumnInfoData* pPkCol = taosArrayGet(pBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + colDataSetVal(pPkCol, pBlock->info.rows, (const char*)pPkData, pPkData == NULL); + } + pBlock->info.rows++; +} + +void appendPkToSpecialBlock(SSDataBlock* pBlock, TSKEY* pTsArray, SColumnInfoData* pPkCol, int32_t rowId, + uint64_t* pUid, uint64_t* pGp, void* pTbName) { + void* pVal = NULL; + if (pPkCol) { + pVal = colDataGetData(pPkCol, rowId); + } + appendOneRowToSpecialBlockImpl(pBlock, pTsArray + rowId, pTsArray + rowId, pTsArray + rowId, pTsArray + rowId, pUid, + pGp, pTbName, pVal); +} + +static void getPreVersionDataBlock(uint64_t uid, TSKEY startTs, TSKEY endTs, int64_t version, char* taskIdStr, + SStreamScanInfo* pInfo, SSDataBlock* pBlock) { + SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, uid, startTs, endTs, version); + printDataBlock(pPreRes, "pre res", taskIdStr); + blockDataCleanup(pBlock); + if (!pPreRes) { + return ; + } + int32_t code = blockDataEnsureCapacity(pBlock, pPreRes->info.rows); + if (code != TSDB_CODE_SUCCESS) { + return ; + } + + SColumnInfoData* pTsCol = (SColumnInfoData*)taosArrayGet(pPreRes->pDataBlock, pInfo->primaryTsIndex); + SColumnInfoData* pPkCol = NULL; + if (hasPrimaryKey(pInfo)) { + pPkCol = (SColumnInfoData*)taosArrayGet(pPreRes->pDataBlock, pInfo->primaryKeyIndex); + } + for (int32_t i = 0; i < pPreRes->info.rows; i++) { + uint64_t groupId = calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, i); + appendPkToSpecialBlock(pBlock, (TSKEY*)pTsCol->pData, pPkCol, i, &uid, &groupId, NULL); + } + printDataBlock(pBlock, "new delete", taskIdStr); +} + static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock) { - blockDataCleanup(pDestBlock); if (pSrcBlock->info.rows == 0) { return TSDB_CODE_SUCCESS; } - int32_t code = blockDataEnsureCapacity(pDestBlock, pSrcBlock->info.rows); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - ASSERT(taosArrayGetSize(pSrcBlock->pDataBlock) >= 3); + SExecTaskInfo* pTaskInfo = pInfo->pStreamScanOp->pTaskInfo; SColumnInfoData* pStartTsCol = taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX); TSKEY* startData = (TSKEY*)pStartTsCol->pData; SColumnInfoData* pEndTsCol = taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX); TSKEY* endData = (TSKEY*)pEndTsCol->pData; SColumnInfoData* pUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); uint64_t* uidCol = (uint64_t*)pUidCol->pData; + SColumnInfoData* pGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); + SColumnInfoData* pSrcPkCol = NULL; + uint64_t* pSrcGp = (uint64_t*)pGpCol->pData; + if (taosArrayGetSize(pSrcBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX) { + pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + } + int64_t ver = pSrcBlock->info.version - 1; + + if (pInfo->partitionSup.needCalc && (startData[0] != endData[0] || hasPrimaryKey(pInfo))) { + getPreVersionDataBlock(uidCol[0], startData[0], endData[0], ver, GET_TASKID(pTaskInfo), pInfo, pSrcBlock); + startData = (TSKEY*)pStartTsCol->pData; + endData = (TSKEY*)pEndTsCol->pData; + uidCol = (uint64_t*)pUidCol->pData; + pSrcGp = (uint64_t*)pGpCol->pData; + } + blockDataCleanup(pDestBlock); + int32_t code = blockDataEnsureCapacity(pDestBlock, pSrcBlock->info.rows); + if (code != TSDB_CODE_SUCCESS) { + return code; + } SColumnInfoData* pDestStartCol = taosArrayGet(pDestBlock->pDataBlock, START_TS_COLUMN_INDEX); SColumnInfoData* pDestEndCol = taosArrayGet(pDestBlock->pDataBlock, END_TS_COLUMN_INDEX); @@ -1580,9 +1676,15 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr SColumnInfoData* pDestGpCol = taosArrayGet(pDestBlock->pDataBlock, GROUPID_COLUMN_INDEX); SColumnInfoData* pDestCalStartTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); SColumnInfoData* pDestCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); - int64_t ver = pSrcBlock->info.version - 1; for (int32_t i = 0; i < pSrcBlock->info.rows; i++) { - uint64_t groupId = getGroupIdByData(pInfo, uidCol[i], startData[i], ver); + uint64_t groupId = pSrcGp[i]; + if (groupId == 0) { + void* pVal = NULL; + if (hasPrimaryKey(pInfo) && pSrcPkCol) { + pVal = colDataGetData(pSrcPkCol, i); + } + groupId = getGroupIdByData(pInfo, uidCol[i], startData[i], ver, pVal); + } // gap must be 0. SSessionKey startWin = {0}; getCurSessionWindow(pInfo->windowSup.pStreamAggSup, startData[i], startData[i], groupId, &startWin); @@ -1617,17 +1719,33 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB if (pSrcBlock->info.rows == 0) { return TSDB_CODE_SUCCESS; } - int32_t code = blockDataEnsureCapacity(pDestBlock, pSrcBlock->info.rows); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - ASSERT(taosArrayGetSize(pSrcBlock->pDataBlock) >= 3); + SExecTaskInfo* pTaskInfo = pInfo->pStreamScanOp->pTaskInfo; SColumnInfoData* pStartTsCol = taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX); TSKEY* startData = (TSKEY*)pStartTsCol->pData; SColumnInfoData* pEndTsCol = taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX); TSKEY* endData = (TSKEY*)pEndTsCol->pData; SColumnInfoData* pUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); uint64_t* uidCol = (uint64_t*)pUidCol->pData; + SColumnInfoData* pGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); + uint64_t* pSrcGp = (uint64_t*)pGpCol->pData; + SColumnInfoData* pSrcPkCol = NULL; + if (taosArrayGetSize(pSrcBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX ) { + pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + } + int64_t ver = pSrcBlock->info.version - 1; + + if (pInfo->partitionSup.needCalc && (startData[0] != endData[0] || hasPrimaryKey(pInfo))) { + getPreVersionDataBlock(uidCol[0], startData[0], endData[0], ver, GET_TASKID(pTaskInfo), pInfo, pSrcBlock); + startData = (TSKEY*)pStartTsCol->pData; + endData = (TSKEY*)pEndTsCol->pData; + uidCol = (uint64_t*)pUidCol->pData; + pSrcGp = (uint64_t*)pGpCol->pData; + } + + int32_t code = blockDataEnsureCapacity(pDestBlock, pSrcBlock->info.rows); + if (code != TSDB_CODE_SUCCESS) { + return code; + } SColumnInfoData* pDestStartCol = taosArrayGet(pDestBlock->pDataBlock, START_TS_COLUMN_INDEX); SColumnInfoData* pDestEndCol = taosArrayGet(pDestBlock->pDataBlock, END_TS_COLUMN_INDEX); @@ -1635,9 +1753,15 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB SColumnInfoData* pDestGpCol = taosArrayGet(pDestBlock->pDataBlock, GROUPID_COLUMN_INDEX); SColumnInfoData* pDestCalStartTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); SColumnInfoData* pDestCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); - int64_t ver = pSrcBlock->info.version - 1; for (int32_t i = 0; i < pSrcBlock->info.rows; i++) { - uint64_t groupId = getGroupIdByData(pInfo, uidCol[i], startData[i], ver); + uint64_t groupId = pSrcGp[i]; + if (groupId == 0) { + void* pVal = NULL; + if (hasPrimaryKey(pInfo) && pSrcPkCol) { + pVal = colDataGetData(pSrcPkCol, i); + } + groupId = getGroupIdByData(pInfo, uidCol[i], startData[i], ver, pVal); + } SSessionKey startWin = {.win.skey = startData[i], .win.ekey = endData[i], .groupId = groupId}; SSessionKey range = {0}; getCountWinRange(pInfo->windowSup.pStreamAggSup, &startWin, mode, &range); @@ -1655,8 +1779,7 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock) { blockDataCleanup(pDestBlock); - int32_t rows = pSrcBlock->info.rows; - if (rows == 0) { + if (pSrcBlock->info.rows == 0) { return TSDB_CODE_SUCCESS; } SExecTaskInfo* pTaskInfo = pInfo->pStreamScanOp->pTaskInfo; @@ -1664,6 +1787,10 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS SColumnInfoData* pSrcEndTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX); SColumnInfoData* pSrcUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); + SColumnInfoData* pSrcPkCol = NULL; + if (taosArrayGetSize(pSrcBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX ) { + pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + } uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData; ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); @@ -1671,34 +1798,15 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS TSKEY* srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData; int64_t ver = pSrcBlock->info.version - 1; - if (pInfo->partitionSup.needCalc && srcStartTsCol[0] != srcEndTsCol[0]) { - uint64_t srcUid = srcUidData[0]; - TSKEY startTs = srcStartTsCol[0]; - TSKEY endTs = srcEndTsCol[0]; - SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, srcUid, startTs, endTs, ver); - printDataBlock(pPreRes, "pre res", GET_TASKID(pTaskInfo)); - blockDataCleanup(pSrcBlock); - int32_t code = blockDataEnsureCapacity(pSrcBlock, pPreRes->info.rows); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - - SColumnInfoData* pTsCol = (SColumnInfoData*)taosArrayGet(pPreRes->pDataBlock, pInfo->primaryTsIndex); - rows = pPreRes->info.rows; - - for (int32_t i = 0; i < rows; i++) { - uint64_t groupId = calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, i); - appendOneRowToStreamSpecialBlock(pSrcBlock, ((TSKEY*)pTsCol->pData) + i, ((TSKEY*)pTsCol->pData) + i, &srcUid, - &groupId, NULL); - } - printDataBlock(pSrcBlock, "new delete", GET_TASKID(pTaskInfo)); + if (pInfo->partitionSup.needCalc && (srcStartTsCol[0] != srcEndTsCol[0] || hasPrimaryKey(pInfo))) { + getPreVersionDataBlock(srcUidData[0], srcStartTsCol[0], srcEndTsCol[0], ver, GET_TASKID(pTaskInfo), pInfo, pSrcBlock); + srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData; + srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData; + srcUidData = (uint64_t*)pSrcUidCol->pData; } - uint64_t* srcGp = (uint64_t*)pSrcGpCol->pData; - srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData; - srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData; - srcUidData = (uint64_t*)pSrcUidCol->pData; - int32_t code = blockDataEnsureCapacity(pDestBlock, rows); + uint64_t* srcGp = (uint64_t*)pSrcGpCol->pData; + int32_t code = blockDataEnsureCapacity(pDestBlock, pSrcBlock->info.rows); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -1709,11 +1817,15 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS SColumnInfoData* pGpCol = taosArrayGet(pDestBlock->pDataBlock, GROUPID_COLUMN_INDEX); SColumnInfoData* pCalStartTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); SColumnInfoData* pCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); - for (int32_t i = 0; i < rows;) { + for (int32_t i = 0; i < pSrcBlock->info.rows;) { uint64_t srcUid = srcUidData[i]; uint64_t groupId = srcGp[i]; if (groupId == 0) { - groupId = getGroupIdByData(pInfo, srcUid, srcStartTsCol[i], ver); + void* pVal = NULL; + if (hasPrimaryKey(pInfo) && pSrcPkCol) { + pVal = colDataGetData(pSrcPkCol, i); + } + groupId = getGroupIdByData(pInfo, srcUid, srcStartTsCol[i], ver, pVal); } TSKEY calStartTs = srcStartTsCol[i]; colDataSetVal(pCalStartTsCol, pDestBlock->info.rows, (const char*)(&calStartTs), false); @@ -1730,17 +1842,102 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS return TSDB_CODE_SUCCESS; } -static void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock) { - SExprSupp* pTbNameCalSup = &pInfo->tbnameCalSup; +static void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock, int32_t rowId) { blockDataCleanup(pInfo->pCreateTbRes); if (pInfo->tbnameCalSup.numOfExprs == 0 && pInfo->tagCalSup.numOfExprs == 0) { pBlock->info.parTbName[0] = 0; } else { appendCreateTableRow(pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState, &pInfo->tbnameCalSup, &pInfo->tagCalSup, - pBlock->info.id.groupId, pBlock, 0, pInfo->pCreateTbRes, &pInfo->stateStore); + pBlock->info.id.groupId, pBlock, rowId, pInfo->pCreateTbRes, &pInfo->stateStore); } } +static int32_t generatePartitionDelResBlock(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock) { + SColumnInfoData* pSrcStartTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX); + SColumnInfoData* pSrcEndTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX); + SColumnInfoData* pSrcUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); + uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData; + SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); + uint64_t* srcGp = (uint64_t*)pSrcGpCol->pData; + + ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); + TSKEY* srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData; + TSKEY* srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData; + int64_t ver = pSrcBlock->info.version - 1; + for (int32_t delI = 0; delI < pSrcBlock->info.rows; delI++) { + uint64_t groupId = 0; + uint64_t srcUid = srcUidData[delI]; + char tbname[VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN] = {0}; + SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, srcUid, srcStartTsCol[delI], srcEndTsCol[delI], ver); + blockDataEnsureCapacity(pDestBlock, pDestBlock->info.rows + pPreRes->info.rows); + for (int32_t preJ = 0; preJ < pPreRes->info.rows; preJ++) { + groupId = calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, preJ); + if (pInfo->pPartTbnameSup) { + void* parTbname = NULL; + int32_t code = pInfo->stateStore.streamStateGetParName(pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState, groupId, &parTbname); + if (code != TSDB_CODE_SUCCESS) { + calBlockTbName(pInfo, pPreRes, preJ); + memcpy(varDataVal(tbname), pPreRes->info.parTbName, strlen(pPreRes->info.parTbName)); + } else { + memcpy(varDataVal(tbname), parTbname, TSDB_TABLE_NAME_LEN); + } + varDataSetLen(tbname, strlen(varDataVal(tbname))); + pInfo->stateStore.streamStateFreeVal(parTbname); + } + appendDataToSpecialBlock(pDestBlock, srcStartTsCol + delI, srcEndTsCol + delI, srcUidData + delI, &groupId, + tbname[0] == 0 ? NULL : tbname); + } + } + return TSDB_CODE_SUCCESS; +} + +static int32_t generateDeleteResultBlockImpl(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock) { + SColumnInfoData* pSrcStartTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX); + SColumnInfoData* pSrcEndTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX); + SColumnInfoData* pSrcUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); + uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData; + SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); + uint64_t* srcGp = (uint64_t*)pSrcGpCol->pData; + SColumnInfoData* pSrcPkCol = NULL; + if (taosArrayGetSize(pSrcBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX ) { + pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + } + + ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); + TSKEY* srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData; + TSKEY* srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData; + int64_t ver = pSrcBlock->info.version - 1; + for (int32_t i = 0; i < pSrcBlock->info.rows; i++) { + uint64_t srcUid = srcUidData[i]; + uint64_t groupId = srcGp[i]; + char tbname[VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN] = {0}; + if (groupId == 0) { + void* pVal = NULL; + if (hasPrimaryKey(pInfo) && pSrcPkCol) { + pVal = colDataGetData(pSrcPkCol, i); + } + groupId = getGroupIdByData(pInfo, srcUid, srcStartTsCol[i], ver, pVal); + } + if (pInfo->tbnameCalSup.pExprInfo) { + void* parTbname = NULL; + int32_t code = pInfo->stateStore.streamStateGetParName(pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState, groupId, &parTbname); + if (code != TSDB_CODE_SUCCESS) { + SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, srcUid, srcStartTsCol[i], srcStartTsCol[i], ver); + printDataBlock(pPreRes, "pre res", GET_TASKID(pInfo->pStreamScanOp->pTaskInfo)); + calBlockTbName(pInfo, pPreRes, 0); + memcpy(varDataVal(tbname), pPreRes->info.parTbName, strlen(pPreRes->info.parTbName)); + } else { + memcpy(varDataVal(tbname), parTbname, TSDB_TABLE_NAME_LEN); + } + varDataSetLen(tbname, strlen(varDataVal(tbname))); + pInfo->stateStore.streamStateFreeVal(parTbname); + } + appendDataToSpecialBlock(pDestBlock, srcStartTsCol + i, srcEndTsCol + i, srcUidData + i, &groupId, + tbname[0] == 0 ? NULL : tbname); + } + return TSDB_CODE_SUCCESS; +} + static int32_t generateDeleteResultBlock(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock) { blockDataCleanup(pDestBlock); int32_t rows = pSrcBlock->info.rows; @@ -1751,42 +1948,10 @@ static int32_t generateDeleteResultBlock(SStreamScanInfo* pInfo, SSDataBlock* pS if (code != TSDB_CODE_SUCCESS) { return code; } - - SColumnInfoData* pSrcStartTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX); - SColumnInfoData* pSrcEndTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX); - SColumnInfoData* pSrcUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); - uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData; - SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); - uint64_t* srcGp = (uint64_t*)pSrcGpCol->pData; - ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); - TSKEY* srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData; - TSKEY* srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData; - int64_t ver = pSrcBlock->info.version - 1; - for (int32_t i = 0; i < pSrcBlock->info.rows; i++) { - uint64_t srcUid = srcUidData[i]; - uint64_t groupId = srcGp[i]; - char tbname[VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN] = {0}; - if (groupId == 0) { - groupId = getGroupIdByData(pInfo, srcUid, srcStartTsCol[i], ver); - } - if (pInfo->tbnameCalSup.pExprInfo) { - void* parTbname = NULL; - code = pInfo->stateStore.streamStateGetParName(pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState, groupId, &parTbname); - if (code != TSDB_CODE_SUCCESS) { - SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, srcUid, srcStartTsCol[i], srcStartTsCol[i], ver); - printDataBlock(pPreRes, "pre res", GET_TASKID(pInfo->pStreamScanOp->pTaskInfo)); - calBlockTbName(pInfo, pPreRes); - memcpy(varDataVal(tbname), pPreRes->info.parTbName, strlen(pPreRes->info.parTbName)); - } else { - memcpy(varDataVal(tbname), parTbname, TSDB_TABLE_NAME_LEN); - } - varDataSetLen(tbname, strlen(varDataVal(tbname))); - pInfo->stateStore.streamStateFreeVal(parTbname); - } - appendOneRowToStreamSpecialBlock(pDestBlock, srcStartTsCol + i, srcEndTsCol + i, srcUidData + i, &groupId, - tbname[0] == 0 ? NULL : tbname); + if (pInfo->partitionSup.needCalc) { + return generatePartitionDelResBlock(pInfo, pSrcBlock, pDestBlock); } - return TSDB_CODE_SUCCESS; + return generateDeleteResultBlockImpl(pInfo, pSrcBlock, pDestBlock); } static int32_t generateScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock, EStreamType type) { @@ -1807,28 +1972,9 @@ static int32_t generateScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, return code; } -void appendOneRowToStreamSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid, - uint64_t* pGp, void* pTbName) { - appendAllColumnToStreamSpecialBlock(pBlock, pStartTs, pEndTs, pStartTs, pEndTs, pUid, pGp, pTbName); -} - -void appendAllColumnToStreamSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, TSKEY* pCalStartTs, - TSKEY* pCalEndTs, uint64_t* pUid, uint64_t* pGp, void* pTbName) { - SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); - SColumnInfoData* pEndTsCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX); - SColumnInfoData* pUidCol = taosArrayGet(pBlock->pDataBlock, UID_COLUMN_INDEX); - SColumnInfoData* pGpCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); - SColumnInfoData* pCalStartCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); - SColumnInfoData* pCalEndCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); - SColumnInfoData* pTableCol = taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX); - colDataSetVal(pStartTsCol, pBlock->info.rows, (const char*)pStartTs, false); - colDataSetVal(pEndTsCol, pBlock->info.rows, (const char*)pEndTs, false); - colDataSetVal(pUidCol, pBlock->info.rows, (const char*)pUid, false); - colDataSetVal(pGpCol, pBlock->info.rows, (const char*)pGp, false); - colDataSetVal(pCalStartCol, pBlock->info.rows, (const char*)pCalStartTs, false); - colDataSetVal(pCalEndCol, pBlock->info.rows, (const char*)pCalEndTs, false); - colDataSetVal(pTableCol, pBlock->info.rows, (const char*)pTbName, pTbName == NULL); - pBlock->info.rows++; +void appendDataToSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid, uint64_t* pGp, + void* pTbName) { + appendOneRowToSpecialBlockImpl(pBlock, pStartTs, pEndTs, pStartTs, pEndTs, pUid, pGp, pTbName, NULL); } bool checkExpiredData(SStateStore* pAPI, SUpdateInfo* pUpdateInfo, STimeWindowAggSupp* pTwSup, uint64_t tableId, TSKEY ts) { @@ -1848,6 +1994,11 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, pInfo->primaryTsIndex); ASSERT(pColDataInfo->info.type == TSDB_DATA_TYPE_TIMESTAMP); TSKEY* tsCol = (TSKEY*)pColDataInfo->pData; + SColumnInfoData* pPkColDataInfo = NULL; + if (hasPrimaryKey(pInfo)) { + pPkColDataInfo = taosArrayGet(pBlock->pDataBlock, pInfo->primaryKeyIndex); + } + bool tableInserted = pInfo->stateStore.updateInfoIsTableInserted(pInfo->pUpdateInfo, pBlock->info.id.uid); for (int32_t rowId = 0; rowId < pBlock->info.rows; rowId++) { SResultRowInfo dumyInfo; @@ -1865,17 +2016,15 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock } // must check update info first. bool update = pInfo->stateStore.updateInfoIsUpdated(pInfo->pUpdateInfo, pBlock->info.id.uid, tsCol[rowId]); - bool closedWin = isClosed && isSignleIntervalWindow(pInfo) && + bool isDeleted = isClosed && isSignleIntervalWindow(pInfo) && isDeletedStreamWindow(&win, pBlock->info.id.groupId, pInfo->pState, &pInfo->twAggSup, &pInfo->stateStore); - if ((update || closedWin) && out) { - qDebug("stream update check not pass, update %d, closedWin %d", update, closedWin); + if ((update || isDeleted) && out) { + qDebug("stream update check not pass, update %d, deleted Win %d", update, isDeleted); uint64_t gpId = 0; - appendOneRowToStreamSpecialBlock(pInfo->pUpdateDataRes, tsCol + rowId, tsCol + rowId, &pBlock->info.id.uid, &gpId, - NULL); - if (closedWin && pInfo->partitionSup.needCalc) { + appendPkToSpecialBlock(pInfo->pUpdateDataRes, tsCol, pPkColDataInfo, rowId, &pBlock->info.id.uid, &gpId, NULL); + if (isDeleted && pInfo->partitionSup.needCalc) { gpId = calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pBlock, rowId); - appendOneRowToStreamSpecialBlock(pInfo->pUpdateDataRes, tsCol + rowId, tsCol + rowId, &pBlock->info.id.uid, - &gpId, NULL); + appendPkToSpecialBlock(pInfo->pUpdateDataRes, tsCol, pPkColDataInfo, rowId, &pBlock->info.id.uid, &gpId, NULL); } } } @@ -2082,7 +2231,7 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock return 0; } - calBlockTbName(pInfo, pInfo->pRes); + calBlockTbName(pInfo, pInfo->pRes, 0); return 0; } @@ -2364,7 +2513,7 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { pInfo->pRecoverRes = doTableScan(pInfo->pTableScanOp); if (pInfo->pRecoverRes != NULL) { - calBlockTbName(pInfo, pInfo->pRecoverRes); + calBlockTbName(pInfo, pInfo->pRecoverRes, 0); if (!pInfo->igCheckUpdate && pInfo->pUpdateInfo) { TSKEY maxTs = pAPI->stateStore.updateInfoFillBlockData(pInfo->pUpdateInfo, pInfo->pRecoverRes, pInfo->primaryTsIndex); pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, maxTs); @@ -2422,6 +2571,7 @@ FETCH_NEXT_BLOCK: switch (pBlock->info.type) { case STREAM_NORMAL: case STREAM_GET_ALL: + printDataBlock(pBlock, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); return pBlock; case STREAM_RETRIEVE: { pInfo->blockType = STREAM_INPUT__DATA_SUBMIT; @@ -2453,11 +2603,15 @@ FETCH_NEXT_BLOCK: if (!isStreamWindow(pInfo)) { generateDeleteResultBlock(pInfo, pDelBlock, pInfo->pDeleteDataRes); - pInfo->pDeleteDataRes->info.type = STREAM_DELETE_RESULT; - printSpecDataBlock(pDelBlock, getStreamOpName(pOperator->operatorType), "delete result", GET_TASKID(pTaskInfo)); + if (pInfo->partitionSup.needCalc) { + pInfo->pDeleteDataRes->info.type = STREAM_DELETE_DATA; + } else { + pInfo->pDeleteDataRes->info.type = STREAM_DELETE_RESULT; + } blockDataDestroy(pDelBlock); if (pInfo->pDeleteDataRes->info.rows > 0) { + printSpecDataBlock(pInfo->pDeleteDataRes, getStreamOpName(pOperator->operatorType), "delete result", GET_TASKID(pTaskInfo)); return pInfo->pDeleteDataRes; } else { goto FETCH_NEXT_BLOCK; @@ -2469,12 +2623,12 @@ FETCH_NEXT_BLOCK: prepareRangeScan(pInfo, pInfo->pUpdateRes, &pInfo->updateResIndex); copyDataBlock(pInfo->pDeleteDataRes, pInfo->pUpdateRes); pInfo->pDeleteDataRes->info.type = STREAM_DELETE_DATA; - printSpecDataBlock(pDelBlock, getStreamOpName(pOperator->operatorType), "delete result", GET_TASKID(pTaskInfo)); if (pInfo->tqReader) { blockDataDestroy(pDelBlock); } if (pInfo->pDeleteDataRes->info.rows > 0) { pInfo->scanMode = STREAM_SCAN_FROM_DATAREADER_RANGE; + printSpecDataBlock(pInfo->pDeleteDataRes, getStreamOpName(pOperator->operatorType), "delete result", GET_TASKID(pTaskInfo)); return pInfo->pDeleteDataRes; } else { goto FETCH_NEXT_BLOCK; @@ -2499,6 +2653,7 @@ FETCH_NEXT_BLOCK: pInfo->pRes->info.dataLoad = 1; blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex); if (pInfo->pRes->info.rows > 0) { + printDataBlock(pInfo->pRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); return pInfo->pRes; } } break; @@ -2526,7 +2681,7 @@ FETCH_NEXT_BLOCK: checkUpdateData(pInfo, true, pSDB, false); } printSpecDataBlock(pSDB, getStreamOpName(pOperator->operatorType), "update", GET_TASKID(pTaskInfo)); - calBlockTbName(pInfo, pSDB); + calBlockTbName(pInfo, pSDB, 0); return pSDB; } blockDataCleanup(pInfo->pUpdateDataRes); @@ -2620,6 +2775,7 @@ FETCH_NEXT_BLOCK: qDebug("stream scan completed, and return source rows:%" PRId64", %s", pBlockInfo->rows, id); if (pBlockInfo->rows > 0) { + printDataBlock(pInfo->pRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); return pInfo->pRes; } @@ -2643,7 +2799,7 @@ FETCH_NEXT_BLOCK: if (pBlock->info.type == STREAM_CHECKPOINT) { streamScanOperatorSaveCheckpoint(pInfo); } - // printDataBlock(pBlock, "stream scan ck"); + // printDataBlock(pInfo->pCheckpointRes, "stream scan ck", GET_TASKID(pTaskInfo)); return pInfo->pCheckpointRes; } @@ -2874,6 +3030,14 @@ void streamScanReloadState(SOperatorInfo* pOperator) { } } +void addPrimaryKeyCol(SSDataBlock* pBlock, uint8_t type, int32_t bytes) { + pBlock->info.rowSize += bytes; + SColumnInfoData infoData = {0}; + infoData.info.type = type; + infoData.info.bytes = bytes; + taosArrayPush(pBlock->pDataBlock, &infoData); +} + SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode* pTableScanNode, SNode* pTagCond, STableListInfo* pTableListInfo, SExecTaskInfo* pTaskInfo) { SArray* pColIds = NULL; @@ -2902,6 +3066,8 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys goto _error; } + SDataType pkType = {0}; + pInfo->primaryKeyIndex = -1; int32_t numOfOutput = taosArrayGetSize(pInfo->matchInfo.pList); pColIds = taosArrayInit(numOfOutput, sizeof(int16_t)); for (int32_t i = 0; i < numOfOutput; ++i) { @@ -2912,8 +3078,13 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys if (id->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { pInfo->primaryTsIndex = id->dstSlotId; } + if (id->isPk) { + pInfo->primaryKeyIndex = id->dstSlotId; + pkType = id->dataType; + } } + pInfo->pPartTbnameSup = NULL; if (pTableScanNode->pSubtable != NULL) { SExprInfo* pSubTableExpr = taosMemoryCalloc(1, sizeof(SExprInfo)); if (pSubTableExpr == NULL) { @@ -3029,6 +3200,9 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys pInfo->pDeleteDataRes = createSpecialDataBlock(STREAM_DELETE_DATA); pInfo->updateWin = (STimeWindow){.skey = INT64_MAX, .ekey = INT64_MAX}; pInfo->pUpdateDataRes = createSpecialDataBlock(STREAM_CLEAR); + if (hasPrimaryKey(pInfo)) { + addPrimaryKeyCol(pInfo->pUpdateDataRes, pkType.type, pkType.bytes); + } pInfo->assignBlockUid = pTableScanNode->assignBlockUid; pInfo->partitionSup.needCalc = false; pInfo->igCheckUpdate = pTableScanNode->igCheckUpdate; @@ -4483,6 +4657,8 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN pInfo->bSortRowId = false; } + prepareDataBlockBuf(pInfo->pResBlock, &pInfo->base.matchInfo); + pInfo->pSortInfo = generateSortByTsPkInfo(pInfo->base.matchInfo.pList, pInfo->base.cond.order); pInfo->pReaderBlock = createOneDataBlock(pInfo->pResBlock, false); diff --git a/source/libs/executor/src/streamcountwindowoperator.c b/source/libs/executor/src/streamcountwindowoperator.c index 720734431f..5b2db5bb4f 100644 --- a/source/libs/executor/src/streamcountwindowoperator.c +++ b/source/libs/executor/src/streamcountwindowoperator.c @@ -24,7 +24,7 @@ #include "tlog.h" #include "ttime.h" -#define IS_FINAL_COUNT_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_COUNT) +#define IS_NORMAL_COUNT_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT) #define STREAM_COUNT_OP_STATE_NAME "StreamCountHistoryState" #define STREAM_COUNT_OP_CHECKPOINT_NAME "StreamCountOperator_Checkpoint" @@ -61,6 +61,8 @@ void destroyStreamCountAggOperatorInfo(void* param) { taosArrayDestroy(pInfo->historyWins); blockDataDestroy(pInfo->pCheckpointRes); + tSimpleHashCleanup(pInfo->pPkDeleted); + taosMemoryFreeClear(param); } @@ -267,23 +269,27 @@ static void doStreamCountAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl range.win.skey = TMIN(startTsCols[i], range.win.skey); range.win.ekey = TMAX(startTsCols[rows-1], range.win.ekey); uint64_t uid = 0; - appendOneRowToStreamSpecialBlock(pAggSup->pScanBlock, &range.win.skey, &range.win.ekey, &uid, &range.groupId, NULL); + appendDataToSpecialBlock(pAggSup->pScanBlock, &range.win.skey, &range.win.ekey, &uid, &range.groupId, NULL); break; } code = doOneWindowAggImpl(&pInfo->twAggSup.timeWindowData, &curWin.winInfo, &pResult, i, winRows, rows, numOfOutput, pOperator, 0); if (code != TSDB_CODE_SUCCESS || pResult == NULL) { qError("%s do stream count aggregate impl error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + break; } saveSessionOutputBuf(pAggSup, &curWin.winInfo); + if (pInfo->destHasPrimaryKey && curWin.winInfo.isOutput && IS_NORMAL_COUNT_OP(pOperator)) { + saveDeleteRes(pInfo->pPkDeleted, curWin.winInfo.sessionWin); + } + if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE && pStUpdated) { code = saveResult(curWin.winInfo, pStUpdated); if (code != TSDB_CODE_SUCCESS) { qError("%s do stream count aggregate impl, set result error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + break; } } if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE) { @@ -484,7 +490,7 @@ void doDeleteCountWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SAr } void deleteCountWinState(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHashObj* pMapUpdate, - SSHashObj* pMapDelete) { + SSHashObj* pMapDelete, SSHashObj* pPkDelete, bool needAdd) { SArray* pWins = taosArrayInit(16, sizeof(SSessionKey)); if (isSlidingCountWindow(pAggSup)) { doDeleteCountWindows(pAggSup, pBlock, pWins); @@ -493,6 +499,9 @@ void deleteCountWinState(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHa } removeSessionResults(pAggSup, pMapUpdate, pWins); copyDeleteWindowInfo(pWins, pMapDelete); + if (needAdd) { + copyDeleteWindowInfo(pWins, pPkDelete); + } taosArrayDestroy(pWins); } @@ -542,7 +551,8 @@ static SSDataBlock* doStreamCountAgg(SOperatorInfo* pOperator) { printSpecDataBlock(pBlock, getStreamOpName(pOperator->operatorType), "recv", GET_TASKID(pTaskInfo)); if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT) { - deleteCountWinState(&pInfo->streamAggSup, pBlock, pInfo->pStUpdated, pInfo->pStDeleted); + bool add = pInfo->destHasPrimaryKey && IS_NORMAL_COUNT_OP(pOperator); + deleteCountWinState(&pInfo->streamAggSup, pBlock, pInfo->pStUpdated, pInfo->pStDeleted, pInfo->pPkDeleted, add); continue; } else if (pBlock->info.type == STREAM_CLEAR) { doResetCountWindows(&pInfo->streamAggSup, pBlock); @@ -582,6 +592,10 @@ static SSDataBlock* doStreamCountAgg(SOperatorInfo* pOperator) { pInfo->pUpdated = NULL; blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity); + if (pInfo->destHasPrimaryKey && IS_NORMAL_COUNT_OP(pOperator)) { + copyDeleteSessionKey(pInfo->pPkDeleted, pInfo->pStDeleted); + } + SSDataBlock* opRes = buildCountResult(pOperator); if (opRes) { return opRes; @@ -694,6 +708,8 @@ SOperatorInfo* createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT); pInfo->recvGetAll = false; + pInfo->pPkDeleted = tSimpleHashInit(64, hashFn); + pInfo->destHasPrimaryKey = pCountNode->window.destHasPrimayKey; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT; setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT, true, diff --git a/source/libs/executor/src/streameventwindowoperator.c b/source/libs/executor/src/streameventwindowoperator.c index ef5c2572d9..f93ca1a04c 100644 --- a/source/libs/executor/src/streameventwindowoperator.c +++ b/source/libs/executor/src/streameventwindowoperator.c @@ -27,7 +27,7 @@ #include "tlog.h" #include "ttime.h" -#define IS_FINAL_EVENT_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_EVENT) +#define IS_NORMAL_EVENT_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT) #define STREAM_EVENT_OP_STATE_NAME "StreamEventHistoryState" #define STREAM_EVENT_OP_CHECKPOINT_NAME "StreamEventOperator_Checkpoint" @@ -66,6 +66,8 @@ void destroyStreamEventOperatorInfo(void* param) { taosArrayDestroy(pInfo->historyWins); blockDataDestroy(pInfo->pCheckpointRes); + tSimpleHashCleanup(pInfo->pPkDeleted); + if (pInfo->pStartCondInfo != NULL) { filterFreeInfo(pInfo->pStartCondInfo); pInfo->pStartCondInfo = NULL; @@ -99,17 +101,21 @@ int32_t getEndCondIndex(bool* pEnd, int32_t start, int32_t rows) { return -1; } +static bool isWindowIncomplete(SEventWindowInfo* pWinInfo) { + return !(pWinInfo->pWinFlag->startFlag && pWinInfo->pWinFlag->endFlag); +} int32_t reuseOutputBuf(void* pState, SRowBuffPos* pPos, SStateStore* pAPI) { pAPI->streamStateReleaseBuf(pState, pPos, true); return TSDB_CODE_SUCCESS; } -void setEventOutputBuf(SStreamAggSupporter* pAggSup, TSKEY* pTs, uint64_t groupId, bool* pStart, bool* pEnd, int32_t index, int32_t rows, SEventWindowInfo* pCurWin, SSessionKey* pNextWinKey) { +void setEventOutputBuf(SStreamAggSupporter* pAggSup, TSKEY* pTs, uint64_t groupId, bool* pStart, bool* pEnd, + int32_t index, int32_t rows, SEventWindowInfo* pCurWin, SSessionKey* pNextWinKey) { int32_t code = TSDB_CODE_SUCCESS; int32_t size = pAggSup->resultRowSize; - TSKEY ts = pTs [index]; - bool start = pStart[index]; - bool end = pEnd[index]; + TSKEY ts = pTs[index]; + bool start = pStart[index]; + bool end = pEnd[index]; pCurWin->winInfo.sessionWin.groupId = groupId; pCurWin->winInfo.sessionWin.win.skey = ts; pCurWin->winInfo.sessionWin.win.ekey = ts; @@ -122,7 +128,7 @@ void setEventOutputBuf(SStreamAggSupporter* pAggSup, TSKEY* pTs, uint64_t groupI bool inWin = isInTimeWindow(&leftWinKey.win, ts, 0); setEventWindowInfo(pAggSup, &leftWinKey, pVal, pCurWin); if(inWin || (pCurWin->pWinFlag->startFlag && !pCurWin->pWinFlag->endFlag) ) { - pCurWin->winInfo.isOutput = true; + pCurWin->winInfo.isOutput = !isWindowIncomplete(pCurWin); goto _end; } } @@ -135,7 +141,7 @@ void setEventOutputBuf(SStreamAggSupporter* pAggSup, TSKEY* pTs, uint64_t groupI int32_t endi = getEndCondIndex(pEnd, index, rows); if (endi < 0 || pTs[endi] >= rightWinKey.win.skey) { setEventWindowInfo(pAggSup, &rightWinKey, pVal, pCurWin); - pCurWin->winInfo.isOutput = true; + pCurWin->winInfo.isOutput = !isWindowIncomplete(pCurWin); goto _end; } } @@ -247,10 +253,6 @@ static int32_t compactEventWindow(SOperatorInfo* pOperator, SEventWindowInfo* pC return winNum; } -static bool isWindowIncomplete(SEventWindowInfo* pWinInfo) { - return !(pWinInfo->pWinFlag->startFlag && pWinInfo->pWinFlag->endFlag); -} - bool doDeleteEventWindow(SStreamAggSupporter* pAggSup, SSHashObj* pSeUpdated, SSessionKey* pKey) { pAggSup->stateStore.streamStateSessionDel(pAggSup->pState, pKey); removeSessionResult(pAggSup, pSeUpdated, pAggSup->pResultRows, pKey); @@ -324,10 +326,13 @@ static void doStreamEventAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl ASSERT(winRows >= 1); if (rebuild) { uint64_t uid = 0; - appendOneRowToStreamSpecialBlock(pAggSup->pScanBlock, &curWin.winInfo.sessionWin.win.skey, + appendDataToSpecialBlock(pAggSup->pScanBlock, &curWin.winInfo.sessionWin.win.skey, &curWin.winInfo.sessionWin.win.ekey, &uid, &groupId, NULL); tSimpleHashRemove(pSeUpdated, &curWin.winInfo.sessionWin, sizeof(SSessionKey)); doDeleteEventWindow(pAggSup, pSeUpdated, &curWin.winInfo.sessionWin); + if (pInfo->destHasPrimaryKey && curWin.winInfo.isOutput && IS_NORMAL_EVENT_OP(pOperator) && !isWindowIncomplete(&curWin)) { + saveDeleteRes(pInfo->pPkDeleted, curWin.winInfo.sessionWin); + } releaseOutputBuf(pAggSup->pState, curWin.winInfo.pStatePos, &pAPI->stateStore); SSessionKey tmpSeInfo = {0}; getSessionHashKey(&curWin.winInfo.sessionWin, &tmpSeInfo); @@ -337,7 +342,7 @@ static void doStreamEventAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl code = doOneWindowAggImpl(&pInfo->twAggSup.timeWindowData, &curWin.winInfo, &pResult, i, winRows, rows, numOfOutput, pOperator, 0); if (code != TSDB_CODE_SUCCESS || pResult == NULL) { - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + break; } compactEventWindow(pOperator, &curWin, pInfo->pSeUpdated, pInfo->pSeDeleted, false); saveSessionOutputBuf(pAggSup, &curWin.winInfo); @@ -351,6 +356,10 @@ static void doStreamEventAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl continue; } + if (pInfo->destHasPrimaryKey && curWin.winInfo.isOutput && IS_NORMAL_EVENT_OP(pOperator)) { + saveDeleteRes(pInfo->pPkDeleted, curWin.winInfo.sessionWin); + } + if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE) { code = saveResult(curWin.winInfo, pSeUpdated); } @@ -523,7 +532,8 @@ static SSDataBlock* doStreamEventAgg(SOperatorInfo* pOperator) { if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT || pBlock->info.type == STREAM_CLEAR) { - deleteSessionWinState(&pInfo->streamAggSup, pBlock, pInfo->pSeUpdated, pInfo->pSeDeleted); + bool add = pInfo->destHasPrimaryKey && IS_NORMAL_EVENT_OP(pOperator); + deleteSessionWinState(&pInfo->streamAggSup, pBlock, pInfo->pSeUpdated, pInfo->pSeDeleted, pInfo->pPkDeleted, add); continue; } else if (pBlock->info.type == STREAM_GET_ALL) { pInfo->recvGetAll = true; @@ -563,6 +573,9 @@ static SSDataBlock* doStreamEventAgg(SOperatorInfo* pOperator) { getMaxTsWins(pHisWins, pInfo->historyWins); taosArrayDestroy(pHisWins); } + if (pInfo->destHasPrimaryKey && IS_NORMAL_EVENT_OP(pOperator)) { + copyDeleteSessionKey(pInfo->pPkDeleted, pInfo->pSeDeleted); + } initGroupResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated); pInfo->pUpdated = NULL; @@ -744,6 +757,8 @@ SOperatorInfo* createStreamEventAggOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT); pInfo->reCkBlock = false; pInfo->recvGetAll = false; + pInfo->pPkDeleted = tSimpleHashInit(64, hashFn); + pInfo->destHasPrimaryKey = pEventNode->window.destHasPrimayKey; setOperatorInfo(pOperator, "StreamEventAggOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT, true, OP_NOT_OPENED, pInfo, pTaskInfo); diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index 51071e2b4a..ed67c69771 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -29,7 +29,13 @@ #define IS_FINAL_INTERVAL_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) #define IS_MID_INTERVAL_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL) +#define IS_NORMAL_INTERVAL_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL || (op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) + #define IS_FINAL_SESSION_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) +#define IS_NORMAL_SESSION_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION || (op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) + +#define IS_NORMAL_STATE_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE) + #define DEAULT_DELETE_MARK INT64_MAX #define STREAM_INTERVAL_OP_STATE_NAME "StreamIntervalHistoryState" #define STREAM_SESSION_OP_STATE_NAME "StreamSessionHistoryState" @@ -371,11 +377,11 @@ static void doBuildDeleteResult(SStreamIntervalOperatorInfo* pInfo, SArray* pWin void* tbname = NULL; pInfo->stateStore.streamStateGetParName(pInfo->pState, pWin->groupId, &tbname); if (tbname == NULL) { - appendOneRowToStreamSpecialBlock(pBlock, &pWin->ts, &pWin->ts, &uid, &pWin->groupId, NULL); + appendDataToSpecialBlock(pBlock, &pWin->ts, &pWin->ts, &uid, &pWin->groupId, NULL); } else { char parTbName[VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN]; STR_WITH_MAXSIZE_TO_VARSTR(parTbName, tbname, sizeof(parTbName)); - appendOneRowToStreamSpecialBlock(pBlock, &pWin->ts, &pWin->ts, &uid, &pWin->groupId, parTbName); + appendDataToSpecialBlock(pBlock, &pWin->ts, &pWin->ts, &uid, &pWin->groupId, parTbName); } pInfo->stateStore.streamStateFreeVal(tbname); (*index)++; @@ -432,6 +438,7 @@ void destroyStreamFinalIntervalOperatorInfo(void* param) { tSimpleHashCleanup(pInfo->pUpdatedMap); pInfo->pUpdatedMap = NULL; pInfo->pUpdated = taosArrayDestroy(pInfo->pUpdated); + tSimpleHashCleanup(pInfo->pDeletedMap); blockDataDestroy(pInfo->pCheckpointRes); @@ -526,9 +533,7 @@ int32_t setIntervalOutputBuf(void* pState, STimeWindow* win, SRowBuffPos** pResu char* value = NULL; int32_t size = pAggSup->resultRowSize; - if (pStore->streamStateAddIfNotExist(pState, &key, (void**)&value, &size) < 0) { - return TSDB_CODE_OUT_OF_MEMORY; - } + int32_t code = pStore->streamStateAddIfNotExist(pState, &key, (void**)&value, &size); *pResult = (SRowBuffPos*)value; SResultRow* res = (SResultRow*)((*pResult)->pRowBuff); @@ -536,7 +541,7 @@ int32_t setIntervalOutputBuf(void* pState, STimeWindow* win, SRowBuffPos** pResu // set time window for current result res->win = (*win); setResultRowInitCtx(res, pCtx, numOfOutput, rowEntryInfoOffset); - return TSDB_CODE_SUCCESS; + return code; } bool isDeletedStreamWindow(STimeWindow* pWin, uint64_t groupId, void* pState, STimeWindowAggSupp* pTwSup, @@ -612,6 +617,7 @@ static void doBuildPullDataBlock(SArray* array, int32_t* pIndex, SSDataBlock* pB static bool processPullOver(SSDataBlock* pBlock, SHashObj* pMap, SHashObj* pFinalMap, SInterval* pInterval, SArray* pPullWins, int32_t numOfCh, SOperatorInfo* pOperator) { + SStreamIntervalOperatorInfo* pInfo = pOperator->info; SColumnInfoData* pStartCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); TSKEY* tsData = (TSKEY*)pStartCol->pData; SColumnInfoData* pEndCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); @@ -654,6 +660,10 @@ static bool processPullOver(SSDataBlock* pBlock, SHashObj* pMap, SHashObj* pFina taosArrayPush(pInfo->pMidPullDatas, &winRes); } else if (savePullWindow(&pull, pPullWins) == TSDB_CODE_SUCCESS) { addPullWindow(pMap, &winRes, numOfCh); + if (pInfo->destHasPrimaryKey) { + tSimpleHashPut(pInfo->pDeletedMap,&winRes, sizeof(SWinKey), NULL, 0); + } + qDebug("===stream===prepare final retrive for delete %" PRId64 ", size:%d", winRes.ts, numOfCh); } } } @@ -677,6 +687,9 @@ static void addRetriveWindow(SArray* wins, SStreamIntervalOperatorInfo* pInfo, i // add pull data request if (savePullWindow(&pull, pInfo->pPullWins) == TSDB_CODE_SUCCESS) { addPullWindow(pInfo->pPullDataMap, winKey, pInfo->numOfChild); + if (pInfo->destHasPrimaryKey) { + tSimpleHashPut(pInfo->pDeletedMap,winKey, sizeof(SWinKey), NULL, 0); + } qDebug("===stream===prepare retrive for delete %" PRId64 ", size:%d", winKey->ts, pInfo->numOfChild); } } else { @@ -807,7 +820,7 @@ static int32_t getNextQualifiedFinalWindow(SInterval* pInterval, STimeWindow* pN } static void doStreamIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBlock, uint64_t groupId, - SSHashObj* pUpdatedMap) { + SSHashObj* pUpdatedMap, SSHashObj* pDeletedMap) { SStreamIntervalOperatorInfo* pInfo = (SStreamIntervalOperatorInfo*)pOperator->info; pInfo->dataVersion = TMAX(pInfo->dataVersion, pSDataBlock->info.version); @@ -875,6 +888,9 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDat // add pull data request if (savePullWindow(&pull, pInfo->pPullWins) == TSDB_CODE_SUCCESS) { addPullWindow(pInfo->pPullDataMap, &winRes, pInfo->numOfChild); + if (pInfo->destHasPrimaryKey) { + tSimpleHashPut(pInfo->pDeletedMap,&winRes, sizeof(SWinKey), NULL, 0); + } } } else { int32_t index = -1; @@ -902,9 +918,9 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDat int32_t code = setIntervalOutputBuf(pInfo->pState, &nextWin, &pResPos, groupId, pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, &pInfo->stateStore); pResult = (SResultRow*)pResPos->pRowBuff; - if (code != TSDB_CODE_SUCCESS || pResult == NULL) { + if (pResult == NULL) { qError("%s set interval output buff error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + break; } if (IS_FINAL_INTERVAL_OP(pOperator)) { forwardRows = 1; @@ -917,6 +933,11 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDat .ts = pResult->win.skey, .groupId = groupId, }; + + if (pInfo->destHasPrimaryKey && code == TSDB_CODE_SUCCESS && IS_NORMAL_INTERVAL_OP(pOperator)) { + tSimpleHashPut(pDeletedMap,&key, sizeof(SWinKey), NULL, 0); + } + if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE && pUpdatedMap) { saveWinResult(&key, pResPos, pUpdatedMap); } @@ -1174,6 +1195,16 @@ void doStreamIntervalSaveCheckpoint(SOperatorInfo* pOperator) { taosMemoryFree(buf); } +static void copyIntervalDeleteKey(SSHashObj* pMap, SArray* pWins) { + void* pIte = NULL; + int32_t iter = 0; + while ((pIte = tSimpleHashIterate(pMap, pIte, &iter)) != NULL) { + void* pKey = tSimpleHashGetKey(pIte, NULL); + taosArrayPush(pWins, pKey); + } + tSimpleHashClear(pMap); +} + static SSDataBlock* buildIntervalResult(SOperatorInfo* pOperator) { SStreamIntervalOperatorInfo* pInfo = pOperator->info; SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; @@ -1359,7 +1390,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { projectApplyFunctions(pExprSup->pExprInfo, pBlock, pBlock, pExprSup->pCtx, pExprSup->numOfExprs, NULL); } setInputDataBlock(pSup, pBlock, TSDB_ORDER_ASC, MAIN_SCAN, true); - doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pInfo->pUpdatedMap); + doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pInfo->pUpdatedMap, pInfo->pDeletedMap); pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, pBlock->info.window.ekey); pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, pBlock->info.watermark); pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, pBlock->info.window.skey); @@ -1369,6 +1400,9 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { if (IS_FINAL_INTERVAL_OP(pOperator)) { closeStreamIntervalWindow(pInfo->aggSup.pResultRowHashTable, &pInfo->twAggSup, &pInfo->interval, pInfo->pPullDataMap, pInfo->pUpdatedMap, pInfo->pDelWins, pOperator); + if (pInfo->destHasPrimaryKey) { + copyIntervalDeleteKey(pInfo->pDeletedMap, pInfo->pDelWins); + } } pInfo->binfo.pRes->info.watermark = pInfo->twAggSup.maxTs; @@ -1565,6 +1599,8 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, pInfo->pMidPulloverRes = createSpecialDataBlock(STREAM_MID_RETRIEVE); pInfo->clearState = false; pInfo->pMidPullDatas = taosArrayInit(4, sizeof(SWinKey)); + pInfo->pDeletedMap = tSimpleHashInit(4096, hashFn); + pInfo->destHasPrimaryKey = pIntervalPhyNode->window.destHasPrimayKey; pOperator->operatorType = pPhyNode->type; if (!IS_FINAL_INTERVAL_OP(pOperator) || numOfChild == 0) { @@ -1646,6 +1682,7 @@ void destroyStreamSessionAggOperatorInfo(void* param) { taosArrayDestroy(pInfo->historyWins); blockDataDestroy(pInfo->pCheckpointRes); + tSimpleHashCleanup(pInfo->pPkDeleted); taosMemoryFreeClear(param); } @@ -1865,10 +1902,10 @@ void removeSessionDeleteResults(SSHashObj* pHashMap, SArray* pWins) { } int32_t size = taosArrayGetSize(pWins); for (int32_t i = 0; i < size; i++) { - SSessionKey* pWin = taosArrayGet(pWins, i); + SResultWindowInfo* pWin = taosArrayGet(pWins, i); if (!pWin) continue; SSessionKey key = {0}; - getSessionHashKey(pWin, &key); + getSessionHashKey(&pWin->sessionWin, &key); tSimpleHashRemove(pHashMap, &key, sizeof(SSessionKey)); } } @@ -2109,17 +2146,20 @@ static void doStreamSessionAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSData pOperator, winDelta); if (code != TSDB_CODE_SUCCESS || pResult == NULL) { qError("%s do stream session aggregate impl error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + break; } compactSessionWindow(pOperator, &winInfo, pStUpdated, pStDeleted, addGap); saveSessionOutputBuf(pAggSup, &winInfo); + if (pInfo->destHasPrimaryKey && winInfo.isOutput && IS_NORMAL_SESSION_OP(pOperator)) { + saveDeleteRes(pInfo->pPkDeleted, winInfo.sessionWin); + } if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE && pStUpdated) { code = saveResult(winInfo, pStUpdated); if (code != TSDB_CODE_SUCCESS) { qError("%s do stream session aggregate impl, set result error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + break; } } if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE) { @@ -2645,6 +2685,20 @@ void resetUnCloseSessionWinInfo(SSHashObj* winMap) { } } +void copyDeleteSessionKey(SSHashObj* source, SSHashObj* dest) { + if (tSimpleHashGetSize(source) == 0) { + return; + } + void* pIte = NULL; + int32_t iter = 0; + size_t keyLen = 0; + while ((pIte = tSimpleHashIterate(source, pIte, &iter)) != NULL) { + SSessionKey* pKey = tSimpleHashGetKey(pIte, &keyLen); + saveDeleteRes(dest, *pKey); + } + tSimpleHashClear(source); +} + static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { SExprSupp* pSup = &pOperator->exprSupp; SStreamSessionAggOperatorInfo* pInfo = pOperator->info; @@ -2705,6 +2759,9 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { rebuildSessionWindow(pOperator, pWins, pInfo->pStUpdated); } copyDeleteWindowInfo(pWins, pInfo->pStDeleted); + if (pInfo->destHasPrimaryKey && IS_NORMAL_SESSION_OP(pOperator)) { + copyDeleteWindowInfo(pWins, pInfo->pPkDeleted); + } taosArrayDestroy(pWins); continue; } else if (pBlock->info.type == STREAM_GET_ALL) { @@ -2760,6 +2817,9 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { if (pInfo->isHistoryOp) { getMaxTsWins(pInfo->pUpdated, pInfo->historyWins); } + if (pInfo->destHasPrimaryKey && IS_NORMAL_SESSION_OP(pOperator)) { + copyDeleteSessionKey(pInfo->pPkDeleted, pInfo->pStDeleted); + } initGroupResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated); pInfo->pUpdated = NULL; blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity); @@ -2985,6 +3045,8 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT); pInfo->clearState = false; pInfo->recvGetAll = false; + pInfo->destHasPrimaryKey = pSessionNode->window.destHasPrimayKey; + pInfo->pPkDeleted = tSimpleHashInit(64, hashFn); pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION; setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION, true, @@ -3025,11 +3087,14 @@ static void clearStreamSessionOperator(SStreamSessionAggOperatorInfo* pInfo) { } void deleteSessionWinState(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHashObj* pMapUpdate, - SSHashObj* pMapDelete) { + SSHashObj* pMapDelete, SSHashObj* pPkDelete, bool needAdd) { SArray* pWins = taosArrayInit(16, sizeof(SSessionKey)); doDeleteTimeWindows(pAggSup, pBlock, pWins); removeSessionResults(pAggSup, pMapUpdate, pWins); copyDeleteWindowInfo(pWins, pMapDelete); + if (needAdd) { + copyDeleteWindowInfo(pWins, pPkDelete); + } taosArrayDestroy(pWins); } @@ -3092,7 +3157,7 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) { if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT || pBlock->info.type == STREAM_CLEAR) { // gap must be 0 - deleteSessionWinState(pAggSup, pBlock, pInfo->pStUpdated, pInfo->pStDeleted); + deleteSessionWinState(pAggSup, pBlock, pInfo->pStUpdated, pInfo->pStDeleted, NULL, false); pInfo->clearState = true; break; } else if (pBlock->info.type == STREAM_GET_ALL) { @@ -3218,6 +3283,7 @@ void destroyStreamStateOperatorInfo(void* param) { taosArrayDestroy(pInfo->historyWins); blockDataDestroy(pInfo->pCheckpointRes); + tSimpleHashCleanup(pInfo->pPkDeleted); taosMemoryFreeClear(param); } @@ -3448,7 +3514,7 @@ static void doStreamStateAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl pAggSup->pResultRows, pSeUpdated, pStDeleted); if (!allEqual) { uint64_t uid = 0; - appendOneRowToStreamSpecialBlock(pAggSup->pScanBlock, &curWin.winInfo.sessionWin.win.skey, + appendDataToSpecialBlock(pAggSup->pScanBlock, &curWin.winInfo.sessionWin.win.skey, &curWin.winInfo.sessionWin.win.ekey, &uid, &groupId, NULL); tSimpleHashRemove(pSeUpdated, &curWin.winInfo.sessionWin, sizeof(SSessionKey)); doDeleteSessionWindow(pAggSup, &curWin.winInfo.sessionWin); @@ -3459,15 +3525,19 @@ static void doStreamStateAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl pOperator, 0); if (code != TSDB_CODE_SUCCESS || pResult == NULL) { qError("%s do one window aggregate impl error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + break; } saveSessionOutputBuf(pAggSup, &curWin.winInfo); + if (pInfo->destHasPrimaryKey && curWin.winInfo.isOutput && IS_NORMAL_STATE_OP(pOperator)) { + saveDeleteRes(pInfo->pPkDeleted, curWin.winInfo.sessionWin); + } + if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE) { code = saveResult(curWin.winInfo, pSeUpdated); if (code != TSDB_CODE_SUCCESS) { qError("%s do stream state aggregate impl, set result error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + break; } } @@ -3654,7 +3724,8 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) { if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT || pBlock->info.type == STREAM_CLEAR) { - deleteSessionWinState(&pInfo->streamAggSup, pBlock, pInfo->pSeUpdated, pInfo->pSeDeleted); + bool add = pInfo->destHasPrimaryKey && IS_NORMAL_STATE_OP(pOperator); + deleteSessionWinState(&pInfo->streamAggSup, pBlock, pInfo->pSeUpdated, pInfo->pSeDeleted, pInfo->pPkDeleted, add); continue; } else if (pBlock->info.type == STREAM_GET_ALL) { pInfo->recvGetAll = true; @@ -3690,6 +3761,9 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) { if (pInfo->isHistoryOp) { getMaxTsWins(pInfo->pUpdated, pInfo->historyWins); } + if (pInfo->destHasPrimaryKey && IS_NORMAL_STATE_OP(pOperator)) { + copyDeleteSessionKey(pInfo->pPkDeleted, pInfo->pSeDeleted); + } initGroupResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated); pInfo->pUpdated = NULL; @@ -3871,6 +3945,8 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT); pInfo->recvGetAll = false; + pInfo->pPkDeleted = tSimpleHashInit(64, hashFn); + pInfo->destHasPrimaryKey = pStateNode->window.destHasPrimayKey; setOperatorInfo(pOperator, "StreamStateAggOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE, true, OP_NOT_OPENED, pInfo, pTaskInfo); @@ -4011,7 +4087,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { } #endif - doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pInfo->pUpdatedMap); + doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pInfo->pUpdatedMap, pInfo->pDeletedMap); pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, pBlock->info.window.ekey); pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, pBlock->info.window.skey); } @@ -4019,6 +4095,9 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins); closeStreamIntervalWindow(pInfo->aggSup.pResultRowHashTable, &pInfo->twAggSup, &pInfo->interval, NULL, pInfo->pUpdatedMap, pInfo->pDelWins, pOperator); + if (pInfo->destHasPrimaryKey && IS_NORMAL_INTERVAL_OP(pOperator)) { + copyIntervalDeleteKey(pInfo->pDeletedMap, pInfo->pDelWins); + } void* pIte = NULL; int32_t iter = 0; @@ -4135,6 +4214,10 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->recvGetAll = false; pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT); + _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); + pInfo->pDeletedMap = tSimpleHashInit(4096, hashFn); + pInfo->destHasPrimaryKey = pIntervalPhyNode->window.destHasPrimayKey; + // for stream void* buff = NULL; int32_t len = 0; @@ -4213,8 +4296,9 @@ static void doStreamMidIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pS int32_t code = setIntervalOutputBuf(pInfo->pState, &nextWin, &pResPos, groupId, pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, &pInfo->stateStore); pResult = (SResultRow*)pResPos->pRowBuff; - if (code != TSDB_CODE_SUCCESS || pResult == NULL) { - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + if (pResult == NULL) { + qError("%s set interval output buff error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); + break; } if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE) { diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c index 69a90f03ed..25b8dcfe6e 100644 --- a/source/libs/executor/src/sysscanoperator.c +++ b/source/libs/executor/src/sysscanoperator.c @@ -879,7 +879,7 @@ static int32_t sysTableGetGeomText(char* iGeom, int32_t nGeom, char** output, in char* outputWKT = NULL; if (nGeom == 0) { - if (!(*output = strdup(""))) code = TSDB_CODE_OUT_OF_MEMORY; + if (!(*output = taosStrdup(""))) code = TSDB_CODE_OUT_OF_MEMORY; *nOutput = 0; return code; } @@ -983,7 +983,10 @@ static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo, : (3 + DBL_MANT_DIG - DBL_MIN_EXP + VARSTR_HEADER_SIZE); tagVarChar = taosMemoryCalloc(1, bufSize + 1); int32_t len = -1; - convertTagDataToStr(varDataVal(tagVarChar), tagType, tagData, tagLen, &len); + if (tagLen > 0) + convertTagDataToStr(varDataVal(tagVarChar), tagType, tagData, tagLen, &len); + else + len = 0; varDataSetLen(tagVarChar, len); } } diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index 9b28a203b8..080fd6b914 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -206,28 +206,14 @@ static bool checkDuplicateTimestamps(STimeSliceOperatorInfo* pSliceInfo, SColumn cur.pks[0].type = pPkCol->info.type; } + // let's discard the duplicated ts if ((pSliceInfo->prevTsSet == true) && (currentTs == pSliceInfo->prevKey.ts)) { -// if (pPkCol == NULL) { - return true; - /* } else { - tRowGetKeyFromColData(currentTs, pPkCol, curIndex, &cur); - if (tRowKeyCompare(&cur, &pSliceInfo->prevKey) == 0) { - return true; - } - }*/ + return true; } pSliceInfo->prevTsSet = true; tRowKeyAssign(&pSliceInfo->prevKey, &cur); - // todo handle next - if (currentTs == pSliceInfo->win.ekey && curIndex < rows - 1) { - int64_t nextTs = *(int64_t*)colDataGetData(pTsCol, curIndex + 1); - if (currentTs == nextTs) { - return true; - } - } - return false; } @@ -735,7 +721,6 @@ static void doTimesliceImpl(SOperatorInfo* pOperator, STimeSliceOperatorInfo* pS // check for duplicate timestamps if (checkDuplicateTimestamps(pSliceInfo, pTsCol, pPkCol, i, pBlock->info.rows)) { continue; -// T_LONG_JMP(pTaskInfo->env, TSDB_CODE_FUNC_DUP_TIMESTAMP); } if (checkNullRow(&pOperator->exprSupp, pBlock, i, ignoreNull)) { @@ -754,6 +739,7 @@ static void doTimesliceImpl(SOperatorInfo* pOperator, STimeSliceOperatorInfo* pS if (checkWindowBoundReached(pSliceInfo)) { break; } + if (checkThresholdReached(pSliceInfo, pOperator->resultInfo.threshold)) { saveBlockStatus(pSliceInfo, pBlock, i); return; @@ -828,7 +814,6 @@ static void doTimesliceImpl(SOperatorInfo* pOperator, STimeSliceOperatorInfo* pS // if reached here, meaning block processing finished naturally, // or interpolation reach window upper bound pSliceInfo->pRemainRes = NULL; - } static void genInterpAfterDataBlock(STimeSliceOperatorInfo* pSliceInfo, SOperatorInfo* pOperator, int32_t index) { diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 57cc0e82d2..8fb8aaa69d 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -359,8 +359,8 @@ static bool setTimeWindowInterpolationStartTs(SIntervalAggOperatorInfo* pInfo, i } static bool setTimeWindowInterpolationEndTs(SIntervalAggOperatorInfo* pInfo, SExprSupp* pSup, int32_t endRowIndex, - SArray* pDataBlock, const TSKEY* tsCols, TSKEY blockEkey, - STimeWindow* win) { + int32_t nextRowIndex, SArray* pDataBlock, const TSKEY* tsCols, + TSKEY blockEkey, STimeWindow* win) { int32_t order = pInfo->binfo.inputTsOrder; TSKEY actualEndKey = tsCols[endRowIndex]; @@ -378,7 +378,6 @@ static bool setTimeWindowInterpolationEndTs(SIntervalAggOperatorInfo* pInfo, SEx return true; } - int32_t nextRowIndex = endRowIndex + 1; ASSERT(nextRowIndex >= 0); TSKEY nextKey = tsCols[nextRowIndex]; @@ -496,7 +495,6 @@ static void doWindowBorderInterpolation(SIntervalAggOperatorInfo* pInfo, SSDataB ASSERT(pBlock != NULL); if (pBlock->pDataBlock == NULL) { - // tscError("pBlock->pDataBlock == NULL"); return; } @@ -514,17 +512,25 @@ static void doWindowBorderInterpolation(SIntervalAggOperatorInfo* pInfo, SSDataB } // point interpolation does not require the end key time window interpolation. - // if (pointInterpQuery) { - // return; - // } - // interpolation query does not generate the time window end interpolation done = isResultRowInterpolated(pResult, RESULT_ROW_END_INTERP); if (!done) { int32_t endRowIndex = startPos + forwardRows - 1; + int32_t nextRowIndex = endRowIndex + 1; + + // duplicated ts row does not involve in the interpolation of end value for current time window + int32_t x = endRowIndex; + while(x > 0) { + if (tsCols[x] == tsCols[x-1]) { + x -= 1; + } else { + endRowIndex = x; + break; + } + } TSKEY endKey = (pInfo->binfo.inputTsOrder == TSDB_ORDER_ASC) ? pBlock->info.window.ekey : pBlock->info.window.skey; - bool interp = setTimeWindowInterpolationEndTs(pInfo, pSup, endRowIndex, pBlock->pDataBlock, tsCols, endKey, win); + bool interp = setTimeWindowInterpolationEndTs(pInfo, pSup, endRowIndex, nextRowIndex, pBlock->pDataBlock, tsCols, endKey, win); if (interp) { setResultRowInterpo(pResult, RESULT_ROW_END_INTERP); } diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index fafc313afc..b88e1474d7 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -138,7 +138,7 @@ typedef struct SElapsedInfo { typedef struct STwaInfo { double dOutput; - bool isNull; + int64_t numOfElems; SPoint1 p; STimeWindow win; } STwaInfo; @@ -533,6 +533,24 @@ bool funcInputGetNextRowDescPk(SFuncInputRowIter* pIter, SFuncInputRow* pRow) { } } +static void forwardToNextDiffTsRow(SFuncInputRowIter* pIter, int32_t rowIndex) { + int32_t idx = rowIndex + 1; + while (idx <= pIter->inputEndIndex && pIter->tsList[idx] == pIter->tsList[rowIndex]) { + ++idx; + } + pIter->rowIndex = idx; +} + +static void setInputRowInfo(SFuncInputRow* pRow, SFuncInputRowIter* pIter, int32_t rowIndex, bool setPk) { + pRow->ts = pIter->tsList[rowIndex]; + pRow->ts = pIter->tsList[rowIndex]; + pRow->isDataNull = colDataIsNull_f(pIter->pDataCol->nullbitmap, rowIndex); + pRow->pData = colDataGetData(pIter->pDataCol, rowIndex); + pRow->pPk = setPk? colDataGetData(pIter->pPkCol, rowIndex):NULL; + pRow->block = pIter->pSrcBlock; + pRow->rowIndex = rowIndex; +} + bool funcInputGetNextRowAscPk(SFuncInputRowIter *pIter, SFuncInputRow* pRow) { if (pIter->hasPrev) { if (pIter->prevBlockTsEnd == pIter->tsList[pIter->inputEndIndex]) { @@ -543,33 +561,19 @@ bool funcInputGetNextRowAscPk(SFuncInputRowIter *pIter, SFuncInputRow* pRow) { while (pIter->tsList[idx] == pIter->prevBlockTsEnd) { ++idx; } - pRow->ts = pIter->tsList[idx]; - pRow->isDataNull = colDataIsNull_f(pIter->pDataCol->nullbitmap, idx); - pRow->pData = colDataGetData(pIter->pDataCol, idx); - pRow->pPk = colDataGetData(pIter->pPkCol, idx); - pRow->block = pIter->pSrcBlock; - pRow->rowIndex = idx; pIter->hasPrev = false; - pIter->rowIndex = idx + 1; + setInputRowInfo(pRow, pIter, idx, true); + forwardToNextDiffTsRow(pIter, idx); return true; } } else { if (pIter->rowIndex <= pIter->inputEndIndex) { - pRow->ts = pIter->tsList[pIter->rowIndex]; - pRow->isDataNull = colDataIsNull_f(pIter->pDataCol->nullbitmap, pIter->rowIndex); - pRow->pData = colDataGetData(pIter->pDataCol, pIter->rowIndex); - pRow->pPk = colDataGetData(pIter->pPkCol, pIter->rowIndex); - pRow->block = pIter->pSrcBlock; - pRow->rowIndex = pIter->rowIndex; + setInputRowInfo(pRow, pIter, pIter->rowIndex, true); TSKEY tsEnd = pIter->tsList[pIter->inputEndIndex]; if (pIter->tsList[pIter->rowIndex] != tsEnd) { - int32_t idx = pIter->rowIndex + 1; - while (idx <= pIter->inputEndIndex && pIter->tsList[idx] == pIter->tsList[pIter->rowIndex]) { - ++idx; - } - pIter->rowIndex = idx; + forwardToNextDiffTsRow(pIter, pIter->rowIndex); } else { pIter->rowIndex = pIter->inputEndIndex + 1; } @@ -585,13 +589,7 @@ bool funcInputGetNextRowAscPk(SFuncInputRowIter *pIter, SFuncInputRow* pRow) { bool funcInputGetNextRowNoPk(SFuncInputRowIter *pIter, SFuncInputRow* pRow) { if (pIter->rowIndex <= pIter->inputEndIndex) { - pRow->ts = pIter->tsList[pIter->rowIndex]; - pRow->isDataNull = colDataIsNull_f(pIter->pDataCol->nullbitmap, pIter->rowIndex); - pRow->pData = colDataGetData(pIter->pDataCol, pIter->rowIndex); - pRow->pPk = NULL; - pRow->block = pIter->pSrcBlock; - pRow->rowIndex = pIter->rowIndex; - + setInputRowInfo(pRow, pIter, pIter->rowIndex, false); ++pIter->rowIndex; return true; } else { @@ -602,10 +600,10 @@ bool funcInputGetNextRowNoPk(SFuncInputRowIter *pIter, SFuncInputRow* pRow) { bool funcInputGetNextRow(SqlFunctionCtx* pCtx, SFuncInputRow* pRow) { SFuncInputRowIter* pIter = &pCtx->rowIter; if (pCtx->hasPrimaryKey) { - if (pCtx->order == TSDB_ORDER_DESC) { - return funcInputGetNextRowDescPk(pIter, pRow); - } else { + if (pCtx->order == TSDB_ORDER_ASC) { return funcInputGetNextRowAscPk(pIter, pRow); + } else { + return funcInputGetNextRowDescPk(pIter, pRow); } } else { return funcInputGetNextRowNoPk(pIter, pRow); @@ -2821,11 +2819,13 @@ static int32_t firstLastTransferInfoImpl(SFirstLastRes* pInput, SFirstLastRes* p pOutput->isNull = pInput->isNull; pOutput->ts = pInput->ts; pOutput->bytes = pInput->bytes; + pOutput->pkType = pInput->pkType; memcpy(pOutput->buf, pInput->buf, pOutput->bytes); if (pInput->pkData) { pOutput->pkBytes = pInput->pkBytes; memcpy(pOutput->buf+pOutput->bytes, pInput->pkData, pOutput->pkBytes); + pOutput->pkData = pOutput->buf + pOutput->bytes; } return TSDB_CODE_SUCCESS; } @@ -5556,7 +5556,7 @@ bool twaFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo) { } STwaInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - pInfo->isNull = false; + pInfo->numOfElems = 0; pInfo->p.key = INT64_MIN; pInfo->win = TSWINDOW_INITIALIZER; return true; @@ -5580,16 +5580,12 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pInputCol = pInput->pData[0]; - TSKEY* tsList = (int64_t*)pInput->pPTS->pData; - SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); - - STwaInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); - SPoint1* last = &pInfo->p; - int32_t numOfElems = 0; + STwaInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); + SPoint1* last = &pInfo->p; if (IS_NULL_TYPE(pInputCol->info.type)) { - pInfo->isNull = true; + pInfo->numOfElems = 0; goto _twa_over; } @@ -5607,7 +5603,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { pInfo->dOutput += twa_get_area(pCtx->start, *last); pInfo->win.skey = pCtx->start.key; - numOfElems++; + pInfo->numOfElems++; break; } } else if (pInfo->p.key == INT64_MIN) { @@ -5621,7 +5617,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { GET_TYPED_DATA(last->val, double, pInputCol->info.type, row.pData); pInfo->win.skey = last->key; - numOfElems++; + pInfo->numOfElems++; break; } } @@ -5635,7 +5631,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(int8_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5653,7 +5649,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(int16_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5670,7 +5666,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(int32_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5687,7 +5683,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(int64_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5704,7 +5700,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(float_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5721,7 +5717,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(double*)row.pData); if (pInfo->p.key == st.key) { @@ -5738,7 +5734,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(uint8_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5755,7 +5751,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(uint16_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5772,7 +5768,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(uint32_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5789,7 +5785,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(uint64_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5810,16 +5806,12 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (pCtx->end.key != INT64_MIN) { pInfo->dOutput += twa_get_area(pInfo->p, pCtx->end); pInfo->p = pCtx->end; - numOfElems += 1; + pInfo->numOfElems += 1; } pInfo->win.ekey = pInfo->p.key; _twa_over: - if (numOfElems == 0) { - pInfo->isNull = true; - } - SET_VAL(pResInfo, 1, 1); return TSDB_CODE_SUCCESS; } @@ -5840,7 +5832,7 @@ int32_t twaFinalize(struct SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); STwaInfo* pInfo = (STwaInfo*)GET_ROWCELL_INTERBUF(pResInfo); - if (pInfo->isNull == true) { + if (pInfo->numOfElems == 0) { pResInfo->numOfRes = 0; } else { if (pInfo->win.ekey == pInfo->win.skey) { diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 3e4b3cad31..eb4a687bc9 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -13,6 +13,7 @@ * along with this program. If not, see . */ +#include "cmdnodes.h" #include "nodesUtil.h" #include "plannodes.h" #include "querynodes.h" @@ -121,6 +122,16 @@ static int32_t columnNodeCopy(const SColumnNode* pSrc, SColumnNode* pDst) { COPY_SCALAR_FIELD(slotId); COPY_SCALAR_FIELD(tableHasPk); COPY_SCALAR_FIELD(isPk); + COPY_SCALAR_FIELD(numOfPKs); + return TSDB_CODE_SUCCESS; +} + +static int32_t columnDefNodeCopy(const SColumnDefNode* pSrc, SColumnDefNode* pDst) { + COPY_CHAR_ARRAY_FIELD(colName); + COPY_OBJECT_FIELD(dataType, sizeof(SDataType)); + COPY_CHAR_ARRAY_FIELD(comments); + COPY_SCALAR_FIELD(sma); + COPY_SCALAR_FIELD(is_pk); return TSDB_CODE_SUCCESS; } @@ -717,6 +728,7 @@ static int32_t physiWindowCopy(const SWindowPhysiNode* pSrc, SWindowPhysiNode* p COPY_SCALAR_FIELD(triggerType); COPY_SCALAR_FIELD(watermark); COPY_SCALAR_FIELD(igExpired); + COPY_SCALAR_FIELD(destHasPrimayKey); return TSDB_CODE_SUCCESS; } @@ -834,6 +846,9 @@ SNode* nodesCloneNode(const SNode* pNode) { case QUERY_NODE_COLUMN: code = columnNodeCopy((const SColumnNode*)pNode, (SColumnNode*)pDst); break; + case QUERY_NODE_COLUMN_DEF: + code = columnDefNodeCopy((const SColumnDefNode*)pNode, (SColumnDefNode*)pDst); + break; case QUERY_NODE_VALUE: code = valueNodeCopy((const SValueNode*)pNode, (SValueNode*)pDst); break; diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index f000d87fdc..6c45df7f43 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -514,6 +514,7 @@ static const char* jkSchemaType = "Type"; static const char* jkSchemaColId = "ColId"; static const char* jkSchemaBytes = "bytes"; static const char* jkSchemaName = "Name"; +static const char* jkSchemaFlags = "Flags"; static int32_t schemaToJson(const void* pObj, SJson* pJson) { const SSchema* pNode = (const SSchema*)pObj; @@ -528,6 +529,9 @@ static int32_t schemaToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddStringToObject(pJson, jkSchemaName, pNode->name); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkSchemaFlags, pNode->flags); + } return code; } @@ -546,6 +550,9 @@ static int32_t jsonToSchema(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetStringValue(pJson, jkSchemaName, pNode->name); } + if (TSDB_CODE_SUCCESS == code) { + tjsonGetNumberValue(pJson, jkSchemaFlags, pNode->flags, code); + } return code; } @@ -2513,6 +2520,7 @@ static const char* jkWindowPhysiPlanDeleteMark = "DeleteMark"; static const char* jkWindowPhysiPlanIgnoreExpired = "IgnoreExpired"; static const char* jkWindowPhysiPlanInputTsOrder = "InputTsOrder"; static const char* jkWindowPhysiPlanMergeDataBlock = "MergeDataBlock"; +static const char* jkWindowPhysiPlanDestHasPrimaryKey = "DestHasPrimaryKey"; static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) { const SWindowPhysiNode* pNode = (const SWindowPhysiNode*)pObj; @@ -2545,6 +2553,9 @@ static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddBoolToObject(pJson, jkWindowPhysiPlanMergeDataBlock, pNode->mergeDataBlock); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkWindowPhysiPlanDestHasPrimaryKey, pNode->destHasPrimayKey); + } return code; } @@ -2580,6 +2591,9 @@ static int32_t jsonToPhysiWindowNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBoolValue(pJson, jkWindowPhysiPlanMergeDataBlock, &pNode->mergeDataBlock); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetTinyIntValue(pJson, jkWindowPhysiPlanDestHasPrimaryKey, &pNode->destHasPrimayKey); + } return code; } @@ -3618,6 +3632,7 @@ static const char* jkColumnDataBlockId = "DataBlockId"; static const char* jkColumnSlotId = "SlotId"; static const char* jkColumnTableHasPk = "TableHasPk"; static const char* jkColumnIsPk = "IsPk"; +static const char* jkColumnNumOfPKs = "NumOfPKs"; static int32_t columnNodeToJson(const void* pObj, SJson* pJson) { const SColumnNode* pNode = (const SColumnNode*)pObj; @@ -3662,6 +3677,9 @@ static int32_t columnNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddBoolToObject(pJson, jkColumnIsPk, pNode->isPk); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkColumnNumOfPKs, pNode->numOfPKs); + } return code; } @@ -3707,7 +3725,10 @@ static int32_t jsonToColumnNode(const SJson* pJson, void* pObj) { } if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBoolValue(pJson, jkColumnIsPk, &pNode->isPk); - } + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetSmallIntValue(pJson, jkColumnNumOfPKs, &pNode->numOfPKs); + } return code; } diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c index 0639a161bd..79cc5e47f2 100644 --- a/source/libs/nodes/src/nodesMsgFuncs.c +++ b/source/libs/nodes/src/nodesMsgFuncs.c @@ -731,6 +731,9 @@ static int32_t columnNodeInlineToMsg(const void* pObj, STlvEncoder* pEncoder) { if (TSDB_CODE_SUCCESS == code) { code = tlvEncodeValueBool(pEncoder, pNode->isPk); } + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeValueI16(pEncoder, pNode->numOfPKs); + } return code; } @@ -778,6 +781,9 @@ static int32_t msgToColumnNodeInline(STlvDecoder* pDecoder, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tlvDecodeValueBool(pDecoder, &pNode->isPk); } + if (TSDB_CODE_SUCCESS == code) { + code = tlvDecodeValueI16(pDecoder, &pNode->numOfPKs); + } return code; } @@ -2907,7 +2913,8 @@ enum { PHY_WINDOW_CODE_IG_EXPIRED, PHY_WINDOW_CODE_INPUT_TS_ORDER, PHY_WINDOW_CODE_OUTPUT_TS_ORDER, - PHY_WINDOW_CODE_MERGE_DATA_BLOCK + PHY_WINDOW_CODE_MERGE_DATA_BLOCK, + PHY_WINDOW_CODE_DEST_HAS_PRIMARY_KEY, }; static int32_t physiWindowNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { @@ -2941,6 +2948,9 @@ static int32_t physiWindowNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { if (TSDB_CODE_SUCCESS == code) { code = tlvEncodeBool(pEncoder, PHY_WINDOW_CODE_MERGE_DATA_BLOCK, pNode->mergeDataBlock); } + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeI8(pEncoder, PHY_WINDOW_CODE_DEST_HAS_PRIMARY_KEY, pNode->destHasPrimayKey); + } return code; } @@ -2982,6 +2992,9 @@ static int32_t msgToPhysiWindowNode(STlvDecoder* pDecoder, void* pObj) { case PHY_WINDOW_CODE_MERGE_DATA_BLOCK: code = tlvDecodeBool(pTlv, &pNode->mergeDataBlock); break; + case PHY_WINDOW_CODE_DEST_HAS_PRIMARY_KEY: + code = tlvDecodeI8(pTlv, &pNode->destHasPrimayKey); + break; default: break; } diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 2cac8ee411..2c60c1261b 100755 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -681,13 +681,23 @@ cmd ::= RESUME STREAM exists_opt(A) ignore_opt(C) stream_name(B). %type col_list_opt { SNodeList* } %destructor col_list_opt { nodesDestroyList($$); } col_list_opt(A) ::= . { A = NULL; } -col_list_opt(A) ::= NK_LP col_name_list(B) NK_RP. { A = B; } +col_list_opt(A) ::= NK_LP column_stream_def_list(B) NK_RP. { A = B; } + +%type column_stream_def_list { SNodeList* } +%destructor column_stream_def_list { nodesDestroyList($$); } +column_stream_def_list(A) ::= column_stream_def(B). { A = createNodeList(pCxt, B); } +column_stream_def_list(A) ::= column_stream_def_list(B) + NK_COMMA column_stream_def(C). { A = addNodeToList(pCxt, B, C); } + +column_stream_def(A) ::= column_name(B). { A = createColumnDefNode(pCxt, &B, createDataType(TSDB_DATA_TYPE_NULL), NULL, false); } +column_stream_def(A) ::= column_name(B) PRIMARY KEY. { A = createColumnDefNode(pCxt, &B, createDataType(TSDB_DATA_TYPE_NULL), NULL, true); } +//column_stream_def(A) ::= column_def(B). { A = B; } %type tag_def_or_ref_opt { SNodeList* } %destructor tag_def_or_ref_opt { nodesDestroyList($$); } tag_def_or_ref_opt(A) ::= . { A = NULL; } tag_def_or_ref_opt(A) ::= tags_def(B). { A = B; } -tag_def_or_ref_opt(A) ::= TAGS NK_LP col_name_list(B) NK_RP. { A = B; } +tag_def_or_ref_opt(A) ::= TAGS NK_LP column_stream_def_list(B) NK_RP. { A = B; } stream_options(A) ::= . { A = createStreamOptions(pCxt); } stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE(C). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, NULL); } @@ -748,16 +758,52 @@ insert_query(A) ::= INSERT INTO full_table_name(C) query_or_subquery(B). /************************************************ tags_literal *************************************************************/ tags_literal(A) ::= NK_INTEGER(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B, NULL); } +tags_literal(A) ::= NK_INTEGER(B) NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_INTEGER(B) NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_PLUS(B) NK_INTEGER(C). { SToken t = B; t.n = (C.z + C.n) - B.z; A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } +tags_literal(A) ::= NK_PLUS(B) NK_INTEGER NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_PLUS(B) NK_INTEGER NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_MINUS(B) NK_INTEGER(C). { SToken t = B; t.n = (C.z + C.n) - B.z; A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } +tags_literal(A) ::= NK_MINUS(B) NK_INTEGER NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_MINUS(B) NK_INTEGER NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_FLOAT(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &B, NULL); } tags_literal(A) ::= NK_PLUS(B) NK_FLOAT(C). { SToken t = B; @@ -771,29 +817,113 @@ tags_literal(A) ::= NK_MINUS(B) NK_FLOAT(C). } tags_literal(A) ::= NK_BIN(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B, NULL); } +tags_literal(A) ::= NK_BIN(B) NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_BIN(B) NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_PLUS(B) NK_BIN(C). { SToken t = B; t.n = (C.z + C.n) - B.z; A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } +tags_literal(A) ::= NK_PLUS(B) NK_BIN NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_PLUS(B) NK_BIN NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_MINUS(B) NK_BIN(C). { SToken t = B; t.n = (C.z + C.n) - B.z; A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } +tags_literal(A) ::= NK_MINUS(B) NK_BIN NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_MINUS(B) NK_BIN NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_HEX(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B, NULL); } +tags_literal(A) ::= NK_HEX(B) NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_HEX(B) NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_PLUS(B) NK_HEX(C). { SToken t = B; t.n = (C.z + C.n) - B.z; A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } +tags_literal(A) ::= NK_PLUS(B) NK_HEX NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_PLUS(B) NK_HEX NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_MINUS(B) NK_HEX(C). { SToken t = B; t.n = (C.z + C.n) - B.z; A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } +tags_literal(A) ::= NK_MINUS(B) NK_HEX NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_MINUS(B) NK_HEX NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_STRING(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B, NULL); } +tags_literal(A) ::= NK_STRING(B) NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_STRING(B) NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_BOOL(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B, NULL); } tags_literal(A) ::= NULL(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &B, NULL); } diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 1a41ba5fb9..bbcd27bd65 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -183,6 +183,8 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, const char** pSql, E pBoundInfo->numOfBound = 0; + bool hasPK = pTableMeta->tableInfo.numOfPKs; + int16_t numOfBoundPKs = 0; int16_t lastColIdx = -1; // last column found int32_t code = TSDB_CODE_SUCCESS; while (TSDB_CODE_SUCCESS == code) { @@ -219,14 +221,20 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, const char** pSql, E pUseCols[index] = true; pBoundInfo->pColIndex[pBoundInfo->numOfBound] = index; ++pBoundInfo->numOfBound; + if (hasPK && (pSchema[index].flags & COL_IS_KEY)) ++numOfBoundPKs; } } - if (TSDB_CODE_SUCCESS == code && (BOUND_TAGS != boundColsType) && !pUseCols[0]) { - code = buildInvalidOperationMsg(&pCxt->msg, "primary timestamp column can not be null"); + if (TSDB_CODE_SUCCESS == code && (BOUND_TAGS != boundColsType)) { + if (!pUseCols[0]) { + code = buildInvalidOperationMsg(&pCxt->msg, "Primary timestamp column should not be null"); + } + if (numOfBoundPKs != pTableMeta->tableInfo.numOfPKs) { + code = buildInvalidOperationMsg(&pCxt->msg, "Primary key column should not be none"); + } } if (TSDB_CODE_SUCCESS == code && (BOUND_ALL_AND_TBNAME == boundColsType) && !pUseCols[tbnameSchemaIndex]) { - code = buildInvalidOperationMsg(&pCxt->msg, "tbname column can not be null"); + code = buildInvalidOperationMsg(&pCxt->msg, "tbname column should not be null"); } taosMemoryFree(pUseCols); @@ -469,13 +477,15 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema, char* endptr = NULL; int32_t code = TSDB_CODE_SUCCESS; +#if 0 if (isNullValue(pSchema->type, pToken)) { if (TSDB_DATA_TYPE_TIMESTAMP == pSchema->type && PRIMARYKEY_TIMESTAMP_COL_ID == pSchema->colId) { - return buildSyntaxErrMsg(pMsgBuf, "primary timestamp should not be null", pToken->z); + return buildSyntaxErrMsg(pMsgBuf, "Primary timestamp column can not be null", pToken->z); } return TSDB_CODE_SUCCESS; } +#endif // strcpy(val->colName, pSchema->name); val->cid = pSchema->colId; @@ -1382,7 +1392,7 @@ int32_t initTableColSubmitData(STableDataCxt* pTableCxt) { if (NULL == pCol) { return TSDB_CODE_OUT_OF_MEMORY; } - tColDataInit(pCol, pSchema->colId, pSchema->type, 0); + tColDataInit(pCol, pSchema->colId, pSchema->type, pSchema->flags); } return TSDB_CODE_SUCCESS; @@ -1643,7 +1653,10 @@ static int32_t parseValueToken(SInsertParseContext* pCxt, const char** pSql, STo int32_t code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, pSchema->type); if (TSDB_CODE_SUCCESS == code && isNullValue(pSchema->type, pToken)) { if (TSDB_DATA_TYPE_TIMESTAMP == pSchema->type && PRIMARYKEY_TIMESTAMP_COL_ID == pSchema->colId) { - return buildSyntaxErrMsg(&pCxt->msg, "primary timestamp should not be null", pToken->z); + return buildSyntaxErrMsg(&pCxt->msg, "Primary timestamp column should not be null", pToken->z); + } + if (pSchema->flags & COL_IS_KEY) { + return buildSyntaxErrMsg(&pCxt->msg, "Primary key column should not be null", pToken->z); } pVal->flag = CV_FLAG_NULL; diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c index a88aec20b3..59c5ce82ad 100644 --- a/source/libs/parser/src/parInsertStmt.c +++ b/source/libs/parser/src/parInsertStmt.c @@ -267,6 +267,11 @@ int32_t qBindStmtColsValue(void* pBlock, TAOS_MULTI_BIND* bind, char* msgBuf, in pBind = bind + c; } + if(pBind->is_null && (pColSchema->flags & COL_IS_KEY)){ + code = buildInvalidOperationMsg(&pBuf, "Primary key column should not be null"); + goto _return; + } + code = tColDataAddValueByBind(pCol, pBind, IS_VAR_DATA_TYPE(pColSchema->type) ? pColSchema->bytes - VARSTR_HEADER_SIZE: -1); if (code) { goto _return; @@ -313,7 +318,12 @@ int32_t qBindStmtSingleColValue(void* pBlock, TAOS_MULTI_BIND* bind, char* msgBu pBind = bind; } - tColDataAddValueByBind(pCol, pBind, IS_VAR_DATA_TYPE(pColSchema->type) ? pColSchema->bytes - VARSTR_HEADER_SIZE: -1); + if (pBind->is_null && (pColSchema->flags & COL_IS_KEY)) { + code = buildInvalidOperationMsg(&pBuf, "Primary key column should not be null"); + goto _return; + } + + tColDataAddValueByBind(pCol, pBind, IS_VAR_DATA_TYPE(pColSchema->type) ? pColSchema->bytes - VARSTR_HEADER_SIZE : -1); qDebug("stmt col %d bind %d rows data", colIdx, rowNum); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index b08552fc3d..59ce465c08 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -955,6 +955,7 @@ static void setColumnInfoBySchema(const SRealTableNode* pTable, const SSchema* p } pCol->tableHasPk = hasPkInTable(pTable->pMeta); pCol->isPk = (pCol->tableHasPk) && (pColSchema->flags & COL_IS_KEY); + pCol->numOfPKs = pTable->pMeta->tableInfo.numOfPKs; } static void setColumnInfoByExpr(STempTableNode* pTable, SExprNode* pExpr, SColumnNode** pColRef) { @@ -3981,7 +3982,12 @@ static int32_t checkStateWindowForStream(STranslateContext* pCxt, SSelectStmt* p } if (TSDB_SUPER_TABLE == ((SRealTableNode*)pSelect->pFromTable)->pMeta->tableType && !hasPartitionByTbname(pSelect->pPartitionByList)) { - return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Unsupported stream query"); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "State window for stream on super table must patitioned by table name"); + } + if ((SRealTableNode*)pSelect->pFromTable && hasPkInTable(((SRealTableNode*)pSelect->pFromTable)->pMeta)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "Source table of State window must not has primary key"); } return TSDB_CODE_SUCCESS; } @@ -5084,9 +5090,11 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM, "Illegal number of columns"); } - SNode* pPrimaryKeyExpr = NULL; - SNode* pBoundCol = NULL; - SNode* pProj = NULL; + SNode* pPrimaryKeyExpr = NULL; + SNode* pBoundCol = NULL; + SNode* pProj = NULL; + int16_t numOfTargetPKs = 0; + int16_t numOfBoundPKs = 0; FORBOTH(pBoundCol, pInsert->pCols, pProj, pProjects) { SColumnNode* pCol = (SColumnNode*)pBoundCol; SExprNode* pExpr = (SExprNode*)pProj; @@ -5102,12 +5110,18 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns snprintf(pExpr->aliasName, sizeof(pExpr->aliasName), "%s", pCol->colName); if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId) { pPrimaryKeyExpr = (SNode*)pExpr; + numOfTargetPKs = pCol->numOfPKs; } + if (pCol->isPk) ++numOfBoundPKs; } if (NULL == pPrimaryKeyExpr) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM, - "Primary timestamp column can not be null"); + "Primary timestamp column should not be null"); + } + + if (numOfBoundPKs != numOfTargetPKs) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "Primary key column should not be none"); } return addOrderByPrimaryKeyToQuery(pCxt, pPrimaryKeyExpr, pInsert->pQuery); @@ -5856,12 +5870,17 @@ static int32_t translateTrimDatabase(STranslateContext* pCxt, STrimDatabaseStmt* return buildCmdMsg(pCxt, TDMT_MND_TRIM_DB, (FSerializeFunc)tSerializeSTrimDbReq, &req); } -static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray) { +static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray, bool calBytes) { *pArray = taosArrayInit(LIST_LENGTH(pList), sizeof(SField)); SNode* pNode; FOREACH(pNode, pList) { SColumnDefNode* pCol = (SColumnDefNode*)pNode; - SField field = {.type = pCol->dataType.type, .bytes = calcTypeBytes(pCol->dataType)}; + SField field = {.type = pCol->dataType.type,}; + if (calBytes) { + field.bytes = calcTypeBytes(pCol->dataType); + } else { + field.bytes = pCol->dataType.bytes; + } strcpy(field.name, pCol->colName); if (pCol->sma) { field.flags |= COL_SMA_ON; @@ -6081,22 +6100,26 @@ static int32_t checkTableColsSchema(STranslateContext* pCxt, SHashObj* pHash, in return code; } -static int32_t checkTableSchema(STranslateContext* pCxt, SCreateTableStmt* pStmt) { - SHashObj* pHash = taosHashInit(LIST_LENGTH(pStmt->pTags) + LIST_LENGTH(pStmt->pCols), +static int32_t checkTableSchemaImpl(STranslateContext* pCxt, SNodeList* pTags, SNodeList* pCols, SNodeList* pRollupFuncs) { + SHashObj* pHash = taosHashInit(LIST_LENGTH(pTags) + LIST_LENGTH(pCols), taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); if (NULL == pHash) { return TSDB_CODE_OUT_OF_MEMORY; } - int32_t code = checkTableTagsSchema(pCxt, pHash, pStmt->pTags); + int32_t code = checkTableTagsSchema(pCxt, pHash, pTags); if (TSDB_CODE_SUCCESS == code) { - code = checkTableColsSchema(pCxt, pHash, LIST_LENGTH(pStmt->pTags), pStmt->pCols, pStmt->pOptions->pRollupFuncs); + code = checkTableColsSchema(pCxt, pHash, LIST_LENGTH(pTags), pCols, pRollupFuncs); } taosHashCleanup(pHash); return code; } +static int32_t checkTableSchema(STranslateContext* pCxt, SCreateTableStmt* pStmt) { + return checkTableSchemaImpl(pCxt, pStmt->pTags, pStmt->pCols, pStmt->pOptions->pRollupFuncs); +} + 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); @@ -6566,8 +6589,8 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm pReq->colVer = 1; pReq->tagVer = 1; pReq->source = TD_REQ_FROM_APP; - columnDefNodeToField(pStmt->pCols, &pReq->pColumns); - columnDefNodeToField(pStmt->pTags, &pReq->pTags); + columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true); + columnDefNodeToField(pStmt->pTags, &pReq->pTags, true); pReq->numOfColumns = LIST_LENGTH(pStmt->pCols); pReq->numOfTags = LIST_LENGTH(pStmt->pTags); if (pStmt->pOptions->commentNull == false) { @@ -7720,7 +7743,7 @@ static void getStreamQueryFirstProjectAliasName(SHashObj* pUserAliasSet, char* a } static int32_t addWstartTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSelectStmt* pSelect, - SHashObj* pUserAliasSet) { + SHashObj* pUserAliasSet, SNodeList* pCols, SCMCreateStreamReq* pReq) { SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 0); if (NULL == pSelect->pWindow || (QUERY_NODE_FUNCTION == nodeType(pProj) && 0 == strcmp("_wstart", ((SFunctionNode*)pProj)->functionName))) { @@ -7736,18 +7759,27 @@ static int32_t addWstartTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSele if (TSDB_CODE_SUCCESS == code) { code = nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc); } + + if (TSDB_CODE_SUCCESS == code && STREAM_CREATE_STABLE_TRUE == pReq->createStb) { + SColumnDefNode* pColDef = (SColumnDefNode*)nodesMakeNode(QUERY_NODE_COLUMN_DEF); + strcpy(pColDef->colName, pFunc->node.aliasName); + pColDef->dataType = pFunc->node.resType; + pColDef->sma = true; + pColDef->is_pk = false; + code = nodesListPushFront(pCols, (SNode*)pColDef); + } if (TSDB_CODE_SUCCESS != code) { nodesDestroyNode((SNode*)pFunc); } return code; } -static int32_t addWstartTsToCreateStreamQuery(STranslateContext* pCxt, SNode* pStmt) { +static int32_t addWstartTsToCreateStreamQuery(STranslateContext* pCxt, SNode* pStmt, SNodeList* pCols, SCMCreateStreamReq* pReq) { SSelectStmt* pSelect = (SSelectStmt*)pStmt; SHashObj* pUserAliasSet = NULL; int32_t code = checkProjectAlias(pCxt, pSelect->pProjectionList, &pUserAliasSet); if (TSDB_CODE_SUCCESS == code) { - code = addWstartTsToCreateStreamQueryImpl(pCxt, pSelect, pUserAliasSet); + code = addWstartTsToCreateStreamQueryImpl(pCxt, pSelect, pUserAliasSet, pCols, pReq); } taosHashCleanup(pUserAliasSet); return code; @@ -7865,6 +7897,44 @@ static int32_t addNullTagsToCreateStreamQuery(STranslateContext* pCxt, STableMet return addNullTagsForExistTable(pCxt, pMeta, (SSelectStmt*)pStmt->pQuery); } +static int32_t addColDefNodeByProj(SNodeList** ppCols, SNode* pProject, int8_t flags) { + SExprNode* pExpr = (SExprNode*)pProject; + SColumnDefNode* pColDef = (SColumnDefNode*)nodesMakeNode(QUERY_NODE_COLUMN_DEF); + strcpy(pColDef->colName, pExpr->userAlias); + pColDef->dataType = pExpr->resType; + pColDef->sma = flags & COL_SMA_ON; + pColDef->is_pk = flags & COL_IS_KEY; + return nodesListMakeAppend(ppCols, (SNode*)pColDef); +} + +static int32_t addColsToCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq) { + if ( STREAM_CREATE_STABLE_FALSE == pReq->createStb) { + return TSDB_CODE_SUCCESS; + } + SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery; + SNode* pProject = NULL; + SNode* pNode = NULL; + if (0 != LIST_LENGTH(pStmt->pCols)) { + if (LIST_LENGTH(pStmt->pCols) != LIST_LENGTH(pSelect->pProjectionList)) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM); + } + FORBOTH(pNode, pStmt->pCols, pProject, pSelect->pProjectionList) { + SExprNode* pExpr = (SExprNode*)pProject; + SColumnDefNode* pColDef = (SColumnDefNode*)pNode; + pColDef->dataType = pExpr->resType; + } + return TSDB_CODE_SUCCESS; + } + + FOREACH(pProject, pSelect->pProjectionList) { + int32_t code = addColDefNodeByProj(&pStmt->pCols, pProject, 0); + if (TSDB_CODE_SUCCESS != code) { + return code; + } + } + return TSDB_CODE_SUCCESS; +} + static int32_t addSubtableInfoToCreateStreamQuery(STranslateContext* pCxt, STableMeta* pMeta, SCreateStreamStmt* pStmt) { int32_t code = TSDB_CODE_SUCCESS; @@ -7924,6 +7994,13 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Event window for stream on super table must patitioned by table name"); } + + if (pSelect->pWindow != NULL && pSelect->pWindow->type == QUERY_NODE_EVENT_WINDOW && + (SRealTableNode*)pSelect->pFromTable && hasPkInTable(((SRealTableNode*)pSelect->pFromTable)->pMeta)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "Source table of Event window must not has primary key"); + } + if (TSDB_DATA_TYPE_TIMESTAMP != ((SExprNode*)nodesListGetNode(pSelect->pProjectionList, 0))->resType.type || !isTimeLineQuery(pStmt->pQuery) || crossTableWithoutAggOper(pSelect) || NULL != pSelect->pOrderByList || crossTableWithUdaf(pSelect) || hasJsonTypeProjection(pSelect)) { @@ -7966,12 +8043,18 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Ignore expired data of Count window must be 1."); } + + if ((SRealTableNode*)pSelect->pFromTable && hasPkInTable(((SRealTableNode*)pSelect->pFromTable)->pMeta)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "Source table of Count window must not has primary key"); + } } return TSDB_CODE_SUCCESS; } -static int32_t adjustDataTypeOfProjections(STranslateContext* pCxt, const STableMeta* pMeta, SNodeList* pProjections) { +static int32_t adjustDataTypeOfProjections(STranslateContext* pCxt, const STableMeta* pMeta, SNodeList* pProjections, + SNodeList** ppCols) { if (getNumOfColumns(pMeta) != LIST_LENGTH(pProjections)) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM, "Illegal number of columns"); } @@ -7990,6 +8073,15 @@ static int32_t adjustDataTypeOfProjections(STranslateContext* pCxt, const STable } REPLACE_NODE(pFunc); } + SColumnDefNode* pColDef = (SColumnDefNode*)nodesMakeNode(QUERY_NODE_COLUMN_DEF); + strcpy(pColDef->colName, pSchema->name); + pColDef->dataType = dt; + pColDef->sma = pSchema->flags & COL_SMA_ON; + pColDef->is_pk = pSchema->flags & COL_IS_KEY; + int32_t code = nodesListMakeAppend(ppCols, (SNode*)pColDef); + if (TSDB_CODE_SUCCESS != code) { + return code; + } } return TSDB_CODE_SUCCESS; @@ -7997,6 +8089,7 @@ static int32_t adjustDataTypeOfProjections(STranslateContext* pCxt, const STable typedef struct SProjColPos { int32_t colId; + int8_t flags; SNode* pProj; } SProjColPos; @@ -8020,10 +8113,11 @@ static int32_t addProjToProjColPos(STranslateContext* pCxt, const SSchema* pSche if (!dataTypeEqual(&dt, &((SExprNode*)pNewProj)->resType)) { SNode* pFunc = NULL; code = createCastFunc(pCxt, pNewProj, dt, &pFunc); + strcpy(((SExprNode*)pFunc)->userAlias, ((SExprNode*)pNewProj)->userAlias); pNewProj = pFunc; } if (TSDB_CODE_SUCCESS == code) { - SProjColPos pos = {.colId = pSchema->colId, .pProj = pNewProj}; + SProjColPos pos = {.colId = pSchema->colId, .pProj = pNewProj, .flags = pSchema->flags}; code = (NULL == taosArrayPush(pProjColPos, &pos) ? TSDB_CODE_OUT_OF_MEMORY : TSDB_CODE_SUCCESS); } if (TSDB_CODE_SUCCESS != code) { @@ -8055,13 +8149,13 @@ static int32_t setFillNullCols(SArray* pProjColPos, const STableMeta* pMeta, SCM return TSDB_CODE_SUCCESS; } -static int32_t adjustOrderOfProjections(STranslateContext* pCxt, SNodeList* pCols, const STableMeta* pMeta, +static int32_t adjustOrderOfProjections(STranslateContext* pCxt, SNodeList** ppCols, const STableMeta* pMeta, SNodeList** pProjections, SCMCreateStreamReq* pReq) { - if (LIST_LENGTH(pCols) != LIST_LENGTH(*pProjections)) { + if (LIST_LENGTH((*ppCols)) != LIST_LENGTH(*pProjections)) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM, "Illegal number of columns"); } - SArray* pProjColPos = taosArrayInit(LIST_LENGTH(pCols), sizeof(SProjColPos)); + SArray* pProjColPos = taosArrayInit(LIST_LENGTH((*ppCols)), sizeof(SProjColPos)); if (NULL == pProjColPos) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -8070,10 +8164,10 @@ static int32_t adjustOrderOfProjections(STranslateContext* pCxt, SNodeList* pCol bool hasPrimaryKey = false; SNode* pCol = NULL; SNode* pProj = NULL; - FORBOTH(pCol, pCols, pProj, *pProjections) { - const SSchema* pSchema = getNormalColSchema(pMeta, ((SColumnNode*)pCol)->colName); + FORBOTH(pCol, (*ppCols), pProj, *pProjections) { + const SSchema* pSchema = getNormalColSchema(pMeta, ((SColumnDefNode*)pCol)->colName); if (NULL == pSchema) { - code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN, ((SColumnNode*)pCol)->colName); + code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN, ((SColumnDefNode*)pCol)->colName); } if (TSDB_CODE_SUCCESS == code) { code = addProjToProjColPos(pCxt, pSchema, pProj, pProjColPos); @@ -8092,31 +8186,37 @@ static int32_t adjustOrderOfProjections(STranslateContext* pCxt, SNodeList* pCol } SNodeList* pNewProjections = NULL; + SNodeList* pNewCols = NULL; if (TSDB_CODE_SUCCESS == code) { taosArraySort(pProjColPos, projColPosCompar); int32_t num = taosArrayGetSize(pProjColPos); pNewProjections = nodesMakeList(); + pNewCols = nodesMakeList(); if (NULL == pNewProjections) { code = TSDB_CODE_OUT_OF_MEMORY; } for (int32_t i = 0; TSDB_CODE_SUCCESS == code && i < num; ++i) { SProjColPos* pPos = taosArrayGet(pProjColPos, i); code = nodesListStrictAppend(pNewProjections, pPos->pProj); + addColDefNodeByProj(&pNewCols, pPos->pProj, pPos->flags); pPos->pProj = NULL; } } - if (TSDB_CODE_SUCCESS == code && pMeta->tableInfo.numOfColumns > LIST_LENGTH(pCols)) { + if (TSDB_CODE_SUCCESS == code && pMeta->tableInfo.numOfColumns > LIST_LENGTH((*ppCols)) ) { code = setFillNullCols(pProjColPos, pMeta, pReq); } if (TSDB_CODE_SUCCESS == code) { taosArrayDestroy(pProjColPos); nodesDestroyList(*pProjections); + nodesDestroyList(*ppCols); *pProjections = pNewProjections; + *ppCols = pNewCols; } else { taosArrayDestroyEx(pProjColPos, projColPosDelete); nodesDestroyList(pNewProjections); + nodesDestroyList(pNewCols); } return code; @@ -8126,9 +8226,9 @@ static int32_t adjustProjectionsForExistTable(STranslateContext* pCxt, SCreateSt const STableMeta* pMeta, SCMCreateStreamReq* pReq) { SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery; if (NULL == pStmt->pCols) { - return adjustDataTypeOfProjections(pCxt, pMeta, pSelect->pProjectionList); + return adjustDataTypeOfProjections(pCxt, pMeta, pSelect->pProjectionList, &pStmt->pCols); } - return adjustOrderOfProjections(pCxt, pStmt->pCols, pMeta, &pSelect->pProjectionList, pReq); + return adjustOrderOfProjections(pCxt, &pStmt->pCols, pMeta, &pSelect->pProjectionList, pReq); } static bool isGroupIdTagStream(const STableMeta* pMeta, SNodeList* pTags) { @@ -8178,9 +8278,9 @@ static int32_t adjustOrderOfTags(STranslateContext* pCxt, SNodeList* pTags, cons SNode* pTag = NULL; SNode* pTagExpr = NULL; FORBOTH(pTag, pTags, pTagExpr, *pTagExprs) { - const SSchema* pSchema = getTagSchema(pMeta, ((SColumnNode*)pTag)->colName); + const SSchema* pSchema = getTagSchema(pMeta, ((SColumnDefNode*)pTag)->colName); if (NULL == pSchema) { - code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TAG_NAME, ((SColumnNode*)pTag)->colName); + code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TAG_NAME, ((SColumnDefNode*)pTag)->colName); } if (TSDB_CODE_SUCCESS == code) { code = addProjToProjColPos(pCxt, pSchema, pTagExpr, pTagPos); @@ -8277,21 +8377,23 @@ static bool isTagDef(SNodeList* pTags) { if (NULL == pTags) { return false; } - return QUERY_NODE_COLUMN_DEF == nodeType(nodesListGetNode(pTags, 0)); + SColumnDefNode* pColDef = (SColumnDefNode*)nodesListGetNode(pTags, 0); + return TSDB_DATA_TYPE_NULL != pColDef->dataType.type; } static bool isTagBound(SNodeList* pTags) { if (NULL == pTags) { return false; } - return QUERY_NODE_COLUMN == nodeType(nodesListGetNode(pTags, 0)); + SColumnDefNode* pColDef = (SColumnDefNode*)nodesListGetNode(pTags, 0); + return TSDB_DATA_TYPE_NULL == pColDef->dataType.type; } static int32_t translateStreamTargetTable(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq, STableMeta** pMeta) { int32_t code = getTableMeta(pCxt, pStmt->targetDbName, pStmt->targetTabName, pMeta); if (TSDB_CODE_PAR_TABLE_NOT_EXIST == code) { - if (NULL != pStmt->pCols || isTagBound(pStmt->pTags)) { + if (isTagBound(pStmt->pTags)) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_TABLE_NOT_EXIST, pStmt->targetTabName); } pReq->createStb = STREAM_CREATE_STABLE_TRUE; @@ -8432,6 +8534,42 @@ static int32_t createLastTsSelectStmt(char* pDb, char* pTable, STableMeta* pMeta return nodesListAppend((*pSelect1)->pGroupByList, (SNode*)pNode2); } +static int32_t checkAndAdjStreamDestTableSchema(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq) { + SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery; + SNode* pNode = nodesListGetNode(pStmt->pCols, 0); + SColumnDefNode* pCol = (SColumnDefNode*)pNode; + if (pCol && pCol->dataType.type != TSDB_DATA_TYPE_TIMESTAMP) { + pCol->dataType = (SDataType){.type = TSDB_DATA_TYPE_TIMESTAMP, + .precision = 0, + .scale = 0, + .bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes}; + } + int32_t code = checkTableSchemaImpl(pCxt, pStmt->pTags, pStmt->pCols, NULL); + if (TSDB_CODE_SUCCESS == code && NULL == pSelect->pWindow && + ((SRealTableNode*)pSelect->pFromTable && hasPkInTable(((SRealTableNode*)pSelect->pFromTable)->pMeta))) { + if (1 >= LIST_LENGTH(pStmt->pCols) || 1 >= LIST_LENGTH(pSelect->pProjectionList)) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY); + } + + SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 1); + if (QUERY_NODE_COLUMN != nodeType(pProj) || + 0 != strcmp(((SColumnNode*)pProj)->colName, ((SRealTableNode*)pSelect->pFromTable)->pMeta->schema[1].name)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "Source table has primary key, result must has primary key"); + } + + pNode = nodesListGetNode(pStmt->pCols, 1); + pCol = (SColumnDefNode*)pNode; + if (STREAM_CREATE_STABLE_TRUE == pReq->createStb) { + pCol->is_pk = true; + } + if (!pCol->is_pk) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Source table has primary key, dest table must has primary key"); + } + } + return code; +} + static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq) { pCxt->createStream = true; STableMeta* pMeta = NULL; @@ -8443,7 +8581,10 @@ static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt code = translateQuery(pCxt, pStmt->pQuery); } if (TSDB_CODE_SUCCESS == code) { - code = addWstartTsToCreateStreamQuery(pCxt, pStmt->pQuery); + code = addColsToCreateStreamQuery(pCxt, pStmt, pReq); + } + if (TSDB_CODE_SUCCESS == code) { + code = addWstartTsToCreateStreamQuery(pCxt, pStmt->pQuery, pStmt->pCols, pReq); } if (TSDB_CODE_SUCCESS == code) { code = checkStreamQuery(pCxt, pStmt); @@ -8454,6 +8595,9 @@ static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt if (TSDB_CODE_SUCCESS == code) { code = adjustTags(pCxt, pStmt, pMeta, pReq); } + if (TSDB_CODE_SUCCESS == code) { + code = checkAndAdjStreamDestTableSchema(pCxt, pStmt, pReq); + } if (TSDB_CODE_SUCCESS == code) { getSourceDatabase(pStmt->pQuery, pCxt->pParseCxt->acctId, pReq->sourceDB); code = nodesNodeToString(pStmt->pQuery, false, &pReq->ast, NULL); @@ -8519,9 +8663,10 @@ static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt* pReq->fillHistory = pStmt->pOptions->fillHistory; pReq->igExpired = pStmt->pOptions->ignoreExpired; if (pReq->createStb) { - columnDefNodeToField(pStmt->pTags, &pReq->pTags); + columnDefNodeToField(pStmt->pTags, &pReq->pTags, true); pReq->numOfTags = LIST_LENGTH(pStmt->pTags); } + columnDefNodeToField(pStmt->pCols, &pReq->pCols, false); pReq->igUpdate = pStmt->pOptions->ignoreUpdate; } diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 7c82555e63..ce0d719594 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -161,7 +161,7 @@ static char* getSyntaxErrFormat(int32_t errCode) { case TSDB_CODE_PAR_VALUE_TOO_LONG: return "Value too long for column/tag: %s"; case TSDB_CODE_PAR_INVALID_DELETE_WHERE: - return "The DELETE statement must have a definite time window range"; + return "The DELETE statement must only have a definite time window range"; case TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG: return "The REDISTRIBUTE VGROUP statement only support 1 to 3 dnodes"; case TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC: diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 326168b5c1..2c1826a3ff 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -1,3 +1,5 @@ +/* This file is automatically generated by Lemon from input grammar +** source file "sql.y". */ /* ** 2000-05-29 ** @@ -22,10 +24,7 @@ ** The following is the concatenation of all %include directives from the ** input grammar file: */ -#include -#include /************ Begin %include sections from the grammar ************************/ - #include #include #include @@ -42,11 +41,365 @@ #define YYSTACKDEPTH 0 /**************** End of %include directives **********************************/ -/* These constants specify the various numeric values for terminal symbols -** in a format understandable to "makeheaders". This section is blank unless -** "lemon" is run with the "-m" command-line option. -***************** Begin makeheaders token definitions *************************/ -/**************** End makeheaders token definitions ***************************/ +/* These constants specify the various numeric values for terminal symbols. +***************** Begin token definitions *************************************/ +#ifndef TK_OR +#define TK_OR 1 +#define TK_AND 2 +#define TK_UNION 3 +#define TK_ALL 4 +#define TK_MINUS 5 +#define TK_EXCEPT 6 +#define TK_INTERSECT 7 +#define TK_NK_BITAND 8 +#define TK_NK_BITOR 9 +#define TK_NK_LSHIFT 10 +#define TK_NK_RSHIFT 11 +#define TK_NK_PLUS 12 +#define TK_NK_MINUS 13 +#define TK_NK_STAR 14 +#define TK_NK_SLASH 15 +#define TK_NK_REM 16 +#define TK_NK_CONCAT 17 +#define TK_CREATE 18 +#define TK_ACCOUNT 19 +#define TK_NK_ID 20 +#define TK_PASS 21 +#define TK_NK_STRING 22 +#define TK_ALTER 23 +#define TK_PPS 24 +#define TK_TSERIES 25 +#define TK_STORAGE 26 +#define TK_STREAMS 27 +#define TK_QTIME 28 +#define TK_DBS 29 +#define TK_USERS 30 +#define TK_CONNS 31 +#define TK_STATE 32 +#define TK_NK_COMMA 33 +#define TK_HOST 34 +#define TK_USER 35 +#define TK_ENABLE 36 +#define TK_NK_INTEGER 37 +#define TK_SYSINFO 38 +#define TK_ADD 39 +#define TK_DROP 40 +#define TK_GRANT 41 +#define TK_ON 42 +#define TK_TO 43 +#define TK_REVOKE 44 +#define TK_FROM 45 +#define TK_SUBSCRIBE 46 +#define TK_READ 47 +#define TK_WRITE 48 +#define TK_NK_DOT 49 +#define TK_WITH 50 +#define TK_DNODE 51 +#define TK_PORT 52 +#define TK_DNODES 53 +#define TK_RESTORE 54 +#define TK_NK_IPTOKEN 55 +#define TK_FORCE 56 +#define TK_UNSAFE 57 +#define TK_CLUSTER 58 +#define TK_LOCAL 59 +#define TK_QNODE 60 +#define TK_BNODE 61 +#define TK_SNODE 62 +#define TK_MNODE 63 +#define TK_VNODE 64 +#define TK_DATABASE 65 +#define TK_USE 66 +#define TK_FLUSH 67 +#define TK_TRIM 68 +#define TK_COMPACT 69 +#define TK_IF 70 +#define TK_NOT 71 +#define TK_EXISTS 72 +#define TK_BUFFER 73 +#define TK_CACHEMODEL 74 +#define TK_CACHESIZE 75 +#define TK_COMP 76 +#define TK_DURATION 77 +#define TK_NK_VARIABLE 78 +#define TK_MAXROWS 79 +#define TK_MINROWS 80 +#define TK_KEEP 81 +#define TK_PAGES 82 +#define TK_PAGESIZE 83 +#define TK_TSDB_PAGESIZE 84 +#define TK_PRECISION 85 +#define TK_REPLICA 86 +#define TK_VGROUPS 87 +#define TK_SINGLE_STABLE 88 +#define TK_RETENTIONS 89 +#define TK_SCHEMALESS 90 +#define TK_WAL_LEVEL 91 +#define TK_WAL_FSYNC_PERIOD 92 +#define TK_WAL_RETENTION_PERIOD 93 +#define TK_WAL_RETENTION_SIZE 94 +#define TK_WAL_ROLL_PERIOD 95 +#define TK_WAL_SEGMENT_SIZE 96 +#define TK_STT_TRIGGER 97 +#define TK_TABLE_PREFIX 98 +#define TK_TABLE_SUFFIX 99 +#define TK_KEEP_TIME_OFFSET 100 +#define TK_NK_COLON 101 +#define TK_BWLIMIT 102 +#define TK_START 103 +#define TK_TIMESTAMP 104 +#define TK_END 105 +#define TK_TABLE 106 +#define TK_NK_LP 107 +#define TK_NK_RP 108 +#define TK_STABLE 109 +#define TK_COLUMN 110 +#define TK_MODIFY 111 +#define TK_RENAME 112 +#define TK_TAG 113 +#define TK_SET 114 +#define TK_NK_EQ 115 +#define TK_USING 116 +#define TK_TAGS 117 +#define TK_PRIMARY 118 +#define TK_KEY 119 +#define TK_BOOL 120 +#define TK_TINYINT 121 +#define TK_SMALLINT 122 +#define TK_INT 123 +#define TK_INTEGER 124 +#define TK_BIGINT 125 +#define TK_FLOAT 126 +#define TK_DOUBLE 127 +#define TK_BINARY 128 +#define TK_NCHAR 129 +#define TK_UNSIGNED 130 +#define TK_JSON 131 +#define TK_VARCHAR 132 +#define TK_MEDIUMBLOB 133 +#define TK_BLOB 134 +#define TK_VARBINARY 135 +#define TK_GEOMETRY 136 +#define TK_DECIMAL 137 +#define TK_COMMENT 138 +#define TK_MAX_DELAY 139 +#define TK_WATERMARK 140 +#define TK_ROLLUP 141 +#define TK_TTL 142 +#define TK_SMA 143 +#define TK_DELETE_MARK 144 +#define TK_FIRST 145 +#define TK_LAST 146 +#define TK_SHOW 147 +#define TK_PRIVILEGES 148 +#define TK_DATABASES 149 +#define TK_TABLES 150 +#define TK_STABLES 151 +#define TK_MNODES 152 +#define TK_QNODES 153 +#define TK_ARBGROUPS 154 +#define TK_FUNCTIONS 155 +#define TK_INDEXES 156 +#define TK_ACCOUNTS 157 +#define TK_APPS 158 +#define TK_CONNECTIONS 159 +#define TK_LICENCES 160 +#define TK_GRANTS 161 +#define TK_FULL 162 +#define TK_LOGS 163 +#define TK_MACHINES 164 +#define TK_QUERIES 165 +#define TK_SCORES 166 +#define TK_TOPICS 167 +#define TK_VARIABLES 168 +#define TK_BNODES 169 +#define TK_SNODES 170 +#define TK_TRANSACTIONS 171 +#define TK_DISTRIBUTED 172 +#define TK_CONSUMERS 173 +#define TK_SUBSCRIPTIONS 174 +#define TK_VNODES 175 +#define TK_ALIVE 176 +#define TK_VIEWS 177 +#define TK_VIEW 178 +#define TK_COMPACTS 179 +#define TK_NORMAL 180 +#define TK_CHILD 181 +#define TK_LIKE 182 +#define TK_TBNAME 183 +#define TK_QTAGS 184 +#define TK_AS 185 +#define TK_SYSTEM 186 +#define TK_INDEX 187 +#define TK_FUNCTION 188 +#define TK_INTERVAL 189 +#define TK_COUNT 190 +#define TK_LAST_ROW 191 +#define TK_META 192 +#define TK_ONLY 193 +#define TK_TOPIC 194 +#define TK_CONSUMER 195 +#define TK_GROUP 196 +#define TK_DESC 197 +#define TK_DESCRIBE 198 +#define TK_RESET 199 +#define TK_QUERY 200 +#define TK_CACHE 201 +#define TK_EXPLAIN 202 +#define TK_ANALYZE 203 +#define TK_VERBOSE 204 +#define TK_NK_BOOL 205 +#define TK_RATIO 206 +#define TK_NK_FLOAT 207 +#define TK_OUTPUTTYPE 208 +#define TK_AGGREGATE 209 +#define TK_BUFSIZE 210 +#define TK_LANGUAGE 211 +#define TK_REPLACE 212 +#define TK_STREAM 213 +#define TK_INTO 214 +#define TK_PAUSE 215 +#define TK_RESUME 216 +#define TK_TRIGGER 217 +#define TK_AT_ONCE 218 +#define TK_WINDOW_CLOSE 219 +#define TK_IGNORE 220 +#define TK_EXPIRED 221 +#define TK_FILL_HISTORY 222 +#define TK_UPDATE 223 +#define TK_SUBTABLE 224 +#define TK_UNTREATED 225 +#define TK_KILL 226 +#define TK_CONNECTION 227 +#define TK_TRANSACTION 228 +#define TK_BALANCE 229 +#define TK_VGROUP 230 +#define TK_LEADER 231 +#define TK_MERGE 232 +#define TK_REDISTRIBUTE 233 +#define TK_SPLIT 234 +#define TK_DELETE 235 +#define TK_INSERT 236 +#define TK_NK_BIN 237 +#define TK_NK_HEX 238 +#define TK_NULL 239 +#define TK_NK_QUESTION 240 +#define TK_NK_ALIAS 241 +#define TK_NK_ARROW 242 +#define TK_ROWTS 243 +#define TK_QSTART 244 +#define TK_QEND 245 +#define TK_QDURATION 246 +#define TK_WSTART 247 +#define TK_WEND 248 +#define TK_WDURATION 249 +#define TK_IROWTS 250 +#define TK_ISFILLED 251 +#define TK_CAST 252 +#define TK_NOW 253 +#define TK_TODAY 254 +#define TK_TIMEZONE 255 +#define TK_CLIENT_VERSION 256 +#define TK_SERVER_VERSION 257 +#define TK_SERVER_STATUS 258 +#define TK_CURRENT_USER 259 +#define TK_CASE 260 +#define TK_WHEN 261 +#define TK_THEN 262 +#define TK_ELSE 263 +#define TK_BETWEEN 264 +#define TK_IS 265 +#define TK_NK_LT 266 +#define TK_NK_GT 267 +#define TK_NK_LE 268 +#define TK_NK_GE 269 +#define TK_NK_NE 270 +#define TK_MATCH 271 +#define TK_NMATCH 272 +#define TK_CONTAINS 273 +#define TK_IN 274 +#define TK_JOIN 275 +#define TK_INNER 276 +#define TK_SELECT 277 +#define TK_NK_HINT 278 +#define TK_DISTINCT 279 +#define TK_WHERE 280 +#define TK_PARTITION 281 +#define TK_BY 282 +#define TK_SESSION 283 +#define TK_STATE_WINDOW 284 +#define TK_EVENT_WINDOW 285 +#define TK_COUNT_WINDOW 286 +#define TK_SLIDING 287 +#define TK_FILL 288 +#define TK_VALUE 289 +#define TK_VALUE_F 290 +#define TK_NONE 291 +#define TK_PREV 292 +#define TK_NULL_F 293 +#define TK_LINEAR 294 +#define TK_NEXT 295 +#define TK_HAVING 296 +#define TK_RANGE 297 +#define TK_EVERY 298 +#define TK_ORDER 299 +#define TK_SLIMIT 300 +#define TK_SOFFSET 301 +#define TK_LIMIT 302 +#define TK_OFFSET 303 +#define TK_ASC 304 +#define TK_NULLS 305 +#define TK_ABORT 306 +#define TK_AFTER 307 +#define TK_ATTACH 308 +#define TK_BEFORE 309 +#define TK_BEGIN 310 +#define TK_BITAND 311 +#define TK_BITNOT 312 +#define TK_BITOR 313 +#define TK_BLOCKS 314 +#define TK_CHANGE 315 +#define TK_COMMA 316 +#define TK_CONCAT 317 +#define TK_CONFLICT 318 +#define TK_COPY 319 +#define TK_DEFERRED 320 +#define TK_DELIMITERS 321 +#define TK_DETACH 322 +#define TK_DIVIDE 323 +#define TK_DOT 324 +#define TK_EACH 325 +#define TK_FAIL 326 +#define TK_FILE 327 +#define TK_FOR 328 +#define TK_GLOB 329 +#define TK_ID 330 +#define TK_IMMEDIATE 331 +#define TK_IMPORT 332 +#define TK_INITIALLY 333 +#define TK_INSTEAD 334 +#define TK_ISNULL 335 +#define TK_MODULES 336 +#define TK_NK_BITNOT 337 +#define TK_NK_SEMI 338 +#define TK_NOTNULL 339 +#define TK_OF 340 +#define TK_PLUS 341 +#define TK_PRIVILEGE 342 +#define TK_RAISE 343 +#define TK_RESTRICT 344 +#define TK_ROW 345 +#define TK_SEMI 346 +#define TK_STAR 347 +#define TK_STATEMENT 348 +#define TK_STRICT 349 +#define TK_STRING 350 +#define TK_TIMES 351 +#define TK_VALUES 352 +#define TK_VARIABLE 353 +#define TK_WAL 354 +#endif +/**************** End token definitions ***************************************/ /* The next sections is a series of control #defines. ** various aspects of the generated parser. @@ -104,29 +457,29 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 518 +#define YYNOCODE 520 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - STokenPair yy21; - int32_t yy396; - SNodeList* yy404; - EFillMode yy466; - SDataType yy504; - SAlterOption yy529; - ENullOrder yy669; - EJoinType yy680; - SToken yy701; - EShowKind yy705; - bool yy733; - EOperatorType yy884; - SNode* yy896; - int8_t yy915; - EOrder yy918; - int64_t yy949; - SShowTablesOption yy989; + int32_t yy20; + SNodeList* yy184; + ENullOrder yy217; + EOperatorType yy220; + SToken yy369; + EFillMode yy374; + bool yy377; + SNode* yy392; + SShowTablesOption yy397; + EOrder yy578; + int8_t yy743; + SAlterOption yy845; + EShowKind yy849; + SDataType yy864; + int64_t yy909; + EJoinType yy932; + STokenPair yy937; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -142,18 +495,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 862 -#define YYNRULE 672 -#define YYNRULE_WITH_ACTION 672 +#define YYNSTATE 895 +#define YYNRULE 696 +#define YYNRULE_WITH_ACTION 696 #define YYNTOKEN 355 -#define YY_MAX_SHIFT 861 -#define YY_MIN_SHIFTREDUCE 1284 -#define YY_MAX_SHIFTREDUCE 1955 -#define YY_ERROR_ACTION 1956 -#define YY_ACCEPT_ACTION 1957 -#define YY_NO_ACTION 1958 -#define YY_MIN_REDUCE 1959 -#define YY_MAX_REDUCE 2630 +#define YY_MAX_SHIFT 894 +#define YY_MIN_SHIFTREDUCE 1330 +#define YY_MAX_SHIFTREDUCE 2025 +#define YY_ERROR_ACTION 2026 +#define YY_ACCEPT_ACTION 2027 +#define YY_NO_ACTION 2028 +#define YY_MIN_REDUCE 2029 +#define YY_MAX_REDUCE 2724 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -220,644 +573,638 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (3163) +#define YY_ACTTAB_COUNT (3107) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 2289, 174, 239, 2405, 761, 2149, 577, 711, 2010, 2088, - /* 10 */ 2601, 2140, 47, 45, 1877, 422, 474, 2535, 2286, 748, - /* 20 */ 419, 473, 1717, 1960, 138, 723, 147, 2409, 710, 204, - /* 30 */ 2389, 617, 1742, 2602, 712, 1803, 2045, 1715, 46, 44, - /* 40 */ 43, 42, 41, 2532, 128, 2429, 1431, 127, 126, 125, - /* 50 */ 124, 123, 122, 121, 120, 119, 40, 39, 726, 1742, - /* 60 */ 46, 44, 43, 42, 41, 1798, 425, 682, 185, 705, - /* 70 */ 2601, 19, 2411, 2413, 416, 761, 2149, 765, 1723, 2606, - /* 80 */ 760, 29, 2601, 765, 2203, 425, 2447, 1433, 2607, 204, - /* 90 */ 390, 388, 2269, 2602, 712, 138, 765, 2447, 2395, 2201, - /* 100 */ 743, 2605, 622, 665, 858, 2602, 2604, 15, 1881, 833, - /* 110 */ 832, 831, 830, 437, 1742, 829, 828, 152, 823, 822, - /* 120 */ 821, 820, 819, 818, 817, 151, 811, 810, 809, 436, - /* 130 */ 435, 806, 805, 804, 184, 183, 803, 302, 2528, 722, - /* 140 */ 2428, 139, 721, 2466, 2601, 1805, 1806, 115, 2430, 747, - /* 150 */ 2432, 2433, 742, 173, 765, 175, 1922, 1971, 344, 187, - /* 160 */ 704, 2520, 710, 204, 579, 415, 2516, 2602, 712, 2388, - /* 170 */ 576, 711, 426, 571, 2601, 342, 75, 66, 816, 74, - /* 180 */ 206, 2110, 569, 1777, 1787, 565, 561, 590, 2550, 371, - /* 190 */ 1804, 1807, 710, 204, 1324, 1596, 1597, 2602, 712, 723, - /* 200 */ 147, 237, 556, 554, 551, 1718, 423, 1716, 197, 723, - /* 210 */ 147, 40, 39, 1331, 172, 46, 44, 43, 42, 41, - /* 220 */ 2190, 760, 2151, 128, 425, 2368, 127, 126, 125, 124, - /* 230 */ 123, 122, 121, 120, 119, 765, 1326, 1329, 1330, 1721, - /* 240 */ 1722, 1774, 62, 1776, 1779, 1780, 1781, 1782, 1783, 1784, - /* 250 */ 1785, 1786, 739, 763, 762, 1797, 1799, 1800, 1801, 1802, - /* 260 */ 2, 47, 45, 1959, 2337, 1742, 368, 2605, 1740, 419, - /* 270 */ 1350, 1717, 1349, 760, 380, 524, 682, 1778, 544, 2601, - /* 280 */ 62, 594, 63, 543, 1803, 2369, 1715, 137, 136, 135, - /* 290 */ 134, 133, 132, 131, 130, 129, 1745, 2607, 204, 504, - /* 300 */ 1743, 545, 2602, 712, 802, 1351, 369, 506, 50, 663, - /* 310 */ 725, 202, 2528, 2529, 1798, 145, 2533, 484, 1832, 276, - /* 320 */ 19, 203, 2528, 2529, 241, 145, 2533, 1723, 577, 2125, - /* 330 */ 2010, 706, 85, 84, 477, 1775, 682, 217, 1874, 2601, - /* 340 */ 574, 40, 39, 575, 2002, 46, 44, 43, 42, 41, - /* 350 */ 469, 467, 62, 858, 391, 2606, 15, 2607, 204, 1489, - /* 360 */ 50, 367, 2602, 712, 456, 492, 2416, 453, 449, 445, - /* 370 */ 442, 470, 1745, 761, 2149, 1480, 790, 789, 788, 1484, - /* 380 */ 787, 1486, 1487, 786, 783, 1833, 1495, 780, 1497, 1498, - /* 390 */ 777, 774, 771, 209, 1805, 1806, 1723, 2276, 2255, 802, - /* 400 */ 532, 531, 530, 529, 528, 523, 522, 521, 520, 374, - /* 410 */ 434, 433, 306, 510, 509, 508, 507, 501, 500, 499, - /* 420 */ 701, 494, 493, 389, 2418, 1524, 1525, 485, 1584, 1585, - /* 430 */ 1910, 96, 1777, 1787, 1603, 1724, 1746, 40, 39, 1804, - /* 440 */ 1807, 46, 44, 43, 42, 41, 314, 315, 392, 1746, - /* 450 */ 306, 313, 396, 395, 1718, 185, 1716, 2144, 40, 39, - /* 460 */ 1945, 304, 46, 44, 43, 42, 41, 36, 417, 1827, - /* 470 */ 1828, 1829, 1830, 1831, 1835, 1836, 1837, 1838, 306, 2270, - /* 480 */ 698, 697, 1908, 1909, 1911, 1912, 1913, 100, 1721, 1722, - /* 490 */ 1774, 12, 1776, 1779, 1780, 1781, 1782, 1783, 1784, 1785, - /* 500 */ 1786, 739, 763, 762, 1797, 1799, 1800, 1801, 1802, 2, - /* 510 */ 12, 47, 45, 2429, 707, 702, 695, 691, 1644, 419, - /* 520 */ 2238, 1717, 306, 1982, 394, 393, 744, 619, 582, 2405, - /* 530 */ 1952, 575, 2002, 33, 1803, 2606, 1715, 304, 2601, 40, - /* 540 */ 39, 643, 813, 46, 44, 43, 42, 41, 1350, 793, - /* 550 */ 1349, 621, 1774, 2409, 2447, 620, 655, 2605, 1921, 2126, - /* 560 */ 2289, 2602, 2603, 714, 1798, 143, 2395, 2048, 743, 2124, - /* 570 */ 19, 2429, 272, 636, 635, 634, 2395, 1723, 2287, 748, - /* 580 */ 626, 144, 630, 1351, 726, 107, 629, 666, 646, 37, - /* 590 */ 310, 628, 633, 398, 397, 640, 638, 627, 2411, 2414, - /* 600 */ 623, 195, 269, 858, 535, 1727, 15, 815, 2428, 765, - /* 610 */ 2142, 2466, 2447, 1873, 200, 115, 2430, 747, 2432, 2433, - /* 620 */ 742, 12, 765, 10, 2395, 149, 743, 156, 2491, 2520, - /* 630 */ 761, 2149, 329, 415, 2516, 2197, 2198, 1951, 1957, 1717, - /* 640 */ 636, 635, 634, 71, 1805, 1806, 70, 626, 144, 630, - /* 650 */ 55, 458, 430, 629, 1715, 2196, 2198, 1747, 628, 633, - /* 660 */ 398, 397, 584, 2328, 627, 737, 2428, 623, 229, 2466, - /* 670 */ 1747, 490, 2265, 115, 2430, 747, 2432, 2433, 742, 2138, - /* 680 */ 765, 224, 1777, 1787, 517, 187, 2134, 2520, 516, 1804, - /* 690 */ 1807, 415, 2516, 534, 228, 1723, 515, 800, 162, 161, - /* 700 */ 797, 796, 795, 159, 1718, 1697, 1716, 800, 162, 161, - /* 710 */ 797, 796, 795, 159, 2551, 2203, 761, 2149, 440, 481, - /* 720 */ 220, 858, 91, 439, 658, 90, 657, 40, 39, 1742, - /* 730 */ 730, 46, 44, 43, 42, 41, 478, 274, 1721, 1722, - /* 740 */ 1774, 273, 1776, 1779, 1780, 1781, 1782, 1783, 1784, 1785, - /* 750 */ 1786, 739, 763, 762, 1797, 1799, 1800, 1801, 1802, 2, - /* 760 */ 47, 45, 1808, 2429, 541, 539, 2136, 370, 419, 682, - /* 770 */ 1717, 218, 2601, 723, 147, 160, 744, 2203, 2012, 496, - /* 780 */ 2265, 172, 462, 1803, 404, 1715, 2535, 761, 2149, 2152, - /* 790 */ 2607, 204, 2201, 2429, 89, 2602, 712, 800, 162, 161, - /* 800 */ 797, 796, 795, 159, 2447, 198, 744, 479, 2558, 464, - /* 810 */ 460, 99, 2531, 1798, 377, 62, 2395, 403, 743, 656, - /* 820 */ 62, 732, 1718, 2492, 1716, 35, 1723, 1893, 222, 761, - /* 830 */ 2149, 40, 39, 1824, 2447, 46, 44, 43, 42, 41, - /* 840 */ 761, 2149, 761, 2149, 761, 2149, 2395, 1813, 743, 498, - /* 850 */ 54, 1696, 858, 1742, 591, 48, 1721, 1722, 2428, 666, - /* 860 */ 511, 2466, 512, 2429, 513, 115, 2430, 747, 2432, 2433, - /* 870 */ 742, 1981, 765, 1980, 661, 1700, 744, 2621, 2571, 2520, - /* 880 */ 526, 2265, 2535, 415, 2516, 205, 2528, 2529, 2428, 145, - /* 890 */ 2533, 2466, 1778, 1805, 1806, 115, 2430, 747, 2432, 2433, - /* 900 */ 742, 96, 765, 667, 2447, 1703, 1706, 2621, 2530, 2520, - /* 910 */ 592, 2282, 1331, 415, 2516, 2089, 2395, 472, 743, 471, - /* 920 */ 434, 433, 761, 2149, 2395, 682, 2395, 2145, 2601, 227, - /* 930 */ 1731, 1777, 1787, 1746, 668, 2328, 1329, 1330, 1804, 1807, - /* 940 */ 761, 2149, 593, 1803, 2132, 1724, 2607, 204, 428, 470, - /* 950 */ 1775, 2602, 712, 1718, 682, 1716, 169, 2601, 2428, 1902, - /* 960 */ 2146, 2466, 2222, 405, 2151, 115, 2430, 747, 2432, 2433, - /* 970 */ 742, 2201, 765, 1798, 1903, 2607, 204, 2621, 792, 2520, - /* 980 */ 2602, 712, 727, 415, 2516, 306, 1723, 1721, 1722, 1774, - /* 990 */ 306, 1776, 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786, - /* 1000 */ 739, 763, 762, 1797, 1799, 1800, 1801, 1802, 2, 47, - /* 1010 */ 45, 654, 736, 51, 282, 1901, 1778, 419, 738, 1717, - /* 1020 */ 2203, 1699, 2203, 428, 1743, 2429, 652, 414, 650, 271, - /* 1030 */ 270, 172, 1803, 682, 1715, 2201, 2601, 756, 744, 2151, - /* 1040 */ 693, 40, 39, 2203, 1746, 46, 44, 43, 42, 41, - /* 1050 */ 424, 1702, 1705, 2564, 2607, 204, 761, 2149, 2201, 2602, - /* 1060 */ 712, 621, 1798, 40, 39, 620, 2447, 46, 44, 43, - /* 1070 */ 42, 41, 761, 2149, 1775, 1723, 277, 1742, 2395, 681, - /* 1080 */ 743, 431, 761, 2149, 1979, 761, 2149, 761, 2149, 172, - /* 1090 */ 761, 2149, 285, 2203, 761, 2149, 1443, 2151, 199, 1978, - /* 1100 */ 429, 858, 729, 2429, 48, 318, 275, 758, 2201, 148, - /* 1110 */ 759, 1442, 2491, 1732, 325, 1727, 744, 734, 2594, 2492, - /* 1120 */ 2428, 1834, 1977, 2466, 519, 518, 1976, 115, 2430, 747, - /* 1130 */ 2432, 2433, 742, 699, 765, 761, 2149, 2395, 1447, 2621, - /* 1140 */ 9, 2520, 1805, 1806, 2447, 415, 2516, 1735, 1737, 1616, - /* 1150 */ 1617, 113, 2395, 1446, 1747, 432, 2395, 2356, 743, 1353, - /* 1160 */ 1354, 763, 762, 1797, 1799, 1800, 1801, 1802, 150, 43, - /* 1170 */ 42, 41, 14, 13, 1975, 2395, 2141, 1974, 546, 2395, - /* 1180 */ 1777, 1787, 299, 306, 2203, 1665, 1666, 1804, 1807, 715, - /* 1190 */ 613, 612, 615, 614, 1615, 1618, 632, 631, 2428, 2202, - /* 1200 */ 718, 2466, 1718, 34, 1716, 115, 2430, 747, 2432, 2433, - /* 1210 */ 742, 1973, 765, 1839, 60, 1972, 1970, 2621, 171, 2520, - /* 1220 */ 548, 293, 679, 415, 2516, 1969, 142, 2395, 2448, 1968, - /* 1230 */ 2395, 1967, 1966, 1965, 1964, 1963, 1721, 1722, 1774, 1962, - /* 1240 */ 1776, 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786, 739, - /* 1250 */ 763, 762, 1797, 1799, 1800, 1801, 1802, 2, 47, 45, - /* 1260 */ 2274, 2429, 827, 825, 2395, 1747, 419, 794, 1717, 2395, - /* 1270 */ 2194, 2359, 798, 2248, 744, 2194, 2539, 799, 2395, 1846, - /* 1280 */ 2194, 1803, 2395, 1715, 2395, 2395, 2395, 2395, 2395, 3, - /* 1290 */ 338, 2429, 2395, 2180, 1333, 1987, 853, 140, 1775, 77, - /* 1300 */ 1741, 53, 2447, 2127, 744, 2540, 1866, 262, 2032, 87, - /* 1310 */ 260, 1798, 2030, 624, 2395, 488, 743, 264, 266, 625, - /* 1320 */ 263, 265, 447, 268, 1723, 2021, 267, 2019, 160, 160, - /* 1330 */ 637, 689, 2447, 2086, 639, 286, 153, 1428, 1954, 1955, - /* 1340 */ 14, 13, 49, 1426, 2395, 2085, 743, 641, 49, 644, - /* 1350 */ 858, 188, 160, 15, 88, 2003, 2428, 64, 2013, 2466, - /* 1360 */ 2429, 324, 323, 115, 2430, 747, 2432, 2433, 742, 49, - /* 1370 */ 765, 49, 1726, 744, 1866, 2621, 2554, 2520, 1386, 101, - /* 1380 */ 1725, 415, 2516, 696, 312, 76, 2428, 410, 211, 2466, - /* 1390 */ 112, 1805, 1806, 115, 2430, 747, 2432, 2433, 742, 109, - /* 1400 */ 765, 2447, 158, 1660, 1663, 2495, 1897, 2520, 373, 372, - /* 1410 */ 851, 415, 2516, 2395, 703, 743, 406, 1907, 1707, 1387, - /* 1420 */ 750, 807, 438, 1906, 2275, 808, 291, 728, 2191, 1777, - /* 1430 */ 1787, 1803, 1840, 1695, 160, 73, 1804, 1807, 769, 158, - /* 1440 */ 160, 2009, 141, 158, 1788, 1405, 1613, 675, 724, 1403, - /* 1450 */ 2555, 1718, 2565, 1716, 301, 2428, 298, 716, 2466, 316, - /* 1460 */ 753, 1798, 115, 2430, 747, 2432, 2433, 742, 305, 765, - /* 1470 */ 719, 2111, 5, 441, 2493, 2429, 2520, 320, 446, 454, - /* 1480 */ 415, 2516, 386, 1750, 212, 1721, 1722, 1774, 744, 1776, - /* 1490 */ 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786, 739, 763, - /* 1500 */ 762, 1797, 1799, 1800, 1801, 1802, 2, 2429, 455, 1473, - /* 1510 */ 337, 466, 465, 1502, 1506, 1513, 2447, 1511, 163, 213, - /* 1520 */ 744, 215, 468, 1637, 332, 1740, 1741, 226, 2395, 482, - /* 1530 */ 743, 489, 491, 495, 497, 537, 502, 525, 514, 2267, - /* 1540 */ 527, 533, 1729, 536, 538, 549, 550, 547, 2447, 232, - /* 1550 */ 1728, 552, 231, 553, 234, 555, 557, 1748, 572, 4, - /* 1560 */ 2395, 573, 743, 580, 1743, 581, 242, 93, 583, 245, - /* 1570 */ 2428, 585, 1749, 2466, 586, 1751, 587, 115, 2430, 747, - /* 1580 */ 2432, 2433, 742, 248, 765, 250, 589, 1752, 2283, 733, - /* 1590 */ 94, 2520, 595, 616, 95, 415, 2516, 255, 618, 117, - /* 1600 */ 2139, 1708, 2428, 1698, 259, 2466, 2429, 364, 2135, 116, - /* 1610 */ 2430, 747, 2432, 2433, 742, 261, 765, 98, 165, 744, - /* 1620 */ 166, 647, 2137, 2520, 2133, 167, 168, 2519, 2516, 648, - /* 1630 */ 333, 2346, 662, 1701, 1704, 1709, 278, 660, 154, 2343, - /* 1640 */ 1744, 670, 2342, 669, 283, 674, 281, 2447, 676, 763, - /* 1650 */ 762, 1797, 1799, 1800, 1801, 1802, 2329, 677, 686, 2395, - /* 1660 */ 700, 743, 2570, 288, 751, 290, 8, 709, 671, 687, - /* 1670 */ 2569, 685, 179, 295, 2542, 2429, 292, 297, 684, 717, - /* 1680 */ 411, 2624, 720, 1745, 146, 1871, 300, 294, 744, 1869, - /* 1690 */ 296, 2600, 1866, 191, 2536, 61, 749, 2297, 334, 307, - /* 1700 */ 155, 2428, 2296, 335, 2466, 2429, 754, 207, 116, 2430, - /* 1710 */ 747, 2432, 2433, 742, 2501, 765, 2447, 157, 741, 755, - /* 1720 */ 108, 2295, 2520, 336, 1308, 1, 735, 2516, 2395, 339, - /* 1730 */ 743, 106, 2150, 327, 2429, 767, 852, 421, 855, 351, - /* 1740 */ 2387, 2386, 2195, 52, 384, 164, 2447, 744, 857, 363, - /* 1750 */ 362, 2429, 2367, 352, 343, 2366, 2365, 82, 2395, 2360, - /* 1760 */ 743, 341, 443, 385, 744, 444, 1688, 1689, 210, 448, - /* 1770 */ 745, 2358, 452, 2466, 450, 2447, 451, 116, 2430, 747, - /* 1780 */ 2432, 2433, 742, 1687, 765, 2357, 387, 2395, 2355, 743, - /* 1790 */ 457, 2520, 2447, 2354, 459, 379, 2516, 2353, 461, 2352, - /* 1800 */ 2428, 463, 1676, 2466, 2395, 2333, 743, 360, 2430, 747, - /* 1810 */ 2432, 2433, 742, 740, 765, 731, 2485, 214, 2332, 216, - /* 1820 */ 2429, 83, 1640, 1639, 2310, 2309, 2308, 475, 476, 2428, - /* 1830 */ 2307, 2306, 2466, 744, 2257, 480, 176, 2430, 747, 2432, - /* 1840 */ 2433, 742, 2254, 765, 1583, 483, 2428, 486, 2244, 2466, - /* 1850 */ 2429, 2253, 2247, 177, 2430, 747, 2432, 2433, 742, 2243, - /* 1860 */ 765, 2447, 487, 744, 219, 86, 2242, 2241, 2246, 2245, - /* 1870 */ 221, 2240, 2239, 2395, 2237, 743, 2236, 2235, 683, 2561, - /* 1880 */ 503, 223, 2234, 505, 2232, 2231, 2230, 2429, 2229, 2252, - /* 1890 */ 2228, 2447, 2227, 2226, 2250, 2233, 2225, 2224, 2223, 2221, - /* 1900 */ 744, 2220, 2219, 2395, 2218, 743, 225, 713, 2622, 2217, - /* 1910 */ 2216, 2215, 2214, 2213, 2212, 2428, 2211, 2251, 2466, 2249, - /* 1920 */ 92, 2210, 116, 2430, 747, 2432, 2433, 742, 2447, 765, - /* 1930 */ 2209, 2208, 230, 2207, 2206, 542, 2520, 1589, 540, 2205, - /* 1940 */ 2395, 2517, 743, 2204, 1444, 2428, 1448, 2051, 2466, 2050, - /* 1950 */ 375, 2049, 176, 2430, 747, 2432, 2433, 742, 376, 765, - /* 1960 */ 2429, 2047, 408, 1440, 2044, 560, 558, 2043, 233, 559, - /* 1970 */ 235, 563, 236, 744, 562, 2429, 2036, 564, 566, 2023, - /* 1980 */ 568, 570, 2428, 567, 1998, 2466, 186, 238, 744, 361, - /* 1990 */ 2430, 747, 2432, 2433, 742, 2562, 765, 79, 1997, 2415, - /* 2000 */ 1332, 2447, 240, 196, 80, 578, 2429, 247, 249, 2304, - /* 2010 */ 2281, 2128, 252, 2395, 2331, 743, 2447, 2327, 2317, 744, - /* 2020 */ 2305, 2046, 2042, 597, 1379, 596, 2040, 598, 2395, 600, - /* 2030 */ 743, 601, 602, 2038, 604, 409, 606, 2035, 605, 608, - /* 2040 */ 609, 610, 2018, 2016, 2017, 2015, 1994, 2447, 2130, 1518, - /* 2050 */ 1517, 72, 2129, 258, 1416, 2428, 1430, 824, 2466, 2395, - /* 2060 */ 1429, 743, 361, 2430, 747, 2432, 2433, 742, 1427, 765, - /* 2070 */ 2428, 1425, 1424, 2466, 826, 2429, 1423, 354, 2430, 747, - /* 2080 */ 2432, 2433, 742, 2033, 765, 399, 1422, 1421, 741, 2031, - /* 2090 */ 1418, 1417, 1415, 2429, 400, 2022, 401, 2020, 402, 645, - /* 2100 */ 642, 2428, 1993, 1992, 2466, 1991, 744, 649, 177, 2430, - /* 2110 */ 747, 2432, 2433, 742, 1990, 765, 2447, 651, 1989, 2429, - /* 2120 */ 653, 118, 1670, 708, 1672, 1669, 2330, 280, 2395, 2326, - /* 2130 */ 743, 56, 744, 1674, 2447, 1648, 1646, 28, 2316, 1650, - /* 2140 */ 2303, 672, 57, 67, 2302, 673, 2395, 17, 743, 2606, - /* 2150 */ 678, 65, 688, 170, 284, 1625, 1624, 20, 30, 407, - /* 2160 */ 2447, 680, 6, 2623, 1924, 287, 692, 1898, 418, 694, - /* 2170 */ 2428, 690, 2395, 2466, 743, 7, 289, 360, 2430, 747, - /* 2180 */ 2432, 2433, 742, 21, 765, 1905, 2486, 22, 2428, 178, - /* 2190 */ 190, 2466, 1892, 664, 420, 361, 2430, 747, 2432, 2433, - /* 2200 */ 742, 189, 765, 31, 257, 2429, 32, 201, 2416, 24, - /* 2210 */ 303, 861, 1944, 81, 2428, 1945, 1863, 2466, 744, 1939, - /* 2220 */ 180, 361, 2430, 747, 2432, 2433, 742, 331, 765, 611, - /* 2230 */ 607, 603, 599, 1938, 256, 412, 1943, 1942, 413, 1862, - /* 2240 */ 59, 2301, 181, 194, 2280, 103, 2447, 25, 58, 102, - /* 2250 */ 23, 13, 849, 845, 841, 837, 18, 328, 2395, 1733, - /* 2260 */ 743, 1815, 11, 1790, 2429, 1814, 1825, 182, 192, 38, - /* 2270 */ 1767, 1789, 16, 26, 27, 97, 1759, 744, 254, 311, - /* 2280 */ 746, 752, 1900, 2279, 193, 317, 2429, 69, 104, 322, - /* 2290 */ 105, 109, 2471, 2470, 768, 1792, 319, 764, 114, 744, - /* 2300 */ 659, 321, 1503, 2466, 68, 2447, 766, 356, 2430, 747, - /* 2310 */ 2432, 2433, 742, 427, 765, 770, 772, 2395, 1500, 743, - /* 2320 */ 773, 775, 778, 1499, 776, 781, 784, 2447, 1496, 779, - /* 2330 */ 1479, 1490, 782, 326, 1488, 757, 785, 110, 111, 2395, - /* 2340 */ 1512, 743, 1494, 78, 1508, 791, 1493, 244, 1412, 1377, - /* 2350 */ 1409, 1492, 801, 1408, 1491, 1407, 253, 246, 1406, 2428, - /* 2360 */ 1404, 1402, 2466, 251, 588, 2429, 346, 2430, 747, 2432, - /* 2370 */ 2433, 742, 1401, 765, 1400, 1438, 812, 1437, 744, 309, - /* 2380 */ 208, 2428, 243, 814, 2466, 1398, 308, 2429, 345, 2430, - /* 2390 */ 747, 2432, 2433, 742, 1397, 765, 1396, 1395, 1394, 1393, - /* 2400 */ 744, 1392, 1432, 1434, 1389, 279, 2447, 1388, 1385, 1384, - /* 2410 */ 1383, 1382, 2041, 834, 835, 836, 2039, 839, 2395, 838, - /* 2420 */ 743, 840, 2037, 2429, 842, 844, 2034, 846, 2447, 843, - /* 2430 */ 2014, 848, 847, 1988, 850, 1321, 744, 1309, 854, 330, - /* 2440 */ 2395, 856, 743, 1719, 860, 340, 859, 1958, 1958, 1958, - /* 2450 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, - /* 2460 */ 2428, 1958, 1958, 2466, 2447, 1958, 1958, 347, 2430, 747, - /* 2470 */ 2432, 2433, 742, 1958, 765, 1958, 2395, 1958, 743, 1958, - /* 2480 */ 1958, 1958, 2428, 1958, 1958, 2466, 1958, 1958, 1958, 353, - /* 2490 */ 2430, 747, 2432, 2433, 742, 1958, 765, 1958, 1958, 1958, - /* 2500 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 2429, 1958, 1958, - /* 2510 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 2428, 1958, - /* 2520 */ 744, 2466, 2429, 1958, 1958, 357, 2430, 747, 2432, 2433, - /* 2530 */ 742, 1958, 765, 1958, 1958, 744, 1958, 2429, 1958, 1958, - /* 2540 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 2447, 1958, - /* 2550 */ 744, 1958, 1958, 2429, 1958, 1958, 1958, 1958, 1958, 1958, - /* 2560 */ 2395, 1958, 743, 2447, 1958, 1958, 744, 1958, 1958, 1958, - /* 2570 */ 1958, 1958, 1958, 1958, 1958, 2395, 1958, 743, 2447, 1958, - /* 2580 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, - /* 2590 */ 2395, 1958, 743, 1958, 2447, 1958, 1958, 1958, 1958, 1958, - /* 2600 */ 1958, 1958, 2428, 1958, 1958, 2466, 2395, 1958, 743, 348, - /* 2610 */ 2430, 747, 2432, 2433, 742, 1958, 765, 2428, 1958, 1958, - /* 2620 */ 2466, 1958, 1958, 2429, 358, 2430, 747, 2432, 2433, 742, - /* 2630 */ 1958, 765, 2428, 1958, 1958, 2466, 744, 1958, 1958, 349, - /* 2640 */ 2430, 747, 2432, 2433, 742, 1958, 765, 1958, 2428, 1958, - /* 2650 */ 1958, 2466, 1958, 1958, 1958, 359, 2430, 747, 2432, 2433, - /* 2660 */ 742, 1958, 765, 1958, 2447, 1958, 1958, 2429, 1958, 1958, - /* 2670 */ 1958, 1958, 1958, 1958, 1958, 1958, 2395, 1958, 743, 1958, - /* 2680 */ 744, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, - /* 2690 */ 1958, 1958, 1958, 1958, 2429, 1958, 1958, 1958, 1958, 1958, - /* 2700 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 744, 2447, 1958, - /* 2710 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 2428, 1958, - /* 2720 */ 2395, 2466, 743, 1958, 1958, 350, 2430, 747, 2432, 2433, - /* 2730 */ 742, 1958, 765, 1958, 1958, 2447, 1958, 1958, 2429, 1958, - /* 2740 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 2395, 1958, 743, - /* 2750 */ 1958, 744, 1958, 1958, 2429, 1958, 1958, 1958, 1958, 1958, - /* 2760 */ 1958, 1958, 2428, 1958, 1958, 2466, 1958, 744, 1958, 365, - /* 2770 */ 2430, 747, 2432, 2433, 742, 1958, 765, 2429, 1958, 2447, - /* 2780 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 2428, - /* 2790 */ 744, 2395, 2466, 743, 1958, 2447, 366, 2430, 747, 2432, - /* 2800 */ 2433, 742, 1958, 765, 1958, 1958, 1958, 2395, 1958, 743, - /* 2810 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 2447, 1958, - /* 2820 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, - /* 2830 */ 2395, 1958, 743, 2428, 1958, 2429, 2466, 1958, 1958, 1958, - /* 2840 */ 2441, 2430, 747, 2432, 2433, 742, 1958, 765, 744, 2428, - /* 2850 */ 1958, 2429, 2466, 1958, 1958, 1958, 2440, 2430, 747, 2432, - /* 2860 */ 2433, 742, 1958, 765, 744, 1958, 1958, 1958, 1958, 1958, - /* 2870 */ 1958, 1958, 2428, 1958, 1958, 2466, 2447, 1958, 1958, 2439, - /* 2880 */ 2430, 747, 2432, 2433, 742, 1958, 765, 1958, 2395, 1958, - /* 2890 */ 743, 1958, 2447, 1958, 1958, 1958, 1958, 1958, 1958, 1958, - /* 2900 */ 1958, 1958, 1958, 1958, 2395, 1958, 743, 1958, 1958, 2429, - /* 2910 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, - /* 2920 */ 1958, 1958, 744, 1958, 1958, 1958, 1958, 1958, 1958, 1958, - /* 2930 */ 2428, 1958, 1958, 2466, 2429, 1958, 1958, 381, 2430, 747, - /* 2940 */ 2432, 2433, 742, 1958, 765, 1958, 2428, 744, 1958, 2466, - /* 2950 */ 2447, 1958, 1958, 382, 2430, 747, 2432, 2433, 742, 1958, - /* 2960 */ 765, 1958, 2395, 1958, 743, 1958, 1958, 2429, 1958, 1958, - /* 2970 */ 1958, 1958, 1958, 1958, 1958, 2447, 1958, 1958, 1958, 1958, - /* 2980 */ 744, 1958, 1958, 1958, 1958, 1958, 1958, 2395, 1958, 743, - /* 2990 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, - /* 3000 */ 1958, 1958, 1958, 1958, 2428, 1958, 1958, 2466, 2447, 1958, - /* 3010 */ 1958, 378, 2430, 747, 2432, 2433, 742, 1958, 765, 1958, - /* 3020 */ 2395, 1958, 743, 1958, 1958, 1958, 1958, 1958, 1958, 2428, - /* 3030 */ 1958, 1958, 2466, 1958, 1958, 1958, 383, 2430, 747, 2432, - /* 3040 */ 2433, 742, 1958, 765, 1958, 1958, 1958, 1958, 1958, 1958, - /* 3050 */ 1958, 1958, 1958, 2429, 1958, 1958, 1958, 1958, 1958, 1958, - /* 3060 */ 1958, 1958, 745, 1958, 1958, 2466, 744, 1958, 1958, 356, - /* 3070 */ 2430, 747, 2432, 2433, 742, 1958, 765, 1958, 1958, 1958, - /* 3080 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, - /* 3090 */ 1958, 1958, 1958, 1958, 2447, 1958, 1958, 1958, 1958, 1958, - /* 3100 */ 1958, 1958, 1958, 1958, 1958, 1958, 2395, 1958, 743, 1958, - /* 3110 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, - /* 3120 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, - /* 3130 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, - /* 3140 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 2428, 1958, - /* 3150 */ 1958, 2466, 1958, 1958, 1958, 355, 2430, 747, 2432, 2433, - /* 3160 */ 742, 1958, 765, + /* 0 */ 825, 505, 37, 311, 744, 605, 504, 2695, 606, 2072, + /* 10 */ 2359, 459, 47, 45, 1947, 2482, 2208, 186, 457, 166, + /* 20 */ 440, 2030, 1787, 756, 147, 743, 205, 2221, 2357, 781, + /* 30 */ 2696, 745, 2308, 2210, 1812, 1873, 2115, 1785, 610, 411, + /* 40 */ 2359, 2339, 128, 2523, 607, 127, 126, 125, 124, 123, + /* 50 */ 122, 121, 120, 119, 715, 443, 759, 2695, 2356, 781, + /* 60 */ 1813, 1377, 40, 39, 739, 1868, 46, 44, 43, 42, + /* 70 */ 41, 19, 446, 426, 2406, 2701, 205, 738, 1793, 793, + /* 80 */ 2696, 745, 2273, 798, 2541, 1375, 1376, 40, 39, 409, + /* 90 */ 446, 46, 44, 43, 42, 41, 2489, 2271, 776, 613, + /* 100 */ 694, 798, 606, 2072, 891, 2541, 175, 15, 793, 866, + /* 110 */ 865, 864, 863, 468, 2158, 862, 861, 152, 856, 855, + /* 120 */ 854, 853, 852, 851, 850, 151, 844, 843, 842, 467, + /* 130 */ 466, 839, 838, 837, 185, 184, 836, 303, 2622, 755, + /* 140 */ 2522, 139, 754, 2560, 2695, 1875, 1876, 115, 2524, 780, + /* 150 */ 2526, 2527, 775, 174, 798, 2407, 444, 2483, 365, 188, + /* 160 */ 161, 2614, 743, 205, 173, 436, 2610, 2696, 745, 602, + /* 170 */ 737, 744, 2221, 62, 2695, 363, 75, 698, 600, 74, + /* 180 */ 207, 596, 592, 1847, 1857, 1570, 1571, 1991, 2644, 392, + /* 190 */ 1874, 1877, 743, 205, 1370, 50, 548, 2696, 745, 489, + /* 200 */ 547, 238, 587, 585, 582, 1788, 461, 1786, 546, 2266, + /* 210 */ 2268, 40, 39, 1377, 446, 46, 44, 43, 42, 41, + /* 220 */ 176, 699, 2041, 128, 2699, 798, 127, 126, 125, 124, + /* 230 */ 123, 122, 121, 120, 119, 54, 1372, 1375, 1376, 1791, + /* 240 */ 1792, 1844, 62, 1846, 1849, 1850, 1851, 1852, 1853, 1854, + /* 250 */ 1855, 1856, 772, 796, 795, 1867, 1869, 1870, 1871, 1872, + /* 260 */ 2, 47, 45, 2029, 849, 793, 389, 2180, 1810, 440, + /* 270 */ 503, 1787, 502, 240, 401, 555, 512, 608, 575, 2080, + /* 280 */ 794, 2219, 63, 574, 1873, 1844, 1785, 137, 136, 135, + /* 290 */ 134, 133, 132, 131, 130, 129, 615, 2398, 33, 535, + /* 300 */ 210, 576, 501, 621, 40, 39, 390, 537, 46, 44, + /* 310 */ 43, 42, 41, 2700, 1868, 1812, 2695, 515, 1902, 242, + /* 320 */ 19, 572, 570, 608, 391, 2080, 1815, 1793, 219, 2273, + /* 330 */ 493, 2430, 85, 84, 508, 2699, 435, 218, 113, 2696, + /* 340 */ 2698, 40, 39, 307, 2271, 46, 44, 43, 42, 41, + /* 350 */ 500, 498, 50, 891, 412, 150, 15, 495, 491, 1535, + /* 360 */ 1951, 388, 198, 2211, 487, 523, 1812, 484, 480, 476, + /* 370 */ 473, 501, 186, 695, 2260, 1526, 823, 822, 821, 1530, + /* 380 */ 820, 1532, 1533, 819, 816, 1903, 1541, 813, 1543, 1544, + /* 390 */ 810, 807, 804, 1379, 1875, 1876, 2340, 2346, 2325, 1811, + /* 400 */ 563, 562, 561, 560, 559, 554, 553, 552, 551, 395, + /* 410 */ 465, 464, 307, 541, 540, 539, 538, 532, 531, 530, + /* 420 */ 625, 525, 524, 410, 66, 756, 147, 516, 1630, 1631, + /* 430 */ 1980, 96, 1847, 1857, 1649, 1794, 2433, 40, 39, 1874, + /* 440 */ 1877, 46, 44, 43, 42, 41, 315, 316, 413, 1816, + /* 450 */ 1812, 314, 35, 696, 1788, 1813, 1786, 2214, 40, 39, + /* 460 */ 756, 147, 46, 44, 43, 42, 41, 36, 438, 1897, + /* 470 */ 1898, 1899, 1900, 1901, 1905, 1906, 1907, 1908, 1642, 1643, + /* 480 */ 731, 730, 1978, 1979, 1981, 1982, 1983, 478, 1791, 1792, + /* 490 */ 1844, 305, 1846, 1849, 1850, 1851, 1852, 1853, 1854, 1855, + /* 500 */ 1856, 772, 796, 795, 1867, 1869, 1870, 1871, 1872, 2, + /* 510 */ 12, 47, 45, 2523, 275, 1396, 2273, 1395, 274, 440, + /* 520 */ 747, 1787, 307, 445, 62, 2700, 777, 62, 2695, 1848, + /* 530 */ 2022, 2271, 143, 258, 1873, 846, 1785, 62, 674, 204, + /* 540 */ 2622, 2623, 2523, 145, 2627, 794, 2219, 2699, 12, 181, + /* 550 */ 1397, 2696, 2697, 686, 2541, 759, 14, 13, 642, 638, + /* 560 */ 634, 630, 212, 257, 1868, 55, 2489, 1972, 776, 273, + /* 570 */ 19, 51, 734, 758, 203, 2622, 2623, 1793, 145, 2627, + /* 580 */ 1662, 1663, 1973, 2541, 287, 677, 699, 1845, 99, 794, + /* 590 */ 2219, 398, 671, 669, 424, 2489, 687, 776, 2700, 270, + /* 600 */ 848, 2052, 1883, 891, 97, 1797, 15, 255, 1812, 138, + /* 610 */ 2522, 452, 2629, 2560, 201, 1815, 648, 115, 2524, 780, + /* 620 */ 2526, 2527, 775, 1971, 798, 1661, 1664, 149, 101, 157, + /* 630 */ 2585, 2614, 794, 2219, 154, 436, 2610, 2021, 2626, 2522, + /* 640 */ 71, 2411, 2560, 70, 1875, 1876, 115, 2524, 780, 2526, + /* 650 */ 2527, 775, 138, 798, 2489, 794, 2219, 455, 188, 653, + /* 660 */ 2614, 701, 2398, 1916, 436, 2610, 740, 735, 728, 724, + /* 670 */ 1817, 794, 2219, 40, 39, 509, 245, 46, 44, 43, + /* 680 */ 42, 41, 1847, 1857, 2051, 254, 247, 2645, 1944, 1874, + /* 690 */ 1877, 510, 252, 619, 307, 685, 277, 307, 29, 1396, + /* 700 */ 1535, 1395, 2195, 2015, 1788, 566, 1786, 307, 622, 1706, + /* 710 */ 683, 244, 681, 272, 271, 835, 1526, 823, 822, 821, + /* 720 */ 1530, 820, 1532, 1533, 819, 816, 2050, 1541, 813, 1543, + /* 730 */ 1544, 810, 807, 804, 1397, 756, 147, 2489, 1791, 1792, + /* 740 */ 1844, 307, 1846, 1849, 1850, 1851, 1852, 1853, 1854, 1855, + /* 750 */ 1856, 772, 796, 795, 1867, 1869, 1870, 1871, 1872, 2, + /* 760 */ 47, 45, 1878, 2523, 623, 2352, 521, 2335, 440, 230, + /* 770 */ 1787, 1848, 835, 1992, 527, 2335, 777, 2049, 2082, 2489, + /* 780 */ 305, 1756, 276, 1873, 2273, 1785, 46, 44, 43, 42, + /* 790 */ 41, 460, 2523, 148, 565, 229, 2585, 794, 2219, 2271, + /* 800 */ 1793, 667, 666, 665, 2541, 777, 2196, 2652, 657, 144, + /* 810 */ 661, 451, 450, 1868, 660, 221, 2489, 529, 776, 659, + /* 820 */ 664, 419, 418, 223, 2027, 658, 1793, 1755, 654, 1845, + /* 830 */ 2489, 1787, 2083, 2541, 40, 39, 794, 2219, 46, 44, + /* 840 */ 43, 42, 41, 1904, 652, 2489, 1785, 776, 651, 206, + /* 850 */ 2622, 2623, 891, 145, 2627, 48, 542, 454, 453, 2048, + /* 860 */ 2522, 1715, 1716, 2560, 2523, 2047, 1477, 115, 2524, 780, + /* 870 */ 2526, 2527, 775, 2292, 798, 794, 2219, 774, 12, 2715, + /* 880 */ 10, 2614, 794, 2219, 884, 436, 2610, 1793, 694, 2522, + /* 890 */ 2267, 2268, 2560, 1875, 1876, 543, 115, 2524, 780, 2526, + /* 900 */ 2527, 775, 544, 798, 471, 2541, 2442, 1479, 2715, 470, + /* 910 */ 2614, 826, 2489, 891, 436, 2610, 1812, 2489, 2489, 776, + /* 920 */ 794, 2219, 40, 39, 350, 34, 46, 44, 43, 42, + /* 930 */ 41, 1847, 1857, 714, 1963, 1909, 794, 2219, 1874, 1877, + /* 940 */ 624, 2204, 425, 2406, 833, 163, 162, 830, 829, 828, + /* 950 */ 160, 1399, 1400, 1788, 2206, 1786, 2216, 715, 2499, 715, + /* 960 */ 2695, 2522, 2695, 1943, 2560, 43, 42, 41, 381, 2524, + /* 970 */ 780, 2526, 2527, 775, 773, 798, 764, 2579, 2701, 205, + /* 980 */ 2701, 205, 2503, 2696, 745, 2696, 745, 1791, 1792, 1844, + /* 990 */ 107, 1846, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, + /* 1000 */ 772, 796, 795, 1867, 1869, 1870, 1871, 1872, 2, 47, + /* 1010 */ 45, 225, 2523, 2443, 1788, 2212, 1786, 440, 2499, 1787, + /* 1020 */ 2046, 557, 2335, 794, 2219, 777, 2202, 2665, 692, 2505, + /* 1030 */ 2507, 437, 1873, 2194, 1785, 550, 549, 794, 2219, 173, + /* 1040 */ 798, 2523, 2503, 278, 2045, 644, 643, 2222, 1791, 1792, + /* 1050 */ 646, 645, 91, 2541, 777, 90, 726, 286, 794, 2219, + /* 1060 */ 794, 2219, 1868, 794, 2219, 2489, 715, 776, 60, 2695, + /* 1070 */ 228, 794, 2219, 2489, 827, 1793, 712, 2264, 762, 1848, + /* 1080 */ 319, 715, 2541, 791, 2695, 794, 2219, 2701, 205, 2505, + /* 1090 */ 2508, 792, 2696, 745, 2489, 9, 776, 2489, 459, 172, + /* 1100 */ 798, 891, 2701, 205, 48, 346, 173, 2696, 745, 2522, + /* 1110 */ 2629, 1816, 2560, 2523, 2221, 1816, 115, 2524, 780, 2526, + /* 1120 */ 2527, 775, 199, 798, 89, 1489, 777, 1816, 2715, 2273, + /* 1130 */ 2614, 794, 2219, 2044, 436, 2610, 2625, 1845, 2522, 2629, + /* 1140 */ 1488, 2560, 1875, 1876, 763, 115, 2524, 780, 2526, 2527, + /* 1150 */ 775, 463, 798, 700, 2541, 760, 1812, 2715, 765, 2614, + /* 1160 */ 2586, 2043, 462, 436, 2610, 2624, 2489, 767, 776, 2586, + /* 1170 */ 173, 833, 163, 162, 830, 829, 828, 160, 2221, 96, + /* 1180 */ 1847, 1857, 663, 662, 2273, 1493, 2489, 1874, 1877, 417, + /* 1190 */ 416, 3, 833, 163, 162, 830, 829, 828, 160, 789, + /* 1200 */ 1492, 655, 1788, 53, 1786, 2215, 715, 577, 715, 2695, + /* 1210 */ 2522, 2695, 2040, 2560, 2489, 748, 2039, 178, 2524, 780, + /* 1220 */ 2526, 2527, 775, 1796, 798, 1474, 2038, 2701, 205, 2701, + /* 1230 */ 205, 283, 2696, 745, 2696, 745, 1791, 1792, 1844, 100, + /* 1240 */ 1846, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 772, + /* 1250 */ 796, 795, 1867, 1869, 1870, 1871, 1872, 2, 47, 45, + /* 1260 */ 2523, 415, 414, 2037, 650, 2489, 440, 579, 1787, 2489, + /* 1270 */ 1690, 746, 2716, 777, 2036, 2688, 196, 2035, 2318, 2489, + /* 1280 */ 200, 1873, 2034, 1785, 2033, 2032, 831, 2273, 652, 2264, + /* 1290 */ 2523, 77, 651, 860, 858, 832, 359, 154, 2264, 2250, + /* 1300 */ 140, 2541, 2272, 777, 656, 2633, 2057, 886, 2197, 2634, + /* 1310 */ 1936, 1868, 87, 2489, 263, 776, 2489, 261, 265, 267, + /* 1320 */ 519, 264, 266, 269, 1793, 2102, 268, 2489, 1472, 1936, + /* 1330 */ 2489, 2541, 1817, 2100, 2091, 2489, 1817, 2489, 2489, 2089, + /* 1340 */ 689, 153, 688, 2489, 722, 776, 88, 668, 1817, 49, + /* 1350 */ 891, 49, 189, 15, 771, 670, 672, 2522, 2510, 751, + /* 1360 */ 2560, 675, 2024, 2025, 115, 2524, 780, 2526, 2527, 775, + /* 1370 */ 2159, 798, 1713, 161, 14, 13, 2715, 1845, 2614, 465, + /* 1380 */ 464, 770, 436, 2610, 64, 49, 49, 2522, 2042, 1801, + /* 1390 */ 2560, 1875, 1876, 1799, 115, 2524, 780, 2526, 2527, 775, + /* 1400 */ 1795, 798, 1873, 313, 1794, 76, 2715, 159, 2614, 161, + /* 1410 */ 325, 324, 436, 2610, 840, 2523, 2512, 327, 326, 1967, + /* 1420 */ 329, 328, 331, 330, 1977, 2658, 1976, 292, 777, 1847, + /* 1430 */ 1857, 841, 1868, 333, 332, 73, 1874, 1877, 1451, 335, + /* 1440 */ 334, 337, 336, 112, 732, 1793, 339, 338, 761, 341, + /* 1450 */ 340, 1788, 109, 1786, 2118, 1449, 2541, 300, 294, 1910, + /* 1460 */ 1858, 1659, 343, 342, 345, 344, 802, 142, 2489, 159, + /* 1470 */ 776, 769, 1432, 2542, 2156, 161, 2155, 2073, 317, 2344, + /* 1480 */ 786, 141, 321, 749, 1519, 1791, 1792, 1844, 2648, 1846, + /* 1490 */ 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 772, 796, + /* 1500 */ 795, 1867, 1869, 1870, 1871, 1872, 2, 394, 393, 159, + /* 1510 */ 358, 729, 2522, 1433, 431, 2560, 736, 447, 427, 115, + /* 1520 */ 2524, 780, 2526, 2527, 775, 783, 798, 667, 666, 665, + /* 1530 */ 1873, 2589, 456, 2614, 657, 144, 661, 436, 2610, 2523, + /* 1540 */ 660, 1548, 469, 2079, 1552, 659, 664, 419, 418, 1894, + /* 1550 */ 1559, 658, 777, 2345, 654, 2261, 1557, 708, 2649, 2659, + /* 1560 */ 1868, 757, 302, 2523, 299, 306, 2181, 5, 472, 477, + /* 1570 */ 1798, 407, 1802, 485, 1797, 1820, 777, 486, 497, 496, + /* 1580 */ 2541, 214, 213, 1683, 164, 499, 216, 353, 1810, 513, + /* 1590 */ 1811, 520, 2489, 227, 776, 522, 526, 568, 528, 2523, + /* 1600 */ 533, 545, 564, 556, 2541, 2337, 1805, 1807, 567, 558, + /* 1610 */ 569, 580, 777, 581, 578, 232, 2489, 233, 776, 583, + /* 1620 */ 796, 795, 1867, 1869, 1870, 1871, 1872, 235, 586, 752, + /* 1630 */ 584, 588, 1818, 603, 4, 604, 2522, 611, 612, 2560, + /* 1640 */ 2541, 614, 243, 115, 2524, 780, 2526, 2527, 775, 1813, + /* 1650 */ 798, 93, 2489, 616, 776, 2587, 246, 2614, 1819, 1821, + /* 1660 */ 2522, 436, 2610, 2560, 617, 618, 1822, 115, 2524, 780, + /* 1670 */ 2526, 2527, 775, 249, 798, 620, 251, 2353, 94, 766, + /* 1680 */ 95, 2614, 626, 256, 647, 436, 2610, 649, 2209, 260, + /* 1690 */ 117, 678, 2205, 679, 262, 167, 2522, 168, 385, 2560, + /* 1700 */ 1778, 2207, 1754, 116, 2524, 780, 2526, 2527, 775, 691, + /* 1710 */ 798, 2420, 2203, 169, 170, 98, 2523, 2614, 2417, 279, + /* 1720 */ 693, 2613, 2610, 354, 155, 1814, 2399, 703, 2416, 777, + /* 1730 */ 704, 702, 449, 448, 1779, 710, 707, 284, 719, 733, + /* 1740 */ 784, 709, 2664, 2663, 2636, 8, 2523, 742, 796, 795, + /* 1750 */ 1867, 1869, 1870, 1871, 1872, 293, 720, 2541, 289, 777, + /* 1760 */ 291, 180, 718, 295, 717, 282, 432, 2718, 753, 2489, + /* 1770 */ 296, 776, 2694, 298, 750, 297, 1936, 146, 301, 1815, + /* 1780 */ 1941, 1939, 61, 192, 308, 2630, 156, 2541, 782, 2523, + /* 1790 */ 355, 356, 2367, 2366, 2365, 442, 788, 787, 357, 2489, + /* 1800 */ 1, 776, 777, 158, 2481, 106, 2480, 2595, 2476, 2220, + /* 1810 */ 2475, 2467, 1354, 2522, 108, 2466, 2560, 800, 348, 885, + /* 1820 */ 116, 2524, 780, 2526, 2527, 775, 52, 798, 2458, 2441, + /* 1830 */ 2541, 2457, 888, 208, 2614, 2473, 2472, 165, 768, 2610, + /* 1840 */ 890, 2464, 2489, 778, 776, 360, 2560, 2440, 364, 2523, + /* 1850 */ 116, 2524, 780, 2526, 2527, 775, 2463, 798, 2452, 362, + /* 1860 */ 384, 2439, 777, 82, 2614, 2434, 2451, 2470, 400, 2610, + /* 1870 */ 2469, 2523, 372, 2461, 2460, 2449, 405, 383, 2448, 2446, + /* 1880 */ 2445, 2265, 373, 474, 777, 475, 2522, 406, 1738, 2560, + /* 1890 */ 2541, 1739, 211, 177, 2524, 780, 2526, 2527, 775, 479, + /* 1900 */ 798, 2432, 2489, 481, 776, 482, 483, 1737, 2431, 408, + /* 1910 */ 2429, 488, 2541, 490, 2427, 492, 2426, 494, 1726, 2403, + /* 1920 */ 2402, 215, 217, 1686, 2489, 2428, 776, 83, 1685, 2380, + /* 1930 */ 2379, 2378, 506, 507, 2377, 716, 2655, 2376, 511, 2327, + /* 1940 */ 1629, 2324, 514, 2323, 2317, 518, 2522, 220, 517, 2560, + /* 1950 */ 2314, 2523, 2313, 116, 2524, 780, 2526, 2527, 775, 2312, + /* 1960 */ 798, 2311, 86, 2316, 777, 2315, 2310, 2614, 2522, 2309, + /* 1970 */ 222, 2560, 2611, 224, 2304, 177, 2524, 780, 2526, 2527, + /* 1980 */ 775, 2523, 798, 2307, 2306, 2305, 534, 536, 2302, 2301, + /* 1990 */ 2300, 2299, 2541, 92, 777, 2322, 2298, 2297, 2296, 2523, + /* 2000 */ 2320, 2303, 2295, 2294, 2489, 2293, 776, 2291, 2290, 2289, + /* 2010 */ 2288, 2287, 777, 2286, 2285, 2284, 226, 2283, 2656, 2282, + /* 2020 */ 2281, 2321, 2541, 2319, 2280, 2279, 429, 2278, 1635, 2523, + /* 2030 */ 2277, 231, 571, 2276, 2489, 573, 776, 2275, 2274, 2121, + /* 2040 */ 2541, 234, 777, 2120, 1490, 236, 2119, 237, 2522, 396, + /* 2050 */ 1494, 2560, 2489, 2117, 776, 382, 2524, 780, 2526, 2527, + /* 2060 */ 775, 2114, 798, 1486, 2113, 2106, 397, 2093, 589, 590, + /* 2070 */ 2541, 591, 593, 597, 430, 250, 595, 2068, 2522, 601, + /* 2080 */ 187, 2560, 2489, 594, 776, 375, 2524, 780, 2526, 2527, + /* 2090 */ 775, 598, 798, 599, 239, 1378, 2522, 79, 2067, 2560, + /* 2100 */ 241, 2509, 80, 382, 2524, 780, 2526, 2527, 775, 2523, + /* 2110 */ 798, 197, 609, 2401, 2397, 2387, 2375, 2374, 253, 2351, + /* 2120 */ 248, 2198, 774, 627, 628, 629, 2522, 2116, 2523, 2560, + /* 2130 */ 1425, 741, 2112, 178, 2524, 780, 2526, 2527, 775, 2110, + /* 2140 */ 798, 777, 632, 631, 633, 2108, 2523, 635, 636, 637, + /* 2150 */ 2541, 2105, 640, 641, 2088, 639, 2086, 2087, 2085, 777, + /* 2160 */ 2064, 2200, 2489, 72, 776, 1564, 1563, 259, 2199, 2541, + /* 2170 */ 1476, 1475, 1473, 1471, 1470, 1469, 857, 1468, 1467, 859, + /* 2180 */ 2103, 2489, 2101, 776, 1464, 1463, 1462, 2541, 2717, 1461, + /* 2190 */ 2092, 420, 421, 422, 2090, 673, 423, 2063, 2062, 2489, + /* 2200 */ 676, 776, 2061, 439, 680, 2060, 2522, 684, 697, 2560, + /* 2210 */ 682, 2059, 118, 381, 2524, 780, 2526, 2527, 775, 28, + /* 2220 */ 798, 441, 2580, 1720, 1722, 2522, 894, 2400, 2560, 56, + /* 2230 */ 1719, 67, 382, 2524, 780, 2526, 2527, 775, 1724, 798, + /* 2240 */ 695, 2396, 352, 2522, 1710, 281, 2560, 1692, 2523, 2386, + /* 2250 */ 382, 2524, 780, 2526, 2527, 775, 57, 798, 195, 706, + /* 2260 */ 1694, 777, 1696, 2373, 171, 705, 2372, 882, 878, 874, + /* 2270 */ 870, 2523, 349, 285, 1671, 1670, 711, 2700, 20, 713, + /* 2280 */ 1994, 721, 30, 288, 777, 1968, 17, 428, 723, 2541, + /* 2290 */ 6, 290, 7, 725, 727, 21, 179, 22, 191, 65, + /* 2300 */ 202, 2489, 190, 776, 2510, 2523, 32, 1975, 31, 24, + /* 2310 */ 304, 1962, 2541, 114, 2014, 81, 322, 2015, 777, 2009, + /* 2320 */ 2008, 433, 2013, 23, 2489, 2012, 776, 18, 434, 1933, + /* 2330 */ 59, 2523, 1932, 2371, 58, 182, 2350, 102, 25, 1885, + /* 2340 */ 103, 11, 13, 1803, 777, 690, 2541, 1895, 2560, 183, + /* 2350 */ 790, 2523, 377, 2524, 780, 2526, 2527, 775, 2489, 798, + /* 2360 */ 776, 1884, 1860, 193, 777, 38, 1837, 1859, 2522, 2349, + /* 2370 */ 104, 2560, 2541, 779, 16, 367, 2524, 780, 2526, 2527, + /* 2380 */ 775, 323, 798, 1829, 2489, 26, 776, 27, 109, 312, + /* 2390 */ 801, 458, 2541, 805, 310, 1970, 194, 318, 808, 69, + /* 2400 */ 320, 309, 2522, 785, 2489, 2560, 776, 1862, 105, 366, + /* 2410 */ 2524, 780, 2526, 2527, 775, 2565, 798, 2564, 797, 68, + /* 2420 */ 280, 799, 811, 1549, 803, 814, 1546, 806, 2522, 817, + /* 2430 */ 1545, 2560, 1542, 2523, 809, 368, 2524, 780, 2526, 2527, + /* 2440 */ 775, 812, 798, 1536, 815, 818, 777, 1534, 2522, 1540, + /* 2450 */ 110, 2560, 347, 1539, 1558, 374, 2524, 780, 2526, 2527, + /* 2460 */ 775, 1538, 798, 2523, 1525, 824, 111, 78, 1554, 1423, + /* 2470 */ 834, 1537, 1458, 1455, 2541, 1454, 777, 1453, 1452, 1450, + /* 2480 */ 1448, 2523, 1447, 1484, 1446, 845, 2489, 1483, 776, 209, + /* 2490 */ 847, 1444, 1443, 1441, 777, 1442, 1440, 1439, 1438, 1480, + /* 2500 */ 1478, 1435, 1434, 1431, 2541, 1430, 1429, 1428, 2111, 867, + /* 2510 */ 2109, 869, 871, 868, 2107, 875, 2489, 2104, 776, 873, + /* 2520 */ 879, 877, 2541, 881, 872, 876, 2084, 880, 883, 1367, + /* 2530 */ 2522, 2058, 887, 2560, 2489, 1355, 776, 378, 2524, 780, + /* 2540 */ 2526, 2527, 775, 351, 798, 889, 2028, 1789, 893, 361, + /* 2550 */ 892, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, + /* 2560 */ 2522, 2028, 2523, 2560, 2028, 2028, 2028, 369, 2524, 780, + /* 2570 */ 2526, 2527, 775, 2028, 798, 777, 2028, 2028, 2522, 2028, + /* 2580 */ 2523, 2560, 2028, 2028, 2028, 379, 2524, 780, 2526, 2527, + /* 2590 */ 775, 2028, 798, 777, 2028, 2523, 2028, 2028, 2028, 2028, + /* 2600 */ 2028, 2028, 2028, 2541, 2028, 2028, 2028, 2028, 777, 2028, + /* 2610 */ 2523, 2028, 2028, 2028, 2028, 2489, 2028, 776, 2028, 2028, + /* 2620 */ 2028, 2541, 2028, 777, 2028, 2028, 2028, 2028, 2028, 2028, + /* 2630 */ 2028, 2028, 2028, 2489, 2028, 776, 2541, 2028, 2028, 2028, + /* 2640 */ 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2489, 2028, + /* 2650 */ 776, 2541, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2522, + /* 2660 */ 2028, 2028, 2560, 2489, 2028, 776, 370, 2524, 780, 2526, + /* 2670 */ 2527, 775, 2028, 798, 2028, 2028, 2028, 2522, 2028, 2028, + /* 2680 */ 2560, 2028, 2028, 2523, 380, 2524, 780, 2526, 2527, 775, + /* 2690 */ 2028, 798, 2522, 2028, 2028, 2560, 777, 2028, 2028, 371, + /* 2700 */ 2524, 780, 2526, 2527, 775, 2028, 798, 2522, 2028, 2523, + /* 2710 */ 2560, 2028, 2028, 2028, 386, 2524, 780, 2526, 2527, 775, + /* 2720 */ 2028, 798, 777, 2028, 2541, 2028, 2028, 2028, 2028, 2028, + /* 2730 */ 2028, 2523, 2028, 2028, 2028, 2028, 2489, 2028, 776, 2028, + /* 2740 */ 2028, 2028, 2028, 2028, 777, 2028, 2028, 2028, 2028, 2028, + /* 2750 */ 2541, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, + /* 2760 */ 2028, 2028, 2489, 2028, 776, 2028, 2028, 2028, 2028, 2523, + /* 2770 */ 2028, 2028, 2541, 2028, 2028, 2028, 2028, 2028, 2028, 2028, + /* 2780 */ 2522, 2028, 777, 2560, 2489, 2028, 776, 387, 2524, 780, + /* 2790 */ 2526, 2527, 775, 2028, 798, 2028, 2028, 2028, 2028, 2028, + /* 2800 */ 2028, 2028, 2028, 2028, 2028, 2028, 2522, 2028, 2028, 2560, + /* 2810 */ 2541, 2028, 2028, 2535, 2524, 780, 2526, 2527, 775, 2028, + /* 2820 */ 798, 2028, 2489, 2028, 776, 2028, 2028, 2028, 2522, 2028, + /* 2830 */ 2028, 2560, 2028, 2028, 2028, 2534, 2524, 780, 2526, 2527, + /* 2840 */ 775, 2028, 798, 2028, 2028, 2523, 2028, 2028, 2028, 2028, + /* 2850 */ 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 777, 2028, + /* 2860 */ 2028, 2028, 2028, 2028, 2028, 2028, 2522, 2028, 2028, 2560, + /* 2870 */ 2028, 2028, 2028, 2533, 2524, 780, 2526, 2527, 775, 2028, + /* 2880 */ 798, 2523, 2028, 2028, 2028, 2028, 2541, 2028, 2028, 2028, + /* 2890 */ 2028, 2028, 2028, 2028, 777, 2028, 2028, 2028, 2489, 2028, + /* 2900 */ 776, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, + /* 2910 */ 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2523, + /* 2920 */ 2028, 2028, 2541, 2028, 2028, 2028, 2028, 2028, 2028, 2028, + /* 2930 */ 2028, 2028, 777, 2028, 2489, 2028, 776, 2028, 2028, 2028, + /* 2940 */ 2028, 2028, 2522, 2028, 2028, 2560, 2028, 2028, 2028, 402, + /* 2950 */ 2524, 780, 2526, 2527, 775, 2028, 798, 2028, 2028, 2028, + /* 2960 */ 2541, 2028, 2523, 2028, 2028, 2028, 2028, 2028, 2028, 2028, + /* 2970 */ 2028, 2028, 2489, 2028, 776, 777, 2028, 2028, 2522, 2028, + /* 2980 */ 2523, 2560, 2028, 2028, 2028, 403, 2524, 780, 2526, 2527, + /* 2990 */ 775, 2028, 798, 777, 2028, 2523, 2028, 2028, 2028, 2028, + /* 3000 */ 2028, 2028, 2028, 2541, 2028, 2028, 2028, 2028, 777, 2028, + /* 3010 */ 2028, 2028, 2028, 2028, 2028, 2489, 2522, 776, 2028, 2560, + /* 3020 */ 2028, 2541, 2028, 399, 2524, 780, 2526, 2527, 775, 2028, + /* 3030 */ 798, 2028, 2028, 2489, 2028, 776, 2541, 2028, 2028, 2028, + /* 3040 */ 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2489, 2028, + /* 3050 */ 776, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2522, + /* 3060 */ 2028, 2028, 2560, 2028, 2028, 2028, 404, 2524, 780, 2526, + /* 3070 */ 2527, 775, 2028, 798, 2028, 2028, 2028, 778, 2028, 2028, + /* 3080 */ 2560, 2028, 2028, 2028, 377, 2524, 780, 2526, 2527, 775, + /* 3090 */ 2028, 798, 2522, 2028, 2028, 2560, 2028, 2028, 2028, 376, + /* 3100 */ 2524, 780, 2526, 2527, 775, 2028, 798, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 413, 380, 366, 387, 370, 371, 370, 486, 372, 388, - /* 10 */ 489, 401, 12, 13, 14, 428, 435, 459, 431, 432, - /* 20 */ 20, 440, 22, 0, 390, 370, 371, 411, 507, 508, - /* 30 */ 401, 397, 20, 512, 513, 35, 0, 37, 12, 13, - /* 40 */ 14, 15, 16, 485, 21, 358, 37, 24, 25, 26, - /* 50 */ 27, 28, 29, 30, 31, 32, 8, 9, 371, 20, - /* 60 */ 12, 13, 14, 15, 16, 65, 456, 486, 399, 371, - /* 70 */ 489, 71, 456, 457, 458, 370, 371, 467, 78, 486, - /* 80 */ 20, 33, 489, 467, 399, 456, 399, 78, 507, 508, - /* 90 */ 421, 406, 423, 512, 513, 390, 467, 399, 411, 414, - /* 100 */ 413, 508, 397, 20, 104, 512, 513, 107, 14, 73, - /* 110 */ 74, 75, 76, 77, 20, 79, 80, 81, 82, 83, + /* 0 */ 400, 435, 477, 478, 488, 365, 440, 491, 368, 369, + /* 10 */ 413, 391, 12, 13, 14, 401, 400, 399, 404, 399, + /* 20 */ 20, 0, 22, 370, 371, 509, 510, 407, 431, 432, + /* 30 */ 514, 515, 0, 401, 20, 35, 0, 37, 14, 421, + /* 40 */ 413, 423, 21, 358, 20, 24, 25, 26, 27, 28, + /* 50 */ 29, 30, 31, 32, 488, 428, 371, 491, 431, 432, + /* 60 */ 20, 23, 8, 9, 20, 65, 12, 13, 14, 15, + /* 70 */ 16, 71, 458, 453, 454, 509, 510, 371, 78, 20, + /* 80 */ 514, 515, 399, 469, 399, 47, 48, 8, 9, 406, + /* 90 */ 458, 12, 13, 14, 15, 16, 411, 414, 413, 365, + /* 100 */ 399, 469, 368, 369, 104, 399, 380, 107, 20, 73, + /* 110 */ 74, 75, 76, 77, 388, 79, 80, 81, 82, 83, /* 120 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - /* 130 */ 94, 95, 96, 97, 98, 99, 100, 482, 483, 484, - /* 140 */ 453, 486, 487, 456, 489, 145, 146, 460, 461, 462, - /* 150 */ 463, 464, 465, 18, 467, 357, 108, 359, 23, 472, - /* 160 */ 462, 474, 507, 508, 14, 478, 479, 512, 513, 401, - /* 170 */ 20, 486, 404, 51, 489, 40, 41, 4, 386, 44, - /* 180 */ 493, 389, 60, 183, 184, 63, 64, 20, 501, 54, - /* 190 */ 190, 191, 507, 508, 4, 183, 184, 512, 513, 370, - /* 200 */ 371, 66, 67, 68, 69, 205, 391, 207, 398, 370, - /* 210 */ 371, 8, 9, 23, 399, 12, 13, 14, 15, 16, - /* 220 */ 410, 20, 407, 21, 456, 435, 24, 25, 26, 27, - /* 230 */ 28, 29, 30, 31, 32, 467, 46, 47, 48, 239, + /* 130 */ 94, 95, 96, 97, 98, 99, 100, 484, 485, 486, + /* 140 */ 455, 488, 489, 458, 491, 145, 146, 462, 463, 464, + /* 150 */ 465, 466, 467, 18, 469, 454, 391, 401, 23, 474, + /* 160 */ 33, 476, 509, 510, 399, 480, 481, 514, 515, 51, + /* 170 */ 464, 488, 407, 107, 491, 40, 41, 20, 60, 44, + /* 180 */ 495, 63, 64, 183, 184, 145, 146, 108, 503, 54, + /* 190 */ 190, 191, 509, 510, 4, 107, 164, 514, 515, 69, + /* 200 */ 168, 66, 67, 68, 69, 205, 409, 207, 176, 412, + /* 210 */ 413, 8, 9, 23, 458, 12, 13, 14, 15, 16, + /* 220 */ 357, 370, 359, 21, 3, 469, 24, 25, 26, 27, + /* 230 */ 28, 29, 30, 31, 32, 108, 46, 47, 48, 239, /* 240 */ 240, 241, 107, 243, 244, 245, 246, 247, 248, 249, /* 250 */ 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - /* 260 */ 260, 12, 13, 0, 395, 20, 18, 3, 20, 20, - /* 270 */ 20, 22, 22, 20, 71, 27, 486, 183, 30, 489, - /* 280 */ 107, 70, 147, 35, 35, 435, 37, 24, 25, 26, - /* 290 */ 27, 28, 29, 30, 31, 32, 20, 507, 508, 51, - /* 300 */ 20, 53, 512, 513, 70, 55, 58, 59, 107, 117, - /* 310 */ 481, 482, 483, 484, 65, 486, 487, 69, 115, 450, - /* 320 */ 71, 482, 483, 484, 366, 486, 487, 78, 370, 0, - /* 330 */ 372, 20, 197, 198, 199, 241, 486, 202, 4, 489, - /* 340 */ 365, 8, 9, 368, 369, 12, 13, 14, 15, 16, - /* 350 */ 215, 216, 107, 104, 106, 3, 107, 507, 508, 104, - /* 360 */ 107, 226, 512, 513, 229, 117, 49, 232, 233, 234, - /* 370 */ 235, 236, 20, 370, 371, 120, 121, 122, 123, 124, + /* 260 */ 260, 12, 13, 0, 386, 20, 18, 389, 20, 20, + /* 270 */ 204, 22, 206, 366, 71, 27, 370, 370, 30, 372, + /* 280 */ 370, 371, 147, 35, 35, 241, 37, 24, 25, 26, + /* 290 */ 27, 28, 29, 30, 31, 32, 445, 446, 2, 51, + /* 300 */ 390, 53, 236, 20, 8, 9, 58, 59, 12, 13, + /* 310 */ 14, 15, 16, 488, 65, 20, 491, 69, 115, 366, + /* 320 */ 71, 415, 416, 370, 418, 372, 20, 78, 422, 399, + /* 330 */ 200, 0, 197, 198, 199, 510, 406, 202, 377, 514, + /* 340 */ 515, 8, 9, 277, 414, 12, 13, 14, 15, 16, + /* 350 */ 215, 216, 107, 104, 106, 394, 107, 227, 228, 104, + /* 360 */ 14, 226, 398, 402, 229, 117, 20, 232, 233, 234, + /* 370 */ 235, 236, 399, 118, 410, 120, 121, 122, 123, 124, /* 380 */ 125, 126, 127, 128, 129, 182, 131, 132, 133, 134, - /* 390 */ 135, 136, 137, 390, 145, 146, 78, 149, 150, 70, + /* 390 */ 135, 136, 137, 14, 145, 146, 423, 149, 150, 20, /* 400 */ 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, /* 410 */ 12, 13, 277, 165, 166, 167, 168, 169, 170, 171, - /* 420 */ 189, 173, 174, 175, 107, 145, 146, 179, 180, 181, - /* 430 */ 239, 379, 183, 184, 186, 37, 20, 8, 9, 190, + /* 420 */ 70, 173, 174, 175, 4, 370, 371, 179, 180, 181, + /* 430 */ 239, 379, 183, 184, 186, 37, 0, 8, 9, 190, /* 440 */ 191, 12, 13, 14, 15, 16, 139, 140, 396, 20, - /* 450 */ 277, 144, 39, 40, 205, 399, 207, 405, 8, 9, - /* 460 */ 108, 185, 12, 13, 14, 15, 16, 264, 265, 266, - /* 470 */ 267, 268, 269, 270, 271, 272, 273, 274, 277, 423, - /* 480 */ 289, 290, 291, 292, 293, 294, 295, 178, 239, 240, - /* 490 */ 241, 261, 243, 244, 245, 246, 247, 248, 249, 250, + /* 450 */ 20, 144, 2, 117, 205, 20, 207, 405, 8, 9, + /* 460 */ 370, 371, 12, 13, 14, 15, 16, 264, 265, 266, + /* 470 */ 267, 268, 269, 270, 271, 272, 273, 274, 183, 184, + /* 480 */ 289, 290, 291, 292, 293, 294, 295, 51, 239, 240, + /* 490 */ 241, 185, 243, 244, 245, 246, 247, 248, 249, 250, /* 500 */ 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, - /* 510 */ 261, 12, 13, 358, 283, 284, 285, 286, 209, 20, - /* 520 */ 0, 22, 277, 358, 111, 112, 371, 114, 365, 387, - /* 530 */ 197, 368, 369, 2, 35, 486, 37, 185, 489, 8, - /* 540 */ 9, 4, 13, 12, 13, 14, 15, 16, 20, 117, - /* 550 */ 22, 138, 241, 411, 399, 142, 19, 508, 108, 0, - /* 560 */ 413, 512, 513, 299, 65, 37, 411, 0, 413, 0, - /* 570 */ 71, 358, 35, 73, 74, 75, 411, 78, 431, 432, - /* 580 */ 80, 81, 82, 55, 371, 377, 86, 370, 51, 475, - /* 590 */ 476, 91, 92, 93, 94, 58, 59, 97, 456, 457, - /* 600 */ 100, 185, 65, 104, 87, 207, 107, 78, 453, 467, - /* 610 */ 402, 456, 399, 279, 185, 460, 461, 462, 463, 464, - /* 620 */ 465, 261, 467, 263, 411, 470, 413, 472, 473, 474, - /* 630 */ 370, 371, 34, 478, 479, 412, 413, 304, 355, 22, - /* 640 */ 73, 74, 75, 106, 145, 146, 109, 80, 81, 82, - /* 650 */ 390, 69, 409, 86, 37, 412, 413, 241, 91, 92, - /* 660 */ 93, 94, 445, 446, 97, 71, 453, 100, 151, 456, - /* 670 */ 241, 370, 371, 460, 461, 462, 463, 464, 465, 400, - /* 680 */ 467, 65, 183, 184, 164, 472, 400, 474, 168, 190, - /* 690 */ 191, 478, 479, 176, 177, 78, 176, 138, 139, 140, - /* 700 */ 141, 142, 143, 144, 205, 37, 207, 138, 139, 140, - /* 710 */ 141, 142, 143, 144, 501, 399, 370, 371, 435, 370, - /* 720 */ 419, 104, 106, 440, 221, 109, 223, 8, 9, 20, - /* 730 */ 414, 12, 13, 14, 15, 16, 390, 140, 239, 240, - /* 740 */ 241, 144, 243, 244, 245, 246, 247, 248, 249, 250, + /* 510 */ 261, 12, 13, 358, 140, 20, 399, 22, 144, 20, + /* 520 */ 299, 22, 277, 406, 107, 488, 371, 107, 491, 183, + /* 530 */ 197, 414, 37, 35, 35, 13, 37, 107, 4, 484, + /* 540 */ 485, 486, 358, 488, 489, 370, 371, 510, 261, 51, + /* 550 */ 55, 514, 515, 19, 399, 371, 1, 2, 60, 61, + /* 560 */ 62, 63, 231, 65, 65, 390, 411, 22, 413, 35, + /* 570 */ 71, 107, 189, 483, 484, 485, 486, 78, 488, 489, + /* 580 */ 145, 146, 37, 399, 65, 51, 370, 241, 214, 370, + /* 590 */ 371, 217, 58, 59, 220, 411, 222, 413, 3, 65, + /* 600 */ 78, 358, 14, 104, 106, 207, 107, 109, 20, 390, + /* 610 */ 455, 37, 461, 458, 185, 20, 397, 462, 463, 464, + /* 620 */ 465, 466, 467, 78, 469, 190, 191, 472, 109, 474, + /* 630 */ 475, 476, 370, 371, 33, 480, 481, 304, 487, 455, + /* 640 */ 106, 395, 458, 109, 145, 146, 462, 463, 464, 465, + /* 650 */ 466, 467, 390, 469, 411, 370, 371, 37, 474, 397, + /* 660 */ 476, 445, 446, 108, 480, 481, 283, 284, 285, 286, + /* 670 */ 241, 370, 371, 8, 9, 390, 178, 12, 13, 14, + /* 680 */ 15, 16, 183, 184, 358, 187, 188, 503, 4, 190, + /* 690 */ 191, 390, 194, 195, 277, 21, 450, 277, 33, 20, + /* 700 */ 104, 22, 0, 108, 205, 87, 207, 277, 370, 108, + /* 710 */ 36, 213, 38, 39, 40, 70, 120, 121, 122, 123, + /* 720 */ 124, 125, 126, 127, 128, 129, 358, 131, 132, 133, + /* 730 */ 134, 135, 136, 137, 55, 370, 371, 411, 239, 240, + /* 740 */ 241, 277, 243, 244, 245, 246, 247, 248, 249, 250, /* 750 */ 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, - /* 760 */ 12, 13, 14, 358, 415, 416, 400, 418, 20, 486, - /* 770 */ 22, 422, 489, 370, 371, 33, 371, 399, 373, 370, - /* 780 */ 371, 399, 200, 35, 406, 37, 459, 370, 371, 407, - /* 790 */ 507, 508, 414, 358, 178, 512, 513, 138, 139, 140, - /* 800 */ 141, 142, 143, 144, 399, 441, 371, 390, 373, 227, - /* 810 */ 228, 214, 485, 65, 217, 107, 411, 220, 413, 222, - /* 820 */ 107, 471, 205, 473, 207, 2, 78, 108, 419, 370, - /* 830 */ 371, 8, 9, 239, 399, 12, 13, 14, 15, 16, - /* 840 */ 370, 371, 370, 371, 370, 371, 411, 14, 413, 390, - /* 850 */ 108, 37, 104, 20, 370, 107, 239, 240, 453, 370, - /* 860 */ 390, 456, 390, 358, 390, 460, 461, 462, 463, 464, - /* 870 */ 465, 358, 467, 358, 435, 207, 371, 472, 373, 474, - /* 880 */ 370, 371, 459, 478, 479, 482, 483, 484, 453, 486, - /* 890 */ 487, 456, 183, 145, 146, 460, 461, 462, 463, 464, - /* 900 */ 465, 379, 467, 435, 399, 237, 238, 472, 485, 474, - /* 910 */ 426, 427, 23, 478, 479, 388, 411, 204, 413, 206, - /* 920 */ 12, 13, 370, 371, 411, 486, 411, 405, 489, 419, - /* 930 */ 22, 183, 184, 20, 445, 446, 47, 48, 190, 191, - /* 940 */ 370, 371, 390, 35, 400, 37, 507, 508, 391, 236, - /* 950 */ 241, 512, 513, 205, 486, 207, 399, 489, 453, 22, - /* 960 */ 390, 456, 0, 406, 407, 460, 461, 462, 463, 464, - /* 970 */ 465, 414, 467, 65, 37, 507, 508, 472, 400, 474, - /* 980 */ 512, 513, 435, 478, 479, 277, 78, 239, 240, 241, - /* 990 */ 277, 243, 244, 245, 246, 247, 248, 249, 250, 251, + /* 760 */ 12, 13, 14, 358, 426, 427, 370, 371, 20, 151, + /* 770 */ 22, 183, 70, 108, 370, 371, 371, 358, 373, 411, + /* 780 */ 185, 207, 139, 35, 399, 37, 12, 13, 14, 15, + /* 790 */ 16, 406, 358, 472, 176, 177, 475, 370, 371, 414, + /* 800 */ 78, 73, 74, 75, 399, 371, 0, 373, 80, 81, + /* 810 */ 82, 237, 238, 65, 86, 419, 411, 390, 413, 91, + /* 820 */ 92, 93, 94, 419, 355, 97, 78, 207, 100, 241, + /* 830 */ 411, 22, 0, 399, 8, 9, 370, 371, 12, 13, + /* 840 */ 14, 15, 16, 182, 138, 411, 37, 413, 142, 484, + /* 850 */ 485, 486, 104, 488, 489, 107, 390, 237, 238, 358, + /* 860 */ 455, 218, 219, 458, 358, 358, 37, 462, 463, 464, + /* 870 */ 465, 466, 467, 0, 469, 370, 371, 371, 261, 474, + /* 880 */ 263, 476, 370, 371, 52, 480, 481, 78, 399, 455, + /* 890 */ 412, 413, 458, 145, 146, 390, 462, 463, 464, 465, + /* 900 */ 466, 467, 390, 469, 435, 399, 435, 78, 474, 440, + /* 910 */ 476, 117, 411, 104, 480, 481, 20, 411, 411, 413, + /* 920 */ 370, 371, 8, 9, 34, 264, 12, 13, 14, 15, + /* 930 */ 16, 183, 184, 50, 108, 274, 370, 371, 190, 191, + /* 940 */ 390, 400, 453, 454, 138, 139, 140, 141, 142, 143, + /* 950 */ 144, 56, 57, 205, 400, 207, 390, 488, 387, 488, + /* 960 */ 491, 455, 491, 279, 458, 14, 15, 16, 462, 463, + /* 970 */ 464, 465, 466, 467, 468, 469, 470, 471, 509, 510, + /* 980 */ 509, 510, 411, 514, 515, 514, 515, 239, 240, 241, + /* 990 */ 377, 243, 244, 245, 246, 247, 248, 249, 250, 251, /* 1000 */ 252, 253, 254, 255, 256, 257, 258, 259, 260, 12, - /* 1010 */ 13, 21, 104, 107, 400, 78, 183, 20, 400, 22, - /* 1020 */ 399, 207, 399, 391, 20, 358, 36, 406, 38, 39, - /* 1030 */ 40, 399, 35, 486, 37, 414, 489, 414, 371, 407, - /* 1040 */ 373, 8, 9, 399, 20, 12, 13, 14, 15, 16, - /* 1050 */ 406, 237, 238, 424, 507, 508, 370, 371, 414, 512, - /* 1060 */ 513, 138, 65, 8, 9, 142, 399, 12, 13, 14, - /* 1070 */ 15, 16, 370, 371, 241, 78, 390, 20, 411, 50, - /* 1080 */ 413, 391, 370, 371, 358, 370, 371, 370, 371, 399, - /* 1090 */ 370, 371, 390, 399, 370, 371, 22, 407, 185, 358, - /* 1100 */ 406, 104, 390, 358, 107, 390, 139, 390, 414, 470, - /* 1110 */ 390, 37, 473, 205, 390, 207, 371, 471, 373, 473, - /* 1120 */ 453, 182, 358, 456, 162, 163, 358, 460, 461, 462, - /* 1130 */ 463, 464, 465, 505, 467, 370, 371, 411, 22, 472, - /* 1140 */ 42, 474, 145, 146, 399, 478, 479, 239, 240, 145, - /* 1150 */ 146, 377, 411, 37, 241, 390, 411, 0, 413, 56, - /* 1160 */ 57, 253, 254, 255, 256, 257, 258, 259, 394, 14, - /* 1170 */ 15, 16, 1, 2, 358, 411, 402, 358, 104, 411, - /* 1180 */ 183, 184, 516, 277, 399, 218, 219, 190, 191, 33, - /* 1190 */ 375, 376, 375, 376, 190, 191, 384, 385, 453, 414, - /* 1200 */ 33, 456, 205, 264, 207, 460, 461, 462, 463, 464, - /* 1210 */ 465, 358, 467, 274, 185, 359, 358, 472, 185, 474, - /* 1220 */ 104, 498, 193, 478, 479, 358, 374, 411, 399, 358, - /* 1230 */ 411, 358, 358, 358, 358, 358, 239, 240, 241, 358, + /* 1010 */ 13, 65, 358, 435, 205, 402, 207, 20, 387, 22, + /* 1020 */ 358, 370, 371, 370, 371, 371, 400, 373, 435, 458, + /* 1030 */ 459, 460, 35, 0, 37, 162, 163, 370, 371, 399, + /* 1040 */ 469, 358, 411, 390, 358, 375, 376, 407, 239, 240, + /* 1050 */ 375, 376, 106, 399, 371, 109, 373, 390, 370, 371, + /* 1060 */ 370, 371, 65, 370, 371, 411, 488, 413, 185, 491, + /* 1070 */ 419, 370, 371, 411, 408, 78, 193, 411, 390, 183, + /* 1080 */ 390, 488, 399, 390, 491, 370, 371, 509, 510, 458, + /* 1090 */ 459, 390, 514, 515, 411, 42, 413, 411, 391, 185, + /* 1100 */ 469, 104, 509, 510, 107, 390, 399, 514, 515, 455, + /* 1110 */ 461, 20, 458, 358, 407, 20, 462, 463, 464, 465, + /* 1120 */ 466, 467, 441, 469, 178, 22, 371, 20, 474, 399, + /* 1130 */ 476, 370, 371, 358, 480, 481, 487, 241, 455, 461, + /* 1140 */ 37, 458, 145, 146, 414, 462, 463, 464, 465, 466, + /* 1150 */ 467, 390, 469, 435, 399, 435, 20, 474, 473, 476, + /* 1160 */ 475, 358, 391, 480, 481, 487, 411, 473, 413, 475, + /* 1170 */ 399, 138, 139, 140, 141, 142, 143, 144, 407, 379, + /* 1180 */ 183, 184, 384, 385, 399, 22, 411, 190, 191, 39, + /* 1190 */ 40, 33, 138, 139, 140, 141, 142, 143, 144, 414, + /* 1200 */ 37, 13, 205, 45, 207, 405, 488, 104, 488, 491, + /* 1210 */ 455, 491, 358, 458, 411, 33, 358, 462, 463, 464, + /* 1220 */ 465, 466, 467, 37, 469, 37, 358, 509, 510, 509, + /* 1230 */ 510, 400, 514, 515, 514, 515, 239, 240, 241, 178, /* 1240 */ 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, /* 1250 */ 253, 254, 255, 256, 257, 258, 259, 260, 12, 13, - /* 1260 */ 424, 358, 384, 385, 411, 241, 20, 408, 22, 411, - /* 1270 */ 411, 0, 408, 0, 371, 411, 373, 408, 411, 108, - /* 1280 */ 411, 35, 411, 37, 411, 411, 411, 411, 411, 33, - /* 1290 */ 392, 358, 411, 395, 14, 361, 362, 33, 241, 117, - /* 1300 */ 20, 45, 399, 0, 371, 275, 276, 110, 0, 45, - /* 1310 */ 113, 65, 0, 13, 411, 42, 413, 110, 110, 13, - /* 1320 */ 113, 113, 51, 110, 78, 0, 113, 0, 33, 33, - /* 1330 */ 22, 33, 399, 387, 22, 65, 33, 37, 145, 146, - /* 1340 */ 1, 2, 33, 37, 411, 387, 413, 22, 33, 22, - /* 1350 */ 104, 33, 33, 107, 172, 369, 453, 33, 0, 456, - /* 1360 */ 358, 12, 13, 460, 461, 462, 463, 464, 465, 33, - /* 1370 */ 467, 33, 37, 371, 276, 472, 424, 474, 37, 109, - /* 1380 */ 37, 478, 479, 504, 33, 33, 453, 504, 231, 456, - /* 1390 */ 107, 145, 146, 460, 461, 462, 463, 464, 465, 116, - /* 1400 */ 467, 399, 33, 108, 108, 472, 108, 474, 12, 13, - /* 1410 */ 52, 478, 479, 411, 504, 413, 434, 108, 22, 78, - /* 1420 */ 504, 13, 374, 108, 424, 13, 108, 108, 410, 183, - /* 1430 */ 184, 35, 108, 37, 33, 33, 190, 191, 33, 33, - /* 1440 */ 33, 371, 33, 33, 108, 37, 108, 442, 488, 37, - /* 1450 */ 424, 205, 424, 207, 509, 453, 480, 301, 456, 108, - /* 1460 */ 108, 65, 460, 461, 462, 463, 464, 465, 491, 467, - /* 1470 */ 303, 389, 280, 436, 472, 358, 474, 108, 51, 42, - /* 1480 */ 478, 479, 455, 20, 452, 239, 240, 241, 371, 243, + /* 1260 */ 358, 111, 112, 358, 114, 411, 20, 104, 22, 411, + /* 1270 */ 209, 516, 517, 371, 358, 373, 185, 358, 0, 411, + /* 1280 */ 185, 35, 358, 37, 358, 358, 408, 399, 138, 411, + /* 1290 */ 358, 117, 142, 384, 385, 408, 392, 33, 411, 395, + /* 1300 */ 33, 399, 414, 371, 13, 373, 361, 362, 0, 275, + /* 1310 */ 276, 65, 45, 411, 110, 413, 411, 113, 110, 110, + /* 1320 */ 42, 113, 113, 110, 78, 0, 113, 411, 37, 276, + /* 1330 */ 411, 399, 241, 0, 0, 411, 241, 411, 411, 0, + /* 1340 */ 221, 33, 223, 411, 33, 413, 172, 22, 241, 33, + /* 1350 */ 104, 33, 33, 107, 400, 22, 22, 455, 49, 33, + /* 1360 */ 458, 22, 145, 146, 462, 463, 464, 465, 466, 467, + /* 1370 */ 388, 469, 108, 33, 1, 2, 474, 241, 476, 12, + /* 1380 */ 13, 71, 480, 481, 33, 33, 33, 455, 359, 22, + /* 1390 */ 458, 145, 146, 207, 462, 463, 464, 465, 466, 467, + /* 1400 */ 37, 469, 35, 33, 37, 33, 474, 33, 476, 33, + /* 1410 */ 12, 13, 480, 481, 13, 358, 107, 12, 13, 108, + /* 1420 */ 12, 13, 12, 13, 108, 424, 108, 108, 371, 183, + /* 1430 */ 184, 13, 65, 12, 13, 33, 190, 191, 37, 12, + /* 1440 */ 13, 12, 13, 107, 507, 78, 12, 13, 108, 12, + /* 1450 */ 13, 205, 116, 207, 0, 37, 399, 518, 500, 108, + /* 1460 */ 108, 108, 12, 13, 12, 13, 33, 374, 411, 33, + /* 1470 */ 413, 104, 37, 399, 387, 33, 387, 369, 108, 424, + /* 1480 */ 108, 33, 108, 301, 108, 239, 240, 241, 424, 243, /* 1490 */ 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - /* 1500 */ 254, 255, 256, 257, 258, 259, 260, 358, 454, 108, - /* 1510 */ 108, 447, 220, 108, 108, 108, 399, 108, 108, 379, - /* 1520 */ 371, 379, 447, 203, 438, 20, 20, 45, 411, 370, - /* 1530 */ 413, 371, 420, 371, 420, 182, 417, 371, 370, 370, - /* 1540 */ 420, 417, 207, 417, 417, 105, 383, 103, 399, 370, - /* 1550 */ 207, 102, 382, 381, 370, 370, 370, 20, 363, 50, - /* 1560 */ 411, 367, 413, 363, 20, 367, 379, 379, 447, 379, - /* 1570 */ 453, 413, 20, 456, 372, 20, 437, 460, 461, 462, - /* 1580 */ 463, 464, 465, 379, 467, 379, 372, 20, 427, 472, - /* 1590 */ 379, 474, 370, 363, 379, 478, 479, 379, 399, 370, - /* 1600 */ 399, 205, 453, 207, 399, 456, 358, 363, 399, 460, - /* 1610 */ 461, 462, 463, 464, 465, 399, 467, 107, 399, 371, - /* 1620 */ 399, 361, 399, 474, 399, 399, 399, 478, 479, 361, - /* 1630 */ 447, 411, 451, 237, 238, 239, 377, 224, 449, 411, - /* 1640 */ 20, 211, 411, 210, 377, 413, 443, 399, 436, 253, - /* 1650 */ 254, 255, 256, 257, 258, 259, 446, 370, 411, 411, - /* 1660 */ 288, 413, 497, 429, 287, 429, 296, 196, 444, 298, - /* 1670 */ 497, 297, 497, 495, 500, 358, 499, 436, 281, 300, - /* 1680 */ 305, 517, 302, 20, 371, 117, 510, 496, 371, 278, - /* 1690 */ 494, 511, 276, 372, 459, 107, 411, 411, 429, 377, - /* 1700 */ 377, 453, 411, 429, 456, 358, 188, 490, 460, 461, - /* 1710 */ 462, 463, 464, 465, 477, 467, 399, 377, 371, 425, - /* 1720 */ 107, 411, 474, 395, 22, 492, 478, 479, 411, 370, - /* 1730 */ 413, 377, 371, 377, 358, 403, 38, 411, 360, 393, - /* 1740 */ 411, 411, 411, 439, 430, 364, 399, 371, 363, 448, - /* 1750 */ 393, 358, 0, 393, 356, 0, 0, 45, 411, 0, - /* 1760 */ 413, 378, 37, 430, 371, 230, 37, 37, 37, 230, - /* 1770 */ 453, 0, 230, 456, 37, 399, 37, 460, 461, 462, - /* 1780 */ 463, 464, 465, 37, 467, 0, 230, 411, 0, 413, - /* 1790 */ 37, 474, 399, 0, 37, 478, 479, 0, 22, 0, - /* 1800 */ 453, 37, 225, 456, 411, 0, 413, 460, 461, 462, - /* 1810 */ 463, 464, 465, 466, 467, 468, 469, 213, 0, 213, - /* 1820 */ 358, 214, 207, 205, 0, 0, 0, 201, 200, 453, - /* 1830 */ 0, 0, 456, 371, 150, 49, 460, 461, 462, 463, - /* 1840 */ 464, 465, 0, 467, 49, 37, 453, 37, 0, 456, - /* 1850 */ 358, 0, 0, 460, 461, 462, 463, 464, 465, 0, - /* 1860 */ 467, 399, 51, 371, 49, 45, 0, 0, 0, 0, - /* 1870 */ 49, 0, 0, 411, 0, 413, 0, 0, 502, 503, - /* 1880 */ 37, 168, 0, 168, 0, 0, 0, 358, 0, 0, - /* 1890 */ 0, 399, 0, 0, 0, 0, 0, 0, 0, 0, - /* 1900 */ 371, 0, 0, 411, 0, 413, 49, 514, 515, 0, - /* 1910 */ 0, 0, 0, 0, 0, 453, 0, 0, 456, 0, - /* 1920 */ 45, 0, 460, 461, 462, 463, 464, 465, 399, 467, - /* 1930 */ 0, 0, 150, 0, 0, 148, 474, 22, 149, 0, - /* 1940 */ 411, 479, 413, 0, 22, 453, 22, 0, 456, 0, - /* 1950 */ 50, 0, 460, 461, 462, 463, 464, 465, 50, 467, - /* 1960 */ 358, 0, 433, 37, 0, 42, 37, 0, 65, 51, - /* 1970 */ 65, 51, 65, 371, 37, 358, 0, 42, 37, 0, - /* 1980 */ 42, 37, 453, 51, 0, 456, 33, 45, 371, 460, - /* 1990 */ 461, 462, 463, 464, 465, 503, 467, 42, 0, 49, - /* 2000 */ 14, 399, 43, 49, 42, 49, 358, 42, 196, 0, - /* 2010 */ 0, 0, 49, 411, 0, 413, 399, 0, 0, 371, - /* 2020 */ 0, 0, 0, 51, 72, 37, 0, 42, 411, 37, - /* 2030 */ 413, 51, 42, 0, 37, 433, 42, 0, 51, 37, - /* 2040 */ 51, 42, 0, 0, 0, 0, 0, 399, 0, 37, - /* 2050 */ 22, 115, 0, 113, 22, 453, 37, 33, 456, 411, - /* 2060 */ 37, 413, 460, 461, 462, 463, 464, 465, 37, 467, - /* 2070 */ 453, 37, 37, 456, 33, 358, 37, 460, 461, 462, - /* 2080 */ 463, 464, 465, 0, 467, 22, 37, 37, 371, 0, - /* 2090 */ 37, 37, 37, 358, 22, 0, 22, 0, 22, 37, - /* 2100 */ 53, 453, 0, 0, 456, 0, 371, 37, 460, 461, - /* 2110 */ 462, 463, 464, 465, 0, 467, 399, 37, 0, 358, - /* 2120 */ 22, 20, 37, 506, 37, 37, 0, 49, 411, 0, - /* 2130 */ 413, 185, 371, 108, 399, 22, 37, 107, 0, 212, - /* 2140 */ 0, 22, 185, 107, 0, 185, 411, 282, 413, 3, - /* 2150 */ 192, 3, 37, 208, 188, 185, 185, 33, 107, 37, - /* 2160 */ 399, 192, 50, 515, 108, 107, 105, 108, 433, 103, - /* 2170 */ 453, 107, 411, 456, 413, 50, 108, 460, 461, 462, - /* 2180 */ 463, 464, 465, 33, 467, 108, 469, 33, 453, 107, - /* 2190 */ 33, 456, 108, 1, 433, 460, 461, 462, 463, 464, - /* 2200 */ 465, 107, 467, 107, 35, 358, 33, 49, 49, 33, - /* 2210 */ 49, 19, 108, 107, 453, 108, 108, 456, 371, 37, - /* 2220 */ 51, 460, 461, 462, 463, 464, 465, 35, 467, 60, - /* 2230 */ 61, 62, 63, 37, 65, 37, 37, 37, 37, 108, - /* 2240 */ 33, 0, 49, 51, 0, 42, 399, 33, 275, 107, - /* 2250 */ 282, 2, 60, 61, 62, 63, 282, 65, 411, 22, - /* 2260 */ 413, 105, 262, 108, 358, 105, 239, 49, 49, 107, - /* 2270 */ 22, 108, 107, 107, 107, 106, 108, 371, 109, 108, - /* 2280 */ 242, 189, 108, 0, 107, 107, 358, 107, 42, 49, - /* 2290 */ 107, 116, 107, 107, 37, 108, 187, 107, 106, 371, - /* 2300 */ 453, 109, 108, 456, 107, 399, 117, 460, 461, 462, - /* 2310 */ 463, 464, 465, 37, 467, 107, 37, 411, 108, 413, - /* 2320 */ 107, 37, 37, 108, 107, 37, 37, 399, 108, 107, - /* 2330 */ 119, 108, 107, 33, 108, 143, 107, 107, 107, 411, - /* 2340 */ 37, 413, 130, 107, 22, 118, 130, 178, 37, 72, - /* 2350 */ 37, 130, 71, 37, 130, 37, 187, 188, 37, 453, - /* 2360 */ 37, 37, 456, 194, 195, 358, 460, 461, 462, 463, - /* 2370 */ 464, 465, 37, 467, 37, 78, 101, 78, 371, 187, - /* 2380 */ 33, 453, 213, 101, 456, 37, 194, 358, 460, 461, - /* 2390 */ 462, 463, 464, 465, 37, 467, 37, 22, 37, 37, - /* 2400 */ 371, 37, 37, 78, 37, 213, 399, 37, 37, 37, - /* 2410 */ 22, 37, 0, 37, 51, 42, 0, 51, 411, 37, - /* 2420 */ 413, 42, 0, 358, 37, 42, 0, 37, 399, 51, - /* 2430 */ 0, 42, 51, 0, 37, 37, 371, 22, 33, 22, - /* 2440 */ 411, 21, 413, 22, 20, 22, 21, 518, 518, 518, - /* 2450 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - /* 2460 */ 453, 518, 518, 456, 399, 518, 518, 460, 461, 462, - /* 2470 */ 463, 464, 465, 518, 467, 518, 411, 518, 413, 518, - /* 2480 */ 518, 518, 453, 518, 518, 456, 518, 518, 518, 460, - /* 2490 */ 461, 462, 463, 464, 465, 518, 467, 518, 518, 518, - /* 2500 */ 518, 518, 518, 518, 518, 518, 518, 358, 518, 518, - /* 2510 */ 518, 518, 518, 518, 518, 518, 518, 518, 453, 518, - /* 2520 */ 371, 456, 358, 518, 518, 460, 461, 462, 463, 464, - /* 2530 */ 465, 518, 467, 518, 518, 371, 518, 358, 518, 518, - /* 2540 */ 518, 518, 518, 518, 518, 518, 518, 518, 399, 518, - /* 2550 */ 371, 518, 518, 358, 518, 518, 518, 518, 518, 518, - /* 2560 */ 411, 518, 413, 399, 518, 518, 371, 518, 518, 518, - /* 2570 */ 518, 518, 518, 518, 518, 411, 518, 413, 399, 518, - /* 2580 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - /* 2590 */ 411, 518, 413, 518, 399, 518, 518, 518, 518, 518, - /* 2600 */ 518, 518, 453, 518, 518, 456, 411, 518, 413, 460, - /* 2610 */ 461, 462, 463, 464, 465, 518, 467, 453, 518, 518, - /* 2620 */ 456, 518, 518, 358, 460, 461, 462, 463, 464, 465, - /* 2630 */ 518, 467, 453, 518, 518, 456, 371, 518, 518, 460, - /* 2640 */ 461, 462, 463, 464, 465, 518, 467, 518, 453, 518, - /* 2650 */ 518, 456, 518, 518, 518, 460, 461, 462, 463, 464, - /* 2660 */ 465, 518, 467, 518, 399, 518, 518, 358, 518, 518, - /* 2670 */ 518, 518, 518, 518, 518, 518, 411, 518, 413, 518, - /* 2680 */ 371, 518, 518, 518, 518, 518, 518, 518, 518, 518, - /* 2690 */ 518, 518, 518, 518, 358, 518, 518, 518, 518, 518, - /* 2700 */ 518, 518, 518, 518, 518, 518, 518, 371, 399, 518, - /* 2710 */ 518, 518, 518, 518, 518, 518, 518, 518, 453, 518, - /* 2720 */ 411, 456, 413, 518, 518, 460, 461, 462, 463, 464, - /* 2730 */ 465, 518, 467, 518, 518, 399, 518, 518, 358, 518, - /* 2740 */ 518, 518, 518, 518, 518, 518, 518, 411, 518, 413, - /* 2750 */ 518, 371, 518, 518, 358, 518, 518, 518, 518, 518, - /* 2760 */ 518, 518, 453, 518, 518, 456, 518, 371, 518, 460, - /* 2770 */ 461, 462, 463, 464, 465, 518, 467, 358, 518, 399, - /* 2780 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 453, - /* 2790 */ 371, 411, 456, 413, 518, 399, 460, 461, 462, 463, - /* 2800 */ 464, 465, 518, 467, 518, 518, 518, 411, 518, 413, - /* 2810 */ 518, 518, 518, 518, 518, 518, 518, 518, 399, 518, - /* 2820 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - /* 2830 */ 411, 518, 413, 453, 518, 358, 456, 518, 518, 518, - /* 2840 */ 460, 461, 462, 463, 464, 465, 518, 467, 371, 453, - /* 2850 */ 518, 358, 456, 518, 518, 518, 460, 461, 462, 463, - /* 2860 */ 464, 465, 518, 467, 371, 518, 518, 518, 518, 518, - /* 2870 */ 518, 518, 453, 518, 518, 456, 399, 518, 518, 460, - /* 2880 */ 461, 462, 463, 464, 465, 518, 467, 518, 411, 518, - /* 2890 */ 413, 518, 399, 518, 518, 518, 518, 518, 518, 518, - /* 2900 */ 518, 518, 518, 518, 411, 518, 413, 518, 518, 358, - /* 2910 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - /* 2920 */ 518, 518, 371, 518, 518, 518, 518, 518, 518, 518, - /* 2930 */ 453, 518, 518, 456, 358, 518, 518, 460, 461, 462, - /* 2940 */ 463, 464, 465, 518, 467, 518, 453, 371, 518, 456, - /* 2950 */ 399, 518, 518, 460, 461, 462, 463, 464, 465, 518, - /* 2960 */ 467, 518, 411, 518, 413, 518, 518, 358, 518, 518, - /* 2970 */ 518, 518, 518, 518, 518, 399, 518, 518, 518, 518, - /* 2980 */ 371, 518, 518, 518, 518, 518, 518, 411, 518, 413, - /* 2990 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - /* 3000 */ 518, 518, 518, 518, 453, 518, 518, 456, 399, 518, - /* 3010 */ 518, 460, 461, 462, 463, 464, 465, 518, 467, 518, - /* 3020 */ 411, 518, 413, 518, 518, 518, 518, 518, 518, 453, - /* 3030 */ 518, 518, 456, 518, 518, 518, 460, 461, 462, 463, - /* 3040 */ 464, 465, 518, 467, 518, 518, 518, 518, 518, 518, - /* 3050 */ 518, 518, 518, 358, 518, 518, 518, 518, 518, 518, - /* 3060 */ 518, 518, 453, 518, 518, 456, 371, 518, 518, 460, - /* 3070 */ 461, 462, 463, 464, 465, 518, 467, 518, 518, 518, - /* 3080 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - /* 3090 */ 518, 518, 518, 518, 399, 518, 518, 518, 518, 518, - /* 3100 */ 518, 518, 518, 518, 518, 518, 411, 518, 413, 518, - /* 3110 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - /* 3120 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - /* 3130 */ 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - /* 3140 */ 518, 518, 518, 518, 518, 518, 518, 518, 453, 518, - /* 3150 */ 518, 456, 518, 518, 518, 460, 461, 462, 463, 464, - /* 3160 */ 465, 518, 467, 355, 355, 355, 355, 355, 355, 355, + /* 1500 */ 254, 255, 256, 257, 258, 259, 260, 12, 13, 33, + /* 1510 */ 108, 506, 455, 78, 506, 458, 506, 22, 434, 462, + /* 1520 */ 463, 464, 465, 466, 467, 506, 469, 73, 74, 75, + /* 1530 */ 35, 474, 37, 476, 80, 81, 82, 480, 481, 358, + /* 1540 */ 86, 108, 374, 371, 108, 91, 92, 93, 94, 239, + /* 1550 */ 108, 97, 371, 424, 100, 410, 108, 442, 424, 424, + /* 1560 */ 65, 490, 511, 358, 482, 493, 389, 280, 436, 51, + /* 1570 */ 207, 457, 205, 42, 207, 20, 371, 456, 447, 220, + /* 1580 */ 399, 379, 452, 203, 108, 447, 379, 438, 20, 370, + /* 1590 */ 20, 371, 411, 45, 413, 420, 371, 182, 420, 358, + /* 1600 */ 417, 370, 417, 371, 399, 370, 239, 240, 417, 420, + /* 1610 */ 417, 105, 371, 383, 103, 382, 411, 370, 413, 102, + /* 1620 */ 253, 254, 255, 256, 257, 258, 259, 370, 370, 303, + /* 1630 */ 381, 370, 20, 363, 50, 367, 455, 363, 367, 458, + /* 1640 */ 399, 447, 379, 462, 463, 464, 465, 466, 467, 20, + /* 1650 */ 469, 379, 411, 413, 413, 474, 379, 476, 20, 20, + /* 1660 */ 455, 480, 481, 458, 372, 437, 20, 462, 463, 464, + /* 1670 */ 465, 466, 467, 379, 469, 372, 379, 427, 379, 474, + /* 1680 */ 379, 476, 370, 379, 363, 480, 481, 399, 399, 399, + /* 1690 */ 370, 361, 399, 361, 399, 399, 455, 399, 363, 458, + /* 1700 */ 205, 399, 207, 462, 463, 464, 465, 466, 467, 224, + /* 1710 */ 469, 411, 399, 399, 399, 107, 358, 476, 411, 377, + /* 1720 */ 451, 480, 481, 447, 449, 20, 446, 211, 411, 371, + /* 1730 */ 444, 210, 237, 238, 239, 370, 413, 377, 411, 288, + /* 1740 */ 287, 436, 499, 499, 502, 296, 358, 196, 253, 254, + /* 1750 */ 255, 256, 257, 258, 259, 501, 298, 399, 429, 371, + /* 1760 */ 429, 499, 297, 498, 281, 443, 305, 519, 302, 411, + /* 1770 */ 497, 413, 513, 436, 300, 496, 276, 371, 512, 20, + /* 1780 */ 117, 278, 107, 372, 377, 461, 377, 399, 411, 358, + /* 1790 */ 429, 429, 411, 411, 411, 411, 425, 188, 395, 411, + /* 1800 */ 494, 413, 371, 377, 411, 377, 411, 479, 411, 371, + /* 1810 */ 411, 411, 22, 455, 107, 411, 458, 403, 377, 38, + /* 1820 */ 462, 463, 464, 465, 466, 467, 439, 469, 411, 0, + /* 1830 */ 399, 411, 360, 492, 476, 411, 411, 364, 480, 481, + /* 1840 */ 363, 411, 411, 455, 413, 370, 458, 0, 356, 358, + /* 1850 */ 462, 463, 464, 465, 466, 467, 411, 469, 411, 378, + /* 1860 */ 448, 0, 371, 45, 476, 0, 411, 411, 480, 481, + /* 1870 */ 411, 358, 393, 411, 411, 411, 430, 393, 411, 411, + /* 1880 */ 411, 411, 393, 37, 371, 230, 455, 430, 37, 458, + /* 1890 */ 399, 37, 37, 462, 463, 464, 465, 466, 467, 230, + /* 1900 */ 469, 0, 411, 37, 413, 37, 230, 37, 0, 230, + /* 1910 */ 0, 37, 399, 37, 0, 22, 0, 37, 225, 0, + /* 1920 */ 0, 213, 213, 207, 411, 0, 413, 214, 205, 0, + /* 1930 */ 0, 0, 201, 200, 0, 504, 505, 0, 49, 150, + /* 1940 */ 49, 0, 37, 0, 0, 51, 455, 49, 37, 458, + /* 1950 */ 0, 358, 0, 462, 463, 464, 465, 466, 467, 0, + /* 1960 */ 469, 0, 45, 0, 371, 0, 0, 476, 455, 0, + /* 1970 */ 49, 458, 481, 168, 0, 462, 463, 464, 465, 466, + /* 1980 */ 467, 358, 469, 0, 0, 0, 37, 168, 0, 0, + /* 1990 */ 0, 0, 399, 45, 371, 0, 0, 0, 0, 358, + /* 2000 */ 0, 0, 0, 0, 411, 0, 413, 0, 0, 0, + /* 2010 */ 0, 0, 371, 0, 0, 0, 49, 0, 505, 0, + /* 2020 */ 0, 0, 399, 0, 0, 0, 433, 0, 22, 358, + /* 2030 */ 0, 150, 149, 0, 411, 148, 413, 0, 0, 0, + /* 2040 */ 399, 65, 371, 0, 22, 65, 0, 65, 455, 50, + /* 2050 */ 22, 458, 411, 0, 413, 462, 463, 464, 465, 466, + /* 2060 */ 467, 0, 469, 37, 0, 0, 50, 0, 37, 51, + /* 2070 */ 399, 42, 37, 37, 433, 196, 42, 0, 455, 37, + /* 2080 */ 33, 458, 411, 51, 413, 462, 463, 464, 465, 466, + /* 2090 */ 467, 51, 469, 42, 45, 14, 455, 42, 0, 458, + /* 2100 */ 43, 49, 42, 462, 463, 464, 465, 466, 467, 358, + /* 2110 */ 469, 49, 49, 0, 0, 0, 0, 0, 49, 0, + /* 2120 */ 42, 0, 371, 37, 51, 42, 455, 0, 358, 458, + /* 2130 */ 72, 508, 0, 462, 463, 464, 465, 466, 467, 0, + /* 2140 */ 469, 371, 51, 37, 42, 0, 358, 37, 51, 42, + /* 2150 */ 399, 0, 51, 42, 0, 37, 0, 0, 0, 371, + /* 2160 */ 0, 0, 411, 115, 413, 37, 22, 113, 0, 399, + /* 2170 */ 37, 37, 37, 37, 37, 37, 33, 37, 37, 33, + /* 2180 */ 0, 411, 0, 413, 37, 37, 22, 399, 517, 37, + /* 2190 */ 0, 22, 22, 22, 0, 53, 22, 0, 0, 411, + /* 2200 */ 37, 413, 0, 433, 37, 0, 455, 22, 1, 458, + /* 2210 */ 37, 0, 20, 462, 463, 464, 465, 466, 467, 107, + /* 2220 */ 469, 433, 471, 37, 37, 455, 19, 0, 458, 185, + /* 2230 */ 37, 107, 462, 463, 464, 465, 466, 467, 108, 469, + /* 2240 */ 118, 0, 35, 455, 119, 49, 458, 37, 358, 0, + /* 2250 */ 462, 463, 464, 465, 466, 467, 185, 469, 51, 185, + /* 2260 */ 22, 371, 212, 0, 208, 22, 0, 60, 61, 62, + /* 2270 */ 63, 358, 65, 188, 185, 185, 192, 3, 33, 192, + /* 2280 */ 108, 37, 107, 107, 371, 108, 282, 37, 107, 399, + /* 2290 */ 50, 108, 50, 105, 103, 33, 107, 33, 33, 3, + /* 2300 */ 49, 411, 107, 413, 49, 358, 33, 108, 107, 33, + /* 2310 */ 49, 108, 399, 106, 108, 107, 109, 108, 371, 37, + /* 2320 */ 37, 37, 37, 282, 411, 37, 413, 282, 37, 108, + /* 2330 */ 33, 358, 108, 0, 275, 49, 0, 107, 33, 105, + /* 2340 */ 42, 262, 2, 22, 371, 455, 399, 239, 458, 49, + /* 2350 */ 143, 358, 462, 463, 464, 465, 466, 467, 411, 469, + /* 2360 */ 413, 105, 108, 49, 371, 107, 22, 108, 455, 0, + /* 2370 */ 42, 458, 399, 242, 107, 462, 463, 464, 465, 466, + /* 2380 */ 467, 49, 469, 108, 411, 107, 413, 107, 116, 108, + /* 2390 */ 37, 37, 399, 37, 187, 108, 107, 107, 37, 107, + /* 2400 */ 187, 194, 455, 189, 411, 458, 413, 108, 107, 462, + /* 2410 */ 463, 464, 465, 466, 467, 107, 469, 107, 107, 107, + /* 2420 */ 213, 117, 37, 108, 107, 37, 108, 107, 455, 37, + /* 2430 */ 108, 458, 108, 358, 107, 462, 463, 464, 465, 466, + /* 2440 */ 467, 107, 469, 108, 107, 107, 371, 108, 455, 130, + /* 2450 */ 107, 458, 33, 130, 37, 462, 463, 464, 465, 466, + /* 2460 */ 467, 130, 469, 358, 119, 118, 107, 107, 22, 72, + /* 2470 */ 71, 130, 37, 37, 399, 37, 371, 37, 37, 37, + /* 2480 */ 37, 358, 37, 78, 37, 101, 411, 78, 413, 33, + /* 2490 */ 101, 37, 37, 22, 371, 37, 37, 37, 37, 78, + /* 2500 */ 37, 37, 37, 37, 399, 37, 22, 37, 0, 37, + /* 2510 */ 0, 42, 37, 51, 0, 37, 411, 0, 413, 42, + /* 2520 */ 37, 42, 399, 42, 51, 51, 0, 51, 37, 37, + /* 2530 */ 455, 0, 33, 458, 411, 22, 413, 462, 463, 464, + /* 2540 */ 465, 466, 467, 22, 469, 21, 520, 22, 20, 22, + /* 2550 */ 21, 520, 520, 520, 520, 520, 520, 520, 520, 520, + /* 2560 */ 455, 520, 358, 458, 520, 520, 520, 462, 463, 464, + /* 2570 */ 465, 466, 467, 520, 469, 371, 520, 520, 455, 520, + /* 2580 */ 358, 458, 520, 520, 520, 462, 463, 464, 465, 466, + /* 2590 */ 467, 520, 469, 371, 520, 358, 520, 520, 520, 520, + /* 2600 */ 520, 520, 520, 399, 520, 520, 520, 520, 371, 520, + /* 2610 */ 358, 520, 520, 520, 520, 411, 520, 413, 520, 520, + /* 2620 */ 520, 399, 520, 371, 520, 520, 520, 520, 520, 520, + /* 2630 */ 520, 520, 520, 411, 520, 413, 399, 520, 520, 520, + /* 2640 */ 520, 520, 520, 520, 520, 520, 520, 520, 411, 520, + /* 2650 */ 413, 399, 520, 520, 520, 520, 520, 520, 520, 455, + /* 2660 */ 520, 520, 458, 411, 520, 413, 462, 463, 464, 465, + /* 2670 */ 466, 467, 520, 469, 520, 520, 520, 455, 520, 520, + /* 2680 */ 458, 520, 520, 358, 462, 463, 464, 465, 466, 467, + /* 2690 */ 520, 469, 455, 520, 520, 458, 371, 520, 520, 462, + /* 2700 */ 463, 464, 465, 466, 467, 520, 469, 455, 520, 358, + /* 2710 */ 458, 520, 520, 520, 462, 463, 464, 465, 466, 467, + /* 2720 */ 520, 469, 371, 520, 399, 520, 520, 520, 520, 520, + /* 2730 */ 520, 358, 520, 520, 520, 520, 411, 520, 413, 520, + /* 2740 */ 520, 520, 520, 520, 371, 520, 520, 520, 520, 520, + /* 2750 */ 399, 520, 520, 520, 520, 520, 520, 520, 520, 520, + /* 2760 */ 520, 520, 411, 520, 413, 520, 520, 520, 520, 358, + /* 2770 */ 520, 520, 399, 520, 520, 520, 520, 520, 520, 520, + /* 2780 */ 455, 520, 371, 458, 411, 520, 413, 462, 463, 464, + /* 2790 */ 465, 466, 467, 520, 469, 520, 520, 520, 520, 520, + /* 2800 */ 520, 520, 520, 520, 520, 520, 455, 520, 520, 458, + /* 2810 */ 399, 520, 520, 462, 463, 464, 465, 466, 467, 520, + /* 2820 */ 469, 520, 411, 520, 413, 520, 520, 520, 455, 520, + /* 2830 */ 520, 458, 520, 520, 520, 462, 463, 464, 465, 466, + /* 2840 */ 467, 520, 469, 520, 520, 358, 520, 520, 520, 520, + /* 2850 */ 520, 520, 520, 520, 520, 520, 520, 520, 371, 520, + /* 2860 */ 520, 520, 520, 520, 520, 520, 455, 520, 520, 458, + /* 2870 */ 520, 520, 520, 462, 463, 464, 465, 466, 467, 520, + /* 2880 */ 469, 358, 520, 520, 520, 520, 399, 520, 520, 520, + /* 2890 */ 520, 520, 520, 520, 371, 520, 520, 520, 411, 520, + /* 2900 */ 413, 520, 520, 520, 520, 520, 520, 520, 520, 520, + /* 2910 */ 520, 520, 520, 520, 520, 520, 520, 520, 520, 358, + /* 2920 */ 520, 520, 399, 520, 520, 520, 520, 520, 520, 520, + /* 2930 */ 520, 520, 371, 520, 411, 520, 413, 520, 520, 520, + /* 2940 */ 520, 520, 455, 520, 520, 458, 520, 520, 520, 462, + /* 2950 */ 463, 464, 465, 466, 467, 520, 469, 520, 520, 520, + /* 2960 */ 399, 520, 358, 520, 520, 520, 520, 520, 520, 520, + /* 2970 */ 520, 520, 411, 520, 413, 371, 520, 520, 455, 520, + /* 2980 */ 358, 458, 520, 520, 520, 462, 463, 464, 465, 466, + /* 2990 */ 467, 520, 469, 371, 520, 358, 520, 520, 520, 520, + /* 3000 */ 520, 520, 520, 399, 520, 520, 520, 520, 371, 520, + /* 3010 */ 520, 520, 520, 520, 520, 411, 455, 413, 520, 458, + /* 3020 */ 520, 399, 520, 462, 463, 464, 465, 466, 467, 520, + /* 3030 */ 469, 520, 520, 411, 520, 413, 399, 520, 520, 520, + /* 3040 */ 520, 520, 520, 520, 520, 520, 520, 520, 411, 520, + /* 3050 */ 413, 520, 520, 520, 520, 520, 520, 520, 520, 455, + /* 3060 */ 520, 520, 458, 520, 520, 520, 462, 463, 464, 465, + /* 3070 */ 466, 467, 520, 469, 520, 520, 520, 455, 520, 520, + /* 3080 */ 458, 520, 520, 520, 462, 463, 464, 465, 466, 467, + /* 3090 */ 520, 469, 455, 520, 520, 458, 520, 520, 520, 462, + /* 3100 */ 463, 464, 465, 466, 467, 520, 469, 355, 355, 355, + /* 3110 */ 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, + /* 3120 */ 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, + /* 3130 */ 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, + /* 3140 */ 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, + /* 3150 */ 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, + /* 3160 */ 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, /* 3170 */ 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, /* 3180 */ 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, /* 3190 */ 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, @@ -887,233 +1234,236 @@ static const YYCODETYPE yy_lookahead[] = { /* 3430 */ 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, /* 3440 */ 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, /* 3450 */ 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - /* 3460 */ 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - /* 3470 */ 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - /* 3480 */ 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - /* 3490 */ 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - /* 3500 */ 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - /* 3510 */ 355, 355, 355, 355, 355, 355, 355, 355, + /* 3460 */ 355, 355, }; -#define YY_SHIFT_COUNT (861) +#define YY_SHIFT_COUNT (894) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2433) +#define YY_SHIFT_MAX (2531) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 135, 0, 249, 0, 499, 499, 499, 499, 499, 499, /* 10 */ 499, 499, 499, 499, 499, 499, 748, 997, 997, 1246, /* 20 */ 997, 997, 997, 997, 997, 997, 997, 997, 997, 997, /* 30 */ 997, 997, 997, 997, 997, 997, 997, 997, 997, 997, /* 40 */ 997, 997, 997, 997, 997, 997, 997, 997, 997, 997, - /* 50 */ 201, 245, 713, 253, 708, 906, 708, 708, 253, 253, - /* 60 */ 708, 908, 708, 248, 908, 173, 708, 39, 1396, 1004, - /* 70 */ 60, 60, 1396, 1396, 190, 190, 1004, 12, 280, 150, - /* 80 */ 150, 311, 60, 60, 60, 60, 60, 60, 60, 60, - /* 90 */ 60, 60, 60, 83, 167, 60, 60, 211, 39, 60, - /* 100 */ 83, 60, 39, 60, 60, 39, 60, 60, 39, 60, - /* 110 */ 39, 39, 39, 60, 234, 203, 203, 500, 202, 617, - /* 120 */ 617, 617, 617, 617, 617, 617, 617, 617, 617, 617, - /* 130 */ 617, 617, 617, 617, 617, 617, 617, 617, 413, 352, - /* 140 */ 12, 280, 1103, 1103, 9, 276, 276, 276, 360, 360, - /* 150 */ 329, 529, 9, 211, 192, 39, 230, 39, 39, 318, - /* 160 */ 39, 318, 318, 432, 598, 255, 255, 255, 255, 255, - /* 170 */ 255, 255, 255, 2192, 567, 23, 429, 333, 191, 231, - /* 180 */ 528, 94, 833, 398, 398, 416, 889, 913, 937, 937, - /* 190 */ 937, 1029, 709, 937, 250, 1024, 1280, 923, 309, 1024, - /* 200 */ 1024, 1057, 1030, 1098, 264, 1030, 1256, 334, 529, 1192, - /* 210 */ 1427, 1437, 1463, 1292, 211, 1463, 211, 1320, 1505, 1506, - /* 220 */ 1482, 1506, 1482, 1353, 1505, 1506, 1505, 1482, 1353, 1353, - /* 230 */ 1353, 1440, 1444, 1505, 1449, 1505, 1505, 1505, 1537, 1509, - /* 240 */ 1537, 1509, 1463, 211, 211, 1544, 211, 1552, 1555, 211, - /* 250 */ 1552, 211, 1567, 211, 211, 1505, 211, 1537, 39, 39, - /* 260 */ 39, 39, 39, 39, 39, 39, 39, 39, 39, 1505, - /* 270 */ 598, 598, 1537, 318, 318, 318, 1413, 1510, 1463, 234, - /* 280 */ 1620, 1430, 1433, 1544, 234, 1192, 1505, 318, 1372, 1377, - /* 290 */ 1372, 1377, 1370, 1471, 1372, 1371, 1374, 1397, 1192, 1375, - /* 300 */ 1380, 1379, 1416, 1506, 1663, 1568, 1411, 1552, 234, 234, - /* 310 */ 1588, 1377, 318, 318, 318, 318, 1377, 318, 1518, 234, - /* 320 */ 432, 234, 1506, 318, 318, 1613, 318, 1505, 234, 1702, - /* 330 */ 1698, 1537, 3163, 3163, 3163, 3163, 3163, 3163, 3163, 3163, - /* 340 */ 3163, 36, 2169, 263, 537, 48, 450, 719, 531, 823, - /* 350 */ 1033, 559, 569, 1055, 1055, 1055, 1055, 1055, 1055, 1055, - /* 360 */ 1055, 1055, 659, 597, 990, 26, 26, 582, 616, 520, - /* 370 */ 517, 122, 668, 814, 962, 1074, 1116, 967, 1155, 1171, - /* 380 */ 939, 1155, 1155, 1155, 307, 307, 1271, 1157, 742, 1273, - /* 390 */ 1264, 1182, 1303, 1197, 1207, 1208, 1213, 1300, 1306, 1308, - /* 400 */ 1312, 1325, 1327, 503, 1295, 1296, 1270, 1298, 1309, 1315, - /* 410 */ 1318, 1193, 1156, 1167, 1319, 1339, 1324, 594, 1336, 317, - /* 420 */ 1338, 1351, 1352, 1369, 1401, 1349, 1402, 1405, 1406, 1407, - /* 430 */ 1409, 1410, 1283, 1335, 1343, 1408, 1412, 1341, 1358, 1752, - /* 440 */ 1755, 1756, 1712, 1759, 1725, 1535, 1729, 1730, 1731, 1539, - /* 450 */ 1771, 1737, 1739, 1542, 1746, 1785, 1556, 1788, 1753, 1793, - /* 460 */ 1757, 1797, 1776, 1799, 1764, 1577, 1805, 1604, 1818, 1606, - /* 470 */ 1607, 1615, 1618, 1824, 1825, 1826, 1626, 1628, 1830, 1831, - /* 480 */ 1684, 1786, 1795, 1842, 1808, 1851, 1852, 1810, 1811, 1848, - /* 490 */ 1815, 1859, 1820, 1866, 1867, 1868, 1821, 1869, 1871, 1872, - /* 500 */ 1874, 1876, 1877, 1713, 1843, 1882, 1715, 1884, 1885, 1886, - /* 510 */ 1888, 1889, 1890, 1892, 1893, 1894, 1895, 1896, 1897, 1898, - /* 520 */ 1899, 1901, 1902, 1904, 1909, 1910, 1857, 1911, 1875, 1912, - /* 530 */ 1913, 1914, 1916, 1917, 1919, 1921, 1930, 1915, 1931, 1782, - /* 540 */ 1933, 1789, 1934, 1787, 1939, 1943, 1922, 1900, 1924, 1908, - /* 550 */ 1947, 1903, 1926, 1949, 1905, 1951, 1907, 1961, 1964, 1929, - /* 560 */ 1918, 1923, 1967, 1937, 1920, 1935, 1976, 1941, 1932, 1938, - /* 570 */ 1979, 1944, 1984, 1942, 1955, 1953, 1950, 1954, 1986, 1956, - /* 580 */ 1998, 1959, 1962, 2014, 2017, 2018, 2020, 1965, 1812, 2009, - /* 590 */ 1950, 1963, 2010, 2011, 1952, 2021, 2022, 1988, 1972, 1985, - /* 600 */ 2026, 1992, 1980, 1990, 2033, 1997, 1987, 1994, 2037, 2002, - /* 610 */ 1989, 1999, 2042, 2043, 2044, 2045, 2046, 2048, 1936, 1940, - /* 620 */ 2012, 2028, 2052, 2019, 2023, 2031, 2034, 2035, 2039, 2049, - /* 630 */ 2050, 2024, 2041, 2053, 2054, 2032, 2055, 2083, 2063, 2089, - /* 640 */ 2072, 2095, 2074, 2047, 2097, 2076, 2062, 2102, 2103, 2105, - /* 650 */ 2070, 2114, 2080, 2118, 2098, 2101, 2085, 2087, 2088, 2025, - /* 660 */ 2030, 2126, 1946, 2036, 1927, 1950, 2078, 2129, 1957, 2099, - /* 670 */ 2113, 2138, 1945, 2119, 1960, 1966, 2140, 2144, 1970, 1958, - /* 680 */ 1971, 1969, 2146, 2124, 1865, 2051, 2056, 2058, 2059, 2115, - /* 690 */ 2122, 2064, 2112, 2061, 2125, 2066, 2068, 2150, 2154, 2077, - /* 700 */ 2082, 2094, 2096, 2084, 2157, 2158, 2159, 2106, 2173, 1968, - /* 710 */ 2104, 2107, 2148, 2176, 1974, 2182, 2196, 2198, 2199, 2200, - /* 720 */ 2201, 2108, 2131, 2161, 1973, 2207, 2193, 2241, 2244, 2142, - /* 730 */ 2203, 2214, 2156, 2000, 2160, 2249, 2237, 2027, 2155, 2162, - /* 740 */ 2163, 2218, 2165, 2166, 2219, 2168, 2248, 2038, 2167, 2171, - /* 750 */ 2174, 2177, 2178, 2092, 2180, 2283, 2246, 2109, 2183, 2175, - /* 760 */ 1950, 2240, 2185, 2186, 2187, 2190, 2197, 2189, 2194, 2257, - /* 770 */ 2276, 2208, 2210, 2279, 2213, 2215, 2284, 2217, 2220, 2285, - /* 780 */ 2222, 2223, 2288, 2225, 2226, 2289, 2229, 2212, 2216, 2221, - /* 790 */ 2224, 2211, 2227, 2230, 2300, 2231, 2303, 2236, 2300, 2300, - /* 800 */ 2322, 2277, 2281, 2311, 2313, 2316, 2318, 2321, 2323, 2324, - /* 810 */ 2335, 2337, 2297, 2275, 2299, 2282, 2347, 2348, 2357, 2359, - /* 820 */ 2375, 2361, 2362, 2364, 2325, 2024, 2365, 2041, 2367, 2370, - /* 830 */ 2371, 2372, 2388, 2374, 2412, 2376, 2363, 2373, 2416, 2382, - /* 840 */ 2366, 2379, 2422, 2387, 2378, 2383, 2426, 2390, 2381, 2389, - /* 850 */ 2430, 2397, 2398, 2433, 2415, 2405, 2417, 2420, 2421, 2423, - /* 860 */ 2425, 2424, + /* 50 */ 245, 430, 66, 88, 417, 464, 417, 417, 88, 88, + /* 60 */ 417, 1367, 417, 248, 1367, 420, 417, 14, 1495, 435, + /* 70 */ 59, 59, 1495, 1495, 190, 190, 435, 295, 40, 24, + /* 80 */ 24, 44, 59, 59, 59, 59, 59, 59, 59, 59, + /* 90 */ 59, 59, 59, 157, 283, 59, 59, 350, 14, 59, + /* 100 */ 157, 59, 14, 59, 59, 14, 59, 59, 14, 59, + /* 110 */ 14, 14, 14, 59, 645, 203, 203, 728, 202, 809, + /* 120 */ 809, 809, 809, 809, 809, 809, 809, 809, 809, 809, + /* 130 */ 809, 809, 809, 809, 809, 809, 809, 809, 1150, 595, + /* 140 */ 295, 40, 895, 895, 829, 306, 306, 306, 617, 617, + /* 150 */ 702, 522, 829, 350, 14, 336, 14, 287, 14, 14, + /* 160 */ 722, 14, 722, 722, 794, 890, 255, 596, 596, 596, + /* 170 */ 596, 596, 596, 596, 2207, 1454, 21, 429, 333, 191, + /* 180 */ 383, 495, 346, 588, 398, 398, 1091, 38, 1095, 545, + /* 190 */ 545, 545, 883, 896, 545, 679, 1107, 379, 706, 1061, + /* 200 */ 1107, 1107, 1136, 1034, 1053, 221, 1034, 1158, 684, 522, + /* 210 */ 1287, 1518, 1531, 1555, 1359, 350, 1555, 350, 1380, 1568, + /* 220 */ 1570, 1548, 1570, 1548, 1415, 1568, 1570, 1568, 1548, 1415, + /* 230 */ 1415, 1415, 1506, 1511, 1568, 1517, 1568, 1568, 1568, 1612, + /* 240 */ 1584, 1612, 1584, 1555, 350, 350, 1629, 350, 1638, 1639, + /* 250 */ 350, 1638, 350, 1646, 350, 350, 1568, 350, 1612, 14, + /* 260 */ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + /* 270 */ 1568, 890, 890, 1612, 722, 722, 722, 1485, 1608, 1555, + /* 280 */ 645, 1705, 1516, 1521, 1629, 645, 1287, 1568, 722, 1451, + /* 290 */ 1453, 1451, 1453, 1449, 1551, 1451, 1458, 1465, 1483, 1287, + /* 300 */ 1461, 1466, 1474, 1500, 1570, 1759, 1663, 1503, 1638, 645, + /* 310 */ 645, 1675, 1453, 722, 722, 722, 722, 1453, 722, 1609, + /* 320 */ 645, 794, 645, 1570, 722, 722, 722, 722, 722, 722, + /* 330 */ 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, + /* 340 */ 722, 722, 722, 722, 722, 722, 1707, 722, 1568, 645, + /* 350 */ 1790, 1781, 1612, 3107, 3107, 3107, 3107, 3107, 3107, 3107, + /* 360 */ 3107, 3107, 36, 498, 263, 534, 665, 79, 826, 296, + /* 370 */ 450, 914, 806, 1033, 54, 54, 54, 54, 54, 54, + /* 380 */ 54, 54, 54, 1054, 374, 674, 774, 774, 130, 946, + /* 390 */ 32, 618, 118, 574, 620, 873, 1103, 1163, 643, 951, + /* 400 */ 555, 661, 951, 951, 951, 307, 307, 436, 331, 127, + /* 410 */ 1278, 1267, 1174, 1308, 1204, 1208, 1209, 1213, 1188, 1291, + /* 420 */ 1325, 1333, 1334, 1339, 1119, 601, 1264, 519, 1311, 1316, + /* 430 */ 1318, 1319, 1217, 1182, 1326, 1340, 1373, 1351, 1310, 1352, + /* 440 */ 1309, 1353, 1370, 1372, 1374, 1376, 1398, 1405, 1408, 1410, + /* 450 */ 1421, 1427, 1429, 1434, 1437, 1450, 1452, 1402, 1433, 1436, + /* 460 */ 1442, 1448, 1476, 1336, 1186, 1363, 1401, 1418, 1435, 832, + /* 470 */ 1829, 1847, 1861, 1818, 1865, 1846, 1655, 1851, 1854, 1855, + /* 480 */ 1669, 1901, 1866, 1868, 1676, 1870, 1908, 1679, 1910, 1874, + /* 490 */ 1925, 1876, 1914, 1893, 1916, 1880, 1693, 1919, 1708, 1920, + /* 500 */ 1709, 1713, 1716, 1723, 1929, 1930, 1931, 1731, 1733, 1934, + /* 510 */ 1937, 1789, 1889, 1891, 1941, 1905, 1943, 1944, 1911, 1894, + /* 520 */ 1950, 1898, 1952, 1917, 1959, 1961, 1963, 1921, 1965, 1966, + /* 530 */ 1969, 1983, 1984, 1985, 1805, 1949, 1974, 1819, 1988, 1989, + /* 540 */ 1990, 1991, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, + /* 550 */ 2005, 2007, 2008, 2009, 2010, 2011, 2013, 1967, 2014, 1948, + /* 560 */ 2015, 2017, 2019, 2020, 2021, 2023, 2024, 2025, 2006, 2027, + /* 570 */ 1881, 2030, 1883, 2033, 1887, 2037, 2038, 2022, 1999, 2028, + /* 580 */ 2016, 2039, 1976, 2026, 2043, 1980, 2046, 1982, 2053, 2061, + /* 590 */ 2031, 2018, 2029, 2064, 2035, 2032, 2034, 2065, 2036, 2040, + /* 600 */ 2051, 2067, 2042, 2077, 2049, 2055, 2047, 2052, 2062, 2081, + /* 610 */ 2063, 2098, 2057, 2060, 2113, 2114, 2115, 2116, 2078, 1879, + /* 620 */ 2117, 2052, 2069, 2119, 2121, 2058, 2127, 2132, 2086, 2073, + /* 630 */ 2083, 2139, 2106, 2091, 2102, 2145, 2110, 2097, 2107, 2151, + /* 640 */ 2118, 2101, 2111, 2154, 2156, 2157, 2158, 2160, 2161, 2048, + /* 650 */ 2054, 2128, 2144, 2168, 2133, 2134, 2135, 2136, 2137, 2138, + /* 660 */ 2140, 2141, 2143, 2146, 2147, 2148, 2164, 2152, 2180, 2169, + /* 670 */ 2182, 2170, 2190, 2171, 2142, 2194, 2174, 2163, 2197, 2198, + /* 680 */ 2202, 2167, 2205, 2173, 2211, 2185, 2192, 2186, 2187, 2193, + /* 690 */ 2130, 2112, 2227, 2044, 2122, 2125, 2124, 2050, 2052, 2196, + /* 700 */ 2241, 2071, 2210, 2238, 2249, 2056, 2243, 2074, 2085, 2263, + /* 710 */ 2266, 2089, 2084, 2090, 2087, 2274, 2245, 2004, 2175, 2172, + /* 720 */ 2176, 2177, 2244, 2250, 2181, 2240, 2188, 2242, 2191, 2183, + /* 730 */ 2262, 2264, 2199, 2189, 2195, 2201, 2203, 2265, 2251, 2255, + /* 740 */ 2208, 2273, 2041, 2206, 2209, 2296, 2276, 2045, 2282, 2283, + /* 750 */ 2284, 2285, 2288, 2291, 2221, 2224, 2261, 2059, 2297, 2286, + /* 760 */ 2333, 2336, 2230, 2298, 2305, 2234, 2079, 2256, 2340, 2321, + /* 770 */ 2108, 2254, 2258, 2259, 2300, 2267, 2278, 2314, 2275, 2344, + /* 780 */ 2131, 2280, 2281, 2287, 2289, 2290, 2214, 2292, 2369, 2328, + /* 790 */ 2213, 2301, 2272, 2052, 2332, 2308, 2310, 2299, 2311, 2312, + /* 800 */ 2304, 2315, 2353, 2354, 2317, 2318, 2356, 2320, 2322, 2361, + /* 810 */ 2327, 2324, 2385, 2334, 2335, 2388, 2337, 2339, 2392, 2338, + /* 820 */ 2319, 2323, 2331, 2341, 2345, 2347, 2343, 2419, 2359, 2417, + /* 830 */ 2360, 2419, 2419, 2446, 2397, 2399, 2435, 2436, 2438, 2440, + /* 840 */ 2441, 2442, 2443, 2445, 2447, 2405, 2384, 2409, 2389, 2456, + /* 850 */ 2454, 2455, 2458, 2471, 2459, 2460, 2461, 2421, 2143, 2463, + /* 860 */ 2146, 2464, 2465, 2466, 2468, 2484, 2470, 2508, 2472, 2462, + /* 870 */ 2469, 2510, 2475, 2473, 2477, 2514, 2478, 2474, 2479, 2517, + /* 880 */ 2483, 2476, 2481, 2526, 2491, 2492, 2531, 2513, 2499, 2521, + /* 890 */ 2524, 2525, 2527, 2529, 2528, }; -#define YY_REDUCE_COUNT (340) -#define YY_REDUCE_MIN (-479) -#define YY_REDUCE_MAX (2695) +#define YY_REDUCE_COUNT (361) +#define YY_REDUCE_MIN (-484) +#define YY_REDUCE_MAX (2637) static const short yy_reduce_ofst[] = { - /* 0 */ 283, -313, 155, 213, 405, 435, 505, 667, 745, 903, - /* 10 */ 933, 1002, 1117, 1149, 1248, 1317, 1347, 1376, 1393, 1462, - /* 20 */ 1492, 1529, 1602, 1617, 1648, 1717, 1735, 1761, 1847, 1906, - /* 30 */ 1928, 2007, 2029, 2065, 2149, 2164, 2179, 2195, 2265, 2309, - /* 40 */ 2336, 2380, 2396, 2419, 2477, 2493, 2551, 2576, 2609, 2695, - /* 50 */ -345, -315, -419, -171, -210, -150, 439, 468, -161, 403, - /* 60 */ 547, -384, -479, 349, 142, -407, 49, 557, -232, -413, - /* 70 */ -366, -295, -390, -371, -25, 163, 147, -331, 243, -364, - /* 80 */ -42, -302, 3, 260, 346, 417, 301, 409, 459, 470, - /* 90 */ 472, 474, 510, 217, 484, 552, 570, 52, 378, 686, - /* 100 */ 489, 702, 621, 712, 715, -185, 717, 720, 644, 724, - /* 110 */ 632, 694, 690, 765, 774, 114, 114, -379, -202, 165, - /* 120 */ 513, 515, 726, 741, 764, 768, 816, 819, 853, 858, - /* 130 */ 867, 871, 873, 874, 875, 876, 877, 881, -190, -442, - /* 140 */ 56, 223, 815, 817, 812, -442, 327, 423, 350, 646, - /* 150 */ 208, -208, 878, 522, -131, 316, 639, 623, 382, 859, - /* 160 */ 785, 864, 869, 898, 934, 279, 286, 366, 544, 578, - /* 170 */ 614, 618, 578, 364, 527, 856, 629, 666, 628, 723, - /* 180 */ 852, 829, 829, 946, 958, 836, 986, 952, 879, 883, - /* 190 */ 910, 982, 829, 916, 1048, 1000, 1070, 1018, 1005, 1026, - /* 200 */ 1028, 829, 960, 960, 945, 960, 976, 977, 1082, 1037, - /* 210 */ 1027, 1054, 1064, 1032, 1140, 1075, 1142, 1086, 1159, 1160, - /* 220 */ 1112, 1162, 1114, 1119, 1168, 1166, 1169, 1120, 1124, 1126, - /* 230 */ 1127, 1163, 1170, 1179, 1172, 1184, 1185, 1186, 1195, 1194, - /* 240 */ 1200, 1198, 1121, 1187, 1188, 1158, 1190, 1202, 1139, 1204, - /* 250 */ 1214, 1206, 1161, 1211, 1215, 1222, 1218, 1230, 1199, 1201, - /* 260 */ 1205, 1209, 1216, 1219, 1221, 1223, 1225, 1226, 1227, 1229, - /* 270 */ 1260, 1268, 1244, 1220, 1228, 1231, 1181, 1189, 1183, 1259, - /* 280 */ 1210, 1224, 1203, 1232, 1267, 1212, 1287, 1247, 1165, 1234, - /* 290 */ 1173, 1236, 1174, 1177, 1175, 1191, 1178, 1196, 1241, 1164, - /* 300 */ 1180, 1176, 960, 1313, 1235, 1233, 1217, 1321, 1322, 1323, - /* 310 */ 1237, 1269, 1285, 1286, 1291, 1310, 1274, 1326, 1294, 1340, - /* 320 */ 1328, 1354, 1361, 1329, 1330, 1332, 1331, 1359, 1356, 1378, - /* 330 */ 1381, 1385, 1304, 1301, 1314, 1333, 1346, 1357, 1360, 1383, - /* 340 */ 1398, + /* 0 */ 469, -315, 155, 184, 405, 434, 654, 683, 902, 932, + /* 10 */ 1057, 1181, 1205, 1241, 1358, 1388, 506, 1431, 755, 1491, + /* 20 */ 1513, 1593, 1641, 1623, 1671, 1751, 1770, 1788, 1890, 1913, + /* 30 */ 1947, 1973, 1993, 2075, 2105, 2123, 2204, 2222, 2237, 2252, + /* 40 */ 2325, 2351, 2373, 2411, 2487, 2523, 2561, 2604, 2622, 2637, + /* 50 */ -347, -317, -434, 90, 471, 578, 593, 718, 55, 365, + /* 60 */ 720, 571, -484, -94, 631, -175, 37, -380, -386, -373, + /* 70 */ 219, 262, -368, -244, -360, -266, -403, -382, -203, -93, + /* 80 */ -47, -294, -90, 175, 285, 301, 396, 404, 427, 466, + /* 90 */ 505, 512, 651, -149, 338, 550, 566, 52, 489, 653, + /* 100 */ 216, 667, -70, 688, 690, -235, 693, 701, 117, 715, + /* 110 */ 707, 385, 771, 761, -39, -475, -475, -274, -137, 243, + /* 120 */ 326, 368, 419, 501, 507, 662, 686, 775, 803, 854, + /* 130 */ 858, 868, 905, 916, 919, 924, 926, 927, -36, 151, + /* 140 */ -27, 478, 670, 675, 798, 151, 649, 678, 685, 694, + /* 150 */ 613, -122, 909, 800, -299, 246, 730, 321, 785, 640, + /* 160 */ 666, 888, 878, 887, 904, 945, -400, -384, 541, 554, + /* 170 */ 626, 831, 954, -400, 681, 982, 1029, 1001, 939, 937, + /* 180 */ 958, 1093, 1074, 1074, 1087, 1089, 1055, 1108, 1064, 1005, + /* 190 */ 1008, 1010, 1084, 1074, 1019, 1168, 1129, 1172, 1145, 1115, + /* 200 */ 1134, 1135, 1074, 1071, 1071, 1051, 1071, 1082, 1072, 1177, + /* 210 */ 1132, 1114, 1121, 1131, 1130, 1202, 1138, 1207, 1149, 1219, + /* 220 */ 1220, 1175, 1225, 1178, 1183, 1231, 1232, 1235, 1189, 1185, + /* 230 */ 1191, 1193, 1230, 1233, 1247, 1249, 1257, 1258, 1261, 1270, + /* 240 */ 1268, 1274, 1271, 1194, 1263, 1272, 1240, 1277, 1292, 1228, + /* 250 */ 1294, 1303, 1297, 1250, 1299, 1301, 1312, 1304, 1321, 1288, + /* 260 */ 1289, 1290, 1293, 1295, 1296, 1298, 1302, 1313, 1314, 1315, + /* 270 */ 1320, 1330, 1332, 1335, 1300, 1307, 1317, 1269, 1275, 1276, + /* 280 */ 1342, 1280, 1286, 1322, 1323, 1360, 1305, 1365, 1327, 1243, + /* 290 */ 1329, 1244, 1331, 1242, 1254, 1262, 1265, 1273, 1279, 1337, + /* 300 */ 1248, 1259, 1266, 1071, 1406, 1324, 1306, 1341, 1411, 1407, + /* 310 */ 1409, 1328, 1361, 1377, 1381, 1382, 1383, 1362, 1384, 1371, + /* 320 */ 1426, 1403, 1428, 1438, 1393, 1395, 1397, 1399, 1400, 1404, + /* 330 */ 1417, 1420, 1424, 1425, 1430, 1445, 1447, 1455, 1456, 1459, + /* 340 */ 1462, 1463, 1464, 1467, 1468, 1469, 1414, 1470, 1475, 1441, + /* 350 */ 1472, 1473, 1477, 1387, 1412, 1446, 1457, 1479, 1484, 1489, + /* 360 */ 1481, 1492, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 10 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 20 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 30 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 40 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 50 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 60 */ 2298, 1956, 1956, 2261, 1956, 1956, 1956, 1956, 1956, 1956, - /* 70 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 2268, 1956, 1956, - /* 80 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 90 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 2055, 1956, 1956, - /* 100 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 110 */ 1956, 1956, 1956, 1956, 2053, 2522, 1956, 1956, 1956, 1956, - /* 120 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 130 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 2534, - /* 140 */ 1956, 1956, 2027, 2027, 1956, 2534, 2534, 2534, 2494, 2494, - /* 150 */ 2053, 1956, 1956, 2055, 2336, 1956, 1956, 1956, 1956, 1956, - /* 160 */ 1956, 1956, 1956, 2179, 1986, 1956, 1956, 1956, 1956, 2203, - /* 170 */ 1956, 1956, 1956, 2324, 1956, 1956, 2563, 2625, 1956, 2566, - /* 180 */ 1956, 1956, 1956, 1956, 1956, 2273, 1956, 2553, 1956, 1956, - /* 190 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 2131, 2318, 1956, - /* 200 */ 1956, 1956, 2526, 2540, 2609, 2527, 2524, 2547, 1956, 2557, - /* 210 */ 1956, 2361, 1956, 2350, 2055, 1956, 2055, 2311, 2256, 1956, - /* 220 */ 2266, 1956, 2266, 2263, 1956, 1956, 1956, 2266, 2263, 2263, - /* 230 */ 2263, 2120, 2116, 1956, 2114, 1956, 1956, 1956, 1956, 2011, - /* 240 */ 1956, 2011, 1956, 2055, 2055, 1956, 2055, 1956, 1956, 2055, - /* 250 */ 1956, 2055, 1956, 2055, 2055, 1956, 2055, 1956, 1956, 1956, - /* 260 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 270 */ 1956, 1956, 1956, 1956, 1956, 1956, 2348, 2334, 1956, 2053, - /* 280 */ 1956, 2322, 2320, 1956, 2053, 2557, 1956, 1956, 2579, 2574, - /* 290 */ 2579, 2574, 2593, 2589, 2579, 2598, 2595, 2559, 2557, 2628, - /* 300 */ 2615, 2611, 2540, 1956, 1956, 2545, 2543, 1956, 2053, 2053, - /* 310 */ 1956, 2574, 1956, 1956, 1956, 1956, 2574, 1956, 1956, 2053, - /* 320 */ 1956, 2053, 1956, 1956, 1956, 2147, 1956, 1956, 2053, 1956, - /* 330 */ 1995, 1956, 2313, 2339, 2294, 2294, 2182, 2182, 2182, 2056, - /* 340 */ 1961, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 350 */ 1956, 1956, 1956, 2592, 2591, 2446, 1956, 2498, 2497, 2496, - /* 360 */ 2487, 2445, 2143, 1956, 1956, 2444, 2443, 1956, 1956, 1956, - /* 370 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 2437, 1956, - /* 380 */ 1956, 2438, 2436, 2435, 2285, 2284, 1956, 1956, 1956, 1956, - /* 390 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 400 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 410 */ 1956, 1956, 2612, 2616, 1956, 2523, 1956, 1956, 1956, 2417, - /* 420 */ 1956, 1956, 1956, 1956, 1956, 2385, 1956, 1956, 1956, 1956, - /* 430 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 440 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 450 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 460 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 470 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 480 */ 2262, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 490 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 500 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 510 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 520 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 530 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 540 */ 1956, 1956, 1956, 2277, 1956, 1956, 1956, 1956, 1956, 1956, - /* 550 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 560 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 570 */ 1956, 1956, 1956, 1956, 1956, 2000, 2424, 1956, 1956, 1956, - /* 580 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 590 */ 2427, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 600 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 610 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 620 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 630 */ 1956, 2095, 2094, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 640 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 650 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 2428, - /* 660 */ 1956, 1956, 1956, 1956, 1956, 2419, 1956, 1956, 1956, 1956, - /* 670 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 680 */ 1956, 1956, 2608, 2560, 1956, 1956, 1956, 1956, 1956, 1956, - /* 690 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 700 */ 1956, 1956, 1956, 1956, 1956, 1956, 2417, 1956, 2590, 1956, - /* 710 */ 1956, 2606, 1956, 2610, 1956, 1956, 1956, 1956, 1956, 1956, - /* 720 */ 1956, 2533, 2529, 1956, 1956, 2525, 1956, 1956, 1956, 1956, - /* 730 */ 1956, 2484, 1956, 1956, 1956, 2518, 1956, 1956, 1956, 1956, - /* 740 */ 1956, 1956, 1956, 1956, 1956, 2428, 1956, 2431, 1956, 1956, - /* 750 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 760 */ 2416, 1956, 2469, 2468, 1956, 1956, 1956, 1956, 1956, 1956, - /* 770 */ 1956, 2176, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 780 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 2160, 2158, 2157, - /* 790 */ 2156, 1956, 2153, 1956, 2189, 1956, 1956, 1956, 2185, 2184, - /* 800 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 810 */ 1956, 1956, 1956, 1956, 1956, 1956, 2074, 1956, 1956, 1956, - /* 820 */ 1956, 1956, 1956, 1956, 1956, 2066, 1956, 2065, 1956, 1956, - /* 830 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 840 */ 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, 1956, - /* 850 */ 1956, 1956, 1956, 1956, 1956, 1985, 1956, 1956, 1956, 1956, - /* 860 */ 1956, 1956, + /* 0 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 10 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 20 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 30 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 40 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 50 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 60 */ 2368, 2026, 2026, 2331, 2026, 2026, 2026, 2026, 2026, 2026, + /* 70 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2338, 2026, 2026, + /* 80 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 90 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2125, 2026, 2026, + /* 100 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 110 */ 2026, 2026, 2026, 2026, 2123, 2616, 2026, 2026, 2026, 2026, + /* 120 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 130 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2628, + /* 140 */ 2026, 2026, 2097, 2097, 2026, 2628, 2628, 2628, 2588, 2588, + /* 150 */ 2123, 2026, 2026, 2125, 2026, 2410, 2026, 2026, 2026, 2026, + /* 160 */ 2026, 2026, 2026, 2026, 2249, 2056, 2408, 2026, 2026, 2026, + /* 170 */ 2026, 2026, 2026, 2026, 2394, 2026, 2026, 2657, 2719, 2026, + /* 180 */ 2660, 2026, 2026, 2026, 2026, 2026, 2343, 2026, 2647, 2026, + /* 190 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2201, 2388, + /* 200 */ 2026, 2026, 2026, 2620, 2634, 2703, 2621, 2618, 2641, 2026, + /* 210 */ 2651, 2026, 2435, 2026, 2424, 2125, 2026, 2125, 2381, 2326, + /* 220 */ 2026, 2336, 2026, 2336, 2333, 2026, 2026, 2026, 2336, 2333, + /* 230 */ 2333, 2333, 2190, 2186, 2026, 2184, 2026, 2026, 2026, 2026, + /* 240 */ 2081, 2026, 2081, 2026, 2125, 2125, 2026, 2125, 2026, 2026, + /* 250 */ 2125, 2026, 2125, 2026, 2125, 2125, 2026, 2125, 2026, 2026, + /* 260 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 270 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2422, 2404, 2026, + /* 280 */ 2123, 2026, 2392, 2390, 2026, 2123, 2651, 2026, 2026, 2673, + /* 290 */ 2668, 2673, 2668, 2687, 2683, 2673, 2692, 2689, 2653, 2651, + /* 300 */ 2722, 2709, 2705, 2634, 2026, 2026, 2639, 2637, 2026, 2123, + /* 310 */ 2123, 2026, 2668, 2026, 2026, 2026, 2026, 2668, 2026, 2026, + /* 320 */ 2123, 2026, 2123, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 330 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 340 */ 2026, 2026, 2026, 2026, 2026, 2026, 2217, 2026, 2026, 2123, + /* 350 */ 2026, 2065, 2026, 2383, 2413, 2364, 2364, 2252, 2252, 2252, + /* 360 */ 2126, 2031, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 370 */ 2026, 2026, 2026, 2026, 2686, 2685, 2540, 2026, 2592, 2591, + /* 380 */ 2590, 2581, 2539, 2213, 2026, 2026, 2538, 2537, 2026, 2026, + /* 390 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2531, + /* 400 */ 2026, 2026, 2532, 2530, 2529, 2355, 2354, 2026, 2026, 2026, + /* 410 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 420 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 430 */ 2026, 2026, 2026, 2706, 2710, 2026, 2617, 2026, 2026, 2026, + /* 440 */ 2511, 2026, 2026, 2026, 2026, 2026, 2479, 2474, 2465, 2456, + /* 450 */ 2471, 2462, 2450, 2468, 2459, 2447, 2444, 2026, 2026, 2026, + /* 460 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 470 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 480 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 490 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 500 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 510 */ 2026, 2332, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 520 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 530 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 540 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 550 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 560 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 570 */ 2026, 2026, 2026, 2026, 2347, 2026, 2026, 2026, 2026, 2026, + /* 580 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 590 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 600 */ 2026, 2026, 2026, 2026, 2026, 2026, 2070, 2518, 2026, 2026, + /* 610 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 620 */ 2026, 2521, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 630 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 640 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 650 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 660 */ 2026, 2026, 2165, 2164, 2026, 2026, 2026, 2026, 2026, 2026, + /* 670 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 680 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 690 */ 2522, 2026, 2026, 2026, 2408, 2026, 2026, 2026, 2513, 2026, + /* 700 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 710 */ 2026, 2026, 2026, 2026, 2026, 2702, 2654, 2026, 2026, 2026, + /* 720 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 730 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2511, + /* 740 */ 2026, 2684, 2026, 2026, 2700, 2026, 2704, 2026, 2026, 2026, + /* 750 */ 2026, 2026, 2026, 2026, 2627, 2623, 2026, 2026, 2619, 2026, + /* 760 */ 2026, 2026, 2026, 2026, 2578, 2026, 2026, 2026, 2612, 2026, + /* 770 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2522, 2026, + /* 780 */ 2525, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 790 */ 2026, 2026, 2026, 2510, 2026, 2563, 2562, 2026, 2026, 2026, + /* 800 */ 2026, 2026, 2026, 2026, 2246, 2026, 2026, 2026, 2026, 2026, + /* 810 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 820 */ 2230, 2228, 2227, 2226, 2026, 2223, 2026, 2259, 2026, 2026, + /* 830 */ 2026, 2255, 2254, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 840 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2144, + /* 850 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2136, 2026, + /* 860 */ 2135, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 870 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, + /* 880 */ 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2055, 2026, + /* 890 */ 2026, 2026, 2026, 2026, 2026, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1539,6 +1889,7 @@ struct yyParser { }; typedef struct yyParser yyParser; +#include #ifndef NDEBUG #include static FILE *yyTraceFILE = 0; @@ -2028,71 +2379,73 @@ static const char *const yyTokenName[] = { /* 450 */ "tag_def_or_ref_opt", /* 451 */ "subtable_opt", /* 452 */ "ignore_opt", - /* 453 */ "expression", - /* 454 */ "on_vgroup_id", - /* 455 */ "dnode_list", - /* 456 */ "literal_func", - /* 457 */ "signed_literal", - /* 458 */ "literal_list", - /* 459 */ "table_alias", - /* 460 */ "expr_or_subquery", - /* 461 */ "pseudo_column", - /* 462 */ "column_reference", - /* 463 */ "function_expression", - /* 464 */ "case_when_expression", - /* 465 */ "star_func", - /* 466 */ "star_func_para_list", - /* 467 */ "noarg_func", - /* 468 */ "other_para_list", - /* 469 */ "star_func_para", - /* 470 */ "when_then_list", - /* 471 */ "case_when_else_opt", - /* 472 */ "common_expression", - /* 473 */ "when_then_expr", - /* 474 */ "predicate", - /* 475 */ "compare_op", - /* 476 */ "in_op", - /* 477 */ "in_predicate_value", - /* 478 */ "boolean_value_expression", - /* 479 */ "boolean_primary", - /* 480 */ "from_clause_opt", - /* 481 */ "table_reference_list", - /* 482 */ "table_reference", - /* 483 */ "table_primary", - /* 484 */ "joined_table", - /* 485 */ "alias_opt", - /* 486 */ "subquery", - /* 487 */ "parenthesized_joined_table", - /* 488 */ "join_type", - /* 489 */ "query_specification", - /* 490 */ "hint_list", - /* 491 */ "set_quantifier_opt", - /* 492 */ "tag_mode_opt", - /* 493 */ "select_list", - /* 494 */ "partition_by_clause_opt", - /* 495 */ "range_opt", - /* 496 */ "every_opt", - /* 497 */ "fill_opt", - /* 498 */ "twindow_clause_opt", - /* 499 */ "group_by_clause_opt", - /* 500 */ "having_clause_opt", - /* 501 */ "select_item", - /* 502 */ "partition_list", - /* 503 */ "partition_item", - /* 504 */ "interval_sliding_duration_literal", - /* 505 */ "fill_mode", - /* 506 */ "group_by_list", - /* 507 */ "query_expression", - /* 508 */ "query_simple", - /* 509 */ "order_by_clause_opt", - /* 510 */ "slimit_clause_opt", - /* 511 */ "limit_clause_opt", - /* 512 */ "union_query_expression", - /* 513 */ "query_simple_or_subquery", - /* 514 */ "sort_specification_list", - /* 515 */ "sort_specification", - /* 516 */ "ordering_specification_opt", - /* 517 */ "null_ordering_opt", + /* 453 */ "column_stream_def_list", + /* 454 */ "column_stream_def", + /* 455 */ "expression", + /* 456 */ "on_vgroup_id", + /* 457 */ "dnode_list", + /* 458 */ "literal_func", + /* 459 */ "signed_literal", + /* 460 */ "literal_list", + /* 461 */ "table_alias", + /* 462 */ "expr_or_subquery", + /* 463 */ "pseudo_column", + /* 464 */ "column_reference", + /* 465 */ "function_expression", + /* 466 */ "case_when_expression", + /* 467 */ "star_func", + /* 468 */ "star_func_para_list", + /* 469 */ "noarg_func", + /* 470 */ "other_para_list", + /* 471 */ "star_func_para", + /* 472 */ "when_then_list", + /* 473 */ "case_when_else_opt", + /* 474 */ "common_expression", + /* 475 */ "when_then_expr", + /* 476 */ "predicate", + /* 477 */ "compare_op", + /* 478 */ "in_op", + /* 479 */ "in_predicate_value", + /* 480 */ "boolean_value_expression", + /* 481 */ "boolean_primary", + /* 482 */ "from_clause_opt", + /* 483 */ "table_reference_list", + /* 484 */ "table_reference", + /* 485 */ "table_primary", + /* 486 */ "joined_table", + /* 487 */ "alias_opt", + /* 488 */ "subquery", + /* 489 */ "parenthesized_joined_table", + /* 490 */ "join_type", + /* 491 */ "query_specification", + /* 492 */ "hint_list", + /* 493 */ "set_quantifier_opt", + /* 494 */ "tag_mode_opt", + /* 495 */ "select_list", + /* 496 */ "partition_by_clause_opt", + /* 497 */ "range_opt", + /* 498 */ "every_opt", + /* 499 */ "fill_opt", + /* 500 */ "twindow_clause_opt", + /* 501 */ "group_by_clause_opt", + /* 502 */ "having_clause_opt", + /* 503 */ "select_item", + /* 504 */ "partition_list", + /* 505 */ "partition_item", + /* 506 */ "interval_sliding_duration_literal", + /* 507 */ "fill_mode", + /* 508 */ "group_by_list", + /* 509 */ "query_expression", + /* 510 */ "query_simple", + /* 511 */ "order_by_clause_opt", + /* 512 */ "slimit_clause_opt", + /* 513 */ "limit_clause_opt", + /* 514 */ "union_query_expression", + /* 515 */ "query_simple_or_subquery", + /* 516 */ "sort_specification_list", + /* 517 */ "sort_specification", + /* 518 */ "ordering_specification_opt", + /* 519 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2476,302 +2829,326 @@ static const char *const yyRuleName[] = { /* 373 */ "cmd ::= PAUSE STREAM exists_opt stream_name", /* 374 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", /* 375 */ "col_list_opt ::=", - /* 376 */ "col_list_opt ::= NK_LP col_name_list NK_RP", - /* 377 */ "tag_def_or_ref_opt ::=", - /* 378 */ "tag_def_or_ref_opt ::= tags_def", - /* 379 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", - /* 380 */ "stream_options ::=", - /* 381 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 382 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 383 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 384 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 385 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 386 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 387 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 388 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 389 */ "subtable_opt ::=", - /* 390 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 391 */ "ignore_opt ::=", - /* 392 */ "ignore_opt ::= IGNORE UNTREATED", - /* 393 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 394 */ "cmd ::= KILL QUERY NK_STRING", - /* 395 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 396 */ "cmd ::= KILL COMPACT NK_INTEGER", - /* 397 */ "cmd ::= BALANCE VGROUP", - /* 398 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", - /* 399 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 400 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 401 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 402 */ "on_vgroup_id ::=", - /* 403 */ "on_vgroup_id ::= ON NK_INTEGER", - /* 404 */ "dnode_list ::= DNODE NK_INTEGER", - /* 405 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 406 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 407 */ "cmd ::= query_or_subquery", - /* 408 */ "cmd ::= insert_query", - /* 409 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 410 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 411 */ "tags_literal ::= NK_INTEGER", - /* 412 */ "tags_literal ::= NK_PLUS NK_INTEGER", - /* 413 */ "tags_literal ::= NK_MINUS NK_INTEGER", - /* 414 */ "tags_literal ::= NK_FLOAT", - /* 415 */ "tags_literal ::= NK_PLUS NK_FLOAT", - /* 416 */ "tags_literal ::= NK_MINUS NK_FLOAT", - /* 417 */ "tags_literal ::= NK_BIN", - /* 418 */ "tags_literal ::= NK_PLUS NK_BIN", - /* 419 */ "tags_literal ::= NK_MINUS NK_BIN", - /* 420 */ "tags_literal ::= NK_HEX", - /* 421 */ "tags_literal ::= NK_PLUS NK_HEX", - /* 422 */ "tags_literal ::= NK_MINUS NK_HEX", - /* 423 */ "tags_literal ::= NK_STRING", - /* 424 */ "tags_literal ::= NK_BOOL", - /* 425 */ "tags_literal ::= NULL", - /* 426 */ "tags_literal ::= literal_func", - /* 427 */ "tags_literal ::= literal_func NK_PLUS duration_literal", - /* 428 */ "tags_literal ::= literal_func NK_MINUS duration_literal", - /* 429 */ "tags_literal_list ::= tags_literal", - /* 430 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", - /* 431 */ "literal ::= NK_INTEGER", - /* 432 */ "literal ::= NK_FLOAT", - /* 433 */ "literal ::= NK_STRING", - /* 434 */ "literal ::= NK_BOOL", - /* 435 */ "literal ::= TIMESTAMP NK_STRING", - /* 436 */ "literal ::= duration_literal", - /* 437 */ "literal ::= NULL", - /* 438 */ "literal ::= NK_QUESTION", - /* 439 */ "duration_literal ::= NK_VARIABLE", - /* 440 */ "signed ::= NK_INTEGER", - /* 441 */ "signed ::= NK_PLUS NK_INTEGER", - /* 442 */ "signed ::= NK_MINUS NK_INTEGER", - /* 443 */ "signed ::= NK_FLOAT", - /* 444 */ "signed ::= NK_PLUS NK_FLOAT", - /* 445 */ "signed ::= NK_MINUS NK_FLOAT", - /* 446 */ "signed_literal ::= signed", - /* 447 */ "signed_literal ::= NK_STRING", - /* 448 */ "signed_literal ::= NK_BOOL", - /* 449 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 450 */ "signed_literal ::= duration_literal", - /* 451 */ "signed_literal ::= NULL", - /* 452 */ "signed_literal ::= literal_func", - /* 453 */ "signed_literal ::= NK_QUESTION", - /* 454 */ "literal_list ::= signed_literal", - /* 455 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 456 */ "db_name ::= NK_ID", - /* 457 */ "table_name ::= NK_ID", - /* 458 */ "column_name ::= NK_ID", - /* 459 */ "function_name ::= NK_ID", - /* 460 */ "view_name ::= NK_ID", - /* 461 */ "table_alias ::= NK_ID", - /* 462 */ "column_alias ::= NK_ID", - /* 463 */ "column_alias ::= NK_ALIAS", - /* 464 */ "user_name ::= NK_ID", - /* 465 */ "topic_name ::= NK_ID", - /* 466 */ "stream_name ::= NK_ID", - /* 467 */ "cgroup_name ::= NK_ID", - /* 468 */ "index_name ::= NK_ID", - /* 469 */ "expr_or_subquery ::= expression", - /* 470 */ "expression ::= literal", - /* 471 */ "expression ::= pseudo_column", - /* 472 */ "expression ::= column_reference", - /* 473 */ "expression ::= function_expression", - /* 474 */ "expression ::= case_when_expression", - /* 475 */ "expression ::= NK_LP expression NK_RP", - /* 476 */ "expression ::= NK_PLUS expr_or_subquery", - /* 477 */ "expression ::= NK_MINUS expr_or_subquery", - /* 478 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 479 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 480 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 481 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 482 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 483 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 484 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 485 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 486 */ "expression_list ::= expr_or_subquery", - /* 487 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 488 */ "column_reference ::= column_name", - /* 489 */ "column_reference ::= table_name NK_DOT column_name", - /* 490 */ "column_reference ::= NK_ALIAS", - /* 491 */ "column_reference ::= table_name NK_DOT NK_ALIAS", - /* 492 */ "pseudo_column ::= ROWTS", - /* 493 */ "pseudo_column ::= TBNAME", - /* 494 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 495 */ "pseudo_column ::= QSTART", - /* 496 */ "pseudo_column ::= QEND", - /* 497 */ "pseudo_column ::= QDURATION", - /* 498 */ "pseudo_column ::= WSTART", - /* 499 */ "pseudo_column ::= WEND", - /* 500 */ "pseudo_column ::= WDURATION", - /* 501 */ "pseudo_column ::= IROWTS", - /* 502 */ "pseudo_column ::= ISFILLED", - /* 503 */ "pseudo_column ::= QTAGS", - /* 504 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 505 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 506 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 507 */ "function_expression ::= literal_func", - /* 508 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 509 */ "literal_func ::= NOW", - /* 510 */ "literal_func ::= TODAY", - /* 511 */ "noarg_func ::= NOW", - /* 512 */ "noarg_func ::= TODAY", - /* 513 */ "noarg_func ::= TIMEZONE", - /* 514 */ "noarg_func ::= DATABASE", - /* 515 */ "noarg_func ::= CLIENT_VERSION", - /* 516 */ "noarg_func ::= SERVER_VERSION", - /* 517 */ "noarg_func ::= SERVER_STATUS", - /* 518 */ "noarg_func ::= CURRENT_USER", - /* 519 */ "noarg_func ::= USER", - /* 520 */ "star_func ::= COUNT", - /* 521 */ "star_func ::= FIRST", - /* 522 */ "star_func ::= LAST", - /* 523 */ "star_func ::= LAST_ROW", - /* 524 */ "star_func_para_list ::= NK_STAR", - /* 525 */ "star_func_para_list ::= other_para_list", - /* 526 */ "other_para_list ::= star_func_para", - /* 527 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 528 */ "star_func_para ::= expr_or_subquery", - /* 529 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 530 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 531 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 532 */ "when_then_list ::= when_then_expr", - /* 533 */ "when_then_list ::= when_then_list when_then_expr", - /* 534 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 535 */ "case_when_else_opt ::=", - /* 536 */ "case_when_else_opt ::= ELSE common_expression", - /* 537 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 538 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 539 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 540 */ "predicate ::= expr_or_subquery IS NULL", - /* 541 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 542 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 543 */ "compare_op ::= NK_LT", - /* 544 */ "compare_op ::= NK_GT", - /* 545 */ "compare_op ::= NK_LE", - /* 546 */ "compare_op ::= NK_GE", - /* 547 */ "compare_op ::= NK_NE", - /* 548 */ "compare_op ::= NK_EQ", - /* 549 */ "compare_op ::= LIKE", - /* 550 */ "compare_op ::= NOT LIKE", - /* 551 */ "compare_op ::= MATCH", - /* 552 */ "compare_op ::= NMATCH", - /* 553 */ "compare_op ::= CONTAINS", - /* 554 */ "in_op ::= IN", - /* 555 */ "in_op ::= NOT IN", - /* 556 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 557 */ "boolean_value_expression ::= boolean_primary", - /* 558 */ "boolean_value_expression ::= NOT boolean_primary", - /* 559 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 560 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 561 */ "boolean_primary ::= predicate", - /* 562 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 563 */ "common_expression ::= expr_or_subquery", - /* 564 */ "common_expression ::= boolean_value_expression", - /* 565 */ "from_clause_opt ::=", - /* 566 */ "from_clause_opt ::= FROM table_reference_list", - /* 567 */ "table_reference_list ::= table_reference", - /* 568 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 569 */ "table_reference ::= table_primary", - /* 570 */ "table_reference ::= joined_table", - /* 571 */ "table_primary ::= table_name alias_opt", - /* 572 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 573 */ "table_primary ::= subquery alias_opt", - /* 574 */ "table_primary ::= parenthesized_joined_table", - /* 575 */ "alias_opt ::=", - /* 576 */ "alias_opt ::= table_alias", - /* 577 */ "alias_opt ::= AS table_alias", - /* 578 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 579 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 580 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 581 */ "join_type ::=", - /* 582 */ "join_type ::= INNER", - /* 583 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 584 */ "hint_list ::=", - /* 585 */ "hint_list ::= NK_HINT", - /* 586 */ "tag_mode_opt ::=", - /* 587 */ "tag_mode_opt ::= TAGS", - /* 588 */ "set_quantifier_opt ::=", - /* 589 */ "set_quantifier_opt ::= DISTINCT", - /* 590 */ "set_quantifier_opt ::= ALL", - /* 591 */ "select_list ::= select_item", - /* 592 */ "select_list ::= select_list NK_COMMA select_item", - /* 593 */ "select_item ::= NK_STAR", - /* 594 */ "select_item ::= common_expression", - /* 595 */ "select_item ::= common_expression column_alias", - /* 596 */ "select_item ::= common_expression AS column_alias", - /* 597 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 598 */ "where_clause_opt ::=", - /* 599 */ "where_clause_opt ::= WHERE search_condition", - /* 600 */ "partition_by_clause_opt ::=", - /* 601 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 602 */ "partition_list ::= partition_item", - /* 603 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 604 */ "partition_item ::= expr_or_subquery", - /* 605 */ "partition_item ::= expr_or_subquery column_alias", - /* 606 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 607 */ "twindow_clause_opt ::=", - /* 608 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", - /* 609 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 610 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 611 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 612 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 613 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", - /* 614 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 615 */ "sliding_opt ::=", - /* 616 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", - /* 617 */ "interval_sliding_duration_literal ::= NK_VARIABLE", - /* 618 */ "interval_sliding_duration_literal ::= NK_STRING", - /* 619 */ "interval_sliding_duration_literal ::= NK_INTEGER", - /* 620 */ "fill_opt ::=", - /* 621 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 622 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 623 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 624 */ "fill_mode ::= NONE", - /* 625 */ "fill_mode ::= PREV", - /* 626 */ "fill_mode ::= NULL", - /* 627 */ "fill_mode ::= NULL_F", - /* 628 */ "fill_mode ::= LINEAR", - /* 629 */ "fill_mode ::= NEXT", - /* 630 */ "group_by_clause_opt ::=", - /* 631 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 632 */ "group_by_list ::= expr_or_subquery", - /* 633 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 634 */ "having_clause_opt ::=", - /* 635 */ "having_clause_opt ::= HAVING search_condition", - /* 636 */ "range_opt ::=", - /* 637 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 638 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 639 */ "every_opt ::=", - /* 640 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 641 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 642 */ "query_simple ::= query_specification", - /* 643 */ "query_simple ::= union_query_expression", - /* 644 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 645 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 646 */ "query_simple_or_subquery ::= query_simple", - /* 647 */ "query_simple_or_subquery ::= subquery", - /* 648 */ "query_or_subquery ::= query_expression", - /* 649 */ "query_or_subquery ::= subquery", - /* 650 */ "order_by_clause_opt ::=", - /* 651 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 652 */ "slimit_clause_opt ::=", - /* 653 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 654 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 655 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 656 */ "limit_clause_opt ::=", - /* 657 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 658 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 659 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 660 */ "subquery ::= NK_LP query_expression NK_RP", - /* 661 */ "subquery ::= NK_LP subquery NK_RP", - /* 662 */ "search_condition ::= common_expression", - /* 663 */ "sort_specification_list ::= sort_specification", - /* 664 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 665 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 666 */ "ordering_specification_opt ::=", - /* 667 */ "ordering_specification_opt ::= ASC", - /* 668 */ "ordering_specification_opt ::= DESC", - /* 669 */ "null_ordering_opt ::=", - /* 670 */ "null_ordering_opt ::= NULLS FIRST", - /* 671 */ "null_ordering_opt ::= NULLS LAST", + /* 376 */ "col_list_opt ::= NK_LP column_stream_def_list NK_RP", + /* 377 */ "column_stream_def_list ::= column_stream_def", + /* 378 */ "column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def", + /* 379 */ "column_stream_def ::= column_name", + /* 380 */ "column_stream_def ::= column_name PRIMARY KEY", + /* 381 */ "tag_def_or_ref_opt ::=", + /* 382 */ "tag_def_or_ref_opt ::= tags_def", + /* 383 */ "tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP", + /* 384 */ "stream_options ::=", + /* 385 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 386 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 387 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 388 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 389 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 390 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 391 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 392 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 393 */ "subtable_opt ::=", + /* 394 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 395 */ "ignore_opt ::=", + /* 396 */ "ignore_opt ::= IGNORE UNTREATED", + /* 397 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 398 */ "cmd ::= KILL QUERY NK_STRING", + /* 399 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 400 */ "cmd ::= KILL COMPACT NK_INTEGER", + /* 401 */ "cmd ::= BALANCE VGROUP", + /* 402 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", + /* 403 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 404 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 405 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 406 */ "on_vgroup_id ::=", + /* 407 */ "on_vgroup_id ::= ON NK_INTEGER", + /* 408 */ "dnode_list ::= DNODE NK_INTEGER", + /* 409 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 410 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 411 */ "cmd ::= query_or_subquery", + /* 412 */ "cmd ::= insert_query", + /* 413 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 414 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 415 */ "tags_literal ::= NK_INTEGER", + /* 416 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", + /* 417 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", + /* 418 */ "tags_literal ::= NK_PLUS NK_INTEGER", + /* 419 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", + /* 420 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", + /* 421 */ "tags_literal ::= NK_MINUS NK_INTEGER", + /* 422 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", + /* 423 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", + /* 424 */ "tags_literal ::= NK_FLOAT", + /* 425 */ "tags_literal ::= NK_PLUS NK_FLOAT", + /* 426 */ "tags_literal ::= NK_MINUS NK_FLOAT", + /* 427 */ "tags_literal ::= NK_BIN", + /* 428 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", + /* 429 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", + /* 430 */ "tags_literal ::= NK_PLUS NK_BIN", + /* 431 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", + /* 432 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", + /* 433 */ "tags_literal ::= NK_MINUS NK_BIN", + /* 434 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", + /* 435 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", + /* 436 */ "tags_literal ::= NK_HEX", + /* 437 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", + /* 438 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", + /* 439 */ "tags_literal ::= NK_PLUS NK_HEX", + /* 440 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", + /* 441 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", + /* 442 */ "tags_literal ::= NK_MINUS NK_HEX", + /* 443 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", + /* 444 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", + /* 445 */ "tags_literal ::= NK_STRING", + /* 446 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", + /* 447 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", + /* 448 */ "tags_literal ::= NK_BOOL", + /* 449 */ "tags_literal ::= NULL", + /* 450 */ "tags_literal ::= literal_func", + /* 451 */ "tags_literal ::= literal_func NK_PLUS duration_literal", + /* 452 */ "tags_literal ::= literal_func NK_MINUS duration_literal", + /* 453 */ "tags_literal_list ::= tags_literal", + /* 454 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", + /* 455 */ "literal ::= NK_INTEGER", + /* 456 */ "literal ::= NK_FLOAT", + /* 457 */ "literal ::= NK_STRING", + /* 458 */ "literal ::= NK_BOOL", + /* 459 */ "literal ::= TIMESTAMP NK_STRING", + /* 460 */ "literal ::= duration_literal", + /* 461 */ "literal ::= NULL", + /* 462 */ "literal ::= NK_QUESTION", + /* 463 */ "duration_literal ::= NK_VARIABLE", + /* 464 */ "signed ::= NK_INTEGER", + /* 465 */ "signed ::= NK_PLUS NK_INTEGER", + /* 466 */ "signed ::= NK_MINUS NK_INTEGER", + /* 467 */ "signed ::= NK_FLOAT", + /* 468 */ "signed ::= NK_PLUS NK_FLOAT", + /* 469 */ "signed ::= NK_MINUS NK_FLOAT", + /* 470 */ "signed_literal ::= signed", + /* 471 */ "signed_literal ::= NK_STRING", + /* 472 */ "signed_literal ::= NK_BOOL", + /* 473 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 474 */ "signed_literal ::= duration_literal", + /* 475 */ "signed_literal ::= NULL", + /* 476 */ "signed_literal ::= literal_func", + /* 477 */ "signed_literal ::= NK_QUESTION", + /* 478 */ "literal_list ::= signed_literal", + /* 479 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 480 */ "db_name ::= NK_ID", + /* 481 */ "table_name ::= NK_ID", + /* 482 */ "column_name ::= NK_ID", + /* 483 */ "function_name ::= NK_ID", + /* 484 */ "view_name ::= NK_ID", + /* 485 */ "table_alias ::= NK_ID", + /* 486 */ "column_alias ::= NK_ID", + /* 487 */ "column_alias ::= NK_ALIAS", + /* 488 */ "user_name ::= NK_ID", + /* 489 */ "topic_name ::= NK_ID", + /* 490 */ "stream_name ::= NK_ID", + /* 491 */ "cgroup_name ::= NK_ID", + /* 492 */ "index_name ::= NK_ID", + /* 493 */ "expr_or_subquery ::= expression", + /* 494 */ "expression ::= literal", + /* 495 */ "expression ::= pseudo_column", + /* 496 */ "expression ::= column_reference", + /* 497 */ "expression ::= function_expression", + /* 498 */ "expression ::= case_when_expression", + /* 499 */ "expression ::= NK_LP expression NK_RP", + /* 500 */ "expression ::= NK_PLUS expr_or_subquery", + /* 501 */ "expression ::= NK_MINUS expr_or_subquery", + /* 502 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 503 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 504 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 505 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 506 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 507 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 508 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 509 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 510 */ "expression_list ::= expr_or_subquery", + /* 511 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 512 */ "column_reference ::= column_name", + /* 513 */ "column_reference ::= table_name NK_DOT column_name", + /* 514 */ "column_reference ::= NK_ALIAS", + /* 515 */ "column_reference ::= table_name NK_DOT NK_ALIAS", + /* 516 */ "pseudo_column ::= ROWTS", + /* 517 */ "pseudo_column ::= TBNAME", + /* 518 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 519 */ "pseudo_column ::= QSTART", + /* 520 */ "pseudo_column ::= QEND", + /* 521 */ "pseudo_column ::= QDURATION", + /* 522 */ "pseudo_column ::= WSTART", + /* 523 */ "pseudo_column ::= WEND", + /* 524 */ "pseudo_column ::= WDURATION", + /* 525 */ "pseudo_column ::= IROWTS", + /* 526 */ "pseudo_column ::= ISFILLED", + /* 527 */ "pseudo_column ::= QTAGS", + /* 528 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 529 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 530 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 531 */ "function_expression ::= literal_func", + /* 532 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 533 */ "literal_func ::= NOW", + /* 534 */ "literal_func ::= TODAY", + /* 535 */ "noarg_func ::= NOW", + /* 536 */ "noarg_func ::= TODAY", + /* 537 */ "noarg_func ::= TIMEZONE", + /* 538 */ "noarg_func ::= DATABASE", + /* 539 */ "noarg_func ::= CLIENT_VERSION", + /* 540 */ "noarg_func ::= SERVER_VERSION", + /* 541 */ "noarg_func ::= SERVER_STATUS", + /* 542 */ "noarg_func ::= CURRENT_USER", + /* 543 */ "noarg_func ::= USER", + /* 544 */ "star_func ::= COUNT", + /* 545 */ "star_func ::= FIRST", + /* 546 */ "star_func ::= LAST", + /* 547 */ "star_func ::= LAST_ROW", + /* 548 */ "star_func_para_list ::= NK_STAR", + /* 549 */ "star_func_para_list ::= other_para_list", + /* 550 */ "other_para_list ::= star_func_para", + /* 551 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 552 */ "star_func_para ::= expr_or_subquery", + /* 553 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 554 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 555 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 556 */ "when_then_list ::= when_then_expr", + /* 557 */ "when_then_list ::= when_then_list when_then_expr", + /* 558 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 559 */ "case_when_else_opt ::=", + /* 560 */ "case_when_else_opt ::= ELSE common_expression", + /* 561 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 562 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 563 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 564 */ "predicate ::= expr_or_subquery IS NULL", + /* 565 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 566 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 567 */ "compare_op ::= NK_LT", + /* 568 */ "compare_op ::= NK_GT", + /* 569 */ "compare_op ::= NK_LE", + /* 570 */ "compare_op ::= NK_GE", + /* 571 */ "compare_op ::= NK_NE", + /* 572 */ "compare_op ::= NK_EQ", + /* 573 */ "compare_op ::= LIKE", + /* 574 */ "compare_op ::= NOT LIKE", + /* 575 */ "compare_op ::= MATCH", + /* 576 */ "compare_op ::= NMATCH", + /* 577 */ "compare_op ::= CONTAINS", + /* 578 */ "in_op ::= IN", + /* 579 */ "in_op ::= NOT IN", + /* 580 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 581 */ "boolean_value_expression ::= boolean_primary", + /* 582 */ "boolean_value_expression ::= NOT boolean_primary", + /* 583 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 584 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 585 */ "boolean_primary ::= predicate", + /* 586 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 587 */ "common_expression ::= expr_or_subquery", + /* 588 */ "common_expression ::= boolean_value_expression", + /* 589 */ "from_clause_opt ::=", + /* 590 */ "from_clause_opt ::= FROM table_reference_list", + /* 591 */ "table_reference_list ::= table_reference", + /* 592 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 593 */ "table_reference ::= table_primary", + /* 594 */ "table_reference ::= joined_table", + /* 595 */ "table_primary ::= table_name alias_opt", + /* 596 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 597 */ "table_primary ::= subquery alias_opt", + /* 598 */ "table_primary ::= parenthesized_joined_table", + /* 599 */ "alias_opt ::=", + /* 600 */ "alias_opt ::= table_alias", + /* 601 */ "alias_opt ::= AS table_alias", + /* 602 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 603 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 604 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 605 */ "join_type ::=", + /* 606 */ "join_type ::= INNER", + /* 607 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 608 */ "hint_list ::=", + /* 609 */ "hint_list ::= NK_HINT", + /* 610 */ "tag_mode_opt ::=", + /* 611 */ "tag_mode_opt ::= TAGS", + /* 612 */ "set_quantifier_opt ::=", + /* 613 */ "set_quantifier_opt ::= DISTINCT", + /* 614 */ "set_quantifier_opt ::= ALL", + /* 615 */ "select_list ::= select_item", + /* 616 */ "select_list ::= select_list NK_COMMA select_item", + /* 617 */ "select_item ::= NK_STAR", + /* 618 */ "select_item ::= common_expression", + /* 619 */ "select_item ::= common_expression column_alias", + /* 620 */ "select_item ::= common_expression AS column_alias", + /* 621 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 622 */ "where_clause_opt ::=", + /* 623 */ "where_clause_opt ::= WHERE search_condition", + /* 624 */ "partition_by_clause_opt ::=", + /* 625 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 626 */ "partition_list ::= partition_item", + /* 627 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 628 */ "partition_item ::= expr_or_subquery", + /* 629 */ "partition_item ::= expr_or_subquery column_alias", + /* 630 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 631 */ "twindow_clause_opt ::=", + /* 632 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", + /* 633 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 634 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 635 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 636 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 637 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", + /* 638 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 639 */ "sliding_opt ::=", + /* 640 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", + /* 641 */ "interval_sliding_duration_literal ::= NK_VARIABLE", + /* 642 */ "interval_sliding_duration_literal ::= NK_STRING", + /* 643 */ "interval_sliding_duration_literal ::= NK_INTEGER", + /* 644 */ "fill_opt ::=", + /* 645 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 646 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", + /* 647 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", + /* 648 */ "fill_mode ::= NONE", + /* 649 */ "fill_mode ::= PREV", + /* 650 */ "fill_mode ::= NULL", + /* 651 */ "fill_mode ::= NULL_F", + /* 652 */ "fill_mode ::= LINEAR", + /* 653 */ "fill_mode ::= NEXT", + /* 654 */ "group_by_clause_opt ::=", + /* 655 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 656 */ "group_by_list ::= expr_or_subquery", + /* 657 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 658 */ "having_clause_opt ::=", + /* 659 */ "having_clause_opt ::= HAVING search_condition", + /* 660 */ "range_opt ::=", + /* 661 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 662 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", + /* 663 */ "every_opt ::=", + /* 664 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 665 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 666 */ "query_simple ::= query_specification", + /* 667 */ "query_simple ::= union_query_expression", + /* 668 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 669 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 670 */ "query_simple_or_subquery ::= query_simple", + /* 671 */ "query_simple_or_subquery ::= subquery", + /* 672 */ "query_or_subquery ::= query_expression", + /* 673 */ "query_or_subquery ::= subquery", + /* 674 */ "order_by_clause_opt ::=", + /* 675 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 676 */ "slimit_clause_opt ::=", + /* 677 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 678 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 679 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 680 */ "limit_clause_opt ::=", + /* 681 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 682 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 683 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 684 */ "subquery ::= NK_LP query_expression NK_RP", + /* 685 */ "subquery ::= NK_LP subquery NK_RP", + /* 686 */ "search_condition ::= common_expression", + /* 687 */ "sort_specification_list ::= sort_specification", + /* 688 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 689 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 690 */ "ordering_specification_opt ::=", + /* 691 */ "ordering_specification_opt ::= ASC", + /* 692 */ "ordering_specification_opt ::= DESC", + /* 693 */ "null_ordering_opt ::=", + /* 694 */ "null_ordering_opt ::= NULLS FIRST", + /* 695 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2936,47 +3313,48 @@ static void yy_destructor( case 445: /* full_view_name */ case 448: /* stream_options */ case 451: /* subtable_opt */ - case 453: /* expression */ - case 456: /* literal_func */ - case 457: /* signed_literal */ - case 460: /* expr_or_subquery */ - case 461: /* pseudo_column */ - case 462: /* column_reference */ - case 463: /* function_expression */ - case 464: /* case_when_expression */ - case 469: /* star_func_para */ - case 471: /* case_when_else_opt */ - case 472: /* common_expression */ - case 473: /* when_then_expr */ - case 474: /* predicate */ - case 477: /* in_predicate_value */ - case 478: /* boolean_value_expression */ - case 479: /* boolean_primary */ - case 480: /* from_clause_opt */ - case 481: /* table_reference_list */ - case 482: /* table_reference */ - case 483: /* table_primary */ - case 484: /* joined_table */ - case 486: /* subquery */ - case 487: /* parenthesized_joined_table */ - case 489: /* query_specification */ - case 495: /* range_opt */ - case 496: /* every_opt */ - case 497: /* fill_opt */ - case 498: /* twindow_clause_opt */ - case 500: /* having_clause_opt */ - case 501: /* select_item */ - case 503: /* partition_item */ - case 504: /* interval_sliding_duration_literal */ - case 507: /* query_expression */ - case 508: /* query_simple */ - case 510: /* slimit_clause_opt */ - case 511: /* limit_clause_opt */ - case 512: /* union_query_expression */ - case 513: /* query_simple_or_subquery */ - case 515: /* sort_specification */ + case 454: /* column_stream_def */ + case 455: /* expression */ + case 458: /* literal_func */ + case 459: /* signed_literal */ + case 462: /* expr_or_subquery */ + case 463: /* pseudo_column */ + case 464: /* column_reference */ + case 465: /* function_expression */ + case 466: /* case_when_expression */ + case 471: /* star_func_para */ + case 473: /* case_when_else_opt */ + case 474: /* common_expression */ + case 475: /* when_then_expr */ + case 476: /* predicate */ + case 479: /* in_predicate_value */ + case 480: /* boolean_value_expression */ + case 481: /* boolean_primary */ + case 482: /* from_clause_opt */ + case 483: /* table_reference_list */ + case 484: /* table_reference */ + case 485: /* table_primary */ + case 486: /* joined_table */ + case 488: /* subquery */ + case 489: /* parenthesized_joined_table */ + case 491: /* query_specification */ + case 497: /* range_opt */ + case 498: /* every_opt */ + case 499: /* fill_opt */ + case 500: /* twindow_clause_opt */ + case 502: /* having_clause_opt */ + case 503: /* select_item */ + case 505: /* partition_item */ + case 506: /* interval_sliding_duration_literal */ + case 509: /* query_expression */ + case 510: /* query_simple */ + case 512: /* slimit_clause_opt */ + case 513: /* limit_clause_opt */ + case 514: /* union_query_expression */ + case 515: /* query_simple_or_subquery */ + case 517: /* sort_specification */ { - nodesDestroyNode((yypminor->yy896)); + nodesDestroyNode((yypminor->yy392)); } break; case 356: /* account_options */ @@ -3010,21 +3388,22 @@ static void yy_destructor( case 433: /* expression_list */ case 449: /* col_list_opt */ case 450: /* tag_def_or_ref_opt */ - case 455: /* dnode_list */ - case 458: /* literal_list */ - case 466: /* star_func_para_list */ - case 468: /* other_para_list */ - case 470: /* when_then_list */ - case 490: /* hint_list */ - case 493: /* select_list */ - case 494: /* partition_by_clause_opt */ - case 499: /* group_by_clause_opt */ - case 502: /* partition_list */ - case 506: /* group_by_list */ - case 509: /* order_by_clause_opt */ - case 514: /* sort_specification_list */ + case 453: /* column_stream_def_list */ + case 457: /* dnode_list */ + case 460: /* literal_list */ + case 468: /* star_func_para_list */ + case 470: /* other_para_list */ + case 472: /* when_then_list */ + case 492: /* hint_list */ + case 495: /* select_list */ + case 496: /* partition_by_clause_opt */ + case 501: /* group_by_clause_opt */ + case 504: /* partition_list */ + case 508: /* group_by_list */ + case 511: /* order_by_clause_opt */ + case 516: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy404)); + nodesDestroyList((yypminor->yy184)); } break; case 363: /* user_name */ @@ -3041,11 +3420,11 @@ static void yy_destructor( case 444: /* language_opt */ case 446: /* view_name */ case 447: /* stream_name */ - case 454: /* on_vgroup_id */ - case 459: /* table_alias */ - case 465: /* star_func */ - case 467: /* noarg_func */ - case 485: /* alias_opt */ + case 456: /* on_vgroup_id */ + case 461: /* table_alias */ + case 467: /* star_func */ + case 469: /* noarg_func */ + case 487: /* alias_opt */ { } @@ -3075,8 +3454,8 @@ static void yy_destructor( case 441: /* or_replace_opt */ case 442: /* agg_func_opt */ case 452: /* ignore_opt */ - case 491: /* set_quantifier_opt */ - case 492: /* tag_mode_opt */ + case 493: /* set_quantifier_opt */ + case 494: /* tag_mode_opt */ { } @@ -3103,28 +3482,28 @@ static void yy_destructor( } break; - case 475: /* compare_op */ - case 476: /* in_op */ + case 477: /* compare_op */ + case 478: /* in_op */ { } break; - case 488: /* join_type */ + case 490: /* join_type */ { } break; - case 505: /* fill_mode */ + case 507: /* fill_mode */ { } break; - case 516: /* ordering_specification_opt */ + case 518: /* ordering_specification_opt */ { } break; - case 517: /* null_ordering_opt */ + case 519: /* null_ordering_opt */ { } @@ -3293,7 +3672,7 @@ static YYACTIONTYPE yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ - assert( i>=0 && i=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) ); return yy_action[i]; } }while(1); @@ -3791,302 +4170,326 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 355, /* (373) cmd ::= PAUSE STREAM exists_opt stream_name */ 355, /* (374) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ 449, /* (375) col_list_opt ::= */ - 449, /* (376) col_list_opt ::= NK_LP col_name_list NK_RP */ - 450, /* (377) tag_def_or_ref_opt ::= */ - 450, /* (378) tag_def_or_ref_opt ::= tags_def */ - 450, /* (379) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 448, /* (380) stream_options ::= */ - 448, /* (381) stream_options ::= stream_options TRIGGER AT_ONCE */ - 448, /* (382) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 448, /* (383) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 448, /* (384) stream_options ::= stream_options WATERMARK duration_literal */ - 448, /* (385) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 448, /* (386) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 448, /* (387) stream_options ::= stream_options DELETE_MARK duration_literal */ - 448, /* (388) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 451, /* (389) subtable_opt ::= */ - 451, /* (390) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 452, /* (391) ignore_opt ::= */ - 452, /* (392) ignore_opt ::= IGNORE UNTREATED */ - 355, /* (393) cmd ::= KILL CONNECTION NK_INTEGER */ - 355, /* (394) cmd ::= KILL QUERY NK_STRING */ - 355, /* (395) cmd ::= KILL TRANSACTION NK_INTEGER */ - 355, /* (396) cmd ::= KILL COMPACT NK_INTEGER */ - 355, /* (397) cmd ::= BALANCE VGROUP */ - 355, /* (398) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - 355, /* (399) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 355, /* (400) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 355, /* (401) cmd ::= SPLIT VGROUP NK_INTEGER */ - 454, /* (402) on_vgroup_id ::= */ - 454, /* (403) on_vgroup_id ::= ON NK_INTEGER */ - 455, /* (404) dnode_list ::= DNODE NK_INTEGER */ - 455, /* (405) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 355, /* (406) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 355, /* (407) cmd ::= query_or_subquery */ - 355, /* (408) cmd ::= insert_query */ - 440, /* (409) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 440, /* (410) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - 401, /* (411) tags_literal ::= NK_INTEGER */ - 401, /* (412) tags_literal ::= NK_PLUS NK_INTEGER */ - 401, /* (413) tags_literal ::= NK_MINUS NK_INTEGER */ - 401, /* (414) tags_literal ::= NK_FLOAT */ - 401, /* (415) tags_literal ::= NK_PLUS NK_FLOAT */ - 401, /* (416) tags_literal ::= NK_MINUS NK_FLOAT */ - 401, /* (417) tags_literal ::= NK_BIN */ - 401, /* (418) tags_literal ::= NK_PLUS NK_BIN */ - 401, /* (419) tags_literal ::= NK_MINUS NK_BIN */ - 401, /* (420) tags_literal ::= NK_HEX */ - 401, /* (421) tags_literal ::= NK_PLUS NK_HEX */ - 401, /* (422) tags_literal ::= NK_MINUS NK_HEX */ - 401, /* (423) tags_literal ::= NK_STRING */ - 401, /* (424) tags_literal ::= NK_BOOL */ - 401, /* (425) tags_literal ::= NULL */ - 401, /* (426) tags_literal ::= literal_func */ - 401, /* (427) tags_literal ::= literal_func NK_PLUS duration_literal */ - 401, /* (428) tags_literal ::= literal_func NK_MINUS duration_literal */ - 404, /* (429) tags_literal_list ::= tags_literal */ - 404, /* (430) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ - 358, /* (431) literal ::= NK_INTEGER */ - 358, /* (432) literal ::= NK_FLOAT */ - 358, /* (433) literal ::= NK_STRING */ - 358, /* (434) literal ::= NK_BOOL */ - 358, /* (435) literal ::= TIMESTAMP NK_STRING */ - 358, /* (436) literal ::= duration_literal */ - 358, /* (437) literal ::= NULL */ - 358, /* (438) literal ::= NK_QUESTION */ - 411, /* (439) duration_literal ::= NK_VARIABLE */ - 387, /* (440) signed ::= NK_INTEGER */ - 387, /* (441) signed ::= NK_PLUS NK_INTEGER */ - 387, /* (442) signed ::= NK_MINUS NK_INTEGER */ - 387, /* (443) signed ::= NK_FLOAT */ - 387, /* (444) signed ::= NK_PLUS NK_FLOAT */ - 387, /* (445) signed ::= NK_MINUS NK_FLOAT */ - 457, /* (446) signed_literal ::= signed */ - 457, /* (447) signed_literal ::= NK_STRING */ - 457, /* (448) signed_literal ::= NK_BOOL */ - 457, /* (449) signed_literal ::= TIMESTAMP NK_STRING */ - 457, /* (450) signed_literal ::= duration_literal */ - 457, /* (451) signed_literal ::= NULL */ - 457, /* (452) signed_literal ::= literal_func */ - 457, /* (453) signed_literal ::= NK_QUESTION */ - 458, /* (454) literal_list ::= signed_literal */ - 458, /* (455) literal_list ::= literal_list NK_COMMA signed_literal */ - 370, /* (456) db_name ::= NK_ID */ - 371, /* (457) table_name ::= NK_ID */ - 399, /* (458) column_name ::= NK_ID */ - 413, /* (459) function_name ::= NK_ID */ - 446, /* (460) view_name ::= NK_ID */ - 459, /* (461) table_alias ::= NK_ID */ - 424, /* (462) column_alias ::= NK_ID */ - 424, /* (463) column_alias ::= NK_ALIAS */ - 363, /* (464) user_name ::= NK_ID */ - 372, /* (465) topic_name ::= NK_ID */ - 447, /* (466) stream_name ::= NK_ID */ - 437, /* (467) cgroup_name ::= NK_ID */ - 427, /* (468) index_name ::= NK_ID */ - 460, /* (469) expr_or_subquery ::= expression */ - 453, /* (470) expression ::= literal */ - 453, /* (471) expression ::= pseudo_column */ - 453, /* (472) expression ::= column_reference */ - 453, /* (473) expression ::= function_expression */ - 453, /* (474) expression ::= case_when_expression */ - 453, /* (475) expression ::= NK_LP expression NK_RP */ - 453, /* (476) expression ::= NK_PLUS expr_or_subquery */ - 453, /* (477) expression ::= NK_MINUS expr_or_subquery */ - 453, /* (478) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 453, /* (479) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 453, /* (480) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 453, /* (481) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 453, /* (482) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 453, /* (483) expression ::= column_reference NK_ARROW NK_STRING */ - 453, /* (484) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 453, /* (485) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 433, /* (486) expression_list ::= expr_or_subquery */ - 433, /* (487) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 462, /* (488) column_reference ::= column_name */ - 462, /* (489) column_reference ::= table_name NK_DOT column_name */ - 462, /* (490) column_reference ::= NK_ALIAS */ - 462, /* (491) column_reference ::= table_name NK_DOT NK_ALIAS */ - 461, /* (492) pseudo_column ::= ROWTS */ - 461, /* (493) pseudo_column ::= TBNAME */ - 461, /* (494) pseudo_column ::= table_name NK_DOT TBNAME */ - 461, /* (495) pseudo_column ::= QSTART */ - 461, /* (496) pseudo_column ::= QEND */ - 461, /* (497) pseudo_column ::= QDURATION */ - 461, /* (498) pseudo_column ::= WSTART */ - 461, /* (499) pseudo_column ::= WEND */ - 461, /* (500) pseudo_column ::= WDURATION */ - 461, /* (501) pseudo_column ::= IROWTS */ - 461, /* (502) pseudo_column ::= ISFILLED */ - 461, /* (503) pseudo_column ::= QTAGS */ - 463, /* (504) function_expression ::= function_name NK_LP expression_list NK_RP */ - 463, /* (505) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 463, /* (506) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 463, /* (507) function_expression ::= literal_func */ - 456, /* (508) literal_func ::= noarg_func NK_LP NK_RP */ - 456, /* (509) literal_func ::= NOW */ - 456, /* (510) literal_func ::= TODAY */ - 467, /* (511) noarg_func ::= NOW */ - 467, /* (512) noarg_func ::= TODAY */ - 467, /* (513) noarg_func ::= TIMEZONE */ - 467, /* (514) noarg_func ::= DATABASE */ - 467, /* (515) noarg_func ::= CLIENT_VERSION */ - 467, /* (516) noarg_func ::= SERVER_VERSION */ - 467, /* (517) noarg_func ::= SERVER_STATUS */ - 467, /* (518) noarg_func ::= CURRENT_USER */ - 467, /* (519) noarg_func ::= USER */ - 465, /* (520) star_func ::= COUNT */ - 465, /* (521) star_func ::= FIRST */ - 465, /* (522) star_func ::= LAST */ - 465, /* (523) star_func ::= LAST_ROW */ - 466, /* (524) star_func_para_list ::= NK_STAR */ - 466, /* (525) star_func_para_list ::= other_para_list */ - 468, /* (526) other_para_list ::= star_func_para */ - 468, /* (527) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 469, /* (528) star_func_para ::= expr_or_subquery */ - 469, /* (529) star_func_para ::= table_name NK_DOT NK_STAR */ - 464, /* (530) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 464, /* (531) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 470, /* (532) when_then_list ::= when_then_expr */ - 470, /* (533) when_then_list ::= when_then_list when_then_expr */ - 473, /* (534) when_then_expr ::= WHEN common_expression THEN common_expression */ - 471, /* (535) case_when_else_opt ::= */ - 471, /* (536) case_when_else_opt ::= ELSE common_expression */ - 474, /* (537) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 474, /* (538) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 474, /* (539) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 474, /* (540) predicate ::= expr_or_subquery IS NULL */ - 474, /* (541) predicate ::= expr_or_subquery IS NOT NULL */ - 474, /* (542) predicate ::= expr_or_subquery in_op in_predicate_value */ - 475, /* (543) compare_op ::= NK_LT */ - 475, /* (544) compare_op ::= NK_GT */ - 475, /* (545) compare_op ::= NK_LE */ - 475, /* (546) compare_op ::= NK_GE */ - 475, /* (547) compare_op ::= NK_NE */ - 475, /* (548) compare_op ::= NK_EQ */ - 475, /* (549) compare_op ::= LIKE */ - 475, /* (550) compare_op ::= NOT LIKE */ - 475, /* (551) compare_op ::= MATCH */ - 475, /* (552) compare_op ::= NMATCH */ - 475, /* (553) compare_op ::= CONTAINS */ - 476, /* (554) in_op ::= IN */ - 476, /* (555) in_op ::= NOT IN */ - 477, /* (556) in_predicate_value ::= NK_LP literal_list NK_RP */ - 478, /* (557) boolean_value_expression ::= boolean_primary */ - 478, /* (558) boolean_value_expression ::= NOT boolean_primary */ - 478, /* (559) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 478, /* (560) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 479, /* (561) boolean_primary ::= predicate */ - 479, /* (562) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 472, /* (563) common_expression ::= expr_or_subquery */ - 472, /* (564) common_expression ::= boolean_value_expression */ - 480, /* (565) from_clause_opt ::= */ - 480, /* (566) from_clause_opt ::= FROM table_reference_list */ - 481, /* (567) table_reference_list ::= table_reference */ - 481, /* (568) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 482, /* (569) table_reference ::= table_primary */ - 482, /* (570) table_reference ::= joined_table */ - 483, /* (571) table_primary ::= table_name alias_opt */ - 483, /* (572) table_primary ::= db_name NK_DOT table_name alias_opt */ - 483, /* (573) table_primary ::= subquery alias_opt */ - 483, /* (574) table_primary ::= parenthesized_joined_table */ - 485, /* (575) alias_opt ::= */ - 485, /* (576) alias_opt ::= table_alias */ - 485, /* (577) alias_opt ::= AS table_alias */ - 487, /* (578) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 487, /* (579) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 484, /* (580) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 488, /* (581) join_type ::= */ - 488, /* (582) join_type ::= INNER */ - 489, /* (583) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - 490, /* (584) hint_list ::= */ - 490, /* (585) hint_list ::= NK_HINT */ - 492, /* (586) tag_mode_opt ::= */ - 492, /* (587) tag_mode_opt ::= TAGS */ - 491, /* (588) set_quantifier_opt ::= */ - 491, /* (589) set_quantifier_opt ::= DISTINCT */ - 491, /* (590) set_quantifier_opt ::= ALL */ - 493, /* (591) select_list ::= select_item */ - 493, /* (592) select_list ::= select_list NK_COMMA select_item */ - 501, /* (593) select_item ::= NK_STAR */ - 501, /* (594) select_item ::= common_expression */ - 501, /* (595) select_item ::= common_expression column_alias */ - 501, /* (596) select_item ::= common_expression AS column_alias */ - 501, /* (597) select_item ::= table_name NK_DOT NK_STAR */ - 436, /* (598) where_clause_opt ::= */ - 436, /* (599) where_clause_opt ::= WHERE search_condition */ - 494, /* (600) partition_by_clause_opt ::= */ - 494, /* (601) partition_by_clause_opt ::= PARTITION BY partition_list */ - 502, /* (602) partition_list ::= partition_item */ - 502, /* (603) partition_list ::= partition_list NK_COMMA partition_item */ - 503, /* (604) partition_item ::= expr_or_subquery */ - 503, /* (605) partition_item ::= expr_or_subquery column_alias */ - 503, /* (606) partition_item ::= expr_or_subquery AS column_alias */ - 498, /* (607) twindow_clause_opt ::= */ - 498, /* (608) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - 498, /* (609) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 498, /* (610) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 498, /* (611) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 498, /* (612) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 498, /* (613) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - 498, /* (614) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 429, /* (615) sliding_opt ::= */ - 429, /* (616) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - 504, /* (617) interval_sliding_duration_literal ::= NK_VARIABLE */ - 504, /* (618) interval_sliding_duration_literal ::= NK_STRING */ - 504, /* (619) interval_sliding_duration_literal ::= NK_INTEGER */ - 497, /* (620) fill_opt ::= */ - 497, /* (621) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 497, /* (622) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - 497, /* (623) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - 505, /* (624) fill_mode ::= NONE */ - 505, /* (625) fill_mode ::= PREV */ - 505, /* (626) fill_mode ::= NULL */ - 505, /* (627) fill_mode ::= NULL_F */ - 505, /* (628) fill_mode ::= LINEAR */ - 505, /* (629) fill_mode ::= NEXT */ - 499, /* (630) group_by_clause_opt ::= */ - 499, /* (631) group_by_clause_opt ::= GROUP BY group_by_list */ - 506, /* (632) group_by_list ::= expr_or_subquery */ - 506, /* (633) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 500, /* (634) having_clause_opt ::= */ - 500, /* (635) having_clause_opt ::= HAVING search_condition */ - 495, /* (636) range_opt ::= */ - 495, /* (637) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 495, /* (638) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 496, /* (639) every_opt ::= */ - 496, /* (640) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 507, /* (641) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 508, /* (642) query_simple ::= query_specification */ - 508, /* (643) query_simple ::= union_query_expression */ - 512, /* (644) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 512, /* (645) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 513, /* (646) query_simple_or_subquery ::= query_simple */ - 513, /* (647) query_simple_or_subquery ::= subquery */ - 435, /* (648) query_or_subquery ::= query_expression */ - 435, /* (649) query_or_subquery ::= subquery */ - 509, /* (650) order_by_clause_opt ::= */ - 509, /* (651) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 510, /* (652) slimit_clause_opt ::= */ - 510, /* (653) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 510, /* (654) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 510, /* (655) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 511, /* (656) limit_clause_opt ::= */ - 511, /* (657) limit_clause_opt ::= LIMIT NK_INTEGER */ - 511, /* (658) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 511, /* (659) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 486, /* (660) subquery ::= NK_LP query_expression NK_RP */ - 486, /* (661) subquery ::= NK_LP subquery NK_RP */ - 373, /* (662) search_condition ::= common_expression */ - 514, /* (663) sort_specification_list ::= sort_specification */ - 514, /* (664) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 515, /* (665) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 516, /* (666) ordering_specification_opt ::= */ - 516, /* (667) ordering_specification_opt ::= ASC */ - 516, /* (668) ordering_specification_opt ::= DESC */ - 517, /* (669) null_ordering_opt ::= */ - 517, /* (670) null_ordering_opt ::= NULLS FIRST */ - 517, /* (671) null_ordering_opt ::= NULLS LAST */ + 449, /* (376) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ + 453, /* (377) column_stream_def_list ::= column_stream_def */ + 453, /* (378) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ + 454, /* (379) column_stream_def ::= column_name */ + 454, /* (380) column_stream_def ::= column_name PRIMARY KEY */ + 450, /* (381) tag_def_or_ref_opt ::= */ + 450, /* (382) tag_def_or_ref_opt ::= tags_def */ + 450, /* (383) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ + 448, /* (384) stream_options ::= */ + 448, /* (385) stream_options ::= stream_options TRIGGER AT_ONCE */ + 448, /* (386) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + 448, /* (387) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + 448, /* (388) stream_options ::= stream_options WATERMARK duration_literal */ + 448, /* (389) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + 448, /* (390) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + 448, /* (391) stream_options ::= stream_options DELETE_MARK duration_literal */ + 448, /* (392) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 451, /* (393) subtable_opt ::= */ + 451, /* (394) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 452, /* (395) ignore_opt ::= */ + 452, /* (396) ignore_opt ::= IGNORE UNTREATED */ + 355, /* (397) cmd ::= KILL CONNECTION NK_INTEGER */ + 355, /* (398) cmd ::= KILL QUERY NK_STRING */ + 355, /* (399) cmd ::= KILL TRANSACTION NK_INTEGER */ + 355, /* (400) cmd ::= KILL COMPACT NK_INTEGER */ + 355, /* (401) cmd ::= BALANCE VGROUP */ + 355, /* (402) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + 355, /* (403) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + 355, /* (404) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + 355, /* (405) cmd ::= SPLIT VGROUP NK_INTEGER */ + 456, /* (406) on_vgroup_id ::= */ + 456, /* (407) on_vgroup_id ::= ON NK_INTEGER */ + 457, /* (408) dnode_list ::= DNODE NK_INTEGER */ + 457, /* (409) dnode_list ::= dnode_list DNODE NK_INTEGER */ + 355, /* (410) cmd ::= DELETE FROM full_table_name where_clause_opt */ + 355, /* (411) cmd ::= query_or_subquery */ + 355, /* (412) cmd ::= insert_query */ + 440, /* (413) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + 440, /* (414) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + 401, /* (415) tags_literal ::= NK_INTEGER */ + 401, /* (416) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + 401, /* (417) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ + 401, /* (418) tags_literal ::= NK_PLUS NK_INTEGER */ + 401, /* (419) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + 401, /* (420) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ + 401, /* (421) tags_literal ::= NK_MINUS NK_INTEGER */ + 401, /* (422) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ + 401, /* (423) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ + 401, /* (424) tags_literal ::= NK_FLOAT */ + 401, /* (425) tags_literal ::= NK_PLUS NK_FLOAT */ + 401, /* (426) tags_literal ::= NK_MINUS NK_FLOAT */ + 401, /* (427) tags_literal ::= NK_BIN */ + 401, /* (428) tags_literal ::= NK_BIN NK_PLUS duration_literal */ + 401, /* (429) tags_literal ::= NK_BIN NK_MINUS duration_literal */ + 401, /* (430) tags_literal ::= NK_PLUS NK_BIN */ + 401, /* (431) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ + 401, /* (432) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ + 401, /* (433) tags_literal ::= NK_MINUS NK_BIN */ + 401, /* (434) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ + 401, /* (435) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ + 401, /* (436) tags_literal ::= NK_HEX */ + 401, /* (437) tags_literal ::= NK_HEX NK_PLUS duration_literal */ + 401, /* (438) tags_literal ::= NK_HEX NK_MINUS duration_literal */ + 401, /* (439) tags_literal ::= NK_PLUS NK_HEX */ + 401, /* (440) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ + 401, /* (441) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ + 401, /* (442) tags_literal ::= NK_MINUS NK_HEX */ + 401, /* (443) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ + 401, /* (444) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ + 401, /* (445) tags_literal ::= NK_STRING */ + 401, /* (446) tags_literal ::= NK_STRING NK_PLUS duration_literal */ + 401, /* (447) tags_literal ::= NK_STRING NK_MINUS duration_literal */ + 401, /* (448) tags_literal ::= NK_BOOL */ + 401, /* (449) tags_literal ::= NULL */ + 401, /* (450) tags_literal ::= literal_func */ + 401, /* (451) tags_literal ::= literal_func NK_PLUS duration_literal */ + 401, /* (452) tags_literal ::= literal_func NK_MINUS duration_literal */ + 404, /* (453) tags_literal_list ::= tags_literal */ + 404, /* (454) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ + 358, /* (455) literal ::= NK_INTEGER */ + 358, /* (456) literal ::= NK_FLOAT */ + 358, /* (457) literal ::= NK_STRING */ + 358, /* (458) literal ::= NK_BOOL */ + 358, /* (459) literal ::= TIMESTAMP NK_STRING */ + 358, /* (460) literal ::= duration_literal */ + 358, /* (461) literal ::= NULL */ + 358, /* (462) literal ::= NK_QUESTION */ + 411, /* (463) duration_literal ::= NK_VARIABLE */ + 387, /* (464) signed ::= NK_INTEGER */ + 387, /* (465) signed ::= NK_PLUS NK_INTEGER */ + 387, /* (466) signed ::= NK_MINUS NK_INTEGER */ + 387, /* (467) signed ::= NK_FLOAT */ + 387, /* (468) signed ::= NK_PLUS NK_FLOAT */ + 387, /* (469) signed ::= NK_MINUS NK_FLOAT */ + 459, /* (470) signed_literal ::= signed */ + 459, /* (471) signed_literal ::= NK_STRING */ + 459, /* (472) signed_literal ::= NK_BOOL */ + 459, /* (473) signed_literal ::= TIMESTAMP NK_STRING */ + 459, /* (474) signed_literal ::= duration_literal */ + 459, /* (475) signed_literal ::= NULL */ + 459, /* (476) signed_literal ::= literal_func */ + 459, /* (477) signed_literal ::= NK_QUESTION */ + 460, /* (478) literal_list ::= signed_literal */ + 460, /* (479) literal_list ::= literal_list NK_COMMA signed_literal */ + 370, /* (480) db_name ::= NK_ID */ + 371, /* (481) table_name ::= NK_ID */ + 399, /* (482) column_name ::= NK_ID */ + 413, /* (483) function_name ::= NK_ID */ + 446, /* (484) view_name ::= NK_ID */ + 461, /* (485) table_alias ::= NK_ID */ + 424, /* (486) column_alias ::= NK_ID */ + 424, /* (487) column_alias ::= NK_ALIAS */ + 363, /* (488) user_name ::= NK_ID */ + 372, /* (489) topic_name ::= NK_ID */ + 447, /* (490) stream_name ::= NK_ID */ + 437, /* (491) cgroup_name ::= NK_ID */ + 427, /* (492) index_name ::= NK_ID */ + 462, /* (493) expr_or_subquery ::= expression */ + 455, /* (494) expression ::= literal */ + 455, /* (495) expression ::= pseudo_column */ + 455, /* (496) expression ::= column_reference */ + 455, /* (497) expression ::= function_expression */ + 455, /* (498) expression ::= case_when_expression */ + 455, /* (499) expression ::= NK_LP expression NK_RP */ + 455, /* (500) expression ::= NK_PLUS expr_or_subquery */ + 455, /* (501) expression ::= NK_MINUS expr_or_subquery */ + 455, /* (502) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + 455, /* (503) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + 455, /* (504) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + 455, /* (505) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + 455, /* (506) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + 455, /* (507) expression ::= column_reference NK_ARROW NK_STRING */ + 455, /* (508) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + 455, /* (509) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + 433, /* (510) expression_list ::= expr_or_subquery */ + 433, /* (511) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + 464, /* (512) column_reference ::= column_name */ + 464, /* (513) column_reference ::= table_name NK_DOT column_name */ + 464, /* (514) column_reference ::= NK_ALIAS */ + 464, /* (515) column_reference ::= table_name NK_DOT NK_ALIAS */ + 463, /* (516) pseudo_column ::= ROWTS */ + 463, /* (517) pseudo_column ::= TBNAME */ + 463, /* (518) pseudo_column ::= table_name NK_DOT TBNAME */ + 463, /* (519) pseudo_column ::= QSTART */ + 463, /* (520) pseudo_column ::= QEND */ + 463, /* (521) pseudo_column ::= QDURATION */ + 463, /* (522) pseudo_column ::= WSTART */ + 463, /* (523) pseudo_column ::= WEND */ + 463, /* (524) pseudo_column ::= WDURATION */ + 463, /* (525) pseudo_column ::= IROWTS */ + 463, /* (526) pseudo_column ::= ISFILLED */ + 463, /* (527) pseudo_column ::= QTAGS */ + 465, /* (528) function_expression ::= function_name NK_LP expression_list NK_RP */ + 465, /* (529) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + 465, /* (530) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + 465, /* (531) function_expression ::= literal_func */ + 458, /* (532) literal_func ::= noarg_func NK_LP NK_RP */ + 458, /* (533) literal_func ::= NOW */ + 458, /* (534) literal_func ::= TODAY */ + 469, /* (535) noarg_func ::= NOW */ + 469, /* (536) noarg_func ::= TODAY */ + 469, /* (537) noarg_func ::= TIMEZONE */ + 469, /* (538) noarg_func ::= DATABASE */ + 469, /* (539) noarg_func ::= CLIENT_VERSION */ + 469, /* (540) noarg_func ::= SERVER_VERSION */ + 469, /* (541) noarg_func ::= SERVER_STATUS */ + 469, /* (542) noarg_func ::= CURRENT_USER */ + 469, /* (543) noarg_func ::= USER */ + 467, /* (544) star_func ::= COUNT */ + 467, /* (545) star_func ::= FIRST */ + 467, /* (546) star_func ::= LAST */ + 467, /* (547) star_func ::= LAST_ROW */ + 468, /* (548) star_func_para_list ::= NK_STAR */ + 468, /* (549) star_func_para_list ::= other_para_list */ + 470, /* (550) other_para_list ::= star_func_para */ + 470, /* (551) other_para_list ::= other_para_list NK_COMMA star_func_para */ + 471, /* (552) star_func_para ::= expr_or_subquery */ + 471, /* (553) star_func_para ::= table_name NK_DOT NK_STAR */ + 466, /* (554) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + 466, /* (555) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + 472, /* (556) when_then_list ::= when_then_expr */ + 472, /* (557) when_then_list ::= when_then_list when_then_expr */ + 475, /* (558) when_then_expr ::= WHEN common_expression THEN common_expression */ + 473, /* (559) case_when_else_opt ::= */ + 473, /* (560) case_when_else_opt ::= ELSE common_expression */ + 476, /* (561) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + 476, /* (562) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + 476, /* (563) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + 476, /* (564) predicate ::= expr_or_subquery IS NULL */ + 476, /* (565) predicate ::= expr_or_subquery IS NOT NULL */ + 476, /* (566) predicate ::= expr_or_subquery in_op in_predicate_value */ + 477, /* (567) compare_op ::= NK_LT */ + 477, /* (568) compare_op ::= NK_GT */ + 477, /* (569) compare_op ::= NK_LE */ + 477, /* (570) compare_op ::= NK_GE */ + 477, /* (571) compare_op ::= NK_NE */ + 477, /* (572) compare_op ::= NK_EQ */ + 477, /* (573) compare_op ::= LIKE */ + 477, /* (574) compare_op ::= NOT LIKE */ + 477, /* (575) compare_op ::= MATCH */ + 477, /* (576) compare_op ::= NMATCH */ + 477, /* (577) compare_op ::= CONTAINS */ + 478, /* (578) in_op ::= IN */ + 478, /* (579) in_op ::= NOT IN */ + 479, /* (580) in_predicate_value ::= NK_LP literal_list NK_RP */ + 480, /* (581) boolean_value_expression ::= boolean_primary */ + 480, /* (582) boolean_value_expression ::= NOT boolean_primary */ + 480, /* (583) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + 480, /* (584) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + 481, /* (585) boolean_primary ::= predicate */ + 481, /* (586) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + 474, /* (587) common_expression ::= expr_or_subquery */ + 474, /* (588) common_expression ::= boolean_value_expression */ + 482, /* (589) from_clause_opt ::= */ + 482, /* (590) from_clause_opt ::= FROM table_reference_list */ + 483, /* (591) table_reference_list ::= table_reference */ + 483, /* (592) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + 484, /* (593) table_reference ::= table_primary */ + 484, /* (594) table_reference ::= joined_table */ + 485, /* (595) table_primary ::= table_name alias_opt */ + 485, /* (596) table_primary ::= db_name NK_DOT table_name alias_opt */ + 485, /* (597) table_primary ::= subquery alias_opt */ + 485, /* (598) table_primary ::= parenthesized_joined_table */ + 487, /* (599) alias_opt ::= */ + 487, /* (600) alias_opt ::= table_alias */ + 487, /* (601) alias_opt ::= AS table_alias */ + 489, /* (602) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + 489, /* (603) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + 486, /* (604) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 490, /* (605) join_type ::= */ + 490, /* (606) join_type ::= INNER */ + 491, /* (607) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 492, /* (608) hint_list ::= */ + 492, /* (609) hint_list ::= NK_HINT */ + 494, /* (610) tag_mode_opt ::= */ + 494, /* (611) tag_mode_opt ::= TAGS */ + 493, /* (612) set_quantifier_opt ::= */ + 493, /* (613) set_quantifier_opt ::= DISTINCT */ + 493, /* (614) set_quantifier_opt ::= ALL */ + 495, /* (615) select_list ::= select_item */ + 495, /* (616) select_list ::= select_list NK_COMMA select_item */ + 503, /* (617) select_item ::= NK_STAR */ + 503, /* (618) select_item ::= common_expression */ + 503, /* (619) select_item ::= common_expression column_alias */ + 503, /* (620) select_item ::= common_expression AS column_alias */ + 503, /* (621) select_item ::= table_name NK_DOT NK_STAR */ + 436, /* (622) where_clause_opt ::= */ + 436, /* (623) where_clause_opt ::= WHERE search_condition */ + 496, /* (624) partition_by_clause_opt ::= */ + 496, /* (625) partition_by_clause_opt ::= PARTITION BY partition_list */ + 504, /* (626) partition_list ::= partition_item */ + 504, /* (627) partition_list ::= partition_list NK_COMMA partition_item */ + 505, /* (628) partition_item ::= expr_or_subquery */ + 505, /* (629) partition_item ::= expr_or_subquery column_alias */ + 505, /* (630) partition_item ::= expr_or_subquery AS column_alias */ + 500, /* (631) twindow_clause_opt ::= */ + 500, /* (632) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + 500, /* (633) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + 500, /* (634) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 500, /* (635) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 500, /* (636) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 500, /* (637) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ + 500, /* (638) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 429, /* (639) sliding_opt ::= */ + 429, /* (640) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + 506, /* (641) interval_sliding_duration_literal ::= NK_VARIABLE */ + 506, /* (642) interval_sliding_duration_literal ::= NK_STRING */ + 506, /* (643) interval_sliding_duration_literal ::= NK_INTEGER */ + 499, /* (644) fill_opt ::= */ + 499, /* (645) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + 499, /* (646) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + 499, /* (647) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + 507, /* (648) fill_mode ::= NONE */ + 507, /* (649) fill_mode ::= PREV */ + 507, /* (650) fill_mode ::= NULL */ + 507, /* (651) fill_mode ::= NULL_F */ + 507, /* (652) fill_mode ::= LINEAR */ + 507, /* (653) fill_mode ::= NEXT */ + 501, /* (654) group_by_clause_opt ::= */ + 501, /* (655) group_by_clause_opt ::= GROUP BY group_by_list */ + 508, /* (656) group_by_list ::= expr_or_subquery */ + 508, /* (657) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 502, /* (658) having_clause_opt ::= */ + 502, /* (659) having_clause_opt ::= HAVING search_condition */ + 497, /* (660) range_opt ::= */ + 497, /* (661) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 497, /* (662) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 498, /* (663) every_opt ::= */ + 498, /* (664) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + 509, /* (665) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + 510, /* (666) query_simple ::= query_specification */ + 510, /* (667) query_simple ::= union_query_expression */ + 514, /* (668) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + 514, /* (669) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + 515, /* (670) query_simple_or_subquery ::= query_simple */ + 515, /* (671) query_simple_or_subquery ::= subquery */ + 435, /* (672) query_or_subquery ::= query_expression */ + 435, /* (673) query_or_subquery ::= subquery */ + 511, /* (674) order_by_clause_opt ::= */ + 511, /* (675) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 512, /* (676) slimit_clause_opt ::= */ + 512, /* (677) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + 512, /* (678) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + 512, /* (679) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 513, /* (680) limit_clause_opt ::= */ + 513, /* (681) limit_clause_opt ::= LIMIT NK_INTEGER */ + 513, /* (682) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + 513, /* (683) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 488, /* (684) subquery ::= NK_LP query_expression NK_RP */ + 488, /* (685) subquery ::= NK_LP subquery NK_RP */ + 373, /* (686) search_condition ::= common_expression */ + 516, /* (687) sort_specification_list ::= sort_specification */ + 516, /* (688) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + 517, /* (689) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 518, /* (690) ordering_specification_opt ::= */ + 518, /* (691) ordering_specification_opt ::= ASC */ + 518, /* (692) ordering_specification_opt ::= DESC */ + 519, /* (693) null_ordering_opt ::= */ + 519, /* (694) null_ordering_opt ::= NULLS FIRST */ + 519, /* (695) null_ordering_opt ::= NULLS LAST */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -4468,302 +4871,326 @@ static const signed char yyRuleInfoNRhs[] = { -4, /* (373) cmd ::= PAUSE STREAM exists_opt stream_name */ -5, /* (374) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ 0, /* (375) col_list_opt ::= */ - -3, /* (376) col_list_opt ::= NK_LP col_name_list NK_RP */ - 0, /* (377) tag_def_or_ref_opt ::= */ - -1, /* (378) tag_def_or_ref_opt ::= tags_def */ - -4, /* (379) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 0, /* (380) stream_options ::= */ - -3, /* (381) stream_options ::= stream_options TRIGGER AT_ONCE */ - -3, /* (382) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - -4, /* (383) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - -3, /* (384) stream_options ::= stream_options WATERMARK duration_literal */ - -4, /* (385) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - -3, /* (386) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - -3, /* (387) stream_options ::= stream_options DELETE_MARK duration_literal */ - -4, /* (388) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 0, /* (389) subtable_opt ::= */ - -4, /* (390) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 0, /* (391) ignore_opt ::= */ - -2, /* (392) ignore_opt ::= IGNORE UNTREATED */ - -3, /* (393) cmd ::= KILL CONNECTION NK_INTEGER */ - -3, /* (394) cmd ::= KILL QUERY NK_STRING */ - -3, /* (395) cmd ::= KILL TRANSACTION NK_INTEGER */ - -3, /* (396) cmd ::= KILL COMPACT NK_INTEGER */ - -2, /* (397) cmd ::= BALANCE VGROUP */ - -4, /* (398) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - -4, /* (399) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - -4, /* (400) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - -3, /* (401) cmd ::= SPLIT VGROUP NK_INTEGER */ - 0, /* (402) on_vgroup_id ::= */ - -2, /* (403) on_vgroup_id ::= ON NK_INTEGER */ - -2, /* (404) dnode_list ::= DNODE NK_INTEGER */ - -3, /* (405) dnode_list ::= dnode_list DNODE NK_INTEGER */ - -4, /* (406) cmd ::= DELETE FROM full_table_name where_clause_opt */ - -1, /* (407) cmd ::= query_or_subquery */ - -1, /* (408) cmd ::= insert_query */ - -7, /* (409) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - -4, /* (410) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - -1, /* (411) tags_literal ::= NK_INTEGER */ - -2, /* (412) tags_literal ::= NK_PLUS NK_INTEGER */ - -2, /* (413) tags_literal ::= NK_MINUS NK_INTEGER */ - -1, /* (414) tags_literal ::= NK_FLOAT */ - -2, /* (415) tags_literal ::= NK_PLUS NK_FLOAT */ - -2, /* (416) tags_literal ::= NK_MINUS NK_FLOAT */ - -1, /* (417) tags_literal ::= NK_BIN */ - -2, /* (418) tags_literal ::= NK_PLUS NK_BIN */ - -2, /* (419) tags_literal ::= NK_MINUS NK_BIN */ - -1, /* (420) tags_literal ::= NK_HEX */ - -2, /* (421) tags_literal ::= NK_PLUS NK_HEX */ - -2, /* (422) tags_literal ::= NK_MINUS NK_HEX */ - -1, /* (423) tags_literal ::= NK_STRING */ - -1, /* (424) tags_literal ::= NK_BOOL */ - -1, /* (425) tags_literal ::= NULL */ - -1, /* (426) tags_literal ::= literal_func */ - -3, /* (427) tags_literal ::= literal_func NK_PLUS duration_literal */ - -3, /* (428) tags_literal ::= literal_func NK_MINUS duration_literal */ - -1, /* (429) tags_literal_list ::= tags_literal */ - -3, /* (430) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ - -1, /* (431) literal ::= NK_INTEGER */ - -1, /* (432) literal ::= NK_FLOAT */ - -1, /* (433) literal ::= NK_STRING */ - -1, /* (434) literal ::= NK_BOOL */ - -2, /* (435) literal ::= TIMESTAMP NK_STRING */ - -1, /* (436) literal ::= duration_literal */ - -1, /* (437) literal ::= NULL */ - -1, /* (438) literal ::= NK_QUESTION */ - -1, /* (439) duration_literal ::= NK_VARIABLE */ - -1, /* (440) signed ::= NK_INTEGER */ - -2, /* (441) signed ::= NK_PLUS NK_INTEGER */ - -2, /* (442) signed ::= NK_MINUS NK_INTEGER */ - -1, /* (443) signed ::= NK_FLOAT */ - -2, /* (444) signed ::= NK_PLUS NK_FLOAT */ - -2, /* (445) signed ::= NK_MINUS NK_FLOAT */ - -1, /* (446) signed_literal ::= signed */ - -1, /* (447) signed_literal ::= NK_STRING */ - -1, /* (448) signed_literal ::= NK_BOOL */ - -2, /* (449) signed_literal ::= TIMESTAMP NK_STRING */ - -1, /* (450) signed_literal ::= duration_literal */ - -1, /* (451) signed_literal ::= NULL */ - -1, /* (452) signed_literal ::= literal_func */ - -1, /* (453) signed_literal ::= NK_QUESTION */ - -1, /* (454) literal_list ::= signed_literal */ - -3, /* (455) literal_list ::= literal_list NK_COMMA signed_literal */ - -1, /* (456) db_name ::= NK_ID */ - -1, /* (457) table_name ::= NK_ID */ - -1, /* (458) column_name ::= NK_ID */ - -1, /* (459) function_name ::= NK_ID */ - -1, /* (460) view_name ::= NK_ID */ - -1, /* (461) table_alias ::= NK_ID */ - -1, /* (462) column_alias ::= NK_ID */ - -1, /* (463) column_alias ::= NK_ALIAS */ - -1, /* (464) user_name ::= NK_ID */ - -1, /* (465) topic_name ::= NK_ID */ - -1, /* (466) stream_name ::= NK_ID */ - -1, /* (467) cgroup_name ::= NK_ID */ - -1, /* (468) index_name ::= NK_ID */ - -1, /* (469) expr_or_subquery ::= expression */ - -1, /* (470) expression ::= literal */ - -1, /* (471) expression ::= pseudo_column */ - -1, /* (472) expression ::= column_reference */ - -1, /* (473) expression ::= function_expression */ - -1, /* (474) expression ::= case_when_expression */ - -3, /* (475) expression ::= NK_LP expression NK_RP */ - -2, /* (476) expression ::= NK_PLUS expr_or_subquery */ - -2, /* (477) expression ::= NK_MINUS expr_or_subquery */ - -3, /* (478) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - -3, /* (479) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - -3, /* (480) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - -3, /* (481) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - -3, /* (482) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - -3, /* (483) expression ::= column_reference NK_ARROW NK_STRING */ - -3, /* (484) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - -3, /* (485) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - -1, /* (486) expression_list ::= expr_or_subquery */ - -3, /* (487) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - -1, /* (488) column_reference ::= column_name */ - -3, /* (489) column_reference ::= table_name NK_DOT column_name */ - -1, /* (490) column_reference ::= NK_ALIAS */ - -3, /* (491) column_reference ::= table_name NK_DOT NK_ALIAS */ - -1, /* (492) pseudo_column ::= ROWTS */ - -1, /* (493) pseudo_column ::= TBNAME */ - -3, /* (494) pseudo_column ::= table_name NK_DOT TBNAME */ - -1, /* (495) pseudo_column ::= QSTART */ - -1, /* (496) pseudo_column ::= QEND */ - -1, /* (497) pseudo_column ::= QDURATION */ - -1, /* (498) pseudo_column ::= WSTART */ - -1, /* (499) pseudo_column ::= WEND */ - -1, /* (500) pseudo_column ::= WDURATION */ - -1, /* (501) pseudo_column ::= IROWTS */ - -1, /* (502) pseudo_column ::= ISFILLED */ - -1, /* (503) pseudo_column ::= QTAGS */ - -4, /* (504) function_expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (505) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - -6, /* (506) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - -1, /* (507) function_expression ::= literal_func */ - -3, /* (508) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (509) literal_func ::= NOW */ - -1, /* (510) literal_func ::= TODAY */ - -1, /* (511) noarg_func ::= NOW */ - -1, /* (512) noarg_func ::= TODAY */ - -1, /* (513) noarg_func ::= TIMEZONE */ - -1, /* (514) noarg_func ::= DATABASE */ - -1, /* (515) noarg_func ::= CLIENT_VERSION */ - -1, /* (516) noarg_func ::= SERVER_VERSION */ - -1, /* (517) noarg_func ::= SERVER_STATUS */ - -1, /* (518) noarg_func ::= CURRENT_USER */ - -1, /* (519) noarg_func ::= USER */ - -1, /* (520) star_func ::= COUNT */ - -1, /* (521) star_func ::= FIRST */ - -1, /* (522) star_func ::= LAST */ - -1, /* (523) star_func ::= LAST_ROW */ - -1, /* (524) star_func_para_list ::= NK_STAR */ - -1, /* (525) star_func_para_list ::= other_para_list */ - -1, /* (526) other_para_list ::= star_func_para */ - -3, /* (527) other_para_list ::= other_para_list NK_COMMA star_func_para */ - -1, /* (528) star_func_para ::= expr_or_subquery */ - -3, /* (529) star_func_para ::= table_name NK_DOT NK_STAR */ - -4, /* (530) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - -5, /* (531) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - -1, /* (532) when_then_list ::= when_then_expr */ - -2, /* (533) when_then_list ::= when_then_list when_then_expr */ - -4, /* (534) when_then_expr ::= WHEN common_expression THEN common_expression */ - 0, /* (535) case_when_else_opt ::= */ - -2, /* (536) case_when_else_opt ::= ELSE common_expression */ - -3, /* (537) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - -5, /* (538) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - -6, /* (539) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - -3, /* (540) predicate ::= expr_or_subquery IS NULL */ - -4, /* (541) predicate ::= expr_or_subquery IS NOT NULL */ - -3, /* (542) predicate ::= expr_or_subquery in_op in_predicate_value */ - -1, /* (543) compare_op ::= NK_LT */ - -1, /* (544) compare_op ::= NK_GT */ - -1, /* (545) compare_op ::= NK_LE */ - -1, /* (546) compare_op ::= NK_GE */ - -1, /* (547) compare_op ::= NK_NE */ - -1, /* (548) compare_op ::= NK_EQ */ - -1, /* (549) compare_op ::= LIKE */ - -2, /* (550) compare_op ::= NOT LIKE */ - -1, /* (551) compare_op ::= MATCH */ - -1, /* (552) compare_op ::= NMATCH */ - -1, /* (553) compare_op ::= CONTAINS */ - -1, /* (554) in_op ::= IN */ - -2, /* (555) in_op ::= NOT IN */ - -3, /* (556) in_predicate_value ::= NK_LP literal_list NK_RP */ - -1, /* (557) boolean_value_expression ::= boolean_primary */ - -2, /* (558) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (559) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (560) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (561) boolean_primary ::= predicate */ - -3, /* (562) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (563) common_expression ::= expr_or_subquery */ - -1, /* (564) common_expression ::= boolean_value_expression */ - 0, /* (565) from_clause_opt ::= */ - -2, /* (566) from_clause_opt ::= FROM table_reference_list */ - -1, /* (567) table_reference_list ::= table_reference */ - -3, /* (568) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (569) table_reference ::= table_primary */ - -1, /* (570) table_reference ::= joined_table */ - -2, /* (571) table_primary ::= table_name alias_opt */ - -4, /* (572) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (573) table_primary ::= subquery alias_opt */ - -1, /* (574) table_primary ::= parenthesized_joined_table */ - 0, /* (575) alias_opt ::= */ - -1, /* (576) alias_opt ::= table_alias */ - -2, /* (577) alias_opt ::= AS table_alias */ - -3, /* (578) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (579) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -6, /* (580) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 0, /* (581) join_type ::= */ - -1, /* (582) join_type ::= INNER */ - -14, /* (583) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - 0, /* (584) hint_list ::= */ - -1, /* (585) hint_list ::= NK_HINT */ - 0, /* (586) tag_mode_opt ::= */ - -1, /* (587) tag_mode_opt ::= TAGS */ - 0, /* (588) set_quantifier_opt ::= */ - -1, /* (589) set_quantifier_opt ::= DISTINCT */ - -1, /* (590) set_quantifier_opt ::= ALL */ - -1, /* (591) select_list ::= select_item */ - -3, /* (592) select_list ::= select_list NK_COMMA select_item */ - -1, /* (593) select_item ::= NK_STAR */ - -1, /* (594) select_item ::= common_expression */ - -2, /* (595) select_item ::= common_expression column_alias */ - -3, /* (596) select_item ::= common_expression AS column_alias */ - -3, /* (597) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (598) where_clause_opt ::= */ - -2, /* (599) where_clause_opt ::= WHERE search_condition */ - 0, /* (600) partition_by_clause_opt ::= */ - -3, /* (601) partition_by_clause_opt ::= PARTITION BY partition_list */ - -1, /* (602) partition_list ::= partition_item */ - -3, /* (603) partition_list ::= partition_list NK_COMMA partition_item */ - -1, /* (604) partition_item ::= expr_or_subquery */ - -2, /* (605) partition_item ::= expr_or_subquery column_alias */ - -3, /* (606) partition_item ::= expr_or_subquery AS column_alias */ - 0, /* (607) twindow_clause_opt ::= */ - -6, /* (608) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - -4, /* (609) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (610) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (611) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -7, /* (612) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - -4, /* (613) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - -6, /* (614) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 0, /* (615) sliding_opt ::= */ - -4, /* (616) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - -1, /* (617) interval_sliding_duration_literal ::= NK_VARIABLE */ - -1, /* (618) interval_sliding_duration_literal ::= NK_STRING */ - -1, /* (619) interval_sliding_duration_literal ::= NK_INTEGER */ - 0, /* (620) fill_opt ::= */ - -4, /* (621) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (622) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - -6, /* (623) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - -1, /* (624) fill_mode ::= NONE */ - -1, /* (625) fill_mode ::= PREV */ - -1, /* (626) fill_mode ::= NULL */ - -1, /* (627) fill_mode ::= NULL_F */ - -1, /* (628) fill_mode ::= LINEAR */ - -1, /* (629) fill_mode ::= NEXT */ - 0, /* (630) group_by_clause_opt ::= */ - -3, /* (631) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (632) group_by_list ::= expr_or_subquery */ - -3, /* (633) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 0, /* (634) having_clause_opt ::= */ - -2, /* (635) having_clause_opt ::= HAVING search_condition */ - 0, /* (636) range_opt ::= */ - -6, /* (637) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - -4, /* (638) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 0, /* (639) every_opt ::= */ - -4, /* (640) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - -4, /* (641) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (642) query_simple ::= query_specification */ - -1, /* (643) query_simple ::= union_query_expression */ - -4, /* (644) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - -3, /* (645) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - -1, /* (646) query_simple_or_subquery ::= query_simple */ - -1, /* (647) query_simple_or_subquery ::= subquery */ - -1, /* (648) query_or_subquery ::= query_expression */ - -1, /* (649) query_or_subquery ::= subquery */ - 0, /* (650) order_by_clause_opt ::= */ - -3, /* (651) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (652) slimit_clause_opt ::= */ - -2, /* (653) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (654) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (655) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (656) limit_clause_opt ::= */ - -2, /* (657) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (658) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (659) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (660) subquery ::= NK_LP query_expression NK_RP */ - -3, /* (661) subquery ::= NK_LP subquery NK_RP */ - -1, /* (662) search_condition ::= common_expression */ - -1, /* (663) sort_specification_list ::= sort_specification */ - -3, /* (664) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (665) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 0, /* (666) ordering_specification_opt ::= */ - -1, /* (667) ordering_specification_opt ::= ASC */ - -1, /* (668) ordering_specification_opt ::= DESC */ - 0, /* (669) null_ordering_opt ::= */ - -2, /* (670) null_ordering_opt ::= NULLS FIRST */ - -2, /* (671) null_ordering_opt ::= NULLS LAST */ + -3, /* (376) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ + -1, /* (377) column_stream_def_list ::= column_stream_def */ + -3, /* (378) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ + -1, /* (379) column_stream_def ::= column_name */ + -3, /* (380) column_stream_def ::= column_name PRIMARY KEY */ + 0, /* (381) tag_def_or_ref_opt ::= */ + -1, /* (382) tag_def_or_ref_opt ::= tags_def */ + -4, /* (383) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ + 0, /* (384) stream_options ::= */ + -3, /* (385) stream_options ::= stream_options TRIGGER AT_ONCE */ + -3, /* (386) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + -4, /* (387) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + -3, /* (388) stream_options ::= stream_options WATERMARK duration_literal */ + -4, /* (389) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + -3, /* (390) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + -3, /* (391) stream_options ::= stream_options DELETE_MARK duration_literal */ + -4, /* (392) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 0, /* (393) subtable_opt ::= */ + -4, /* (394) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 0, /* (395) ignore_opt ::= */ + -2, /* (396) ignore_opt ::= IGNORE UNTREATED */ + -3, /* (397) cmd ::= KILL CONNECTION NK_INTEGER */ + -3, /* (398) cmd ::= KILL QUERY NK_STRING */ + -3, /* (399) cmd ::= KILL TRANSACTION NK_INTEGER */ + -3, /* (400) cmd ::= KILL COMPACT NK_INTEGER */ + -2, /* (401) cmd ::= BALANCE VGROUP */ + -4, /* (402) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + -4, /* (403) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + -4, /* (404) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + -3, /* (405) cmd ::= SPLIT VGROUP NK_INTEGER */ + 0, /* (406) on_vgroup_id ::= */ + -2, /* (407) on_vgroup_id ::= ON NK_INTEGER */ + -2, /* (408) dnode_list ::= DNODE NK_INTEGER */ + -3, /* (409) dnode_list ::= dnode_list DNODE NK_INTEGER */ + -4, /* (410) cmd ::= DELETE FROM full_table_name where_clause_opt */ + -1, /* (411) cmd ::= query_or_subquery */ + -1, /* (412) cmd ::= insert_query */ + -7, /* (413) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + -4, /* (414) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + -1, /* (415) tags_literal ::= NK_INTEGER */ + -3, /* (416) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + -3, /* (417) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ + -2, /* (418) tags_literal ::= NK_PLUS NK_INTEGER */ + -4, /* (419) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + -4, /* (420) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ + -2, /* (421) tags_literal ::= NK_MINUS NK_INTEGER */ + -4, /* (422) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ + -4, /* (423) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ + -1, /* (424) tags_literal ::= NK_FLOAT */ + -2, /* (425) tags_literal ::= NK_PLUS NK_FLOAT */ + -2, /* (426) tags_literal ::= NK_MINUS NK_FLOAT */ + -1, /* (427) tags_literal ::= NK_BIN */ + -3, /* (428) tags_literal ::= NK_BIN NK_PLUS duration_literal */ + -3, /* (429) tags_literal ::= NK_BIN NK_MINUS duration_literal */ + -2, /* (430) tags_literal ::= NK_PLUS NK_BIN */ + -4, /* (431) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ + -4, /* (432) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ + -2, /* (433) tags_literal ::= NK_MINUS NK_BIN */ + -4, /* (434) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ + -4, /* (435) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ + -1, /* (436) tags_literal ::= NK_HEX */ + -3, /* (437) tags_literal ::= NK_HEX NK_PLUS duration_literal */ + -3, /* (438) tags_literal ::= NK_HEX NK_MINUS duration_literal */ + -2, /* (439) tags_literal ::= NK_PLUS NK_HEX */ + -4, /* (440) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ + -4, /* (441) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ + -2, /* (442) tags_literal ::= NK_MINUS NK_HEX */ + -4, /* (443) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ + -4, /* (444) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ + -1, /* (445) tags_literal ::= NK_STRING */ + -3, /* (446) tags_literal ::= NK_STRING NK_PLUS duration_literal */ + -3, /* (447) tags_literal ::= NK_STRING NK_MINUS duration_literal */ + -1, /* (448) tags_literal ::= NK_BOOL */ + -1, /* (449) tags_literal ::= NULL */ + -1, /* (450) tags_literal ::= literal_func */ + -3, /* (451) tags_literal ::= literal_func NK_PLUS duration_literal */ + -3, /* (452) tags_literal ::= literal_func NK_MINUS duration_literal */ + -1, /* (453) tags_literal_list ::= tags_literal */ + -3, /* (454) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ + -1, /* (455) literal ::= NK_INTEGER */ + -1, /* (456) literal ::= NK_FLOAT */ + -1, /* (457) literal ::= NK_STRING */ + -1, /* (458) literal ::= NK_BOOL */ + -2, /* (459) literal ::= TIMESTAMP NK_STRING */ + -1, /* (460) literal ::= duration_literal */ + -1, /* (461) literal ::= NULL */ + -1, /* (462) literal ::= NK_QUESTION */ + -1, /* (463) duration_literal ::= NK_VARIABLE */ + -1, /* (464) signed ::= NK_INTEGER */ + -2, /* (465) signed ::= NK_PLUS NK_INTEGER */ + -2, /* (466) signed ::= NK_MINUS NK_INTEGER */ + -1, /* (467) signed ::= NK_FLOAT */ + -2, /* (468) signed ::= NK_PLUS NK_FLOAT */ + -2, /* (469) signed ::= NK_MINUS NK_FLOAT */ + -1, /* (470) signed_literal ::= signed */ + -1, /* (471) signed_literal ::= NK_STRING */ + -1, /* (472) signed_literal ::= NK_BOOL */ + -2, /* (473) signed_literal ::= TIMESTAMP NK_STRING */ + -1, /* (474) signed_literal ::= duration_literal */ + -1, /* (475) signed_literal ::= NULL */ + -1, /* (476) signed_literal ::= literal_func */ + -1, /* (477) signed_literal ::= NK_QUESTION */ + -1, /* (478) literal_list ::= signed_literal */ + -3, /* (479) literal_list ::= literal_list NK_COMMA signed_literal */ + -1, /* (480) db_name ::= NK_ID */ + -1, /* (481) table_name ::= NK_ID */ + -1, /* (482) column_name ::= NK_ID */ + -1, /* (483) function_name ::= NK_ID */ + -1, /* (484) view_name ::= NK_ID */ + -1, /* (485) table_alias ::= NK_ID */ + -1, /* (486) column_alias ::= NK_ID */ + -1, /* (487) column_alias ::= NK_ALIAS */ + -1, /* (488) user_name ::= NK_ID */ + -1, /* (489) topic_name ::= NK_ID */ + -1, /* (490) stream_name ::= NK_ID */ + -1, /* (491) cgroup_name ::= NK_ID */ + -1, /* (492) index_name ::= NK_ID */ + -1, /* (493) expr_or_subquery ::= expression */ + -1, /* (494) expression ::= literal */ + -1, /* (495) expression ::= pseudo_column */ + -1, /* (496) expression ::= column_reference */ + -1, /* (497) expression ::= function_expression */ + -1, /* (498) expression ::= case_when_expression */ + -3, /* (499) expression ::= NK_LP expression NK_RP */ + -2, /* (500) expression ::= NK_PLUS expr_or_subquery */ + -2, /* (501) expression ::= NK_MINUS expr_or_subquery */ + -3, /* (502) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + -3, /* (503) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + -3, /* (504) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + -3, /* (505) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + -3, /* (506) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + -3, /* (507) expression ::= column_reference NK_ARROW NK_STRING */ + -3, /* (508) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + -3, /* (509) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + -1, /* (510) expression_list ::= expr_or_subquery */ + -3, /* (511) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + -1, /* (512) column_reference ::= column_name */ + -3, /* (513) column_reference ::= table_name NK_DOT column_name */ + -1, /* (514) column_reference ::= NK_ALIAS */ + -3, /* (515) column_reference ::= table_name NK_DOT NK_ALIAS */ + -1, /* (516) pseudo_column ::= ROWTS */ + -1, /* (517) pseudo_column ::= TBNAME */ + -3, /* (518) pseudo_column ::= table_name NK_DOT TBNAME */ + -1, /* (519) pseudo_column ::= QSTART */ + -1, /* (520) pseudo_column ::= QEND */ + -1, /* (521) pseudo_column ::= QDURATION */ + -1, /* (522) pseudo_column ::= WSTART */ + -1, /* (523) pseudo_column ::= WEND */ + -1, /* (524) pseudo_column ::= WDURATION */ + -1, /* (525) pseudo_column ::= IROWTS */ + -1, /* (526) pseudo_column ::= ISFILLED */ + -1, /* (527) pseudo_column ::= QTAGS */ + -4, /* (528) function_expression ::= function_name NK_LP expression_list NK_RP */ + -4, /* (529) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + -6, /* (530) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + -1, /* (531) function_expression ::= literal_func */ + -3, /* (532) literal_func ::= noarg_func NK_LP NK_RP */ + -1, /* (533) literal_func ::= NOW */ + -1, /* (534) literal_func ::= TODAY */ + -1, /* (535) noarg_func ::= NOW */ + -1, /* (536) noarg_func ::= TODAY */ + -1, /* (537) noarg_func ::= TIMEZONE */ + -1, /* (538) noarg_func ::= DATABASE */ + -1, /* (539) noarg_func ::= CLIENT_VERSION */ + -1, /* (540) noarg_func ::= SERVER_VERSION */ + -1, /* (541) noarg_func ::= SERVER_STATUS */ + -1, /* (542) noarg_func ::= CURRENT_USER */ + -1, /* (543) noarg_func ::= USER */ + -1, /* (544) star_func ::= COUNT */ + -1, /* (545) star_func ::= FIRST */ + -1, /* (546) star_func ::= LAST */ + -1, /* (547) star_func ::= LAST_ROW */ + -1, /* (548) star_func_para_list ::= NK_STAR */ + -1, /* (549) star_func_para_list ::= other_para_list */ + -1, /* (550) other_para_list ::= star_func_para */ + -3, /* (551) other_para_list ::= other_para_list NK_COMMA star_func_para */ + -1, /* (552) star_func_para ::= expr_or_subquery */ + -3, /* (553) star_func_para ::= table_name NK_DOT NK_STAR */ + -4, /* (554) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + -5, /* (555) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + -1, /* (556) when_then_list ::= when_then_expr */ + -2, /* (557) when_then_list ::= when_then_list when_then_expr */ + -4, /* (558) when_then_expr ::= WHEN common_expression THEN common_expression */ + 0, /* (559) case_when_else_opt ::= */ + -2, /* (560) case_when_else_opt ::= ELSE common_expression */ + -3, /* (561) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + -5, /* (562) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + -6, /* (563) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + -3, /* (564) predicate ::= expr_or_subquery IS NULL */ + -4, /* (565) predicate ::= expr_or_subquery IS NOT NULL */ + -3, /* (566) predicate ::= expr_or_subquery in_op in_predicate_value */ + -1, /* (567) compare_op ::= NK_LT */ + -1, /* (568) compare_op ::= NK_GT */ + -1, /* (569) compare_op ::= NK_LE */ + -1, /* (570) compare_op ::= NK_GE */ + -1, /* (571) compare_op ::= NK_NE */ + -1, /* (572) compare_op ::= NK_EQ */ + -1, /* (573) compare_op ::= LIKE */ + -2, /* (574) compare_op ::= NOT LIKE */ + -1, /* (575) compare_op ::= MATCH */ + -1, /* (576) compare_op ::= NMATCH */ + -1, /* (577) compare_op ::= CONTAINS */ + -1, /* (578) in_op ::= IN */ + -2, /* (579) in_op ::= NOT IN */ + -3, /* (580) in_predicate_value ::= NK_LP literal_list NK_RP */ + -1, /* (581) boolean_value_expression ::= boolean_primary */ + -2, /* (582) boolean_value_expression ::= NOT boolean_primary */ + -3, /* (583) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + -3, /* (584) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + -1, /* (585) boolean_primary ::= predicate */ + -3, /* (586) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + -1, /* (587) common_expression ::= expr_or_subquery */ + -1, /* (588) common_expression ::= boolean_value_expression */ + 0, /* (589) from_clause_opt ::= */ + -2, /* (590) from_clause_opt ::= FROM table_reference_list */ + -1, /* (591) table_reference_list ::= table_reference */ + -3, /* (592) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + -1, /* (593) table_reference ::= table_primary */ + -1, /* (594) table_reference ::= joined_table */ + -2, /* (595) table_primary ::= table_name alias_opt */ + -4, /* (596) table_primary ::= db_name NK_DOT table_name alias_opt */ + -2, /* (597) table_primary ::= subquery alias_opt */ + -1, /* (598) table_primary ::= parenthesized_joined_table */ + 0, /* (599) alias_opt ::= */ + -1, /* (600) alias_opt ::= table_alias */ + -2, /* (601) alias_opt ::= AS table_alias */ + -3, /* (602) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + -3, /* (603) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + -6, /* (604) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 0, /* (605) join_type ::= */ + -1, /* (606) join_type ::= INNER */ + -14, /* (607) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 0, /* (608) hint_list ::= */ + -1, /* (609) hint_list ::= NK_HINT */ + 0, /* (610) tag_mode_opt ::= */ + -1, /* (611) tag_mode_opt ::= TAGS */ + 0, /* (612) set_quantifier_opt ::= */ + -1, /* (613) set_quantifier_opt ::= DISTINCT */ + -1, /* (614) set_quantifier_opt ::= ALL */ + -1, /* (615) select_list ::= select_item */ + -3, /* (616) select_list ::= select_list NK_COMMA select_item */ + -1, /* (617) select_item ::= NK_STAR */ + -1, /* (618) select_item ::= common_expression */ + -2, /* (619) select_item ::= common_expression column_alias */ + -3, /* (620) select_item ::= common_expression AS column_alias */ + -3, /* (621) select_item ::= table_name NK_DOT NK_STAR */ + 0, /* (622) where_clause_opt ::= */ + -2, /* (623) where_clause_opt ::= WHERE search_condition */ + 0, /* (624) partition_by_clause_opt ::= */ + -3, /* (625) partition_by_clause_opt ::= PARTITION BY partition_list */ + -1, /* (626) partition_list ::= partition_item */ + -3, /* (627) partition_list ::= partition_list NK_COMMA partition_item */ + -1, /* (628) partition_item ::= expr_or_subquery */ + -2, /* (629) partition_item ::= expr_or_subquery column_alias */ + -3, /* (630) partition_item ::= expr_or_subquery AS column_alias */ + 0, /* (631) twindow_clause_opt ::= */ + -6, /* (632) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + -4, /* (633) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + -6, /* (634) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -8, /* (635) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -7, /* (636) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + -4, /* (637) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ + -6, /* (638) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 0, /* (639) sliding_opt ::= */ + -4, /* (640) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + -1, /* (641) interval_sliding_duration_literal ::= NK_VARIABLE */ + -1, /* (642) interval_sliding_duration_literal ::= NK_STRING */ + -1, /* (643) interval_sliding_duration_literal ::= NK_INTEGER */ + 0, /* (644) fill_opt ::= */ + -4, /* (645) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + -6, /* (646) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + -6, /* (647) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + -1, /* (648) fill_mode ::= NONE */ + -1, /* (649) fill_mode ::= PREV */ + -1, /* (650) fill_mode ::= NULL */ + -1, /* (651) fill_mode ::= NULL_F */ + -1, /* (652) fill_mode ::= LINEAR */ + -1, /* (653) fill_mode ::= NEXT */ + 0, /* (654) group_by_clause_opt ::= */ + -3, /* (655) group_by_clause_opt ::= GROUP BY group_by_list */ + -1, /* (656) group_by_list ::= expr_or_subquery */ + -3, /* (657) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 0, /* (658) having_clause_opt ::= */ + -2, /* (659) having_clause_opt ::= HAVING search_condition */ + 0, /* (660) range_opt ::= */ + -6, /* (661) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + -4, /* (662) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 0, /* (663) every_opt ::= */ + -4, /* (664) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + -4, /* (665) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + -1, /* (666) query_simple ::= query_specification */ + -1, /* (667) query_simple ::= union_query_expression */ + -4, /* (668) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + -3, /* (669) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + -1, /* (670) query_simple_or_subquery ::= query_simple */ + -1, /* (671) query_simple_or_subquery ::= subquery */ + -1, /* (672) query_or_subquery ::= query_expression */ + -1, /* (673) query_or_subquery ::= subquery */ + 0, /* (674) order_by_clause_opt ::= */ + -3, /* (675) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 0, /* (676) slimit_clause_opt ::= */ + -2, /* (677) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + -4, /* (678) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + -4, /* (679) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 0, /* (680) limit_clause_opt ::= */ + -2, /* (681) limit_clause_opt ::= LIMIT NK_INTEGER */ + -4, /* (682) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + -4, /* (683) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + -3, /* (684) subquery ::= NK_LP query_expression NK_RP */ + -3, /* (685) subquery ::= NK_LP subquery NK_RP */ + -1, /* (686) search_condition ::= common_expression */ + -1, /* (687) sort_specification_list ::= sort_specification */ + -3, /* (688) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + -3, /* (689) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 0, /* (690) ordering_specification_opt ::= */ + -1, /* (691) ordering_specification_opt ::= ASC */ + -1, /* (692) ordering_specification_opt ::= DESC */ + 0, /* (693) null_ordering_opt ::= */ + -2, /* (694) null_ordering_opt ::= NULLS FIRST */ + -2, /* (695) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -4793,54 +5220,6 @@ static YYACTIONTYPE yy_reduce( (void)yyLookahead; (void)yyLookaheadToken; yymsp = yypParser->yytos; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - yysize = yyRuleInfoNRhs[yyruleno]; - if( yysize ){ - fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", - yyTracePrompt, - yyruleno, yyRuleName[yyruleno], - yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ - yypParser->yyhwm++; - assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); - } -#endif -#if YYSTACKDEPTH>0 - if( yypParser->yytos>=yypParser->yystackEnd ){ - yyStackOverflow(yypParser); - /* The call to yyStackOverflow() above pops the stack until it is - ** empty, causing the main parser loop to exit. So the return value - ** is never used and does not matter. */ - return 0; - } -#else - if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ - if( yyGrowStack(yypParser) ){ - yyStackOverflow(yypParser); - /* The call to yyStackOverflow() above pops the stack until it is - ** empty, causing the main parser loop to exit. So the return value - ** is never used and does not matter. */ - return 0; - } - yymsp = yypParser->yytos; - } -#endif - } switch( yyruleno ){ /* Beginning here are the reduction cases. A typical example @@ -4903,151 +5282,151 @@ static YYACTIONTYPE yy_reduce( yy_destructor(yypParser,358,&yymsp[0].minor); break; case 24: /* ip_range_list ::= NK_STRING */ -{ yylhsminor.yy404 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy404 = yylhsminor.yy404; +{ yylhsminor.yy184 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ -{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy404 = yylhsminor.yy404; +{ yylhsminor.yy184 = addNodeToList(pCxt, yymsp[-2].minor.yy184, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 26: /* white_list ::= HOST ip_range_list */ -{ yymsp[-1].minor.yy404 = yymsp[0].minor.yy404; } +{ yymsp[-1].minor.yy184 = yymsp[0].minor.yy184; } break; case 27: /* white_list_opt ::= */ case 188: /* specific_cols_opt ::= */ yytestcase(yyruleno==188); case 220: /* tags_def_opt ::= */ yytestcase(yyruleno==220); case 309: /* tag_list_opt ::= */ yytestcase(yyruleno==309); case 375: /* col_list_opt ::= */ yytestcase(yyruleno==375); - case 377: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==377); - case 600: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==600); - case 630: /* group_by_clause_opt ::= */ yytestcase(yyruleno==630); - case 650: /* order_by_clause_opt ::= */ yytestcase(yyruleno==650); -{ yymsp[1].minor.yy404 = NULL; } + case 381: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==381); + case 624: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==624); + case 654: /* group_by_clause_opt ::= */ yytestcase(yyruleno==654); + case 674: /* order_by_clause_opt ::= */ yytestcase(yyruleno==674); +{ yymsp[1].minor.yy184 = NULL; } break; case 28: /* white_list_opt ::= white_list */ case 221: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==221); - case 378: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==378); - case 525: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==525); -{ yylhsminor.yy404 = yymsp[0].minor.yy404; } - yymsp[0].minor.yy404 = yylhsminor.yy404; + case 382: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==382); + case 549: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==549); +{ yylhsminor.yy184 = yymsp[0].minor.yy184; } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 29: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */ { - pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy701, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy915); - pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy404); + pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy369, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy743); + pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy184); } break; case 30: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy701, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy369, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 31: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy701, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy369, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 32: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy701, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy369, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 33: /* cmd ::= ALTER USER user_name ADD white_list */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy701, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy404); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy369, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy184); } break; case 34: /* cmd ::= ALTER USER user_name DROP white_list */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy701, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy404); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy369, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy184); } break; case 35: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy701); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy369); } break; case 36: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy915 = 1; } +{ yymsp[1].minor.yy743 = 1; } break; case 37: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy915 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy743 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 38: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy949, &yymsp[-3].minor.yy21, &yymsp[0].minor.yy701, yymsp[-2].minor.yy896); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy909, &yymsp[-3].minor.yy937, &yymsp[0].minor.yy369, yymsp[-2].minor.yy392); } break; case 39: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy949, &yymsp[-3].minor.yy21, &yymsp[0].minor.yy701, yymsp[-2].minor.yy896); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy909, &yymsp[-3].minor.yy937, &yymsp[0].minor.yy369, yymsp[-2].minor.yy392); } break; case 40: /* privileges ::= ALL */ -{ yymsp[0].minor.yy949 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_ALL; } break; case 41: /* privileges ::= priv_type_list */ case 43: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==43); -{ yylhsminor.yy949 = yymsp[0].minor.yy949; } - yymsp[0].minor.yy949 = yylhsminor.yy949; +{ yylhsminor.yy909 = yymsp[0].minor.yy909; } + yymsp[0].minor.yy909 = yylhsminor.yy909; break; case 42: /* privileges ::= SUBSCRIBE */ -{ yymsp[0].minor.yy949 = PRIVILEGE_TYPE_SUBSCRIBE; } +{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_SUBSCRIBE; } break; case 44: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy949 = yymsp[-2].minor.yy949 | yymsp[0].minor.yy949; } - yymsp[-2].minor.yy949 = yylhsminor.yy949; +{ yylhsminor.yy909 = yymsp[-2].minor.yy909 | yymsp[0].minor.yy909; } + yymsp[-2].minor.yy909 = yylhsminor.yy909; break; case 45: /* priv_type ::= READ */ -{ yymsp[0].minor.yy949 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_READ; } break; case 46: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy949 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_WRITE; } break; case 47: /* priv_type ::= ALTER */ -{ yymsp[0].minor.yy949 = PRIVILEGE_TYPE_ALTER; } +{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_ALTER; } break; case 48: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy21.first = yymsp[-2].minor.yy0; yylhsminor.yy21.second = yymsp[0].minor.yy0; } - yymsp[-2].minor.yy21 = yylhsminor.yy21; +{ yylhsminor.yy937.first = yymsp[-2].minor.yy0; yylhsminor.yy937.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy937 = yylhsminor.yy937; break; case 49: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy21.first = yymsp[-2].minor.yy701; yylhsminor.yy21.second = yymsp[0].minor.yy0; } - yymsp[-2].minor.yy21 = yylhsminor.yy21; +{ yylhsminor.yy937.first = yymsp[-2].minor.yy369; yylhsminor.yy937.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy937 = yylhsminor.yy937; break; case 50: /* priv_level ::= db_name NK_DOT table_name */ -{ yylhsminor.yy21.first = yymsp[-2].minor.yy701; yylhsminor.yy21.second = yymsp[0].minor.yy701; } - yymsp[-2].minor.yy21 = yylhsminor.yy21; +{ yylhsminor.yy937.first = yymsp[-2].minor.yy369; yylhsminor.yy937.second = yymsp[0].minor.yy369; } + yymsp[-2].minor.yy937 = yylhsminor.yy937; break; case 51: /* priv_level ::= topic_name */ -{ yylhsminor.yy21.first = yymsp[0].minor.yy701; yylhsminor.yy21.second = nil_token; } - yymsp[0].minor.yy21 = yylhsminor.yy21; +{ yylhsminor.yy937.first = yymsp[0].minor.yy369; yylhsminor.yy937.second = nil_token; } + yymsp[0].minor.yy937 = yylhsminor.yy937; break; case 52: /* with_opt ::= */ case 157: /* start_opt ::= */ yytestcase(yyruleno==157); case 161: /* end_opt ::= */ yytestcase(yyruleno==161); case 304: /* like_pattern_opt ::= */ yytestcase(yyruleno==304); - case 389: /* subtable_opt ::= */ yytestcase(yyruleno==389); - case 535: /* case_when_else_opt ::= */ yytestcase(yyruleno==535); - case 565: /* from_clause_opt ::= */ yytestcase(yyruleno==565); - case 598: /* where_clause_opt ::= */ yytestcase(yyruleno==598); - case 607: /* twindow_clause_opt ::= */ yytestcase(yyruleno==607); - case 615: /* sliding_opt ::= */ yytestcase(yyruleno==615); - case 620: /* fill_opt ::= */ yytestcase(yyruleno==620); - case 634: /* having_clause_opt ::= */ yytestcase(yyruleno==634); - case 636: /* range_opt ::= */ yytestcase(yyruleno==636); - case 639: /* every_opt ::= */ yytestcase(yyruleno==639); - case 652: /* slimit_clause_opt ::= */ yytestcase(yyruleno==652); - case 656: /* limit_clause_opt ::= */ yytestcase(yyruleno==656); -{ yymsp[1].minor.yy896 = NULL; } + case 393: /* subtable_opt ::= */ yytestcase(yyruleno==393); + case 559: /* case_when_else_opt ::= */ yytestcase(yyruleno==559); + case 589: /* from_clause_opt ::= */ yytestcase(yyruleno==589); + case 622: /* where_clause_opt ::= */ yytestcase(yyruleno==622); + case 631: /* twindow_clause_opt ::= */ yytestcase(yyruleno==631); + case 639: /* sliding_opt ::= */ yytestcase(yyruleno==639); + case 644: /* fill_opt ::= */ yytestcase(yyruleno==644); + case 658: /* having_clause_opt ::= */ yytestcase(yyruleno==658); + case 660: /* range_opt ::= */ yytestcase(yyruleno==660); + case 663: /* every_opt ::= */ yytestcase(yyruleno==663); + case 676: /* slimit_clause_opt ::= */ yytestcase(yyruleno==676); + case 680: /* limit_clause_opt ::= */ yytestcase(yyruleno==680); +{ yymsp[1].minor.yy392 = NULL; } break; case 53: /* with_opt ::= WITH search_condition */ - case 566: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==566); - case 599: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==599); - case 635: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==635); -{ yymsp[-1].minor.yy896 = yymsp[0].minor.yy896; } + case 590: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==590); + case 623: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==623); + case 659: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==659); +{ yymsp[-1].minor.yy392 = yymsp[0].minor.yy392; } break; case 54: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy701, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy369, NULL); } break; case 55: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy369, &yymsp[0].minor.yy0); } break; case 56: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy733, false); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy377, false); } break; case 57: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy701, yymsp[0].minor.yy733, false); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy369, yymsp[0].minor.yy377, false); } break; case 58: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy733); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy377); } break; case 59: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy701, false, yymsp[0].minor.yy733); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy369, false, yymsp[0].minor.yy377); } break; case 60: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -5071,34 +5450,34 @@ static YYACTIONTYPE yy_reduce( case 332: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==332); case 333: /* sma_func_name ::= LAST */ yytestcase(yyruleno==333); case 334: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==334); - case 456: /* db_name ::= NK_ID */ yytestcase(yyruleno==456); - case 457: /* table_name ::= NK_ID */ yytestcase(yyruleno==457); - case 458: /* column_name ::= NK_ID */ yytestcase(yyruleno==458); - case 459: /* function_name ::= NK_ID */ yytestcase(yyruleno==459); - case 460: /* view_name ::= NK_ID */ yytestcase(yyruleno==460); - case 461: /* table_alias ::= NK_ID */ yytestcase(yyruleno==461); - case 462: /* column_alias ::= NK_ID */ yytestcase(yyruleno==462); - case 463: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==463); - case 464: /* user_name ::= NK_ID */ yytestcase(yyruleno==464); - case 465: /* topic_name ::= NK_ID */ yytestcase(yyruleno==465); - case 466: /* stream_name ::= NK_ID */ yytestcase(yyruleno==466); - case 467: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==467); - case 468: /* index_name ::= NK_ID */ yytestcase(yyruleno==468); - case 511: /* noarg_func ::= NOW */ yytestcase(yyruleno==511); - case 512: /* noarg_func ::= TODAY */ yytestcase(yyruleno==512); - case 513: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==513); - case 514: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==514); - case 515: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==515); - case 516: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==516); - case 517: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==517); - case 518: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==518); - case 519: /* noarg_func ::= USER */ yytestcase(yyruleno==519); - case 520: /* star_func ::= COUNT */ yytestcase(yyruleno==520); - case 521: /* star_func ::= FIRST */ yytestcase(yyruleno==521); - case 522: /* star_func ::= LAST */ yytestcase(yyruleno==522); - case 523: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==523); -{ yylhsminor.yy701 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy701 = yylhsminor.yy701; + case 480: /* db_name ::= NK_ID */ yytestcase(yyruleno==480); + case 481: /* table_name ::= NK_ID */ yytestcase(yyruleno==481); + case 482: /* column_name ::= NK_ID */ yytestcase(yyruleno==482); + case 483: /* function_name ::= NK_ID */ yytestcase(yyruleno==483); + case 484: /* view_name ::= NK_ID */ yytestcase(yyruleno==484); + case 485: /* table_alias ::= NK_ID */ yytestcase(yyruleno==485); + case 486: /* column_alias ::= NK_ID */ yytestcase(yyruleno==486); + case 487: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==487); + case 488: /* user_name ::= NK_ID */ yytestcase(yyruleno==488); + case 489: /* topic_name ::= NK_ID */ yytestcase(yyruleno==489); + case 490: /* stream_name ::= NK_ID */ yytestcase(yyruleno==490); + case 491: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==491); + case 492: /* index_name ::= NK_ID */ yytestcase(yyruleno==492); + case 535: /* noarg_func ::= NOW */ yytestcase(yyruleno==535); + case 536: /* noarg_func ::= TODAY */ yytestcase(yyruleno==536); + case 537: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==537); + case 538: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==538); + case 539: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==539); + case 540: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==540); + case 541: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==541); + case 542: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==542); + case 543: /* noarg_func ::= USER */ yytestcase(yyruleno==543); + case 544: /* star_func ::= COUNT */ yytestcase(yyruleno==544); + case 545: /* star_func ::= FIRST */ yytestcase(yyruleno==545); + case 546: /* star_func ::= LAST */ yytestcase(yyruleno==546); + case 547: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==547); +{ yylhsminor.yy369 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy369 = yylhsminor.yy369; break; case 68: /* force_opt ::= */ case 94: /* not_exists_opt ::= */ yytestcase(yyruleno==94); @@ -5106,18 +5485,18 @@ static YYACTIONTYPE yy_reduce( case 352: /* analyze_opt ::= */ yytestcase(yyruleno==352); case 359: /* agg_func_opt ::= */ yytestcase(yyruleno==359); case 365: /* or_replace_opt ::= */ yytestcase(yyruleno==365); - case 391: /* ignore_opt ::= */ yytestcase(yyruleno==391); - case 586: /* tag_mode_opt ::= */ yytestcase(yyruleno==586); - case 588: /* set_quantifier_opt ::= */ yytestcase(yyruleno==588); -{ yymsp[1].minor.yy733 = false; } + case 395: /* ignore_opt ::= */ yytestcase(yyruleno==395); + case 610: /* tag_mode_opt ::= */ yytestcase(yyruleno==610); + case 612: /* set_quantifier_opt ::= */ yytestcase(yyruleno==612); +{ yymsp[1].minor.yy377 = false; } break; case 69: /* force_opt ::= FORCE */ case 70: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==70); case 353: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==353); case 360: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==360); - case 587: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==587); - case 589: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==589); -{ yymsp[0].minor.yy733 = true; } + case 611: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==611); + case 613: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==613); +{ yymsp[0].minor.yy377 = true; } break; case 71: /* cmd ::= ALTER CLUSTER NK_STRING */ { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -5165,241 +5544,241 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } break; case 86: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy733, &yymsp[-1].minor.yy701, yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy377, &yymsp[-1].minor.yy369, yymsp[0].minor.yy392); } break; case 87: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy733, &yymsp[0].minor.yy701); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy377, &yymsp[0].minor.yy369); } break; case 88: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy701); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy369); } break; case 89: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy701, yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy369, yymsp[0].minor.yy392); } break; case 90: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy701); } +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy369); } break; case 91: /* cmd ::= TRIM DATABASE db_name speed_opt */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy701, yymsp[0].minor.yy396); } +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy369, yymsp[0].minor.yy20); } break; case 92: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ -{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy701, yymsp[-1].minor.yy896, yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy369, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); } break; case 93: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy733 = true; } +{ yymsp[-2].minor.yy377 = true; } break; case 95: /* exists_opt ::= IF EXISTS */ case 366: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==366); - case 392: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==392); -{ yymsp[-1].minor.yy733 = true; } + case 396: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==396); +{ yymsp[-1].minor.yy377 = true; } break; case 97: /* db_options ::= */ -{ yymsp[1].minor.yy896 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy392 = createDefaultDatabaseOptions(pCxt); } break; case 98: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 99: /* db_options ::= db_options CACHEMODEL NK_STRING */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 100: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 101: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 102: /* db_options ::= db_options DURATION NK_INTEGER */ case 103: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==103); -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 104: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 105: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 106: /* db_options ::= db_options KEEP integer_list */ case 107: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==107); -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_KEEP, yymsp[0].minor.yy404); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_KEEP, yymsp[0].minor.yy184); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 108: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 109: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 110: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 111: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 112: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 113: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 114: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 115: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_RETENTIONS, yymsp[0].minor.yy404); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_RETENTIONS, yymsp[0].minor.yy184); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 116: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 117: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 118: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 119: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 120: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-3].minor.yy896, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-3].minor.yy392, DB_OPTION_WAL_RETENTION_PERIOD, &t); } - yymsp[-3].minor.yy896 = yylhsminor.yy896; + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; case 121: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 122: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-3].minor.yy896, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-3].minor.yy392, DB_OPTION_WAL_RETENTION_SIZE, &t); } - yymsp[-3].minor.yy896 = yylhsminor.yy896; + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; case 123: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 124: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 125: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 126: /* db_options ::= db_options TABLE_PREFIX signed */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy896); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy392); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 127: /* db_options ::= db_options TABLE_SUFFIX signed */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy896); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy392); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 128: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ -{ yylhsminor.yy896 = setDatabaseOption(pCxt, yymsp[-2].minor.yy896, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 129: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy896 = createAlterDatabaseOptions(pCxt); yylhsminor.yy896 = setAlterDatabaseOption(pCxt, yylhsminor.yy896, &yymsp[0].minor.yy529); } - yymsp[0].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createAlterDatabaseOptions(pCxt); yylhsminor.yy392 = setAlterDatabaseOption(pCxt, yylhsminor.yy392, &yymsp[0].minor.yy845); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; case 130: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy896 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy896, &yymsp[0].minor.yy529); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy392, &yymsp[0].minor.yy845); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; case 131: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy529.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy845.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy845.val = yymsp[0].minor.yy0; } break; case 132: /* alter_db_option ::= CACHEMODEL NK_STRING */ -{ yymsp[-1].minor.yy529.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy845.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy845.val = yymsp[0].minor.yy0; } break; case 133: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -{ yymsp[-1].minor.yy529.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy845.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy845.val = yymsp[0].minor.yy0; } break; case 134: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy529.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy845.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy845.val = yymsp[0].minor.yy0; } break; case 135: /* alter_db_option ::= KEEP integer_list */ case 136: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==136); -{ yymsp[-1].minor.yy529.type = DB_OPTION_KEEP; yymsp[-1].minor.yy529.pList = yymsp[0].minor.yy404; } +{ yymsp[-1].minor.yy845.type = DB_OPTION_KEEP; yymsp[-1].minor.yy845.pList = yymsp[0].minor.yy184; } break; case 137: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy529.type = DB_OPTION_PAGES; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy845.type = DB_OPTION_PAGES; yymsp[-1].minor.yy845.val = yymsp[0].minor.yy0; } break; case 138: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy529.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy845.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy845.val = yymsp[0].minor.yy0; } break; case 139: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -{ yymsp[-1].minor.yy529.type = DB_OPTION_WAL; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy845.type = DB_OPTION_WAL; yymsp[-1].minor.yy845.val = yymsp[0].minor.yy0; } break; case 140: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -{ yymsp[-1].minor.yy529.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy845.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy845.val = yymsp[0].minor.yy0; } break; case 141: /* alter_db_option ::= MINROWS NK_INTEGER */ -{ yymsp[-1].minor.yy529.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy845.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy845.val = yymsp[0].minor.yy0; } break; case 142: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy529.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy845.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy845.val = yymsp[0].minor.yy0; } break; case 143: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy529.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy529.val = t; + yymsp[-2].minor.yy845.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy845.val = t; } break; case 144: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ -{ yymsp[-1].minor.yy529.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy845.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy845.val = yymsp[0].minor.yy0; } break; case 145: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy529.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy529.val = t; + yymsp[-2].minor.yy845.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy845.val = t; } break; case 146: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ -{ yymsp[-1].minor.yy529.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy845.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy845.val = yymsp[0].minor.yy0; } break; case 147: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy404 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy404 = yylhsminor.yy404; +{ yylhsminor.yy184 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 148: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 405: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==405); -{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy404 = yylhsminor.yy404; + case 409: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==409); +{ yylhsminor.yy184 = addNodeToList(pCxt, yymsp[-2].minor.yy184, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 149: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy404 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy404 = yylhsminor.yy404; +{ yylhsminor.yy184 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 150: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy404 = yylhsminor.yy404; +{ yylhsminor.yy184 = addNodeToList(pCxt, yymsp[-2].minor.yy184, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 151: /* retention_list ::= retention */ case 182: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==182); @@ -5409,15 +5788,16 @@ static YYACTIONTYPE yy_reduce( case 242: /* col_name_list ::= col_name */ yytestcase(yyruleno==242); case 310: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==310); case 327: /* func_list ::= func */ yytestcase(yyruleno==327); - case 429: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==429); - case 454: /* literal_list ::= signed_literal */ yytestcase(yyruleno==454); - case 526: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==526); - case 532: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==532); - case 591: /* select_list ::= select_item */ yytestcase(yyruleno==591); - case 602: /* partition_list ::= partition_item */ yytestcase(yyruleno==602); - case 663: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==663); -{ yylhsminor.yy404 = createNodeList(pCxt, yymsp[0].minor.yy896); } - yymsp[0].minor.yy404 = yylhsminor.yy404; + case 377: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==377); + case 453: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==453); + case 478: /* literal_list ::= signed_literal */ yytestcase(yyruleno==478); + case 550: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==550); + case 556: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==556); + case 615: /* select_list ::= select_item */ yytestcase(yyruleno==615); + case 626: /* partition_list ::= partition_item */ yytestcase(yyruleno==626); + case 687: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==687); +{ yylhsminor.yy184 = createNodeList(pCxt, yymsp[0].minor.yy392); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 152: /* retention_list ::= retention_list NK_COMMA retention */ case 186: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==186); @@ -5426,277 +5806,278 @@ static YYACTIONTYPE yy_reduce( case 243: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==243); case 311: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==311); case 328: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==328); - case 430: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==430); - case 455: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==455); - case 527: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==527); - case 592: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==592); - case 603: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==603); - case 664: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==664); -{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, yymsp[0].minor.yy896); } - yymsp[-2].minor.yy404 = yylhsminor.yy404; + case 378: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==378); + case 454: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==454); + case 479: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==479); + case 551: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==551); + case 616: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==616); + case 627: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==627); + case 688: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==688); +{ yylhsminor.yy184 = addNodeToList(pCxt, yymsp[-2].minor.yy184, yymsp[0].minor.yy392); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 153: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ case 154: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==154); -{ yylhsminor.yy896 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 155: /* speed_opt ::= */ case 361: /* bufsize_opt ::= */ yytestcase(yyruleno==361); -{ yymsp[1].minor.yy396 = 0; } +{ yymsp[1].minor.yy20 = 0; } break; case 156: /* speed_opt ::= BWLIMIT NK_INTEGER */ case 362: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==362); -{ yymsp[-1].minor.yy396 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy20 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; case 158: /* start_opt ::= START WITH NK_INTEGER */ case 162: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==162); -{ yymsp[-2].minor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-2].minor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 159: /* start_opt ::= START WITH NK_STRING */ case 163: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==163); -{ yymsp[-2].minor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +{ yymsp[-2].minor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 160: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ case 164: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==164); -{ yymsp[-3].minor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +{ yymsp[-3].minor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 165: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 167: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==167); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy733, yymsp[-5].minor.yy896, yymsp[-3].minor.yy404, yymsp[-1].minor.yy404, yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy377, yymsp[-5].minor.yy392, yymsp[-3].minor.yy184, yymsp[-1].minor.yy184, yymsp[0].minor.yy392); } break; case 166: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy404); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy184); } break; case 168: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy404); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy184); } break; case 169: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy733, yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy377, yymsp[0].minor.yy392); } break; case 170: /* cmd ::= ALTER TABLE alter_table_clause */ - case 407: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==407); - case 408: /* cmd ::= insert_query */ yytestcase(yyruleno==408); -{ pCxt->pRootNode = yymsp[0].minor.yy896; } + case 411: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==411); + case 412: /* cmd ::= insert_query */ yytestcase(yyruleno==412); +{ pCxt->pRootNode = yymsp[0].minor.yy392; } break; case 171: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy896); } +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy392); } break; case 172: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy896 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy896, yymsp[0].minor.yy896); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; case 173: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy896 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy896, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy701, yymsp[0].minor.yy504); } - yymsp[-4].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy392, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy369, yymsp[0].minor.yy864); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; break; case 174: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy896 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy896, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy701); } - yymsp[-3].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy392, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy369); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; case 175: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy896 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy896, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy701, yymsp[0].minor.yy504); } - yymsp[-4].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy392, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy369, yymsp[0].minor.yy864); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; break; case 176: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy896 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy896, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy701, &yymsp[0].minor.yy701); } - yymsp[-4].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy392, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy369, &yymsp[0].minor.yy369); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; break; case 177: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy896 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy896, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy701, yymsp[0].minor.yy504); } - yymsp[-4].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy392, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy369, yymsp[0].minor.yy864); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; break; case 178: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy896 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy896, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy701); } - yymsp[-3].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy392, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy369); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; case 179: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy896 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy896, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy701, yymsp[0].minor.yy504); } - yymsp[-4].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy392, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy369, yymsp[0].minor.yy864); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; break; case 180: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy896 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy896, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy701, &yymsp[0].minor.yy701); } - yymsp[-4].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy392, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy369, &yymsp[0].minor.yy369); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; break; case 181: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ -{ yylhsminor.yy896 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy896, &yymsp[-2].minor.yy701, yymsp[0].minor.yy896); } - yymsp[-5].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy392, &yymsp[-2].minor.yy369, yymsp[0].minor.yy392); } + yymsp[-5].minor.yy392 = yylhsminor.yy392; break; case 183: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 533: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==533); -{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-1].minor.yy404, yymsp[0].minor.yy896); } - yymsp[-1].minor.yy404 = yylhsminor.yy404; + case 557: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==557); +{ yylhsminor.yy184 = addNodeToList(pCxt, yymsp[-1].minor.yy184, yymsp[0].minor.yy392); } + yymsp[-1].minor.yy184 = yylhsminor.yy184; break; case 184: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ -{ yylhsminor.yy896 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy733, yymsp[-8].minor.yy896, yymsp[-6].minor.yy896, yymsp[-5].minor.yy404, yymsp[-2].minor.yy404, yymsp[0].minor.yy896); } - yymsp[-9].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy377, yymsp[-8].minor.yy392, yymsp[-6].minor.yy392, yymsp[-5].minor.yy184, yymsp[-2].minor.yy184, yymsp[0].minor.yy392); } + yymsp[-9].minor.yy392 = yylhsminor.yy392; break; case 187: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy896 = createDropTableClause(pCxt, yymsp[-1].minor.yy733, yymsp[0].minor.yy896); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createDropTableClause(pCxt, yymsp[-1].minor.yy377, yymsp[0].minor.yy392); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; case 189: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 376: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==376); -{ yymsp[-2].minor.yy404 = yymsp[-1].minor.yy404; } + case 376: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==376); +{ yymsp[-2].minor.yy184 = yymsp[-1].minor.yy184; } break; case 190: /* full_table_name ::= table_name */ -{ yylhsminor.yy896 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy701, NULL); } - yymsp[0].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy369, NULL); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; case 191: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy896 = createRealTableNode(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy701, NULL); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createRealTableNode(pCxt, &yymsp[-2].minor.yy369, &yymsp[0].minor.yy369, NULL); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 194: /* column_def ::= column_name type_name */ -{ yylhsminor.yy896 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy701, yymsp[0].minor.yy504, NULL, false); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy369, yymsp[0].minor.yy864, NULL, false); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; case 195: /* column_def ::= column_name type_name PRIMARY KEY */ -{ yylhsminor.yy896 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy701, yymsp[-2].minor.yy504, NULL, true); } - yymsp[-3].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy369, yymsp[-2].minor.yy864, NULL, true); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; case 196: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy864 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 197: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy864 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 198: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy864 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 199: /* type_name ::= INT */ case 200: /* type_name ::= INTEGER */ yytestcase(yyruleno==200); -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy864 = createDataType(TSDB_DATA_TYPE_INT); } break; case 201: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy864 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 202: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy864 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 203: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy864 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 204: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy504 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy864 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 205: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy864 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 206: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy504 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy864 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 207: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy504 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy864 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 208: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy504 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy864 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 209: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy504 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy864 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 210: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy504 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy864 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 211: /* type_name ::= JSON */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy864 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 212: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy504 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy864 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 213: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy864 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 214: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy864 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 215: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy504 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy864 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 216: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy504 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy864 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } break; case 217: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy864 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 218: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy504 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy864 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 219: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy504 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy864 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 222: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ - case 379: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==379); -{ yymsp[-3].minor.yy404 = yymsp[-1].minor.yy404; } + case 383: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==383); +{ yymsp[-3].minor.yy184 = yymsp[-1].minor.yy184; } break; case 223: /* table_options ::= */ -{ yymsp[1].minor.yy896 = createDefaultTableOptions(pCxt); } +{ yymsp[1].minor.yy392 = createDefaultTableOptions(pCxt); } break; case 224: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy896 = setTableOption(pCxt, yymsp[-2].minor.yy896, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setTableOption(pCxt, yymsp[-2].minor.yy392, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 225: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy896 = setTableOption(pCxt, yymsp[-2].minor.yy896, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy404); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setTableOption(pCxt, yymsp[-2].minor.yy392, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy184); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 226: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy896 = setTableOption(pCxt, yymsp[-2].minor.yy896, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy404); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setTableOption(pCxt, yymsp[-2].minor.yy392, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy184); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 227: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy896 = setTableOption(pCxt, yymsp[-4].minor.yy896, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy404); } - yymsp[-4].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setTableOption(pCxt, yymsp[-4].minor.yy392, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy184); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; break; case 228: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy896 = setTableOption(pCxt, yymsp[-2].minor.yy896, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setTableOption(pCxt, yymsp[-2].minor.yy392, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 229: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy896 = setTableOption(pCxt, yymsp[-4].minor.yy896, TABLE_OPTION_SMA, yymsp[-1].minor.yy404); } - yymsp[-4].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setTableOption(pCxt, yymsp[-4].minor.yy392, TABLE_OPTION_SMA, yymsp[-1].minor.yy184); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; break; case 230: /* table_options ::= table_options DELETE_MARK duration_list */ -{ yylhsminor.yy896 = setTableOption(pCxt, yymsp[-2].minor.yy896, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy404); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setTableOption(pCxt, yymsp[-2].minor.yy392, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy184); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 231: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy896 = createAlterTableOptions(pCxt); yylhsminor.yy896 = setTableOption(pCxt, yylhsminor.yy896, yymsp[0].minor.yy529.type, &yymsp[0].minor.yy529.val); } - yymsp[0].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createAlterTableOptions(pCxt); yylhsminor.yy392 = setTableOption(pCxt, yylhsminor.yy392, yymsp[0].minor.yy845.type, &yymsp[0].minor.yy845.val); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; case 232: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy896 = setTableOption(pCxt, yymsp[-1].minor.yy896, yymsp[0].minor.yy529.type, &yymsp[0].minor.yy529.val); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setTableOption(pCxt, yymsp[-1].minor.yy392, yymsp[0].minor.yy845.type, &yymsp[0].minor.yy845.val); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; case 233: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy529.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy845.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy845.val = yymsp[0].minor.yy0; } break; case 234: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy529.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy845.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy845.val = yymsp[0].minor.yy0; } break; case 235: /* duration_list ::= duration_literal */ - case 486: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==486); -{ yylhsminor.yy404 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy896)); } - yymsp[0].minor.yy404 = yylhsminor.yy404; + case 510: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==510); +{ yylhsminor.yy184 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy392)); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 236: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 487: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==487); -{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, releaseRawExprNode(pCxt, yymsp[0].minor.yy896)); } - yymsp[-2].minor.yy404 = yylhsminor.yy404; + case 511: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==511); +{ yylhsminor.yy184 = addNodeToList(pCxt, yymsp[-2].minor.yy184, releaseRawExprNode(pCxt, yymsp[0].minor.yy392)); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 239: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy896 = createFunctionNode(pCxt, &yymsp[0].minor.yy701, NULL); } - yymsp[0].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createFunctionNode(pCxt, &yymsp[0].minor.yy369, NULL); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; case 240: /* rollup_func_name ::= FIRST */ case 241: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==241); case 313: /* tag_item ::= QTAGS */ yytestcase(yyruleno==313); -{ yylhsminor.yy896 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; case 244: /* col_name ::= column_name */ case 314: /* tag_item ::= column_name */ yytestcase(yyruleno==314); -{ yylhsminor.yy896 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy701); } - yymsp[0].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy369); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; case 245: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } @@ -5710,19 +6091,19 @@ static YYACTIONTYPE yy_reduce( case 248: /* cmd ::= SHOW db_kind_opt DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); - setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy705); + setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy849); } break; case 249: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ { - pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy989, yymsp[0].minor.yy896, OP_TYPE_LIKE); + pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy397, yymsp[0].minor.yy392, OP_TYPE_LIKE); } break; case 250: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy896, yymsp[0].minor.yy896, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy392, yymsp[0].minor.yy392, OP_TYPE_LIKE); } break; case 251: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy896, NULL, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy392, NULL, OP_TYPE_LIKE); } break; case 252: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } @@ -5737,10 +6118,10 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; case 256: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy896, yymsp[-1].minor.yy896, OP_TYPE_EQUAL); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy392, yymsp[-1].minor.yy392, OP_TYPE_EQUAL); } break; case 257: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy701), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy701), OP_TYPE_EQUAL); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy369), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy369), OP_TYPE_EQUAL); } break; case 258: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } @@ -5768,13 +6149,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } break; case 267: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy701); } +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy369); } break; case 268: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy392); } break; case 269: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy392); } break; case 270: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } @@ -5793,7 +6174,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; case 276: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy392); } break; case 277: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } @@ -5808,7 +6189,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; case 281: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy392); } break; case 282: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } @@ -5817,16 +6198,16 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; case 284: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy896, yymsp[-1].minor.yy896, OP_TYPE_EQUAL); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy392, yymsp[-1].minor.yy392, OP_TYPE_EQUAL); } break; case 285: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy701), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy701), OP_TYPE_EQUAL); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy369), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy369), OP_TYPE_EQUAL); } break; case 286: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy896, yymsp[0].minor.yy896, yymsp[-3].minor.yy404); } +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy392, yymsp[0].minor.yy392, yymsp[-3].minor.yy184); } break; case 287: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy701), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy701), yymsp[-4].minor.yy404); } +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy369), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy369), yymsp[-4].minor.yy184); } break; case 288: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } @@ -5835,16 +6216,16 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } break; case 290: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy896, QUERY_NODE_SHOW_DB_ALIVE_STMT); } +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy392, QUERY_NODE_SHOW_DB_ALIVE_STMT); } break; case 291: /* cmd ::= SHOW CLUSTER ALIVE */ { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } break; case 292: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy896, yymsp[0].minor.yy896, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy392, yymsp[0].minor.yy392, OP_TYPE_LIKE); } break; case 293: /* cmd ::= SHOW CREATE VIEW full_table_name */ -{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy392); } break; case 294: /* cmd ::= SHOW COMPACTS */ { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } @@ -5853,906 +6234,950 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; case 296: /* table_kind_db_name_cond_opt ::= */ -{ yymsp[1].minor.yy989.kind = SHOW_KIND_ALL; yymsp[1].minor.yy989.dbName = nil_token; } +{ yymsp[1].minor.yy397.kind = SHOW_KIND_ALL; yymsp[1].minor.yy397.dbName = nil_token; } break; case 297: /* table_kind_db_name_cond_opt ::= table_kind */ -{ yylhsminor.yy989.kind = yymsp[0].minor.yy705; yylhsminor.yy989.dbName = nil_token; } - yymsp[0].minor.yy989 = yylhsminor.yy989; +{ yylhsminor.yy397.kind = yymsp[0].minor.yy849; yylhsminor.yy397.dbName = nil_token; } + yymsp[0].minor.yy397 = yylhsminor.yy397; break; case 298: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy989.kind = SHOW_KIND_ALL; yylhsminor.yy989.dbName = yymsp[-1].minor.yy701; } - yymsp[-1].minor.yy989 = yylhsminor.yy989; +{ yylhsminor.yy397.kind = SHOW_KIND_ALL; yylhsminor.yy397.dbName = yymsp[-1].minor.yy369; } + yymsp[-1].minor.yy397 = yylhsminor.yy397; break; case 299: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ -{ yylhsminor.yy989.kind = yymsp[-2].minor.yy705; yylhsminor.yy989.dbName = yymsp[-1].minor.yy701; } - yymsp[-2].minor.yy989 = yylhsminor.yy989; +{ yylhsminor.yy397.kind = yymsp[-2].minor.yy849; yylhsminor.yy397.dbName = yymsp[-1].minor.yy369; } + yymsp[-2].minor.yy397 = yylhsminor.yy397; break; case 300: /* table_kind ::= NORMAL */ -{ yymsp[0].minor.yy705 = SHOW_KIND_TABLES_NORMAL; } +{ yymsp[0].minor.yy849 = SHOW_KIND_TABLES_NORMAL; } break; case 301: /* table_kind ::= CHILD */ -{ yymsp[0].minor.yy705 = SHOW_KIND_TABLES_CHILD; } +{ yymsp[0].minor.yy849 = SHOW_KIND_TABLES_CHILD; } break; case 302: /* db_name_cond_opt ::= */ case 307: /* from_db_opt ::= */ yytestcase(yyruleno==307); -{ yymsp[1].minor.yy896 = createDefaultDatabaseCondValue(pCxt); } +{ yymsp[1].minor.yy392 = createDefaultDatabaseCondValue(pCxt); } break; case 303: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy896 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy701); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy369); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; case 305: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 306: /* table_name_cond ::= table_name */ -{ yylhsminor.yy896 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy701); } - yymsp[0].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy369); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; case 308: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy896 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy701); } +{ yymsp[-1].minor.yy392 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy369); } break; case 312: /* tag_item ::= TBNAME */ -{ yylhsminor.yy896 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } - yymsp[0].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; case 315: /* tag_item ::= column_name column_alias */ -{ yylhsminor.yy896 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy701), &yymsp[0].minor.yy701); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy369), &yymsp[0].minor.yy369); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; case 316: /* tag_item ::= column_name AS column_alias */ -{ yylhsminor.yy896 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy701), &yymsp[0].minor.yy701); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy369), &yymsp[0].minor.yy369); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 317: /* db_kind_opt ::= */ -{ yymsp[1].minor.yy705 = SHOW_KIND_ALL; } +{ yymsp[1].minor.yy849 = SHOW_KIND_ALL; } break; case 318: /* db_kind_opt ::= USER */ -{ yymsp[0].minor.yy705 = SHOW_KIND_DATABASES_USER; } +{ yymsp[0].minor.yy849 = SHOW_KIND_DATABASES_USER; } break; case 319: /* db_kind_opt ::= SYSTEM */ -{ yymsp[0].minor.yy705 = SHOW_KIND_DATABASES_SYSTEM; } +{ yymsp[0].minor.yy849 = SHOW_KIND_DATABASES_SYSTEM; } break; case 320: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy733, yymsp[-3].minor.yy896, yymsp[-1].minor.yy896, NULL, yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy377, yymsp[-3].minor.yy392, yymsp[-1].minor.yy392, NULL, yymsp[0].minor.yy392); } break; case 321: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy733, yymsp[-5].minor.yy896, yymsp[-3].minor.yy896, yymsp[-1].minor.yy404, NULL); } +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy377, yymsp[-5].minor.yy392, yymsp[-3].minor.yy392, yymsp[-1].minor.yy184, NULL); } break; case 322: /* cmd ::= DROP INDEX exists_opt full_index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy733, yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy377, yymsp[0].minor.yy392); } break; case 323: /* full_index_name ::= index_name */ -{ yylhsminor.yy896 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy701); } - yymsp[0].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy369); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; case 324: /* full_index_name ::= db_name NK_DOT index_name */ -{ yylhsminor.yy896 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy701); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy369, &yymsp[0].minor.yy369); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 325: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy896 = createIndexOption(pCxt, yymsp[-7].minor.yy404, releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), NULL, yymsp[-1].minor.yy896, yymsp[0].minor.yy896); } +{ yymsp[-9].minor.yy392 = createIndexOption(pCxt, yymsp[-7].minor.yy184, releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), NULL, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); } break; case 326: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-11].minor.yy896 = createIndexOption(pCxt, yymsp[-9].minor.yy404, releaseRawExprNode(pCxt, yymsp[-5].minor.yy896), releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), yymsp[-1].minor.yy896, yymsp[0].minor.yy896); } +{ yymsp[-11].minor.yy392 = createIndexOption(pCxt, yymsp[-9].minor.yy184, releaseRawExprNode(pCxt, yymsp[-5].minor.yy392), releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), yymsp[-1].minor.yy392, yymsp[0].minor.yy392); } break; case 329: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy896 = createFunctionNode(pCxt, &yymsp[-3].minor.yy701, yymsp[-1].minor.yy404); } - yymsp[-3].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createFunctionNode(pCxt, &yymsp[-3].minor.yy369, yymsp[-1].minor.yy184); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; case 330: /* sma_func_name ::= function_name */ - case 576: /* alias_opt ::= table_alias */ yytestcase(yyruleno==576); -{ yylhsminor.yy701 = yymsp[0].minor.yy701; } - yymsp[0].minor.yy701 = yylhsminor.yy701; + case 600: /* alias_opt ::= table_alias */ yytestcase(yyruleno==600); +{ yylhsminor.yy369 = yymsp[0].minor.yy369; } + yymsp[0].minor.yy369 = yylhsminor.yy369; break; case 335: /* sma_stream_opt ::= */ - case 380: /* stream_options ::= */ yytestcase(yyruleno==380); -{ yymsp[1].minor.yy896 = createStreamOptions(pCxt); } + case 384: /* stream_options ::= */ yytestcase(yyruleno==384); +{ yymsp[1].minor.yy392 = createStreamOptions(pCxt); } break; case 336: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy896)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy896); yylhsminor.yy896 = yymsp[-2].minor.yy896; } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ ((SStreamOptions*)yymsp[-2].minor.yy392)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy392); yylhsminor.yy392 = yymsp[-2].minor.yy392; } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 337: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy896)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy896); yylhsminor.yy896 = yymsp[-2].minor.yy896; } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ ((SStreamOptions*)yymsp[-2].minor.yy392)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy392); yylhsminor.yy392 = yymsp[-2].minor.yy392; } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 338: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy896)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy896); yylhsminor.yy896 = yymsp[-2].minor.yy896; } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ ((SStreamOptions*)yymsp[-2].minor.yy392)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy392); yylhsminor.yy392 = yymsp[-2].minor.yy392; } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 339: /* with_meta ::= AS */ -{ yymsp[0].minor.yy396 = 0; } +{ yymsp[0].minor.yy20 = 0; } break; case 340: /* with_meta ::= WITH META AS */ -{ yymsp[-2].minor.yy396 = 1; } +{ yymsp[-2].minor.yy20 = 1; } break; case 341: /* with_meta ::= ONLY META AS */ -{ yymsp[-2].minor.yy396 = 2; } +{ yymsp[-2].minor.yy20 = 2; } break; case 342: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy733, &yymsp[-2].minor.yy701, yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy377, &yymsp[-2].minor.yy369, yymsp[0].minor.yy392); } break; case 343: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy733, &yymsp[-3].minor.yy701, &yymsp[0].minor.yy701, yymsp[-2].minor.yy396); } +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy377, &yymsp[-3].minor.yy369, &yymsp[0].minor.yy369, yymsp[-2].minor.yy20); } break; case 344: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy733, &yymsp[-4].minor.yy701, yymsp[-1].minor.yy896, yymsp[-3].minor.yy396, yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy377, &yymsp[-4].minor.yy369, yymsp[-1].minor.yy392, yymsp[-3].minor.yy20, yymsp[0].minor.yy392); } break; case 345: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy733, &yymsp[0].minor.yy701); } +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy377, &yymsp[0].minor.yy369); } break; case 346: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy733, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy701); } +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy377, &yymsp[-2].minor.yy369, &yymsp[0].minor.yy369); } break; case 347: /* cmd ::= DESC full_table_name */ case 348: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==348); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy392); } break; case 349: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; case 350: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ case 351: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==351); -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy733, yymsp[-1].minor.yy896, yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy377, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); } break; case 354: /* explain_options ::= */ -{ yymsp[1].minor.yy896 = createDefaultExplainOptions(pCxt); } +{ yymsp[1].minor.yy392 = createDefaultExplainOptions(pCxt); } break; case 355: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy896 = setExplainVerbose(pCxt, yymsp[-2].minor.yy896, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setExplainVerbose(pCxt, yymsp[-2].minor.yy392, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 356: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy896 = setExplainRatio(pCxt, yymsp[-2].minor.yy896, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = setExplainRatio(pCxt, yymsp[-2].minor.yy392, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 357: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy733, yymsp[-9].minor.yy733, &yymsp[-6].minor.yy701, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy504, yymsp[-1].minor.yy396, &yymsp[0].minor.yy701, yymsp[-10].minor.yy733); } +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy377, yymsp[-9].minor.yy377, &yymsp[-6].minor.yy369, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy864, yymsp[-1].minor.yy20, &yymsp[0].minor.yy369, yymsp[-10].minor.yy377); } break; case 358: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy733, &yymsp[0].minor.yy701); } +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy377, &yymsp[0].minor.yy369); } break; case 363: /* language_opt ::= */ - case 402: /* on_vgroup_id ::= */ yytestcase(yyruleno==402); -{ yymsp[1].minor.yy701 = nil_token; } + case 406: /* on_vgroup_id ::= */ yytestcase(yyruleno==406); +{ yymsp[1].minor.yy369 = nil_token; } break; case 364: /* language_opt ::= LANGUAGE NK_STRING */ - case 403: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==403); -{ yymsp[-1].minor.yy701 = yymsp[0].minor.yy0; } + case 407: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==407); +{ yymsp[-1].minor.yy369 = yymsp[0].minor.yy0; } break; case 367: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy733, yymsp[-2].minor.yy896, &yymsp[-1].minor.yy0, yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy377, yymsp[-2].minor.yy392, &yymsp[-1].minor.yy0, yymsp[0].minor.yy392); } break; case 368: /* cmd ::= DROP VIEW exists_opt full_view_name */ -{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy733, yymsp[0].minor.yy896); } +{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy377, yymsp[0].minor.yy392); } break; case 369: /* full_view_name ::= view_name */ -{ yylhsminor.yy896 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy701); } - yymsp[0].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy369); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; case 370: /* full_view_name ::= db_name NK_DOT view_name */ -{ yylhsminor.yy896 = createViewNode(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy701); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; +{ yylhsminor.yy392 = createViewNode(pCxt, &yymsp[-2].minor.yy369, &yymsp[0].minor.yy369); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; case 371: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy733, &yymsp[-8].minor.yy701, yymsp[-5].minor.yy896, yymsp[-7].minor.yy896, yymsp[-3].minor.yy404, yymsp[-2].minor.yy896, yymsp[0].minor.yy896, yymsp[-4].minor.yy404); } +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy377, &yymsp[-8].minor.yy369, yymsp[-5].minor.yy392, yymsp[-7].minor.yy392, yymsp[-3].minor.yy184, yymsp[-2].minor.yy392, yymsp[0].minor.yy392, yymsp[-4].minor.yy184); } break; case 372: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy733, &yymsp[0].minor.yy701); } +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy377, &yymsp[0].minor.yy369); } break; case 373: /* cmd ::= PAUSE STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy733, &yymsp[0].minor.yy701); } +{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy377, &yymsp[0].minor.yy369); } break; case 374: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ -{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy733, yymsp[-1].minor.yy733, &yymsp[0].minor.yy701); } +{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy377, yymsp[-1].minor.yy377, &yymsp[0].minor.yy369); } break; - case 381: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 382: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==382); -{ yylhsminor.yy896 = setStreamOptions(pCxt, yymsp[-2].minor.yy896, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + case 379: /* column_stream_def ::= column_name */ +{ yylhsminor.yy392 = createColumnDefNode(pCxt, &yymsp[0].minor.yy369, createDataType(TSDB_DATA_TYPE_NULL), NULL, false); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 383: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ yylhsminor.yy896 = setStreamOptions(pCxt, yymsp[-3].minor.yy896, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy896)); } - yymsp[-3].minor.yy896 = yylhsminor.yy896; + case 380: /* column_stream_def ::= column_name PRIMARY KEY */ +{ yylhsminor.yy392 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy369, createDataType(TSDB_DATA_TYPE_NULL), NULL, true); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 384: /* stream_options ::= stream_options WATERMARK duration_literal */ -{ yylhsminor.yy896 = setStreamOptions(pCxt, yymsp[-2].minor.yy896, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy896)); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + case 385: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 386: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==386); +{ yylhsminor.yy392 = setStreamOptions(pCxt, yymsp[-2].minor.yy392, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 385: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -{ yylhsminor.yy896 = setStreamOptions(pCxt, yymsp[-3].minor.yy896, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy896 = yylhsminor.yy896; + case 387: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ yylhsminor.yy392 = setStreamOptions(pCxt, yymsp[-3].minor.yy392, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy392)); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; - case 386: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -{ yylhsminor.yy896 = setStreamOptions(pCxt, yymsp[-2].minor.yy896, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + case 388: /* stream_options ::= stream_options WATERMARK duration_literal */ +{ yylhsminor.yy392 = setStreamOptions(pCxt, yymsp[-2].minor.yy392, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy392)); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 387: /* stream_options ::= stream_options DELETE_MARK duration_literal */ -{ yylhsminor.yy896 = setStreamOptions(pCxt, yymsp[-2].minor.yy896, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy896)); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + case 389: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +{ yylhsminor.yy392 = setStreamOptions(pCxt, yymsp[-3].minor.yy392, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; - case 388: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -{ yylhsminor.yy896 = setStreamOptions(pCxt, yymsp[-3].minor.yy896, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy896 = yylhsminor.yy896; + case 390: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +{ yylhsminor.yy392 = setStreamOptions(pCxt, yymsp[-2].minor.yy392, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 390: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 616: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==616); - case 640: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==640); -{ yymsp[-3].minor.yy896 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy896); } + case 391: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +{ yylhsminor.yy392 = setStreamOptions(pCxt, yymsp[-2].minor.yy392, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy392)); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 393: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 392: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +{ yylhsminor.yy392 = setStreamOptions(pCxt, yymsp[-3].minor.yy392, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; + break; + case 394: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 640: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==640); + case 664: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==664); +{ yymsp[-3].minor.yy392 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy392); } + break; + case 397: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 394: /* cmd ::= KILL QUERY NK_STRING */ + case 398: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 395: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 399: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 396: /* cmd ::= KILL COMPACT NK_INTEGER */ + case 400: /* cmd ::= KILL COMPACT NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); } break; - case 397: /* cmd ::= BALANCE VGROUP */ + case 401: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 398: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ -{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy701); } + case 402: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ +{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy369); } break; - case 399: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 403: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 400: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy404); } + case 404: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy184); } break; - case 401: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 405: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 404: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy404 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 408: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy184 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 406: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy896, yymsp[0].minor.yy896); } + case 410: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); } break; - case 409: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -{ yymsp[-6].minor.yy896 = createInsertStmt(pCxt, yymsp[-4].minor.yy896, yymsp[-2].minor.yy404, yymsp[0].minor.yy896); } + case 413: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +{ yymsp[-6].minor.yy392 = createInsertStmt(pCxt, yymsp[-4].minor.yy392, yymsp[-2].minor.yy184, yymsp[0].minor.yy392); } break; - case 410: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -{ yymsp[-3].minor.yy896 = createInsertStmt(pCxt, yymsp[-1].minor.yy896, NULL, yymsp[0].minor.yy896); } + case 414: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +{ yymsp[-3].minor.yy392 = createInsertStmt(pCxt, yymsp[-1].minor.yy392, NULL, yymsp[0].minor.yy392); } break; - case 411: /* tags_literal ::= NK_INTEGER */ - case 417: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==417); - case 420: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==420); -{ yylhsminor.yy896 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 415: /* tags_literal ::= NK_INTEGER */ + case 427: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==427); + case 436: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==436); +{ yylhsminor.yy392 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 412: /* tags_literal ::= NK_PLUS NK_INTEGER */ - case 413: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==413); - case 418: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==418); - case 419: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==419); - case 421: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==421); - case 422: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==422); + case 416: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + case 417: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==417); + case 428: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==428); + case 429: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==429); + case 437: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==437); + case 438: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==438); + case 446: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==446); + case 447: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==447); +{ + SToken l = yymsp[-2].minor.yy0; + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + l.n = (r.z + r.n) - l.z; + yylhsminor.yy392 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy392); + } + yymsp[-2].minor.yy392 = yylhsminor.yy392; + break; + case 418: /* tags_literal ::= NK_PLUS NK_INTEGER */ + case 421: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==421); + case 430: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==430); + case 433: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==433); + case 439: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==439); + case 442: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==442); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy896 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); + yylhsminor.yy392 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 414: /* tags_literal ::= NK_FLOAT */ -{ yylhsminor.yy896 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 419: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + case 420: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==420); + case 422: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==422); + case 423: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==423); + case 431: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==431); + case 432: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==432); + case 434: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==434); + case 435: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==435); + case 440: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==440); + case 441: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==441); + case 443: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==443); + case 444: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==444); +{ + SToken l = yymsp[-3].minor.yy0; + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + l.n = (r.z + r.n) - l.z; + yylhsminor.yy392 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy392); + } + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; - case 415: /* tags_literal ::= NK_PLUS NK_FLOAT */ - case 416: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==416); + case 424: /* tags_literal ::= NK_FLOAT */ +{ yylhsminor.yy392 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 425: /* tags_literal ::= NK_PLUS NK_FLOAT */ + case 426: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==426); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy896 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); + yylhsminor.yy392 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 423: /* tags_literal ::= NK_STRING */ -{ yylhsminor.yy896 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 445: /* tags_literal ::= NK_STRING */ +{ yylhsminor.yy392 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 424: /* tags_literal ::= NK_BOOL */ -{ yylhsminor.yy896 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 448: /* tags_literal ::= NK_BOOL */ +{ yylhsminor.yy392 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 425: /* tags_literal ::= NULL */ -{ yylhsminor.yy896 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 449: /* tags_literal ::= NULL */ +{ yylhsminor.yy392 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 426: /* tags_literal ::= literal_func */ -{ yylhsminor.yy896 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy896); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 450: /* tags_literal ::= literal_func */ +{ yylhsminor.yy392 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy392); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 427: /* tags_literal ::= literal_func NK_PLUS duration_literal */ - case 428: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==428); + case 451: /* tags_literal ::= literal_func NK_PLUS duration_literal */ + case 452: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==452); { - SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896); - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896); + SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); l.n = (r.z + r.n) - l.z; - yylhsminor.yy896 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy896, yymsp[0].minor.yy896); + yylhsminor.yy392 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy392, yymsp[0].minor.yy392); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 431: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 455: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 432: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 456: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 433: /* literal ::= NK_STRING */ -{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 457: /* literal ::= NK_STRING */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 434: /* literal ::= NK_BOOL */ -{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 458: /* literal ::= NK_BOOL */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 435: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; + case 459: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 436: /* literal ::= duration_literal */ - case 446: /* signed_literal ::= signed */ yytestcase(yyruleno==446); - case 469: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==469); - case 470: /* expression ::= literal */ yytestcase(yyruleno==470); - case 472: /* expression ::= column_reference */ yytestcase(yyruleno==472); - case 473: /* expression ::= function_expression */ yytestcase(yyruleno==473); - case 474: /* expression ::= case_when_expression */ yytestcase(yyruleno==474); - case 507: /* function_expression ::= literal_func */ yytestcase(yyruleno==507); - case 557: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==557); - case 561: /* boolean_primary ::= predicate */ yytestcase(yyruleno==561); - case 563: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==563); - case 564: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==564); - case 567: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==567); - case 569: /* table_reference ::= table_primary */ yytestcase(yyruleno==569); - case 570: /* table_reference ::= joined_table */ yytestcase(yyruleno==570); - case 574: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==574); - case 642: /* query_simple ::= query_specification */ yytestcase(yyruleno==642); - case 643: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==643); - case 646: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==646); - case 648: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==648); -{ yylhsminor.yy896 = yymsp[0].minor.yy896; } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 460: /* literal ::= duration_literal */ + case 470: /* signed_literal ::= signed */ yytestcase(yyruleno==470); + case 493: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==493); + case 494: /* expression ::= literal */ yytestcase(yyruleno==494); + case 496: /* expression ::= column_reference */ yytestcase(yyruleno==496); + case 497: /* expression ::= function_expression */ yytestcase(yyruleno==497); + case 498: /* expression ::= case_when_expression */ yytestcase(yyruleno==498); + case 531: /* function_expression ::= literal_func */ yytestcase(yyruleno==531); + case 581: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==581); + case 585: /* boolean_primary ::= predicate */ yytestcase(yyruleno==585); + case 587: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==587); + case 588: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==588); + case 591: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==591); + case 593: /* table_reference ::= table_primary */ yytestcase(yyruleno==593); + case 594: /* table_reference ::= joined_table */ yytestcase(yyruleno==594); + case 598: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==598); + case 666: /* query_simple ::= query_specification */ yytestcase(yyruleno==666); + case 667: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==667); + case 670: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==670); + case 672: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==672); +{ yylhsminor.yy392 = yymsp[0].minor.yy392; } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 437: /* literal ::= NULL */ -{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 461: /* literal ::= NULL */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 438: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 462: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 439: /* duration_literal ::= NK_VARIABLE */ - case 617: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==617); - case 618: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==618); - case 619: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==619); -{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 463: /* duration_literal ::= NK_VARIABLE */ + case 641: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==641); + case 642: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==642); + case 643: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==643); +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 440: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 464: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 441: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + case 465: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 442: /* signed ::= NK_MINUS NK_INTEGER */ + case 466: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 443: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 467: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 444: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 468: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 445: /* signed ::= NK_MINUS NK_FLOAT */ + case 469: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 447: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 471: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 448: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 472: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 449: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 473: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 450: /* signed_literal ::= duration_literal */ - case 452: /* signed_literal ::= literal_func */ yytestcase(yyruleno==452); - case 528: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==528); - case 594: /* select_item ::= common_expression */ yytestcase(yyruleno==594); - case 604: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==604); - case 647: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==647); - case 649: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==649); - case 662: /* search_condition ::= common_expression */ yytestcase(yyruleno==662); -{ yylhsminor.yy896 = releaseRawExprNode(pCxt, yymsp[0].minor.yy896); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 474: /* signed_literal ::= duration_literal */ + case 476: /* signed_literal ::= literal_func */ yytestcase(yyruleno==476); + case 552: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==552); + case 618: /* select_item ::= common_expression */ yytestcase(yyruleno==618); + case 628: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==628); + case 671: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==671); + case 673: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==673); + case 686: /* search_condition ::= common_expression */ yytestcase(yyruleno==686); +{ yylhsminor.yy392 = releaseRawExprNode(pCxt, yymsp[0].minor.yy392); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 451: /* signed_literal ::= NULL */ -{ yylhsminor.yy896 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 475: /* signed_literal ::= NULL */ +{ yylhsminor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 453: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy896 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 477: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy392 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 471: /* expression ::= pseudo_column */ -{ yylhsminor.yy896 = yymsp[0].minor.yy896; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy896, true); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 495: /* expression ::= pseudo_column */ +{ yylhsminor.yy392 = yymsp[0].minor.yy392; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy392, true); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 475: /* expression ::= NK_LP expression NK_RP */ - case 562: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==562); - case 661: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==661); -{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy896)); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + case 499: /* expression ::= NK_LP expression NK_RP */ + case 586: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==586); + case 685: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==685); +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy392)); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 476: /* expression ::= NK_PLUS expr_or_subquery */ + case 500: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy896)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy392)); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 477: /* expression ::= NK_MINUS expr_or_subquery */ + case 501: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy896), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy392), NULL)); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 478: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 502: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 479: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 503: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 480: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 504: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 481: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 505: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 482: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 506: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 483: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 507: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 484: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 508: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 485: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 509: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 488: /* column_reference ::= column_name */ -{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy701, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy701)); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 512: /* column_reference ::= column_name */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy369, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy369)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 489: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy701, createColumnNode(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy701)); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + case 513: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy369, &yymsp[0].minor.yy369, createColumnNode(pCxt, &yymsp[-2].minor.yy369, &yymsp[0].minor.yy369)); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 490: /* column_reference ::= NK_ALIAS */ -{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 514: /* column_reference ::= NK_ALIAS */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 491: /* column_reference ::= table_name NK_DOT NK_ALIAS */ -{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + case 515: /* column_reference ::= table_name NK_DOT NK_ALIAS */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy369, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy369, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 492: /* pseudo_column ::= ROWTS */ - case 493: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==493); - case 495: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==495); - case 496: /* pseudo_column ::= QEND */ yytestcase(yyruleno==496); - case 497: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==497); - case 498: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==498); - case 499: /* pseudo_column ::= WEND */ yytestcase(yyruleno==499); - case 500: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==500); - case 501: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==501); - case 502: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==502); - case 503: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==503); - case 509: /* literal_func ::= NOW */ yytestcase(yyruleno==509); - case 510: /* literal_func ::= TODAY */ yytestcase(yyruleno==510); -{ yylhsminor.yy896 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 516: /* pseudo_column ::= ROWTS */ + case 517: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==517); + case 519: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==519); + case 520: /* pseudo_column ::= QEND */ yytestcase(yyruleno==520); + case 521: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==521); + case 522: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==522); + case 523: /* pseudo_column ::= WEND */ yytestcase(yyruleno==523); + case 524: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==524); + case 525: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==525); + case 526: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==526); + case 527: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==527); + case 533: /* literal_func ::= NOW */ yytestcase(yyruleno==533); + case 534: /* literal_func ::= TODAY */ yytestcase(yyruleno==534); +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 494: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy701)))); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + case 518: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy369, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy369)))); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 504: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 505: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==505); -{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy701, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy701, yymsp[-1].minor.yy404)); } - yymsp[-3].minor.yy896 = yylhsminor.yy896; + case 528: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 529: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==529); +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy369, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy369, yymsp[-1].minor.yy184)); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; - case 506: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ -{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), yymsp[-1].minor.yy504)); } - yymsp[-5].minor.yy896 = yylhsminor.yy896; + case 530: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), yymsp[-1].minor.yy864)); } + yymsp[-5].minor.yy392 = yylhsminor.yy392; break; - case 508: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy701, NULL)); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + case 532: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy369, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy369, NULL)); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 524: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy404 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy404 = yylhsminor.yy404; + case 548: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy184 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; - case 529: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 597: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==597); -{ yylhsminor.yy896 = createColumnNode(pCxt, &yymsp[-2].minor.yy701, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + case 553: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 621: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==621); +{ yylhsminor.yy392 = createColumnNode(pCxt, &yymsp[-2].minor.yy369, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 530: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy404, yymsp[-1].minor.yy896)); } - yymsp[-3].minor.yy896 = yylhsminor.yy896; + case 554: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy184, yymsp[-1].minor.yy392)); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; - case 531: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), yymsp[-2].minor.yy404, yymsp[-1].minor.yy896)); } - yymsp[-4].minor.yy896 = yylhsminor.yy896; + case 555: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), yymsp[-2].minor.yy184, yymsp[-1].minor.yy392)); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; break; - case 534: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -{ yymsp[-3].minor.yy896 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896)); } + case 558: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy392 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392)); } break; - case 536: /* case_when_else_opt ::= ELSE common_expression */ -{ yymsp[-1].minor.yy896 = releaseRawExprNode(pCxt, yymsp[0].minor.yy896); } + case 560: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy392 = releaseRawExprNode(pCxt, yymsp[0].minor.yy392); } break; - case 537: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 542: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==542); + case 561: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 566: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==566); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy884, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy220, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 538: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 562: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy896); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy896), releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy392), releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-4].minor.yy896 = yylhsminor.yy896; + yymsp[-4].minor.yy392 = yylhsminor.yy392; break; - case 539: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 563: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy896); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy896), releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy392), releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-5].minor.yy896 = yylhsminor.yy896; + yymsp[-5].minor.yy392 = yylhsminor.yy392; break; - case 540: /* predicate ::= expr_or_subquery IS NULL */ + case 564: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), NULL)); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 541: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 565: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), NULL)); } - yymsp[-3].minor.yy896 = yylhsminor.yy896; + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; - case 543: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy884 = OP_TYPE_LOWER_THAN; } + case 567: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy220 = OP_TYPE_LOWER_THAN; } break; - case 544: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy884 = OP_TYPE_GREATER_THAN; } + case 568: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy220 = OP_TYPE_GREATER_THAN; } break; - case 545: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy884 = OP_TYPE_LOWER_EQUAL; } + case 569: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy220 = OP_TYPE_LOWER_EQUAL; } break; - case 546: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy884 = OP_TYPE_GREATER_EQUAL; } + case 570: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy220 = OP_TYPE_GREATER_EQUAL; } break; - case 547: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy884 = OP_TYPE_NOT_EQUAL; } + case 571: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy220 = OP_TYPE_NOT_EQUAL; } break; - case 548: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy884 = OP_TYPE_EQUAL; } + case 572: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy220 = OP_TYPE_EQUAL; } break; - case 549: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy884 = OP_TYPE_LIKE; } + case 573: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy220 = OP_TYPE_LIKE; } break; - case 550: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy884 = OP_TYPE_NOT_LIKE; } + case 574: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy220 = OP_TYPE_NOT_LIKE; } break; - case 551: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy884 = OP_TYPE_MATCH; } + case 575: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy220 = OP_TYPE_MATCH; } break; - case 552: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy884 = OP_TYPE_NMATCH; } + case 576: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy220 = OP_TYPE_NMATCH; } break; - case 553: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy884 = OP_TYPE_JSON_CONTAINS; } + case 577: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy220 = OP_TYPE_JSON_CONTAINS; } break; - case 554: /* in_op ::= IN */ -{ yymsp[0].minor.yy884 = OP_TYPE_IN; } + case 578: /* in_op ::= IN */ +{ yymsp[0].minor.yy220 = OP_TYPE_IN; } break; - case 555: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy884 = OP_TYPE_NOT_IN; } + case 579: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy220 = OP_TYPE_NOT_IN; } break; - case 556: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy404)); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + case 580: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy184)); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 558: /* boolean_value_expression ::= NOT boolean_primary */ + case 582: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy896), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy392), NULL)); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 559: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 583: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 560: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 584: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy896); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy896); - yylhsminor.yy896 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), releaseRawExprNode(pCxt, yymsp[0].minor.yy896))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 568: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy896 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy896, yymsp[0].minor.yy896, NULL); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + case 592: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy392 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy392, yymsp[0].minor.yy392, NULL); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 571: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy896 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy701, &yymsp[0].minor.yy701); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; + case 595: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy392 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy369, &yymsp[0].minor.yy369); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 572: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy896 = createRealTableNode(pCxt, &yymsp[-3].minor.yy701, &yymsp[-1].minor.yy701, &yymsp[0].minor.yy701); } - yymsp[-3].minor.yy896 = yylhsminor.yy896; + case 596: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy392 = createRealTableNode(pCxt, &yymsp[-3].minor.yy369, &yymsp[-1].minor.yy369, &yymsp[0].minor.yy369); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; - case 573: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy896 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy896), &yymsp[0].minor.yy701); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; + case 597: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy392 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy392), &yymsp[0].minor.yy369); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 575: /* alias_opt ::= */ -{ yymsp[1].minor.yy701 = nil_token; } + case 599: /* alias_opt ::= */ +{ yymsp[1].minor.yy369 = nil_token; } break; - case 577: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy701 = yymsp[0].minor.yy701; } + case 601: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy369 = yymsp[0].minor.yy369; } break; - case 578: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 579: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==579); -{ yymsp[-2].minor.yy896 = yymsp[-1].minor.yy896; } + case 602: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 603: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==603); +{ yymsp[-2].minor.yy392 = yymsp[-1].minor.yy392; } break; - case 580: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy896 = createJoinTableNode(pCxt, yymsp[-4].minor.yy680, yymsp[-5].minor.yy896, yymsp[-2].minor.yy896, yymsp[0].minor.yy896); } - yymsp[-5].minor.yy896 = yylhsminor.yy896; + case 604: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy392 = createJoinTableNode(pCxt, yymsp[-4].minor.yy932, yymsp[-5].minor.yy392, yymsp[-2].minor.yy392, yymsp[0].minor.yy392); } + yymsp[-5].minor.yy392 = yylhsminor.yy392; break; - case 581: /* join_type ::= */ -{ yymsp[1].minor.yy680 = JOIN_TYPE_INNER; } + case 605: /* join_type ::= */ +{ yymsp[1].minor.yy932 = JOIN_TYPE_INNER; } break; - case 582: /* join_type ::= INNER */ -{ yymsp[0].minor.yy680 = JOIN_TYPE_INNER; } + case 606: /* join_type ::= INNER */ +{ yymsp[0].minor.yy932 = JOIN_TYPE_INNER; } break; - case 583: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 607: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-13].minor.yy896 = createSelectStmt(pCxt, yymsp[-11].minor.yy733, yymsp[-9].minor.yy404, yymsp[-8].minor.yy896, yymsp[-12].minor.yy404); - yymsp[-13].minor.yy896 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy896, yymsp[-10].minor.yy733); - yymsp[-13].minor.yy896 = addWhereClause(pCxt, yymsp[-13].minor.yy896, yymsp[-7].minor.yy896); - yymsp[-13].minor.yy896 = addPartitionByClause(pCxt, yymsp[-13].minor.yy896, yymsp[-6].minor.yy404); - yymsp[-13].minor.yy896 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy896, yymsp[-2].minor.yy896); - yymsp[-13].minor.yy896 = addGroupByClause(pCxt, yymsp[-13].minor.yy896, yymsp[-1].minor.yy404); - yymsp[-13].minor.yy896 = addHavingClause(pCxt, yymsp[-13].minor.yy896, yymsp[0].minor.yy896); - yymsp[-13].minor.yy896 = addRangeClause(pCxt, yymsp[-13].minor.yy896, yymsp[-5].minor.yy896); - yymsp[-13].minor.yy896 = addEveryClause(pCxt, yymsp[-13].minor.yy896, yymsp[-4].minor.yy896); - yymsp[-13].minor.yy896 = addFillClause(pCxt, yymsp[-13].minor.yy896, yymsp[-3].minor.yy896); + yymsp[-13].minor.yy392 = createSelectStmt(pCxt, yymsp[-11].minor.yy377, yymsp[-9].minor.yy184, yymsp[-8].minor.yy392, yymsp[-12].minor.yy184); + yymsp[-13].minor.yy392 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy392, yymsp[-10].minor.yy377); + yymsp[-13].minor.yy392 = addWhereClause(pCxt, yymsp[-13].minor.yy392, yymsp[-7].minor.yy392); + yymsp[-13].minor.yy392 = addPartitionByClause(pCxt, yymsp[-13].minor.yy392, yymsp[-6].minor.yy184); + yymsp[-13].minor.yy392 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy392, yymsp[-2].minor.yy392); + yymsp[-13].minor.yy392 = addGroupByClause(pCxt, yymsp[-13].minor.yy392, yymsp[-1].minor.yy184); + yymsp[-13].minor.yy392 = addHavingClause(pCxt, yymsp[-13].minor.yy392, yymsp[0].minor.yy392); + yymsp[-13].minor.yy392 = addRangeClause(pCxt, yymsp[-13].minor.yy392, yymsp[-5].minor.yy392); + yymsp[-13].minor.yy392 = addEveryClause(pCxt, yymsp[-13].minor.yy392, yymsp[-4].minor.yy392); + yymsp[-13].minor.yy392 = addFillClause(pCxt, yymsp[-13].minor.yy392, yymsp[-3].minor.yy392); } break; - case 584: /* hint_list ::= */ -{ yymsp[1].minor.yy404 = createHintNodeList(pCxt, NULL); } + case 608: /* hint_list ::= */ +{ yymsp[1].minor.yy184 = createHintNodeList(pCxt, NULL); } break; - case 585: /* hint_list ::= NK_HINT */ -{ yylhsminor.yy404 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy404 = yylhsminor.yy404; + case 609: /* hint_list ::= NK_HINT */ +{ yylhsminor.yy184 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; - case 590: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy733 = false; } + case 614: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy377 = false; } break; - case 593: /* select_item ::= NK_STAR */ -{ yylhsminor.yy896 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy896 = yylhsminor.yy896; + case 617: /* select_item ::= NK_STAR */ +{ yylhsminor.yy392 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 595: /* select_item ::= common_expression column_alias */ - case 605: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==605); -{ yylhsminor.yy896 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy896), &yymsp[0].minor.yy701); } - yymsp[-1].minor.yy896 = yylhsminor.yy896; + case 619: /* select_item ::= common_expression column_alias */ + case 629: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==629); +{ yylhsminor.yy392 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy392), &yymsp[0].minor.yy369); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 596: /* select_item ::= common_expression AS column_alias */ - case 606: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==606); -{ yylhsminor.yy896 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), &yymsp[0].minor.yy701); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + case 620: /* select_item ::= common_expression AS column_alias */ + case 630: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==630); +{ yylhsminor.yy392 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), &yymsp[0].minor.yy369); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 601: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 631: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==631); - case 651: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==651); -{ yymsp[-2].minor.yy404 = yymsp[0].minor.yy404; } + case 625: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 655: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==655); + case 675: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==675); +{ yymsp[-2].minor.yy184 = yymsp[0].minor.yy184; } break; - case 608: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ -{ yymsp[-5].minor.yy896 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), releaseRawExprNode(pCxt, yymsp[-1].minor.yy896)); } + case 632: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ +{ yymsp[-5].minor.yy392 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), releaseRawExprNode(pCxt, yymsp[-1].minor.yy392)); } break; - case 609: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy896 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy896)); } + case 633: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy392 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy392)); } break; - case 610: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy896 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), NULL, yymsp[-1].minor.yy896, yymsp[0].minor.yy896); } + case 634: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy392 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), NULL, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); } break; - case 611: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy896 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy896), releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), yymsp[-1].minor.yy896, yymsp[0].minor.yy896); } + case 635: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy392 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy392), releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), yymsp[-1].minor.yy392, yymsp[0].minor.yy392); } break; - case 612: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -{ yymsp[-6].minor.yy896 = createEventWindowNode(pCxt, yymsp[-3].minor.yy896, yymsp[0].minor.yy896); } + case 636: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +{ yymsp[-6].minor.yy392 = createEventWindowNode(pCxt, yymsp[-3].minor.yy392, yymsp[0].minor.yy392); } break; - case 613: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy896 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } + case 637: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy392 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } break; - case 614: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy896 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } + case 638: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy392 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } break; - case 621: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy896 = createFillNode(pCxt, yymsp[-1].minor.yy466, NULL); } + case 645: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy392 = createFillNode(pCxt, yymsp[-1].minor.yy374, NULL); } break; - case 622: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ -{ yymsp[-5].minor.yy896 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy404)); } + case 646: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ +{ yymsp[-5].minor.yy392 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy184)); } break; - case 623: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ -{ yymsp[-5].minor.yy896 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy404)); } + case 647: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ +{ yymsp[-5].minor.yy392 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy184)); } break; - case 624: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy466 = FILL_MODE_NONE; } + case 648: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy374 = FILL_MODE_NONE; } break; - case 625: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy466 = FILL_MODE_PREV; } + case 649: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy374 = FILL_MODE_PREV; } break; - case 626: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy466 = FILL_MODE_NULL; } + case 650: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy374 = FILL_MODE_NULL; } break; - case 627: /* fill_mode ::= NULL_F */ -{ yymsp[0].minor.yy466 = FILL_MODE_NULL_F; } + case 651: /* fill_mode ::= NULL_F */ +{ yymsp[0].minor.yy374 = FILL_MODE_NULL_F; } break; - case 628: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy466 = FILL_MODE_LINEAR; } + case 652: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy374 = FILL_MODE_LINEAR; } break; - case 629: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy466 = FILL_MODE_NEXT; } + case 653: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy374 = FILL_MODE_NEXT; } break; - case 632: /* group_by_list ::= expr_or_subquery */ -{ yylhsminor.yy404 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy896))); } - yymsp[0].minor.yy404 = yylhsminor.yy404; + case 656: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy184 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; - case 633: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy896))); } - yymsp[-2].minor.yy404 = yylhsminor.yy404; + case 657: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy184 = addNodeToList(pCxt, yymsp[-2].minor.yy184, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; - case 637: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -{ yymsp[-5].minor.yy896 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy896), releaseRawExprNode(pCxt, yymsp[-1].minor.yy896)); } + case 661: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy392 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), releaseRawExprNode(pCxt, yymsp[-1].minor.yy392)); } break; - case 638: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy896 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy896)); } + case 662: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy392 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy392)); } break; - case 641: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 665: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy896 = addOrderByClause(pCxt, yymsp[-3].minor.yy896, yymsp[-2].minor.yy404); - yylhsminor.yy896 = addSlimitClause(pCxt, yylhsminor.yy896, yymsp[-1].minor.yy896); - yylhsminor.yy896 = addLimitClause(pCxt, yylhsminor.yy896, yymsp[0].minor.yy896); + yylhsminor.yy392 = addOrderByClause(pCxt, yymsp[-3].minor.yy392, yymsp[-2].minor.yy184); + yylhsminor.yy392 = addSlimitClause(pCxt, yylhsminor.yy392, yymsp[-1].minor.yy392); + yylhsminor.yy392 = addLimitClause(pCxt, yylhsminor.yy392, yymsp[0].minor.yy392); } - yymsp[-3].minor.yy896 = yylhsminor.yy896; + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; - case 644: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -{ yylhsminor.yy896 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy896, yymsp[0].minor.yy896); } - yymsp[-3].minor.yy896 = yylhsminor.yy896; + case 668: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy392 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy392, yymsp[0].minor.yy392); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; - case 645: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -{ yylhsminor.yy896 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy896, yymsp[0].minor.yy896); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + case 669: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy392 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy392, yymsp[0].minor.yy392); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 653: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 657: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==657); -{ yymsp[-1].minor.yy896 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 677: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 681: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==681); +{ yymsp[-1].minor.yy392 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 654: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 658: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==658); -{ yymsp[-3].minor.yy896 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 678: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 682: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==682); +{ yymsp[-3].minor.yy392 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 655: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 659: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==659); -{ yymsp[-3].minor.yy896 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 679: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 683: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==683); +{ yymsp[-3].minor.yy392 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 660: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy896 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy896); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + case 684: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy392); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 665: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy896 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy896), yymsp[-1].minor.yy918, yymsp[0].minor.yy669); } - yymsp[-2].minor.yy896 = yylhsminor.yy896; + case 689: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy392 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), yymsp[-1].minor.yy578, yymsp[0].minor.yy217); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 666: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy918 = ORDER_ASC; } + case 690: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy578 = ORDER_ASC; } break; - case 667: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy918 = ORDER_ASC; } + case 691: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy578 = ORDER_ASC; } break; - case 668: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy918 = ORDER_DESC; } + case 692: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy578 = ORDER_DESC; } break; - case 669: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy669 = NULL_ORDER_DEFAULT; } + case 693: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy217 = NULL_ORDER_DEFAULT; } break; - case 670: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy669 = NULL_ORDER_FIRST; } + case 694: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy217 = NULL_ORDER_FIRST; } break; - case 671: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy669 = NULL_ORDER_LAST; } + case 695: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy217 = NULL_ORDER_LAST; } break; default: break; @@ -6909,12 +7334,56 @@ void Parse( } #endif - do{ + while(1){ /* Exit by "break" */ + assert( yypParser->yytos>=yypParser->yystack ); assert( yyact==yypParser->yytos->stateno ); yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); if( yyact >= YY_MIN_REDUCE ){ - yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, - yyminor ParseCTX_PARAM); + unsigned int yyruleno = yyact - YY_MIN_REDUCE; /* Reduce by this rule */ +#ifndef NDEBUG + assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ); + if( yyTraceFILE ){ + int yysize = yyRuleInfoNRhs[yyruleno]; + if( yysize ){ + fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", + yyTracePrompt, + yyruleno, yyRuleName[yyruleno], + yyrulenoyytos[yysize].stateno); + }else{ + fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n", + yyTracePrompt, yyruleno, yyRuleName[yyruleno], + yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == + (int)(yypParser->yytos - yypParser->yystack)); + } +#endif +#if YYSTACKDEPTH>0 + if( yypParser->yytos>=yypParser->yystackEnd ){ + yyStackOverflow(yypParser); + break; + } +#else + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ + if( yyGrowStack(yypParser) ){ + yyStackOverflow(yypParser); + break; + } + } +#endif + } + yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor ParseCTX_PARAM); }else if( yyact <= YY_MAX_SHIFTREDUCE ){ yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); #ifndef YYNOERRORRECOVERY @@ -6970,14 +7439,13 @@ void Parse( yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); yymajor = YYNOCODE; }else{ - while( yypParser->yytos >= yypParser->yystack - && (yyact = yy_find_reduce_action( - yypParser->yytos->stateno, - YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE - ){ + while( yypParser->yytos > yypParser->yystack ){ + yyact = yy_find_reduce_action(yypParser->yytos->stateno, + YYERRORSYMBOL); + if( yyact<=YY_MAX_SHIFTREDUCE ) break; yy_pop_parser_stack(yypParser); } - if( yypParser->yytos < yypParser->yystack || yymajor==0 ){ + if( yypParser->yytos <= yypParser->yystack || yymajor==0 ){ yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); yy_parse_failed(yypParser); #ifndef YYNOERRORRECOVERY @@ -7027,7 +7495,7 @@ void Parse( break; #endif } - }while( yypParser->yytos>yypParser->yystack ); + } #ifndef NDEBUG if( yyTraceFILE ){ yyStackEntry *i; diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index b5236fee9e..100251b565 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -294,6 +294,7 @@ static SNode* createFirstCol(uint64_t tableId, const SSchema* pSchema, const STa pCol->colType = COLUMN_TYPE_COLUMN; pCol->isPk = pSchema->flags & COL_IS_KEY; pCol->tableHasPk = hasPkInTable(pMeta); + pCol->numOfPKs = pMeta->tableInfo.numOfPKs; strcpy(pCol->colName, pSchema->name); return (SNode*)pCol; } diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 8748cc7c17..190f608473 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -1573,6 +1573,9 @@ static int32_t createWindowPhysiNodeFinalize(SPhysiPlanContext* pCxt, SNodeList* pWindow->watermark = pWindowLogicNode->watermark; pWindow->deleteMark = pWindowLogicNode->deleteMark; pWindow->igExpired = pWindowLogicNode->igExpired; + if (pCxt->pPlanCxt->streamQuery) { + pWindow->destHasPrimayKey = pCxt->pPlanCxt->destHasPrimaryKey; + } pWindow->mergeDataBlock = (GROUP_ACTION_KEEP == pWindowLogicNode->node.groupAction ? false : true); pWindow->node.inputTsOrder = pWindowLogicNode->node.inputTsOrder; pWindow->node.outputTsOrder = pWindowLogicNode->node.outputTsOrder; diff --git a/source/libs/qcom/src/querymsg.c b/source/libs/qcom/src/querymsg.c index bf87803908..7948bbbceb 100644 --- a/source/libs/qcom/src/querymsg.c +++ b/source/libs/qcom/src/querymsg.c @@ -421,8 +421,16 @@ int32_t queryCreateTableMetaFromMsg(STableMetaRsp *msg, bool isStb, STableMeta * memcpy(pTableMeta->schema, msg->pSchemas, sizeof(SSchema) * total); + bool hasPK = (msg->numOfColumns > 1) && (pTableMeta->schema[1].flags & COL_IS_KEY); for (int32_t i = 0; i < msg->numOfColumns; ++i) { pTableMeta->tableInfo.rowSize += pTableMeta->schema[i].bytes; + if (hasPK && (i > 0)) { + if ((pTableMeta->schema[i].flags & COL_IS_KEY)) { + ++pTableMeta->tableInfo.numOfPKs; + } else { + hasPK = false; + } + } } qDebug("table %s uid %" PRIx64 " meta returned, type %d vgId:%d db %s stb %s suid %" PRIx64 " sver %d tver %d" diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index aa33d6f2fc..079fd7d29d 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -486,6 +486,7 @@ int32_t schHandleNotifyCallback(void *param, SDataBuf *pMsg, int32_t code) { SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " task notify rsp received, code:0x%x", pParam->queryId, pParam->taskId, code); + rpcReleaseHandle(pMsg->handle, TAOS_CONN_CLIENT); if (pMsg) { taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); @@ -526,6 +527,7 @@ int32_t schHandleHbCallback(void *param, SDataBuf *pMsg, int32_t code) { if (code) { qError("hb rsp error:%s", tstrerror(code)); + rpcReleaseHandle(pMsg->handle, TAOS_CONN_CLIENT); SCH_ERR_JRET(code); } @@ -1181,7 +1183,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, qMsg.queryId = pJob->queryId; qMsg.taskId = pTask->taskId; qMsg.refId = pJob->refId; - qMsg.execId = pTask->execId; + qMsg.execId = *(int32_t*)param; msgSize = tSerializeSTaskDropReq(NULL, 0, &qMsg); if (msgSize < 0) { diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c index d96c01fc76..97c3c7d276 100644 --- a/source/libs/scheduler/src/schTask.c +++ b/source/libs/scheduler/src/schTask.c @@ -371,14 +371,13 @@ int32_t schChkUpdateRedirectCtx(SSchJob *pJob, SSchTask *pTask, SEpSet *pEpSet, pCtx->roundTotal = pEpSet->numOfEps; } - if (pCtx->roundTimes >= pCtx->roundTotal) { int64_t nowTs = taosGetTimestampMs(); int64_t lastTime = nowTs - pCtx->startTs; if (lastTime > tsMaxRetryWaitTime) { SCH_TASK_DLOG("task no more redirect retry since timeout, now:%" PRId64 ", start:%" PRId64 ", max:%d, total:%d", nowTs, pCtx->startTs, tsMaxRetryWaitTime, pCtx->totalTimes); - pJob->noMoreRetry = true; + pJob->noMoreRetry = true; SCH_ERR_RET(SCH_GET_REDIRECT_CODE(pJob, rspCode)); } @@ -418,7 +417,7 @@ void schResetTaskForRetry(SSchJob *pJob, SSchTask *pTask) { taosMemoryFreeClear(pTask->msg); pTask->msgLen = 0; pTask->lastMsgType = 0; - pTask->childReady = 0; + pTask->childReady = 0; memset(&pTask->succeedAddr, 0, sizeof(pTask->succeedAddr)); } @@ -505,11 +504,11 @@ int32_t schHandleTaskSetRetry(SSchJob *pJob, SSchTask *pTask, SDataBuf *pData, i pLevel->taskExecDoneNum = 0; pLevel->taskLaunchedNum = 0; } - + SCH_RESET_JOB_LEVEL_IDX(pJob); - + code = schDoTaskRedirect(pJob, pTask, pData, rspCode); - + taosMemoryFreeClear(pData->pData); taosMemoryFreeClear(pData->pEpSet); @@ -627,7 +626,7 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo pTask->maxRetryTimes); return TSDB_CODE_SUCCESS; } - + if (TSDB_CODE_SCH_TIMEOUT_ERROR == errCode) { pTask->maxExecTimes++; pTask->maxRetryTimes++; @@ -862,7 +861,9 @@ void schDropTaskOnExecNode(SSchJob *pJob, SSchTask *pTask) { while (nodeInfo) { if (nodeInfo->handle) { SCH_SET_TASK_HANDLE(pTask, nodeInfo->handle); - schBuildAndSendMsg(pJob, pTask, &nodeInfo->addr, TDMT_SCH_DROP_TASK, NULL); + void *pExecId = taosHashGetKey(nodeInfo, NULL); + schBuildAndSendMsg(pJob, pTask, &nodeInfo->addr, TDMT_SCH_DROP_TASK, pExecId); + SCH_TASK_DLOG("start to drop task's %dth execNode", i); } else { SCH_TASK_DLOG("no need to drop task %dth execNode", i); @@ -901,7 +902,6 @@ int32_t schNotifyTaskOnExecNode(SSchJob *pJob, SSchTask *pTask, ETaskNotifyType return TSDB_CODE_SUCCESS; } - int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId *pEpId, SArray *pStatusList) { int32_t taskNum = (int32_t)taosArrayGetSize(pStatusList); SSchTask *pTask = NULL; @@ -1269,7 +1269,7 @@ int32_t schNotifyTaskInHashList(SSchJob *pJob, SHashObj *list, ETaskNotifyType t int32_t code = TSDB_CODE_SUCCESS; SCH_ERR_RET(schNotifyTaskOnExecNode(pJob, pCurrTask, type)); - + void *pIter = taosHashIterate(list, NULL); while (pIter) { SSchTask *pTask = *(SSchTask **)pIter; @@ -1277,7 +1277,7 @@ int32_t schNotifyTaskInHashList(SSchJob *pJob, SHashObj *list, ETaskNotifyType t SCH_LOCK_TASK(pTask); code = schNotifyTaskOnExecNode(pJob, pTask, type); SCH_UNLOCK_TASK(pTask); - + if (TSDB_CODE_SUCCESS != code) { break; } @@ -1289,7 +1289,6 @@ int32_t schNotifyTaskInHashList(SSchJob *pJob, SHashObj *list, ETaskNotifyType t SCH_RET(code); } - int32_t schExecRemoteFetch(SSchJob *pJob, SSchTask *pTask) { SCH_RET(schBuildAndSendMsg(pJob, pJob->fetchTask, &pJob->resNode, SCH_FETCH_TYPE(pJob->fetchTask), NULL)); } diff --git a/source/libs/stream/src/streamCheckpoint.c b/source/libs/stream/src/streamCheckpoint.c index f58c72eded..7f52c5d2f0 100644 --- a/source/libs/stream/src/streamCheckpoint.c +++ b/source/libs/stream/src/streamCheckpoint.c @@ -278,6 +278,7 @@ void streamTaskClearCheckInfo(SStreamTask* pTask, bool clearChkpReadyMsg) { pTask->chkInfo.numOfNotReady = 0; pTask->chkInfo.transId = 0; pTask->chkInfo.dispatchCheckpointTrigger = false; + pTask->chkInfo.downstreamAlignNum = 0; streamTaskOpenAllUpstreamInput(pTask); // open inputQ for all upstream tasks if (clearChkpReadyMsg) { diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 0af664f1e1..baf5ebf8cb 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -321,6 +321,8 @@ void clearBufferedDispatchMsg(SStreamTask* pTask) { destroyDispatchMsg(pMsgInfo->pData, getNumOfDispatchBranch(pTask)); } + pMsgInfo->checkpointId = -1; + pMsgInfo->transId = -1; pMsgInfo->pData = NULL; pMsgInfo->dispatchMsgType = 0; } @@ -332,6 +334,12 @@ static int32_t doBuildDispatchMsg(SStreamTask* pTask, const SStreamDataBlock* pD pTask->msgInfo.dispatchMsgType = pData->type; + if (pData->type == STREAM_INPUT__CHECKPOINT_TRIGGER) { + SSDataBlock* p = taosArrayGet(pData->blocks, 0); + pTask->msgInfo.checkpointId = p->info.version; + pTask->msgInfo.transId = p->info.window.ekey; + } + if (pTask->outputInfo.type == TASK_OUTPUT__FIXED_DISPATCH) { SStreamDispatchReq* pReq = taosMemoryCalloc(1, sizeof(SStreamDispatchReq)); @@ -580,12 +588,15 @@ int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, S } else { char ctbName[TSDB_TABLE_FNAME_LEN] = {0}; if (pDataBlock->info.parTbName[0]) { - if(pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER && - pTask->subtableWithoutMd5 != 1 && + if(pTask->subtableWithoutMd5 != 1 && !isAutoTableName(pDataBlock->info.parTbName) && !alreadyAddGroupId(pDataBlock->info.parTbName) && groupId != 0){ - buildCtbNameAddGroupId(pDataBlock->info.parTbName, groupId); + if(pTask->ver == SSTREAM_TASK_SUBTABLE_CHANGED_VER){ + buildCtbNameAddGroupId(NULL, pDataBlock->info.parTbName, groupId); + }else if(pTask->ver > SSTREAM_TASK_SUBTABLE_CHANGED_VER) { + buildCtbNameAddGroupId(pTask->outputInfo.shuffleDispatcher.stbFullName, pDataBlock->info.parTbName, groupId); + } } } else { buildCtbNameByGroupIdImpl(pTask->outputInfo.shuffleDispatcher.stbFullName, groupId, pDataBlock->info.parTbName); @@ -947,9 +958,21 @@ void streamClearChkptReadyMsg(SStreamTask* pTask) { // this message has been sent successfully, let's try next one. static int32_t handleDispatchSuccessRsp(SStreamTask* pTask, int32_t downstreamId) { stDebug("s-task:%s destroy dispatch msg:%p", pTask->id.idStr, pTask->msgInfo.pData); + bool delayDispatch = (pTask->msgInfo.dispatchMsgType == STREAM_INPUT__CHECKPOINT_TRIGGER); if (delayDispatch) { - pTask->chkInfo.dispatchCheckpointTrigger = true; + taosThreadMutexLock(&pTask->lock); + // we only set the dispatch msg info for current checkpoint trans + if (streamTaskGetStatus(pTask)->state == TASK_STATUS__CK && pTask->chkInfo.checkpointingId == pTask->msgInfo.checkpointId) { + ASSERT(pTask->chkInfo.transId == pTask->msgInfo.transId); + pTask->chkInfo.dispatchCheckpointTrigger = true; + stDebug("s-task:%s checkpoint-trigger msg rsp for checkpointId:%" PRId64 " transId:%d confirmed", + pTask->id.idStr, pTask->msgInfo.checkpointId, pTask->msgInfo.transId); + } else { + stWarn("s-task:%s checkpoint-trigger msg rsp for checkpointId:%" PRId64 " transId:%d discard, since expired", + pTask->id.idStr, pTask->msgInfo.checkpointId, pTask->msgInfo.transId); + } + taosThreadMutexUnlock(&pTask->lock); } clearBufferedDispatchMsg(pTask); diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 5f6440c06d..aae3594905 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -542,7 +542,6 @@ int32_t streamMetaSaveTask(SStreamMeta* pMeta, SStreamTask* pTask) { void* buf = NULL; int32_t len; int32_t code; - pTask->ver = SSTREAM_TASK_VER; tEncodeSize(tEncodeStreamTask, pTask, len, code); if (code < 0) { return -1; @@ -552,6 +551,9 @@ int32_t streamMetaSaveTask(SStreamMeta* pMeta, SStreamTask* pTask) { return -1; } + if (pTask->ver < SSTREAM_TASK_SUBTABLE_CHANGED_VER){ + pTask->ver = SSTREAM_TASK_VER; + } SEncoder encoder = {0}; tEncoderInit(&encoder, buf, len); tEncodeStreamTask(&encoder, pTask); @@ -648,14 +650,17 @@ SStreamTask* streamMetaAcquireOneTask(SStreamTask* pTask) { } void streamMetaReleaseTask(SStreamMeta* UNUSED_PARAM(pMeta), SStreamTask* pTask) { + int32_t taskId = pTask->id.taskId; int32_t ref = atomic_sub_fetch_32(&pTask->refCnt, 1); + + // not safe to use the pTask->id.idStr, since pTask may be released by other threads when print logs. if (ref > 0) { - stTrace("s-task:%s release task, ref:%d", pTask->id.idStr, ref); + stTrace("s-task:0x%x release task, ref:%d", taskId, ref); } else if (ref == 0) { - stTrace("s-task:%s all refs are gone, free it", pTask->id.idStr); + stTrace("s-task:0x%x all refs are gone, free it", taskId); tFreeStreamTask(pTask); } else if (ref < 0) { - stError("task ref is invalid, ref:%d, %s", ref, pTask->id.idStr); + stError("task ref is invalid, ref:%d, 0x%x", ref, taskId); } } @@ -824,13 +829,6 @@ int64_t streamMetaGetLatestCheckpointId(SStreamMeta* pMeta) { return chkpId; } -static void doClear(void* pKey, void* pVal, TBC* pCur, SArray* pRecycleList) { - tdbFree(pKey); - tdbFree(pVal); - tdbTbcClose(pCur); - taosArrayDestroy(pRecycleList); -} - int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta) { TBC* pCur = NULL; void* pKey = NULL; @@ -847,10 +845,11 @@ int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta) { int32_t vgId = pMeta->vgId; stInfo("vgId:%d load stream tasks from meta files", vgId); - if (tdbTbcOpen(pMeta->pTaskDb, &pCur, NULL) < 0) { - stError("vgId:%d failed to open stream meta, code:%s", vgId, tstrerror(terrno)); + int32_t code = tdbTbcOpen(pMeta->pTaskDb, &pCur, NULL); + if (code != TSDB_CODE_SUCCESS) { + stError("vgId:%d failed to open stream meta, code:%s, not load any stream tasks", vgId, tstrerror(terrno)); taosArrayDestroy(pRecycleList); - return -1; + return TSDB_CODE_SUCCESS; } tdbTbcMoveToFirst(pCur); @@ -859,20 +858,18 @@ int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta) { if (pTask == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; stError("vgId:%d failed to load stream task from meta-files, code:%s", vgId, tstrerror(terrno)); - doClear(pKey, pVal, pCur, pRecycleList); - return -1; + break; } tDecoderInit(&decoder, (uint8_t*)pVal, vLen); if (tDecodeStreamTask(&decoder, pTask) < 0) { tDecoderClear(&decoder); - doClear(pKey, pVal, pCur, pRecycleList); tFreeStreamTask(pTask); stError( "vgId:%d stream read incompatible data, rm %s/vnode/vnode*/tq/stream if taosd cannot start, and rebuild " "stream manually", vgId, tsDataDir); - return -1; + break; } tDecoderClear(&decoder); @@ -892,10 +889,11 @@ int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta) { STaskId id = {.streamId = pTask->id.streamId, .taskId = pTask->id.taskId}; void* p = taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); if (p == NULL) { - if (pMeta->expandFunc(pMeta->ahandle, pTask, pTask->chkInfo.checkpointVer + 1) < 0) { - doClear(pKey, pVal, pCur, pRecycleList); + code = pMeta->expandFunc(pMeta->ahandle, pTask, pTask->chkInfo.checkpointVer + 1); + if (code < 0) { + stError("failed to expand s-task:0x%"PRIx64", code:%s, continue", id.taskId, tstrerror(terrno)); tFreeStreamTask(pTask); - return -1; + continue; } taosArrayPush(pMeta->pTaskList, &pTask->id); @@ -907,9 +905,10 @@ int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta) { } if (taosHashPut(pMeta->pTasksMap, &id, sizeof(id), &pTask, POINTER_BYTES) < 0) { - doClear(pKey, pVal, pCur, pRecycleList); + stError("s-task:0x%x failed to put into hashTable, code:%s, continue", pTask->id.taskId, tstrerror(terrno)); + taosArrayPop(pMeta->pTaskList); tFreeStreamTask(pTask); - return -1; + continue; } if (pTask->info.fillHistory == 0) { @@ -925,10 +924,9 @@ int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta) { tdbFree(pKey); tdbFree(pVal); + if (tdbTbcClose(pCur) < 0) { - stError("vgId:%d failed to close meta-file cursor", vgId); - taosArrayDestroy(pRecycleList); - return -1; + stError("vgId:%d failed to close meta-file cursor, code:%s, continue", vgId, tstrerror(terrno)); } if (taosArrayGetSize(pRecycleList) > 0) { @@ -942,8 +940,9 @@ int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta) { ASSERT(pMeta->numOfStreamTasks <= numOfTasks && pMeta->numOfPausedTasks <= numOfTasks); stDebug("vgId:%d load %d tasks into meta from disk completed, streamTask:%d, paused:%d", pMeta->vgId, numOfTasks, pMeta->numOfStreamTasks, pMeta->numOfPausedTasks); + taosArrayDestroy(pRecycleList); - return 0; + return TSDB_CODE_SUCCESS; } int32_t tEncodeStreamHbMsg(SEncoder* pEncoder, const SStreamHbMsg* pReq) { diff --git a/source/libs/stream/src/streamStart.c b/source/libs/stream/src/streamStart.c index cb340ade32..0161f382ba 100644 --- a/source/libs/stream/src/streamStart.c +++ b/source/libs/stream/src/streamStart.c @@ -119,7 +119,11 @@ int32_t streamReExecScanHistoryFuture(SStreamTask* pTask, int32_t idleDuration) // add ref for task SStreamTask* p = streamMetaAcquireTask(pTask->pMeta, pTask->id.streamId, pTask->id.taskId); - ASSERT(p != NULL); + if (p == NULL) { + stError("s-task:0x%x failed to acquire task, status:%s, not exec scan-history data", pTask->id.taskId, + streamTaskGetStatus(pTask)->name); + return TSDB_CODE_SUCCESS; + } pTask->schedHistoryInfo.numOfTicks = numOfTicks; diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index b53dc9daa6..17c4f8e15d 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -278,11 +278,11 @@ int32_t streamStateFuncPut(SStreamState* pState, const SWinKey* key, const void* #ifdef USE_ROCKSDB void* pVal = NULL; int32_t len = 0; - int32_t code = getRowBuff(pState->pFileState, (void*)key, sizeof(SWinKey), &pVal, &len); + getRowBuff(pState->pFileState, (void*)key, sizeof(SWinKey), &pVal, &len); char* buf = ((SRowBuffPos*)pVal)->pRowBuff; uint32_t rowSize = streamFileStateGeSelectRowSize(pState->pFileState); memcpy(buf + len - rowSize, value, vLen); - return code; + return TSDB_CODE_SUCCESS; #else return tdbTbUpsert(pState->pTdbState->pFuncStateDb, key, sizeof(STupleKey), value, vLen, pState->pTdbState->txn); #endif diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index 4ca784a32f..44f70f8b19 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -216,7 +216,7 @@ int32_t tDecodeStreamTask(SDecoder* pDecoder, SStreamTask* pTask) { if (tStartDecode(pDecoder) < 0) return -1; if (tDecodeI64(pDecoder, &pTask->ver) < 0) return -1; - if (pTask->ver <= SSTREAM_TASK_INCOMPATIBLE_VER) return -1; + if (pTask->ver <= SSTREAM_TASK_INCOMPATIBLE_VER || pTask->ver > SSTREAM_TASK_VER) return -1; if (tDecodeI64(pDecoder, &pTask->id.streamId) < 0) return -1; if (tDecodeI32(pDecoder, &pTask->id.taskId) < 0) return -1; @@ -287,7 +287,9 @@ int32_t tDecodeStreamTask(SDecoder* pDecoder, SStreamTask* pTask) { if (tDecodeCStrTo(pDecoder, pTask->outputInfo.shuffleDispatcher.stbFullName) < 0) return -1; } if (tDecodeI64(pDecoder, &pTask->info.triggerParam) < 0) return -1; - if (tDecodeI8(pDecoder, &pTask->subtableWithoutMd5) < 0) return -1; + if (pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER){ + if (tDecodeI8(pDecoder, &pTask->subtableWithoutMd5) < 0) return -1; + } if (tDecodeCStrTo(pDecoder, pTask->reserve) < 0) return -1; tEndDecode(pDecoder); @@ -378,12 +380,12 @@ void tFreeStreamTask(SStreamTask* pTask) { } if (pTask->hTaskInfo.pTimer != NULL) { - taosTmrStop(pTask->hTaskInfo.pTimer); + /*bool ret = */taosTmrStop(pTask->hTaskInfo.pTimer); pTask->hTaskInfo.pTimer = NULL; } if (pTask->msgInfo.pTimer != NULL) { - taosTmrStop(pTask->msgInfo.pTimer); + /*bool ret = */taosTmrStop(pTask->msgInfo.pTimer); pTask->msgInfo.pTimer = NULL; } diff --git a/source/libs/stream/src/streamTaskSm.c b/source/libs/stream/src/streamTaskSm.c index 6aa215586a..cfa94209f6 100644 --- a/source/libs/stream/src/streamTaskSm.c +++ b/source/libs/stream/src/streamTaskSm.c @@ -543,8 +543,6 @@ void streamTaskSetStatusReady(SStreamTask* pTask) { return; } - taosThreadMutexLock(&pTask->lock); - pSM->prev.state = pSM->current; pSM->prev.evt = 0; @@ -552,8 +550,6 @@ void streamTaskSetStatusReady(SStreamTask* pTask) { pSM->startTs = taosGetTimestampMs(); pSM->pActiveTrans = NULL; taosArrayClear(pSM->pWaitingEventList); - - taosThreadMutexUnlock(&pTask->lock); } STaskStateTrans createStateTransform(ETaskStatus current, ETaskStatus next, EStreamTaskEvent event, __state_trans_fn fn, diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index f86ab6b8a3..f7c3965196 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -438,6 +438,7 @@ SRowBuffPos* getNewRowPosForWrite(SStreamFileState* pFileState) { } int32_t getRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, void** pVal, int32_t* pVLen) { + int32_t code = TSDB_CODE_SUCCESS; pFileState->maxTs = TMAX(pFileState->maxTs, pFileState->getTs(pKey)); SRowBuffPos** pos = tSimpleHashGet(pFileState->rowStateBuff, pKey, keyLen); if (pos) { @@ -445,17 +446,18 @@ int32_t getRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, voi *pVal = *pos; (*pos)->beUsed = true; (*pos)->beFlushed = false; - return TSDB_CODE_SUCCESS; + return code; } SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); ASSERT(pNewPos->pRowBuff); memcpy(pNewPos->pKey, pKey, keyLen); + code = TSDB_CODE_FAILED; TSKEY ts = pFileState->getTs(pKey); if (!isDeteled(pFileState, ts) && isFlushedState(pFileState, ts, 0)) { int32_t len = 0; void* p = NULL; - int32_t code = streamStateGet_rocksdb(pFileState->pFileStore, pKey, &p, &len); + code = streamStateGet_rocksdb(pFileState->pFileStore, pKey, &p, &len); qDebug("===stream===get %" PRId64 " from disc, res %d", ts, code); if (code == TSDB_CODE_SUCCESS) { memcpy(pNewPos->pRowBuff, p, len); @@ -468,7 +470,7 @@ int32_t getRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, voi *pVLen = pFileState->rowSize; *pVal = pNewPos; } - return TSDB_CODE_SUCCESS; + return code; } int32_t deleteRowBuff(SStreamFileState* pFileState, const void* pKey, int32_t keyLen) { diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index d40fff447f..3543ed574c 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -866,9 +866,14 @@ int32_t syncLogReplRecover(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEn SyncTerm term = -1; SyncIndex firstVer = pNode->pLogStore->syncLogBeginIndex(pNode->pLogStore); SyncIndex index = TMIN(pMsg->matchIndex, pNode->pLogBuf->matchIndex); + errno = 0; if (pMsg->matchIndex < pNode->pLogBuf->matchIndex) { term = syncLogReplGetPrevLogTerm(pMgr, pNode, index + 1); + if (term < 0 && (errno == ENFILE || errno == EMFILE)) { + sError("vgId:%d, failed to get prev log term since %s. index:%" PRId64, pNode->vgId, terrstr(), index + 1); + return -1; + } if ((index + 1 < firstVer) || (term < 0) || (term != pMsg->lastMatchTerm && (index + 1 == firstVer || index == firstVer))) { ASSERT(term >= 0 || terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h index c010e31320..da6d71e07b 100644 --- a/source/libs/transport/inc/transComm.h +++ b/source/libs/transport/inc/transComm.h @@ -19,16 +19,12 @@ extern "C" { #endif #include -#include "os.h" -#include "taoserror.h" #include "theap.h" -#include "tmisce.h" #include "tmsg.h" #include "transLog.h" #include "transportInt.h" #include "trpc.h" #include "ttrace.h" -#include "tutil.h" typedef bool (*FilteFunc)(void* arg); @@ -115,9 +111,12 @@ typedef SRpcConnInfo STransHandleInfo; // ref mgt handle typedef struct SExHandle { - void* handle; - int64_t refId; - void* pThrd; + void* handle; + int64_t refId; + void* pThrd; + queue q; + int8_t inited; + SRWLatch latch; } SExHandle; typedef struct { diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index ac45f1eef6..062609baac 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -92,6 +92,7 @@ typedef struct SCliMsg { int64_t refId; uint64_t st; int sent; //(0: no send, 1: alread sent) + queue seqq; } SCliMsg; typedef struct SCliThrd { @@ -121,11 +122,7 @@ typedef struct SCliThrd { SHashObj* batchCache; SCliMsg* stopMsg; - - bool quit; - - int newConnCount; - SHashObj* msgCount; + bool quit; } SCliThrd; typedef struct SCliObj { @@ -262,10 +259,8 @@ static void cliWalkCb(uv_handle_t* handle, void* arg); } \ if (i == sz) { \ pMsg = NULL; \ - tDebug("msg not found, %" PRIu64 "", ahandle); \ } else { \ pMsg = transQueueRm(&conn->cliMsgs, i); \ - tDebug("msg found, %" PRIu64 "", ahandle); \ } \ } while (0) @@ -343,6 +338,34 @@ bool cliMaySendCachedMsg(SCliConn* conn) { _RETURN: return false; } +bool cliConnSendSeqMsg(int64_t refId, SCliConn* conn) { + if (refId == 0) return false; + SExHandle* exh = transAcquireExHandle(transGetRefMgt(), refId); + if (exh == NULL) { + tDebug("release conn %p, refId: %" PRId64 "", conn, refId); + return false; + } + taosWLockLatch(&exh->latch); + if (exh->handle == NULL) exh->handle = conn; + exh->inited = 1; + if (!QUEUE_IS_EMPTY(&exh->q)) { + queue* h = QUEUE_HEAD(&exh->q); + QUEUE_REMOVE(h); + taosWUnLockLatch(&exh->latch); + SCliMsg* t = QUEUE_DATA(h, SCliMsg, seqq); + transCtxMerge(&conn->ctx, &t->ctx->appCtx); + transQueuePush(&conn->cliMsgs, t); + tDebug("pop from conn %p, refId: %" PRId64 "", conn, refId); + transReleaseExHandle(transGetRefMgt(), refId); + cliSend(conn); + return true; + } + taosWUnLockLatch(&exh->latch); + tDebug("empty conn %p, refId: %" PRId64 "", conn, refId); + transReleaseExHandle(transGetRefMgt(), refId); + return false; +} + void cliHandleResp(SCliConn* conn) { SCliThrd* pThrd = conn->hostThrd; STrans* pTransInst = pThrd->pTransInst; @@ -439,8 +462,14 @@ void cliHandleResp(SCliConn* conn) { return; } } + int64_t refId = (pMsg == NULL ? 0 : (int64_t)(pMsg->msg.info.handle)); + tDebug("conn %p msg refId: %" PRId64 "", conn, refId); destroyCmsg(pMsg); + if (cliConnSendSeqMsg(refId, conn)) { + return; + } + if (cliMaySendCachedMsg(conn) == true) { return; } @@ -451,6 +480,21 @@ void cliHandleResp(SCliConn* conn) { uv_read_start((uv_stream_t*)conn->stream, cliAllocRecvBufferCb, cliRecvCb); } +static void cliDestroyMsgInExhandle(int64_t refId) { + if (refId == 0) return; + SExHandle* exh = transAcquireExHandle(transGetRefMgt(), refId); + if (exh) { + taosWLockLatch(&exh->latch); + while (!QUEUE_IS_EMPTY(&exh->q)) { + queue* h = QUEUE_HEAD(&exh->q); + QUEUE_REMOVE(h); + SCliMsg* t = QUEUE_DATA(h, SCliMsg, seqq); + destroyCmsg(t); + } + taosWUnLockLatch(&exh->latch); + transReleaseExHandle(transGetRefMgt(), refId); + } +} void cliHandleExceptImpl(SCliConn* pConn, int32_t code) { if (transQueueEmpty(&pConn->cliMsgs)) { @@ -510,6 +554,8 @@ void cliHandleExceptImpl(SCliConn* pConn, int32_t code) { } if (pMsg == NULL || (pMsg && pMsg->type != Release)) { + int64_t refId = (pMsg == NULL ? 0 : (int64_t)(pMsg->msg.info.handle)); + cliDestroyMsgInExhandle(refId); if (cliAppCb(pConn, &transMsg, pMsg) != 0) { return; } @@ -585,11 +631,12 @@ void* destroyConnPool(SCliThrd* pThrd) { static SCliConn* getConnFromPool(SCliThrd* pThrd, char* key, bool* exceed) { void* pool = pThrd->pool; STrans* pTranInst = pThrd->pTransInst; - SConnList* plist = taosHashGet((SHashObj*)pool, key, strlen(key) + 1); + size_t klen = strlen(key); + SConnList* plist = taosHashGet((SHashObj*)pool, key, klen); if (plist == NULL) { SConnList list = {0}; - taosHashPut((SHashObj*)pool, key, strlen(key) + 1, (void*)&list, sizeof(list)); - plist = taosHashGet(pool, key, strlen(key) + 1); + taosHashPut((SHashObj*)pool, key, klen, (void*)&list, sizeof(list)); + plist = taosHashGet(pool, key, klen); SMsgList* nList = taosMemoryCalloc(1, sizeof(SMsgList)); QUEUE_INIT(&nList->msgQ); @@ -624,11 +671,12 @@ static SCliConn* getConnFromPool(SCliThrd* pThrd, char* key, bool* exceed) { static SCliConn* getConnFromPool2(SCliThrd* pThrd, char* key, SCliMsg** pMsg) { void* pool = pThrd->pool; STrans* pTransInst = pThrd->pTransInst; - SConnList* plist = taosHashGet((SHashObj*)pool, key, strlen(key) + 1); + size_t klen = strlen(key); + SConnList* plist = taosHashGet((SHashObj*)pool, key, klen); if (plist == NULL) { SConnList list = {0}; - taosHashPut((SHashObj*)pool, key, strlen(key) + 1, (void*)&list, sizeof(list)); - plist = taosHashGet(pool, key, strlen(key) + 1); + taosHashPut((SHashObj*)pool, key, klen, (void*)&list, sizeof(list)); + plist = taosHashGet(pool, key, klen); SMsgList* nList = taosMemoryCalloc(1, sizeof(SMsgList)); QUEUE_INIT(&nList->msgQ); @@ -676,7 +724,7 @@ static SCliConn* getConnFromPool2(SCliThrd* pThrd, char* key, SCliMsg** pMsg) { } list->numOfConn++; } - tTrace("%s numOfConn: %d, limit: %d", pTransInst->label, list->numOfConn, pTransInst->connLimitNum); + tDebug("%s numOfConn: %d, limit: %d, dst:%s", pTransInst->label, list->numOfConn, pTransInst->connLimitNum, key); return NULL; } @@ -714,7 +762,7 @@ static void addConnToPool(void* pool, SCliConn* conn) { cliDestroyConnMsgs(conn, false); if (conn->list == NULL) { - conn->list = taosHashGet((SHashObj*)pool, conn->dstAddr, strlen(conn->dstAddr) + 1); + conn->list = taosHashGet((SHashObj*)pool, conn->dstAddr, strlen(conn->dstAddr)); } SConnList* pList = conn->list; @@ -740,13 +788,13 @@ static void addConnToPool(void* pool, SCliConn* conn) { QUEUE_PUSH(&conn->list->conns, &conn->q); conn->list->size += 1; - if (conn->list->size >= 20) { + if (conn->list->size >= 10) { STaskArg* arg = taosMemoryCalloc(1, sizeof(STaskArg)); arg->param1 = conn; arg->param2 = thrd; STrans* pTransInst = thrd->pTransInst; - conn->task = transDQSched(thrd->timeoutQueue, doCloseIdleConn, arg, CONN_PERSIST_TIME(pTransInst->idleTime)); + conn->task = transDQSched(thrd->timeoutQueue, doCloseIdleConn, arg, 10 * CONN_PERSIST_TIME(pTransInst->idleTime)); } } static int32_t allocConnRef(SCliConn* conn, bool update) { @@ -759,8 +807,10 @@ static int32_t allocConnRef(SCliConn* conn, bool update) { exh->handle = conn; exh->pThrd = conn->hostThrd; exh->refId = transAddExHandle(transGetRefMgt(), exh); - conn->refId = exh->refId; + QUEUE_INIT(&exh->q); + taosInitRWLatch(&exh->latch); + conn->refId = exh->refId; if (conn->refId == -1) { taosMemoryFree(exh); } @@ -777,9 +827,11 @@ static int32_t specifyConnRef(SCliConn* conn, bool update, int64_t handle) { if (exh == NULL) { return -1; } + taosWLockLatch(&exh->latch); exh->handle = conn; exh->pThrd = conn->hostThrd; conn->refId = exh->refId; + taosWUnLockLatch(&exh->latch); transReleaseExHandle(transGetRefMgt(), handle); return 0; @@ -880,7 +932,6 @@ static void cliDestroyConn(SCliConn* conn, bool clear) { } conn->list = NULL; - pThrd->newConnCount--; transReleaseExHandle(transGetRefMgt(), conn->refId); transRemoveExHandle(transGetRefMgt(), conn->refId); @@ -1188,7 +1239,6 @@ static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) { addr.sin_port = (uint16_t)htons(pList->port); tTrace("%s conn %p try to connect to %s", pTransInst->label, conn, pList->dst); - pThrd->newConnCount++; int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 10); if (fd == -1) { tError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn, @@ -1279,7 +1329,7 @@ static void cliHandleFastFail(SCliConn* pConn, int status) { if (pMsg != NULL && REQUEST_NO_RESP(&pMsg->msg) && (pTransInst->failFastFp != NULL && pTransInst->failFastFp(pMsg->msg.msgType))) { - SFailFastItem* item = taosHashGet(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr) + 1); + SFailFastItem* item = taosHashGet(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr)); int64_t cTimestamp = taosGetTimestampMs(); if (item != NULL) { int32_t elapse = cTimestamp - item->timestamp; @@ -1291,7 +1341,7 @@ static void cliHandleFastFail(SCliConn* pConn, int status) { } } else { SFailFastItem item = {.count = 1, .timestamp = cTimestamp}; - taosHashPut(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr) + 1, &item, sizeof(SFailFastItem)); + taosHashPut(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr), &item, sizeof(SFailFastItem)); } } } else { @@ -1390,7 +1440,10 @@ static void cliHandleRelease(SCliMsg* pMsg, SCliThrd* pThrd) { return; } + taosRLockLatch(&exh->latch); SCliConn* conn = exh->handle; + taosRUnLockLatch(&exh->latch); + transReleaseExHandle(transGetRefMgt(), refId); tDebug("%s conn %p start to release to inst", CONN_GET_INST_LABEL(conn), conn); @@ -1423,7 +1476,9 @@ SCliConn* cliGetConn(SCliMsg** pMsg, SCliThrd* pThrd, bool* ignore, char* addr) *ignore = true; return NULL; } else { + taosRLockLatch(&exh->latch); conn = exh->handle; + taosRUnLockLatch(&exh->latch); if (conn == NULL) { conn = getConnFromPool2(pThrd, addr, pMsg); if (conn != NULL) specifyConnRef(conn, true, refId); @@ -1437,7 +1492,7 @@ SCliConn* cliGetConn(SCliMsg** pMsg, SCliThrd* pThrd, bool* ignore, char* addr) if (conn != NULL) { tTrace("%s conn %p get from conn pool:%p", CONN_GET_INST_LABEL(conn), conn, pThrd->pool); } else { - tTrace("%s not found conn in conn pool:%p", ((STrans*)pThrd->pTransInst)->label, pThrd->pool); + tTrace("%s not found conn in conn pool:%p, dst:%s", ((STrans*)pThrd->pTransInst)->label, pThrd->pool, addr); } return conn; } @@ -1471,7 +1526,8 @@ FORCE_INLINE int32_t cliBuildExceptResp(SCliMsg* pMsg, STransMsg* pResp) { } static FORCE_INLINE uint32_t cliGetIpFromFqdnCache(SHashObj* cache, char* fqdn) { uint32_t addr = 0; - uint32_t* v = taosHashGet(cache, fqdn, strlen(fqdn) + 1); + size_t len = strlen(fqdn); + uint32_t* v = taosHashGet(cache, fqdn, len); if (v == NULL) { addr = taosGetIpv4FromFqdn(fqdn); if (addr == 0xffffffff) { @@ -1480,7 +1536,7 @@ static FORCE_INLINE uint32_t cliGetIpFromFqdnCache(SHashObj* cache, char* fqdn) return addr; } - taosHashPut(cache, fqdn, strlen(fqdn) + 1, &addr, sizeof(addr)); + taosHashPut(cache, fqdn, len, &addr, sizeof(addr)); } else { addr = *v; } @@ -1490,13 +1546,14 @@ static FORCE_INLINE void cliUpdateFqdnCache(SHashObj* cache, char* fqdn) { // impl later uint32_t addr = taosGetIpv4FromFqdn(fqdn); if (addr != 0xffffffff) { - uint32_t* v = taosHashGet(cache, fqdn, strlen(fqdn) + 1); + size_t len = strlen(fqdn); + uint32_t* v = taosHashGet(cache, fqdn, len); if (addr != *v) { char old[64] = {0}, new[64] = {0}; tinet_ntoa(old, *v); tinet_ntoa(new, addr); tWarn("update ip of fqdn:%s, old: %s, new: %s", fqdn, old, new); - taosHashPut(cache, fqdn, strlen(fqdn) + 1, &addr, sizeof(addr)); + taosHashPut(cache, fqdn, len, &addr, sizeof(addr)); } } return; @@ -1537,21 +1594,6 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { return; } - if (rpcDebugFlag & DEBUG_TRACE) { - if (tmsgIsValid(pMsg->msg.msgType)) { - char buf[128] = {0}; - sprintf(buf, "%s", TMSG_INFO(pMsg->msg.msgType)); - int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); - if (NULL == 0) { - int localCount = 1; - taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); - } else { - int localCount = *count + 1; - taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); - } - } - } - char* fqdn = EPSET_GET_INUSE_IP(&pMsg->ctx->epSet); uint16_t port = EPSET_GET_INUSE_PORT(&pMsg->ctx->epSet); char addr[TSDB_FQDN_LEN + 64] = {0}; @@ -1609,7 +1651,6 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { addr.sin_port = (uint16_t)htons(port); tGTrace("%s conn %p try to connect to %s", pTransInst->label, conn, conn->dstAddr); - pThrd->newConnCount++; int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 10); if (fd == -1) { tGError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn, @@ -1704,9 +1745,8 @@ static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) { uint32_t port = EPSET_GET_INUSE_PORT(&pCtx->epSet); char key[TSDB_FQDN_LEN + 64] = {0}; CONN_CONSTRUCT_HASH_KEY(key, ip, port); - - // SCliBatch** ppBatch = taosHashGet(pThrd->batchCache, key, sizeof(key)); - SCliBatchList** ppBatchList = taosHashGet(pThrd->batchCache, key, sizeof(key)); + size_t klen = strlen(key); + SCliBatchList** ppBatchList = taosHashGet(pThrd->batchCache, key, klen); if (ppBatchList == NULL || *ppBatchList == NULL) { SCliBatchList* pBatchList = taosMemoryCalloc(1, sizeof(SCliBatchList)); QUEUE_INIT(&pBatchList->wq); @@ -1730,7 +1770,7 @@ static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) { QUEUE_PUSH(&pBatchList->wq, &pBatch->listq); - taosHashPut(pThrd->batchCache, key, sizeof(key), &pBatchList, sizeof(void*)); + taosHashPut(pThrd->batchCache, key, klen, &pBatchList, sizeof(void*)); } else { if (QUEUE_IS_EMPTY(&(*ppBatchList)->wq)) { SCliBatch* pBatch = taosMemoryCalloc(1, sizeof(SCliBatch)); @@ -1800,21 +1840,6 @@ static void cliAsyncCb(uv_async_t* handle) { QUEUE_MOVE(&item->qmsg, &wq); taosThreadMutexUnlock(&item->mtx); - if (rpcDebugFlag & DEBUG_TRACE) { - void* pIter = taosHashIterate(pThrd->msgCount, NULL); - while (pIter != NULL) { - int* count = pIter; - size_t len = 0; - char* key = taosHashGetKey(pIter, &len); - if (*count != 0) { - tDebug("key: %s count: %d", key, *count); - } - - pIter = taosHashIterate(pThrd->msgCount, pIter); - } - tDebug("all conn count: %d", pThrd->newConnCount); - } - int8_t supportBatch = pTransInst->supportBatch; if (supportBatch == 0) { cliNoBatchDealReq(&wq, pThrd); @@ -1885,9 +1910,10 @@ void cliIteraConnMsgs(SCliConn* conn) { bool cliRecvReleaseReq(SCliConn* conn, STransMsgHead* pHead) { if (pHead->release == 1 && (pHead->msgLen) == sizeof(*pHead)) { uint64_t ahandle = pHead->ahandle; - tDebug("ahandle = %" PRIu64 "", ahandle); SCliMsg* pMsg = NULL; CONN_GET_MSGCTX_BY_AHANDLE(conn, ahandle); + tDebug("%s conn %p receive release request, refId:%" PRId64 ", may ignore", CONN_GET_INST_LABEL(conn), conn, + conn->refId); transClearBuffer(&conn->readBuf); transFreeMsg(transContFromHead((char*)pHead)); @@ -1896,6 +1922,9 @@ bool cliRecvReleaseReq(SCliConn* conn, STransMsgHead* pHead) { SCliMsg* cliMsg = transQueueGet(&conn->cliMsgs, i); if (cliMsg->type == Release) { ASSERTS(pMsg == NULL, "trans-cli recv invaid release-req"); + tDebug("%s conn %p receive release request, refId:%" PRId64 ", ignore msg", CONN_GET_INST_LABEL(conn), conn, + conn->refId); + cliDestroyConn(conn, true); return true; } } @@ -1971,8 +2000,9 @@ static FORCE_INLINE void destroyCmsgWrapper(void* arg, void* param) { if (pMsg == NULL) { return; } - if (param != NULL) { - SCliThrd* pThrd = param; + + SCliThrd* pThrd = param; + if (pMsg->msg.info.notFreeAhandle == 0 && pThrd != NULL) { if (pThrd->destroyAhandleFp) (*pThrd->destroyAhandleFp)(pMsg->msg.info.ahandle); } destroyCmsg(pMsg); @@ -1984,12 +2014,9 @@ static FORCE_INLINE void destroyCmsgAndAhandle(void* param) { SCliMsg* pMsg = arg->param1; SCliThrd* pThrd = arg->param2; - tDebug("destroy Ahandle A"); - if (pThrd != NULL && pThrd->destroyAhandleFp != NULL) { - tDebug("destroy Ahandle B"); + if (pMsg->msg.info.notFreeAhandle == 0 && pThrd != NULL && pThrd->destroyAhandleFp != NULL) { pThrd->destroyAhandleFp(pMsg->ctx->ahandle); } - tDebug("destroy Ahandle C"); transDestroyConnCtx(pMsg->ctx); transFreeMsg(pMsg->msg.pCont); @@ -2013,11 +2040,9 @@ static SCliThrd* createThrdObj(void* trans) { taosMemoryFree(pThrd); return NULL; } - if (pTransInst->supportBatch) { - pThrd->asyncPool = transAsyncPoolCreate(pThrd->loop, 4, pThrd, cliAsyncCb); - } else { - pThrd->asyncPool = transAsyncPoolCreate(pThrd->loop, 8, pThrd, cliAsyncCb); - } + int32_t nSync = pTransInst->supportBatch ? 4 : 8; + pThrd->asyncPool = transAsyncPoolCreate(pThrd->loop, nSync, pThrd, cliAsyncCb); + if (pThrd->asyncPool == NULL) { tError("failed to init async pool"); uv_loop_close(pThrd->loop); @@ -2058,8 +2083,6 @@ static SCliThrd* createThrdObj(void* trans) { pThrd->quit = false; - pThrd->newConnCount = 0; - pThrd->msgCount = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); return pThrd; } static void destroyThrdObj(SCliThrd* pThrd) { @@ -2105,7 +2128,6 @@ static void destroyThrdObj(SCliThrd* pThrd) { pIter = (void**)taosHashIterate(pThrd->batchCache, pIter); } taosHashCleanup(pThrd->batchCache); - taosHashCleanup(pThrd->msgCount); taosMemoryFree(pThrd); } @@ -2124,14 +2146,7 @@ void cliSendQuit(SCliThrd* thrd) { void cliWalkCb(uv_handle_t* handle, void* arg) { if (!uv_is_closing(handle)) { if (uv_handle_get_type(handle) == UV_TIMER) { - // SCliConn* pConn = handle->data; - // if (pConn != NULL && pConn->timer != NULL) { - // SCliThrd* pThrd = pConn->hostThrd; - // uv_timer_stop((uv_timer_t*)handle); - // handle->data = NULL; - // taosArrayPush(pThrd->timerList, &pConn->timer); - // pConn->timer = NULL; - // } + // do nothing } else { uv_read_stop((uv_stream_t*)handle); } @@ -2166,18 +2181,23 @@ static void doCloseIdleConn(void* param) { cliDestroyConn(conn, true); taosMemoryFree(arg); } +static void cliSchedMsgToDebug(SCliMsg* pMsg, char* label) { + if (!(rpcDebugFlag & DEBUG_DEBUG)) { + return; + } + STransConnCtx* pCtx = pMsg->ctx; + STraceId* trace = &pMsg->msg.info.traceId; + char tbuf[512] = {0}; + EPSET_TO_STR(&pCtx->epSet, tbuf); + tGDebug("%s retry on next node,use:%s, step: %d,timeout:%" PRId64 "", label, tbuf, pCtx->retryStep, + pCtx->retryNextInterval); + return; +} static void cliSchedMsgToNextNode(SCliMsg* pMsg, SCliThrd* pThrd) { STrans* pTransInst = pThrd->pTransInst; STransConnCtx* pCtx = pMsg->ctx; - - if (rpcDebugFlag & DEBUG_DEBUG) { - STraceId* trace = &pMsg->msg.info.traceId; - char tbuf[512] = {0}; - EPSET_TO_STR(&pCtx->epSet, tbuf); - tGDebug("%s retry on next node,use:%s, step: %d,timeout:%" PRId64 "", transLabel(pThrd->pTransInst), tbuf, - pCtx->retryStep, pCtx->retryNextInterval); - } + cliSchedMsgToDebug(pMsg, transLabel(pThrd->pTransInst)); STaskArg* arg = taosMemoryMalloc(sizeof(STaskArg)); arg->param1 = pMsg; @@ -2186,12 +2206,6 @@ static void cliSchedMsgToNextNode(SCliMsg* pMsg, SCliThrd* pThrd) { transDQSched(pThrd->delayQueue, doDelayTask, arg, pCtx->retryNextInterval); } -FORCE_INLINE void cliCompareAndSwap(int8_t* val, int8_t exp, int8_t newVal) { - if (*val != exp) { - *val = newVal; - } -} - FORCE_INLINE bool cliTryExtractEpSet(STransMsg* pResp, SEpSet* dst) { if ((pResp == NULL || pResp->info.hasEpSet == 0)) { return false; @@ -2411,20 +2425,6 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { tGTrace("%s conn %p extract epset from msg", CONN_GET_INST_LABEL(pConn), pConn); } } - if (rpcDebugFlag & DEBUG_TRACE) { - if (tmsgIsValid(pResp->msgType - 1)) { - char buf[128] = {0}; - sprintf(buf, "%s", TMSG_INFO(pResp->msgType - 1)); - int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); - if (NULL == 0) { - int localCount = 0; - taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); - } else { - int localCount = *count - 1; - taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); - } - } - } if (pCtx->pSem || pCtx->syncMsgRef != 0) { tGTrace("%s conn %p(sync) handle resp", CONN_GET_INST_LABEL(pConn), pConn); if (pCtx->pSem) { @@ -2547,21 +2547,7 @@ int transReleaseCliHandle(void* handle) { } return 0; } - -int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransCtx* ctx) { - STrans* pTransInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)shandle); - if (pTransInst == NULL) { - transFreeMsg(pReq->pCont); - return TSDB_CODE_RPC_BROKEN_LINK; - } - - SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle); - if (pThrd == NULL) { - transFreeMsg(pReq->pCont); - transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); - return TSDB_CODE_RPC_BROKEN_LINK; - } - +static SCliMsg* transInitMsg(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransCtx* ctx) { TRACE_SET_MSGID(&pReq->info.traceId, tGenIdPI64()); STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx)); epsetAssign(&pCtx->epSet, pEpSet); @@ -2578,12 +2564,48 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran cliMsg->st = taosGetTimestampUs(); cliMsg->type = Normal; cliMsg->refId = (int64_t)shandle; + QUEUE_INIT(&cliMsg->seqq); + return cliMsg; +} + +int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransCtx* ctx) { + STrans* pTransInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)shandle); + if (pTransInst == NULL) { + transFreeMsg(pReq->pCont); + return TSDB_CODE_RPC_BROKEN_LINK; + } + + int64_t handle = (int64_t)pReq->info.handle; + SCliThrd* pThrd = transGetWorkThrd(pTransInst, handle); + if (pThrd == NULL) { + transFreeMsg(pReq->pCont); + transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); + return TSDB_CODE_RPC_BROKEN_LINK; + } + if (handle != 0) { + SExHandle* exh = transAcquireExHandle(transGetRefMgt(), handle); + if (exh != NULL) { + taosWLockLatch(&exh->latch); + if (exh->handle == NULL && exh->inited != 0) { + SCliMsg* pCliMsg = transInitMsg(shandle, pEpSet, pReq, ctx); + QUEUE_PUSH(&exh->q, &pCliMsg->seqq); + taosWUnLockLatch(&exh->latch); + tDebug("msg refId: %" PRId64 "", handle); + transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); + return 0; + } + exh->inited = 1; + taosWUnLockLatch(&exh->latch); + transReleaseExHandle(transGetRefMgt(), handle); + } + } + SCliMsg* pCliMsg = transInitMsg(shandle, pEpSet, pReq, ctx); STraceId* trace = &pReq->info.traceId; tGDebug("%s send request at thread:%08" PRId64 ", dst:%s:%d, app:%p", transLabel(pTransInst), pThrd->pid, - EPSET_GET_INUSE_IP(&pCtx->epSet), EPSET_GET_INUSE_PORT(&pCtx->epSet), pReq->info.ahandle); - if (0 != transAsyncSend(pThrd->asyncPool, &(cliMsg->q))) { - destroyCmsg(cliMsg); + EPSET_GET_INUSE_IP(pEpSet), EPSET_GET_INUSE_PORT(pEpSet), pReq->info.ahandle); + if (0 != transAsyncSend(pThrd->asyncPool, &(pCliMsg->q))) { + destroyCmsg(pCliMsg); transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); return TSDB_CODE_RPC_BROKEN_LINK; } @@ -2769,6 +2791,8 @@ int transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) { int64_t transAllocHandle() { SExHandle* exh = taosMemoryCalloc(1, sizeof(SExHandle)); exh->refId = transAddExHandle(transGetRefMgt(), exh); + QUEUE_INIT(&exh->q); + taosInitRWLatch(&exh->latch); tDebug("pre alloc refId %" PRId64 "", exh->refId); return exh->refId; diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index f47a688e6f..21ad5be869 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -761,9 +761,12 @@ static bool uvRecvReleaseReq(SSvrConn* pConn, STransMsgHead* pHead) { tTrace("conn %p received release request", pConn); STraceId traceId = pHead->traceId; - pConn->status = ConnRelease; transClearBuffer(&pConn->readBuf); transFreeMsg(transContFromHead((char*)pHead)); + if (pConn->status != ConnAcquire) { + return true; + } + pConn->status = ConnRelease; STransMsg tmsg = {.code = 0, .info.handle = (void*)pConn, .info.traceId = traceId, .info.ahandle = (void*)0x9527}; SSvrMsg* srvMsg = taosMemoryCalloc(1, sizeof(SSvrMsg)); @@ -1090,6 +1093,7 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) { STrans* pTransInst = pThrd->pTransInst; pConn->refId = exh->refId; + QUEUE_INIT(&exh->q); transRefSrvHandle(pConn); tTrace("%s handle %p, conn %p created, refId:%" PRId64, transLabel(pTransInst), exh, pConn, pConn->refId); return pConn; @@ -1121,6 +1125,7 @@ static int reallocConnRef(SSvrConn* conn) { exh->handle = conn; exh->pThrd = conn->hostThrd; exh->refId = transAddExHandle(transGetRefMgt(), exh); + QUEUE_INIT(&exh->q); transAcquireExHandle(transGetRefMgt(), exh->refId); conn->refId = exh->refId; diff --git a/source/util/src/terror.c b/source/util/src/terror.c index a64c8642db..0812181c5c 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -285,7 +285,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_IN_DROPPING, "Dnode in dropping sta // mnode-trans TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_ALREADY_EXIST, "Transaction already exists") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_NOT_EXIST, "Transaction not exists") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_INVALID_STAGE, "Invalid stage to kill") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_INVALID_STAGE, "Invalid transaction stage") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_CONFLICT, "Conflict transaction not completed") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_CLOG_IS_NULL, "Transaction commitlog is null") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL, "Unable to establish connection While execute transaction and will continue in the background") @@ -601,7 +601,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NOT_ALLOWED_WIN_QUERY, "Window query not su TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DROP_COL, "No columns can be dropped") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COL_JSON, "Only tag can be json type") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_VALUE_TOO_LONG, "Value too long for column/tag") -TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DELETE_WHERE, "The DELETE statement must have a definite time window range") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DELETE_WHERE, "The DELETE statement must only have a definite time window range") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG, "The REDISTRIBUTE VGROUP statement only support 1 to 3 dnodes") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC, "Fill not allowed") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_WINDOW_PC, "Invalid windows pc") @@ -628,6 +628,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_TAG_IS_PRIMARY_KEY, "tag can not be prim TAOS_DEFINE_ERROR(TSDB_CODE_PAR_SECOND_COL_PK, "primary key must be second column") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_COL_PK_TYPE, "primary key column must be of type int, uint, bigint, ubigint, and varchar") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_PK_OP, "primary key column can not be added, modified, and dropped") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL, "Primary key column should not be null") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error") //planner @@ -667,6 +668,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SML_INVALID_DATA, "Invalid data format TAOS_DEFINE_ERROR(TSDB_CODE_SML_INVALID_DB_CONF, "Invalid schemaless db config") TAOS_DEFINE_ERROR(TSDB_CODE_SML_NOT_SAME_TYPE, "Not the same type like before") TAOS_DEFINE_ERROR(TSDB_CODE_SML_INTERNAL_ERROR, "Internal error") +TAOS_DEFINE_ERROR(TSDB_CODE_SML_NOT_SUPPORT_PK, "Can not insert data into table with primary key") //tsma TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_INIT_FAILED, "Tsma init failed") diff --git a/source/util/src/tworker.c b/source/util/src/tworker.c index 138d4bc1f4..0712010458 100644 --- a/source/util/src/tworker.c +++ b/source/util/src/tworker.c @@ -19,7 +19,7 @@ #include "tgeosctx.h" #include "tlog.h" -#define QUEUE_THRESHOLD 1000 * 1000 +#define QUEUE_THRESHOLD (1000 * 1000) typedef void *(*ThreadFp)(void *param); diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 0cdac26a3a..89926b1041 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1222,6 +1222,7 @@ ,,y,script,./test.sh -f tsim/stream/countSliding1.sim ,,y,script,./test.sh -f tsim/stream/countSliding2.sim ,,y,script,./test.sh -f tsim/stream/deleteInterval.sim +,,y,script,./test.sh -f tsim/stream/deleteScalar.sim ,,y,script,./test.sh -f tsim/stream/deleteSession.sim ,,y,script,./test.sh -f tsim/stream/deleteState.sim ,,y,script,./test.sh -f tsim/stream/distributeInterval0.sim @@ -1247,6 +1248,7 @@ ,,y,script,./test.sh -f tsim/stream/ignoreExpiredData.sim ,,y,script,./test.sh -f tsim/stream/partitionby1.sim ,,y,script,./test.sh -f tsim/stream/partitionbyColumnInterval.sim +,,y,script,./test.sh -f tsim/stream/partitionbyColumnOther.sim ,,y,script,./test.sh -f tsim/stream/partitionbyColumnSession.sim ,,y,script,./test.sh -f tsim/stream/partitionbyColumnState.sim ,,y,script,./test.sh -f tsim/stream/partitionby.sim @@ -1257,8 +1259,13 @@ ,,y,script,./test.sh -f tsim/stream/sliding.sim ,,y,script,./test.sh -f tsim/stream/state0.sim ,,y,script,./test.sh -f tsim/stream/state1.sim +,,y,script,./test.sh -f tsim/stream/streamPrimaryKey0.sim +,,y,script,./test.sh -f tsim/stream/streamPrimaryKey1.sim +,,y,script,./test.sh -f tsim/stream/streamPrimaryKey2.sim +,,y,script,./test.sh -f tsim/stream/streamPrimaryKey3.sim ,,y,script,./test.sh -f tsim/stream/triggerInterval0.sim ,,y,script,./test.sh -f tsim/stream/triggerSession0.sim +,,y,script,./test.sh -f tsim/stream/udTableAndCol0.sim ,,y,script,./test.sh -f tsim/stream/udTableAndTag0.sim ,,y,script,./test.sh -f tsim/stream/udTableAndTag1.sim ,,y,script,./test.sh -f tsim/stream/udTableAndTag2.sim diff --git a/tests/script/tsim/parser/columnValue_bool.sim b/tests/script/tsim/parser/columnValue_bool.sim index db89db4256..97d074a6f9 100644 --- a/tests/script/tsim/parser/columnValue_bool.sim +++ b/tests/script/tsim/parser/columnValue_bool.sim @@ -936,6 +936,9 @@ sql_error alter table st_bool_i1 set tag tagname="123abc" sql alter table st_bool_i2 set tag tagname="123" sql_error alter table st_bool_i3 set tag tagname=abc sql_error alter table st_bool_i4 set tag tagname="abc" +sql_error alter table st_bool_i4 set tag tagname=now +sql_error alter table st_bool_i4 set tag tagname=now()+1d +sql_error alter table st_bool_i4 set tag tagname=1+1d sql_error alter table st_bool_i5 set tag tagname=" " sql_error alter table st_bool_i6 set tag tagname='' diff --git a/tests/script/tsim/parser/columnValue_int.sim b/tests/script/tsim/parser/columnValue_int.sim index f03a576ae3..f022c33363 100644 --- a/tests/script/tsim/parser/columnValue_int.sim +++ b/tests/script/tsim/parser/columnValue_int.sim @@ -913,6 +913,8 @@ sql_error alter table st_int_e19 set tag tagname=123abc sql_error alter table st_int_e20 set tag tagname="123abc" sql_error alter table st_int_e22 set tag tagname=abc sql_error alter table st_int_e23 set tag tagname="abc" +sql_error alter table st_int_e25 set tag tagname=1+1d +sql_error alter table st_int_e25 set tag tagname="1"+1d sql_error alter table st_int_e24 set tag tagname=" " sql_error alter table st_int_e25 set tag tagname='' sql alter table st_int_e26_1 set tag tagname='123' diff --git a/tests/script/tsim/parser/columnValue_timestamp.sim b/tests/script/tsim/parser/columnValue_timestamp.sim index 1f457dbd7c..4334230a05 100644 --- a/tests/script/tsim/parser/columnValue_timestamp.sim +++ b/tests/script/tsim/parser/columnValue_timestamp.sim @@ -132,6 +132,77 @@ sql show tags from st_timestamp_22 if $data05 != -1 then return -1 endi +sql create table st_timestamp_23 using mt_timestamp tags (1+ 1d ) +sql show tags from st_timestamp_23 +if $data05 != 86400001 then + return -1 +endi +sql create table st_timestamp_24 using mt_timestamp tags (-0 + 1d) +sql show tags from st_timestamp_24 +if $data05 != 86400000 then + return -1 +endi +sql create table st_timestamp_25 using mt_timestamp tags ("-0" -1s) +sql show tags from st_timestamp_25 +if $data05 != -1000 then + return -1 +endi +sql create table st_timestamp_26 using mt_timestamp tags (0b01 -1a) +sql show tags from st_timestamp_26 +if $data05 != 0 then + return -1 +endi +sql create table st_timestamp_27 using mt_timestamp tags (0b01 -1s) +sql show tags from st_timestamp_27 +if $data05 != -999 then + return -1 +endi +sql create table st_timestamp_28 using mt_timestamp tags ("0x01" +1u) +sql show tags from st_timestamp_28 +if $data05 != 1 then + return -1 +endi +sql create table st_timestamp_29 using mt_timestamp tags (0x01 +1b) +sql show tags from st_timestamp_29 +if $data05 != 1 then + return -1 +endi +sql create table st_timestamp_30 using mt_timestamp tags (-0b00 -0a) +sql show tags from st_timestamp_30 +if $data05 != 0 then + return -1 +endi +sql create table st_timestamp_31 using mt_timestamp tags ("-0x00" +1u) +sql show tags from st_timestamp_31 +if $data05 != 0 then + return -1 +endi +sql create table st_timestamp_32 using mt_timestamp tags (-0x00 +1b) +sql show tags from st_timestamp_32 +if $data05 != 0 then + return -1 +endi +sql create table st_timestamp_33 using mt_timestamp tags (now +1b) +sql show tags from st_timestamp_33 +if $data05 < 1711883186000 then + return -1 +endi +sql create table st_timestamp_34 using mt_timestamp tags ("now()" +1b) +sql show tags from st_timestamp_34 +if $data05 < 1711883186000 then + return -1 +endi +sql create table st_timestamp_35 using mt_timestamp tags (today() +1d) +sql show tags from st_timestamp_35 +if $data05 < 1711883186000 then + return -1 +endi +sql create table st_timestamp_36 using mt_timestamp tags ("today()" +1d) +sql show tags from st_timestamp_36 +if $data05 < 1711883186000 then + return -1 +endi + ## case 01: insert values for test column values sql insert into st_timestamp_0 values(now,NULL) @@ -249,6 +320,76 @@ sql select ts, cast(c as bigint) from st_timestamp_22 if $data01 != -1 then return -1 endi +sql insert into st_timestamp_23 values(now,1+ 1d ) +sql select ts, cast(c as bigint) from st_timestamp_23 +if $data01 != 86400001 then + return -1 +endi +sql insert into st_timestamp_24 values(now,-0 + 1d) +sql select ts, cast(c as bigint) from st_timestamp_24 +if $data01 != 86400000 then + return -1 +endi +sql insert into st_timestamp_25 values(now,"-0" -1s) +sql select ts, cast(c as bigint) from st_timestamp_25 +if $data01 != -1000 then + return -1 +endi +sql insert into st_timestamp_26 values(now,0b01 -1a) +sql select ts, cast(c as bigint) from st_timestamp_26 +if $data01 != 0 then + return -1 +endi +sql insert into st_timestamp_27 values(now,+0b01 -1s) +sql select ts, cast(c as bigint) from st_timestamp_27 +if $data01 != -999 then + return -1 +endi +sql insert into st_timestamp_28 values(now,"+0x01" +1u) +sql select ts, cast(c as bigint) from st_timestamp_28 +if $data01 != 1 then + return -1 +endi +sql insert into st_timestamp_29 values(now,0x01 +1b) +sql select ts, cast(c as bigint) from st_timestamp_29 +if $data01 != 1 then + return -1 +endi +sql insert into st_timestamp_30 values(now,-0b00 -0a) +sql show tags from st_timestamp_30 +if $data05 != 0 then + return -1 +endi +sql insert into st_timestamp_31 values(now,"-0x00" +1u) +sql show tags from st_timestamp_31 +if $data05 != 0 then + return -1 +endi +sql insert into st_timestamp_32 values (now,-0x00 +1b) +sql show tags from st_timestamp_32 +if $data05 != 0 then + return -1 +endi +sql insert into st_timestamp_33 values(now,now +1b) +sql select ts, cast(c as bigint) from st_timestamp_33 +if $data01 < 1711883186000 then + return -1 +endi +sql insert into st_timestamp_34 values(now,"now()" +1b) +sql select ts, cast(c as bigint) from st_timestamp_34 +if $data01 < 1711883186000 then + return -1 +endi +sql insert into st_timestamp_35 values(now,today() +1d) +sql select ts, cast(c as bigint) from st_timestamp_35 +if $data01 < 1711883186000 then + return -1 +endi +sql insert into st_timestamp_36 values(now,"today()" +1d) +sql select ts, cast(c as bigint) from st_timestamp_36 +if $data01 < 1711883186000 then + return -1 +endi ## case 02: dynamic create table for test tag values sql insert into st_timestamp_100 using mt_timestamp tags(NULL) values(now, NULL) @@ -450,6 +591,136 @@ sql select ts, cast(c as bigint) from st_timestamp_1022 if $data01 != -1 then return -1 endi +sql insert into st_timestamp_1023 using mt_timestamp tags(+1+1d) values(now,+1+ 1d ) +sql show tags from st_timestamp_1023 +if $data05 != 86400001 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1023 +if $data01 != 86400001 then + return -1 +endi +sql insert into st_timestamp_1024 using mt_timestamp tags(-0+1d) values(now,-0 + 1d) +sql show tags from st_timestamp_1024 +if $data05 != 86400000 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1024 +if $data01 != 86400000 then + return -1 +endi +sql insert into st_timestamp_1025 using mt_timestamp tags("-0" -1s) values(now,"-0" -1s) +sql show tags from st_timestamp_1025 +if $data05 != -1000 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1025 +if $data01 != -1000 then + return -1 +endi +sql insert into st_timestamp_1026 using mt_timestamp tags(+0b01-1a) values(now,+0b01 -1a) +sql show tags from st_timestamp_1026 +if $data05 != 0 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1026 +if $data01 != 0 then + return -1 +endi +sql insert into st_timestamp_1027 using mt_timestamp tags(0b01-1s) values(now,0b01 -1s) +sql show tags from st_timestamp_1027 +if $data05 != -999 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1027 +if $data01 != -999 then + return -1 +endi +sql insert into st_timestamp_1028 using mt_timestamp tags("0x01" + 1u) values(now,"0x01" +1u) +sql show tags from st_timestamp_1028 +if $data05 != 1 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1028 +if $data01 != 1 then + return -1 +endi +sql insert into st_timestamp_1029 using mt_timestamp tags(+0x01 +1b) values(now,+0x01 +1b) +sql show tags from st_timestamp_1029 +if $data05 != 1 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1029 +if $data01 != 1 then + return -1 +endi +sql insert into st_timestamp_1030 using mt_timestamp tags (-0b00 -0a) values(now,-0b00 -0a) +sql show tags from st_timestamp_1030 +if $data05 != 0 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1030 +if $data01 != 0 then + return -1 +endi +sql insert into st_timestamp_1031 using mt_timestamp tags ("-0x00" +1u) values(now,"-0x00" +1u) +sql show tags from st_timestamp_1031 +if $data05 != 0 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1031 +if $data01 != 0 then + return -1 +endi +sql insert into st_timestamp_1032 using mt_timestamp tags (-0x00 +1b) values(now,-0x00 +1b) +sql show tags from st_timestamp_1032 +if $data05 != 0 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1032 +if $data01 != 0 then + return -1 +endi +sql insert into st_timestamp_1033 using mt_timestamp tags(now+1b) values(now,now +1b) +sql show tags from st_timestamp_1033 +if $data05 < 1711883186000 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1033 +if $data01 < 1711883186000 then + return -1 +endi +sql insert into st_timestamp_1034 using mt_timestamp tags("now" +1b) values(now,"now()" +1b) +sql show tags from st_timestamp_1034 +if $data05 < 1711883186000 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1034 +if $data01 < 1711883186000 then + return -1 +endi +sql insert into st_timestamp_1035 using mt_timestamp tags(today() + 1d) values(now,today() +1d) +sql show tags from st_timestamp_1035 +if $data05 < 1711883186000 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1035 +if $data01 < 1711883186000 then + return -1 +endi +sql insert into st_timestamp_1036 using mt_timestamp tags("today" +1d) values(now,"today()" +1d) +sql show tags from st_timestamp_1036 +if $data05 < 1711883186000 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1036 +if $data01 < 1711883186000 then + return -1 +endi + + + + ### case 03: alter tag values sql alter table st_timestamp_0 set tag tagname=NULL @@ -567,12 +838,85 @@ sql show tags from st_timestamp_22 if $data05 != -1 then return -1 endi +sql alter table st_timestamp_23 set tag tagname=1+ 1d +sql show tags from st_timestamp_23 +if $data05 != 86400001 then + return -1 +endi +sql alter table st_timestamp_24 set tag tagname=-0 + 1d +sql show tags from st_timestamp_24 +if $data05 != 86400000 then + return -1 +endi +sql alter table st_timestamp_25 set tag tagname="-0" -1s +sql show tags from st_timestamp_25 +if $data05 != -1000 then + return -1 +endi +sql alter table st_timestamp_26 set tag tagname=+0b01 -1a +sql show tags from st_timestamp_26 +if $data05 != 0 then + return -1 +endi +sql alter table st_timestamp_27 set tag tagname=0b01 -1s +sql show tags from st_timestamp_27 +if $data05 != -999 then + return -1 +endi +sql alter table st_timestamp_28 set tag tagname="0x01" +1u +sql show tags from st_timestamp_28 +if $data05 != 1 then + return -1 +endi +sql alter table st_timestamp_29 set tag tagname=0x01 +1b +sql show tags from st_timestamp_29 +if $data05 != 1 then + return -1 +endi +sql alter table st_timestamp_30 set tag tagname==-0b00 -0a +sql show tags from st_timestamp_30 +if $data05 != 0 then + return -1 +endi +sql alter table st_timestamp_31 set tag tagname="-0x00" +1u +sql show tags from st_timestamp_31 +if $data05 != 0 then + return -1 +endi +sql alter table st_timestamp_32 set tag tagname=-0x00 +1b +sql show tags from st_timestamp_32 +if $data05 != 0 then + return -1 +endi +sql alter table st_timestamp_33 set tag tagname=now +1b +sql show tags from st_timestamp_33 +if $data05 < 1711883186000 then + return -1 +endi +sql alter table st_timestamp_34 set tag tagname="now()" +1b +sql show tags from st_timestamp_34 +if $data05 < 1711883186000 then + return -1 +endi +sql alter table st_timestamp_35 set tag tagname=today( ) +1d +sql show tags from st_timestamp_35 +if $data05 < 1711883186000 then + return -1 +endi +sql alter table st_timestamp_36 set tag tagname="today()" +1d +sql show tags from st_timestamp_36 +if $data05 < 1711883186000 then + return -1 +endi ## case 04: illegal input sql_error create table st_timestamp_e0 using mt_timestamp tags (123abc) sql_error create table st_timestamp_e0 using mt_timestamp tags ("123abc") sql_error create table st_timestamp_e0 using mt_timestamp tags (abc) sql_error create table st_timestamp_e0 using mt_timestamp tags ("abc") +sql_error create table st_timestamp_e0 using mt_timestamp tags (now()+1d+1s) +sql_error create table st_timestamp_e0 using mt_timestamp tags (1+1y) +sql_error create table st_timestamp_e0 using mt_timestamp tags (0x01+1b+1a) sql_error create table st_timestamp_e0 using mt_timestamp tags (" ") sql_error create table st_timestamp_e0 using mt_timestamp tags ('') sql_error create table st_timestamp_104 using mt_timestamp tags ("-123.1") @@ -590,5 +934,7 @@ sql_error create table st_timestamp_115 using mt_timestamp tags (922337203685477 sql create table st_timestamp_116 using mt_timestamp tags (-9223372036854775808) sql_error create table st_timestamp_117 using mt_timestamp tags (-9223372036854775809) sql_error insert into st_timestamp_118 using mt_timestamp tags(9223372036854775807) values(9223372036854775807, 9223372036854775807) +sql_error insert into st_timestamp_119 using mt_timestamp tags(1+1s-1s) values(now, now) +sql_error insert into st_timestamp_120 using mt_timestamp tags(1-1s) values(now, now-1s+1d) system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/columnValue_varbinary.sim b/tests/script/tsim/parser/columnValue_varbinary.sim index 1db1054646..eb437f7597 100644 --- a/tests/script/tsim/parser/columnValue_varbinary.sim +++ b/tests/script/tsim/parser/columnValue_varbinary.sim @@ -299,6 +299,8 @@ sql_error create table st_varbinary_1012 using mt_varbinary tags(tRue) sql_error create table st_varbinary_1013 using mt_varbinary tags(FalsE) sql_error create table st_varbinary_1014 using mt_varbinary tags(noW) sql_error create table st_varbinary_1015 using mt_varbinary tags(toDay) +sql_error create table st_varbinary_1016 using mt_varbinary tags(now()+1s) +sql_error create table st_varbinary_1017 using mt_varbinary tags(1+1s) sql_error insert into st_varbinary_106 using mt_varbinary tags(+0123) values(now, NULL); sql_error insert into st_varbinary_107 using mt_varbinary tags(-01.23) values(now, NULL); sql_error insert into st_varbinary_108 using mt_varbinary tags(+0x01) values(now, NULL); @@ -309,6 +311,8 @@ sql_error insert into st_varbinary_1012 using mt_varbinary tags(tRue) values(no sql_error insert into st_varbinary_1013 using mt_varbinary tags(FalsE) values(now, NULL); sql_error insert into st_varbinary_1014 using mt_varbinary tags(noW) values(now, NULL); sql_error insert into st_varbinary_1015 using mt_varbinary tags(toDay) values(now, NULL); +sql_error insert into st_varbinary_1016 using mt_varbinary tags(now()+1s) values(now, NULL); +sql_error insert into st_varbinary_1017 using mt_varbinary tags(1+1s) values(now, NULL); sql_error insert into st_varbinary_106 using mt_varbinary tags(NULL) values(now(), +0123) sql_error insert into st_varbinary_107 using mt_varbinary tags(NULL) values(now(), -01.23) sql_error insert into st_varbinary_108 using mt_varbinary tags(NULL) values(now(), +0x01) @@ -319,5 +323,7 @@ sql_error insert into st_varbinary_1012 using mt_varbinary tags(NULL) values(no sql_error insert into st_varbinary_1013 using mt_varbinary tags(NULL) values(now(), FalsE) sql_error insert into st_varbinary_1014 using mt_varbinary tags(NULL) values(now(), noW) sql_error insert into st_varbinary_1015 using mt_varbinary tags(NULL) values(now(), toDay) +sql_error insert into st_varbinary_1016 using mt_varbinary tags(NULL) values(now(), now()+1s) +sql_error insert into st_varbinary_1017 using mt_varbinary tags(NULL) values(now(), 1+1s) system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/columnValue_varchar.sim b/tests/script/tsim/parser/columnValue_varchar.sim index 5edfe5ed24..b705f3069a 100644 --- a/tests/script/tsim/parser/columnValue_varchar.sim +++ b/tests/script/tsim/parser/columnValue_varchar.sim @@ -410,6 +410,17 @@ endi # case 04: illegal input +sql_error create table st_varchar_100 using mt_varchar tags(now+1d) +sql_error create table st_varchar_101 using mt_varchar tags(toDay+1d) +sql_error create table st_varchar_102 using mt_varchar tags(1+1b) +sql_error create table st_varchar_103 using mt_varchar tags(0x01+1d) +sql_error create table st_varchar_104 using mt_varchar tags(0b01+1s) +sql_error insert into st_varchar_1100 using mt_varchar tags('now') values(now(),now+1d) +sql_error insert into st_varchar_1101 using mt_varchar tags('now') values(now(),toDay+1d) +sql_error insert into st_varchar_1102 using mt_varchar tags('now') values(now(),1+1b) +sql_error insert into st_varchar_1103 using mt_varchar tags('now') values(now(),0x01+1d) +sql_error insert into st_varchar_1104 using mt_varchar tags('now') values(now(),0b01+1s) +sql_error alter table st_varchar_15 set tag tagname=now()+1d system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/checkpointSession1.sim b/tests/script/tsim/stream/checkpointSession1.sim index ea93e1525a..9720803145 100644 --- a/tests/script/tsim/stream/checkpointSession1.sim +++ b/tests/script/tsim/stream/checkpointSession1.sim @@ -15,6 +15,8 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create stream streams0 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, count(*) c1, sum(a) from st session(ts, 10s); +sleep 1000 + sql insert into t1 values(1648791213000,1,2,3,1.0); sql insert into t2 values(1648791213001,2,2,3,1.1); diff --git a/tests/script/tsim/stream/deleteScalar.sim b/tests/script/tsim/stream/deleteScalar.sim new file mode 100644 index 0000000000..9a634a5c2d --- /dev/null +++ b/tests/script/tsim/stream/deleteScalar.sim @@ -0,0 +1,260 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 1000 +sql connect + +sql drop database if exists test; +sql create database test vgroups 4; +sql use test; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select ts, a, b from t1 partition by a; + +sleep 1000 + +sql insert into t1 values(1648791213000,0,2,3,1.0); +sql insert into t1 values(1648791213001,1,2,3,1.0); +sql insert into t1 values(1648791213002,2,2,3,1.0); + +sql insert into t1 values(1648791213003,0,2,3,1.0); +sql insert into t1 values(1648791213004,1,2,3,1.0); +sql insert into t1 values(1648791213005,2,2,3,1.0); + +$loop_count = 0 + +loop0: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 + +if $rows != 6 then + print ======rows=$rows + goto loop0 +endi + +print delete from t1 where ts <= 1648791213002; +sql delete from t1 where ts <= 1648791213002; + +$loop_count = 0 + +loop1: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt order by 1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 + +if $rows != 3 then + print ======rows=$rows + goto loop1 +endi + +if $data01 != 0 then + print ======data01=$data01 + goto loop1 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop1 +endi + +if $data21 != 2 then + print ======data21=$data21 + goto loop1 +endi + +print ======================step 2 + +sql drop database if exists test1; +sql create database test1 vgroups 4; +sql use test1; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1 subtable(concat("aaa-", cast( a as varchar(10) ))) as select ts, a, b from t1 partition by a; + +sleep 1000 + +sql insert into t1 values(1648791213000,0,2,3,1.0); +sql insert into t1 values(1648791213001,1,2,3,1.0); +sql insert into t1 values(1648791213002,2,2,3,1.0); + +sql insert into t1 values(1648791213003,0,2,3,1.0); +sql insert into t1 values(1648791213004,1,2,3,1.0); +sql insert into t1 values(1648791213005,2,2,3,1.0); + +$loop_count = 0 + +loop2: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 + +if $rows != 6 then + print ======rows=$rows + goto loop2 +endi + +print delete from t1 where ts <= 1648791213002; +sql delete from t1 where ts <= 1648791213002; + +$loop_count = 0 + +loop3: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt1 order by 1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 + +if $rows != 3 then + print ======rows=$rows + goto loop3 +endi + +if $data01 != 0 then + print ======data01=$data01 + goto loop3 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop3 +endi + +if $data21 != 2 then + print ======data21=$data21 + goto loop3 +endi + +print ======================step 3 + +sql drop database if exists test1; +sql create database test2 vgroups 4; +sql use test2; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2 subtable("aaa-a") as select ts, a, b from t1; + +sleep 1000 + +sql insert into t1 values(1648791213000,0,2,3,1.0); +sql insert into t1 values(1648791213001,1,2,3,1.0); +sql insert into t1 values(1648791213002,2,2,3,1.0); + +sql insert into t1 values(1648791213003,0,2,3,1.0); +sql insert into t1 values(1648791213004,1,2,3,1.0); +sql insert into t1 values(1648791213005,2,2,3,1.0); + +$loop_count = 0 + +loop4: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt2; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 + +if $rows != 6 then + print ======rows=$rows + goto loop4 +endi + +print delete from t1 where ts <= 1648791213002; +sql delete from t1 where ts <= 1648791213002; + +$loop_count = 0 + +loop5: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt2 order by 1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 + +if $rows != 3 then + print ======rows=$rows + goto loop5 +endi + +if $data01 != 0 then + print ======data01=$data01 + goto loop5 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop5 +endi + +if $data21 != 2 then + print ======data21=$data21 + goto loop5 +endi + +system sh/stop_dnodes.sh + +#goto looptest \ No newline at end of file diff --git a/tests/script/tsim/stream/partitionbyColumnInterval.sim b/tests/script/tsim/stream/partitionbyColumnInterval.sim index d5f815d533..cc70242172 100644 --- a/tests/script/tsim/stream/partitionbyColumnInterval.sim +++ b/tests/script/tsim/stream/partitionbyColumnInterval.sim @@ -1,6 +1,3 @@ -$loop_all = 0 -looptest: - system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start @@ -660,8 +657,65 @@ if $rows != 4 then #goto loop17 endi -$loop_all = $loop_all + 1 -print ============loop_all=$loop_all +print ================step2 +sql drop database if exists test1; +sql create database test6 vgroups 4; +sql use test6; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt6 subtable("aaa-a") as select _wstart, count(*) from t1 partition by a interval(10s); + +sleep 1000 + +sql insert into t1 values(1648791213000,0,2,3,1.0); +sql insert into t1 values(1648791213001,1,2,3,1.0); +sql insert into t1 values(1648791213002,2,2,3,1.0); + +sql insert into t1 values(1648791213003,0,2,3,1.0); +sql insert into t1 values(1648791213004,1,2,3,1.0); +sql insert into t1 values(1648791213005,2,2,3,1.0); + +print delete from t1 where ts <= 1648791213002; +sql delete from t1 where ts <= 1648791213002; + +$loop_count = 0 + +loop18: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt6 order by 1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 + +if $rows != 3 then + print ======rows=$rows + goto loop18 +endi + +if $data01 != 1 then + print ======data01=$data01 + goto loop18 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop18 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop18 +endi + +print ========over system sh/stop_dnodes.sh diff --git a/tests/script/tsim/stream/partitionbyColumnOther.sim b/tests/script/tsim/stream/partitionbyColumnOther.sim new file mode 100644 index 0000000000..8e6c0c1f23 --- /dev/null +++ b/tests/script/tsim/stream/partitionbyColumnOther.sim @@ -0,0 +1,130 @@ +$loop_all = 0 +looptest: + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print ================step1 +sql drop database if exists test1; +sql create database test0 vgroups 4; +sql use test0; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams0 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 watermark 100s into streamt0 subtable("aaa-a") as select _wstart, count(*) from t1 partition by a count_window(10); + +sleep 1000 + +sql insert into t1 values(1648791213000,0,2,3,1.0); +sql insert into t1 values(1648791213001,1,2,3,1.0); +sql insert into t1 values(1648791213002,2,2,3,1.0); + +sql insert into t1 values(1648791213003,0,2,3,1.0); +sql insert into t1 values(1648791213004,1,2,3,1.0); +sql insert into t1 values(1648791213005,2,2,3,1.0); + +print delete from t1 where ts <= 1648791213002; +sql delete from t1 where ts <= 1648791213002; + +$loop_count = 0 + +loop0: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt0 order by 1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 + +if $rows != 3 then + print ======rows=$rows + goto loop0 +endi + +if $data01 != 1 then + print ======data01=$data01 + goto loop0 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop0 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop0 +endi + +print ================step1 +sql drop database if exists test1; +sql create database test1 vgroups 4; +sql use test1; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1 subtable("aaa-a") as select _wstart, count(*) from t1 partition by a event_window start with b = 2 end with b = 2; + +sleep 1000 + +sql insert into t1 values(1648791213000,0,2,3,1.0); +sql insert into t1 values(1648791213001,1,2,3,1.0); +sql insert into t1 values(1648791213002,2,2,3,1.0); + +sql insert into t1 values(1648791213003,0,2,3,1.0); +sql insert into t1 values(1648791213004,1,2,3,1.0); +sql insert into t1 values(1648791213005,2,2,3,1.0); + +print delete from t1 where ts <= 1648791213002; +sql delete from t1 where ts <= 1648791213002; + +$loop_count = 0 + +loop1: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt1 order by 1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 + +if $rows != 3 then + print ======rows=$rows + goto loop1 +endi + +if $data01 != 1 then + print ======data01=$data01 + goto loop1 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop1 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop1 +endi + +print ========over + +system sh/stop_dnodes.sh + +#goto looptest diff --git a/tests/script/tsim/stream/partitionbyColumnSession.sim b/tests/script/tsim/stream/partitionbyColumnSession.sim index a22e36e499..1daa033399 100644 --- a/tests/script/tsim/stream/partitionbyColumnSession.sim +++ b/tests/script/tsim/stream/partitionbyColumnSession.sim @@ -561,9 +561,66 @@ if $data21 != 1 then goto loop14 endi +print ================step2 +sql drop database if exists test5; +sql create database test5 vgroups 4; +sql use test5; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt6 subtable("aaa-a") as select _wstart, count(*) from t1 partition by a session(ts, 10s); + +sleep 1000 + +sql insert into t1 values(1648791213000,0,2,3,1.0); +sql insert into t1 values(1648791213001,1,2,3,1.0); +sql insert into t1 values(1648791213002,2,2,3,1.0); + +sql insert into t1 values(1648791213003,0,2,3,1.0); +sql insert into t1 values(1648791213004,1,2,3,1.0); +sql insert into t1 values(1648791213005,2,2,3,1.0); + +print delete from t1 where ts <= 1648791213002; +sql delete from t1 where ts <= 1648791213002; + +$loop_count = 0 + +loop15: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt6 order by 1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 + +if $rows != 3 then + print ======rows=$rows + goto loop15 +endi + +if $data01 != 1 then + print ======data01=$data01 + goto loop15 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop15 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop15 +endi + +print ========over + system sh/stop_dnodes.sh -$loop_all = $loop_all + 1 -print ============loop_all=$loop_all - #goto looptest \ No newline at end of file diff --git a/tests/script/tsim/stream/partitionbyColumnState.sim b/tests/script/tsim/stream/partitionbyColumnState.sim index 8435e753d4..d741426786 100644 --- a/tests/script/tsim/stream/partitionbyColumnState.sim +++ b/tests/script/tsim/stream/partitionbyColumnState.sim @@ -266,9 +266,66 @@ if $data32 != 8 then goto loop6 endi +print ================step2 +sql drop database if exists test2; +sql create database test2 vgroups 4; +sql use test2; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt6 subtable("aaa-a") as select _wstart, count(*) from t1 partition by a session(ts, 10s); + +sleep 1000 + +sql insert into t1 values(1648791213000,0,2,3,1.0); +sql insert into t1 values(1648791213001,1,2,3,1.0); +sql insert into t1 values(1648791213002,2,2,3,1.0); + +sql insert into t1 values(1648791213003,0,2,3,1.0); +sql insert into t1 values(1648791213004,1,2,3,1.0); +sql insert into t1 values(1648791213005,2,2,3,1.0); + +print delete from t1 where ts <= 1648791213002; +sql delete from t1 where ts <= 1648791213002; + +$loop_count = 0 + +loop7: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt6 order by 1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 + +if $rows != 3 then + print ======rows=$rows + goto loop7 +endi + +if $data01 != 1 then + print ======data01=$data01 + goto loop7 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop7 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop7 +endi + +print ========over + system sh/stop_dnodes.sh -$loop_all = $loop_all + 1 -print ============loop_all=$loop_all - #goto looptest diff --git a/tests/script/tsim/stream/streamPrimaryKey0.sim b/tests/script/tsim/stream/streamPrimaryKey0.sim new file mode 100644 index 0000000000..8905078a3e --- /dev/null +++ b/tests/script/tsim/stream/streamPrimaryKey0.sim @@ -0,0 +1,245 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c debugflag -v 135 +system sh/cfg.sh -n dnode1 -c streamBufferSize -v 10 +system sh/exec.sh -n dnode1 -s start + +sleep 500 + +sql connect + +print step1============= + +sql create database test vgroups 4; +sql use test; +sql create table st(ts timestamp, a int, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); +sql create table streamt0(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); +sql create table streamt2(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); +sql create stream streams0 trigger at_once ignore expired 0 ignore update 0 into streamt0 as select _wstart, count(*) c1, max(b) from t1 interval(1s); +sql create stream streams2 trigger at_once ignore expired 0 ignore update 0 into streamt2 tags(ta) as select _wstart, count(*) c1, max(b) from st partition by tbname ta interval(1s); + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,3,1.0); + +sleep 500 + +sql insert into t1 values(1648791210001,4,2,3,4.1); + +sql insert into t1 values(1648791220000,2,2,3,1.1); +sql insert into t1 values(1648791230000,3,2,3,2.1); +sql insert into t1 values(1648791240000,4,2,3,3.1); +sql insert into t1 values(1648791250000,4,2,3,3.1); + +$loop_count = 0 + +loop0: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt0 +sql select * from streamt0; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 + +if $rows != 5 then + print =====rows=$rows + goto loop0 +endi + +if $data01 != 2 then + print =====data01=$data01 + goto loop0 +endi + +$loop_count = 0 + +loop2: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt2 +sql select * from streamt2; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 + +if $rows != 5 then + print =====rows=$rows + goto loop2 +endi + +if $data01 != 2 then + print =====data01=$data01 + goto loop2 +endi + +print step2============= + +sql create database test1 vgroups 4; +sql use test1; +sql create table st(ts timestamp, a int, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); +sql create table streamt3(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); +sql create table streamt5(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); +sql create stream streams3 trigger at_once ignore expired 0 ignore update 0 into streamt3 as select _wstart, count(*) c1, max(b) from t1 session(ts,1s); +sql create stream streams5 trigger at_once ignore expired 0 ignore update 0 into streamt5 tags(ta) as select _wstart, count(*) c1, max(b) from st partition by tbname ta session(ts,1s); + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,3,1.0); + +sleep 500 + +sql insert into t1 values(1648791210001,4,2,3,4.1); + +sql insert into t1 values(1648791220000,2,2,3,1.1); +sql insert into t1 values(1648791230000,3,2,3,2.1); +sql insert into t1 values(1648791240000,4,2,3,3.1); +sql insert into t1 values(1648791250000,4,2,3,3.1); + +$loop_count = 0 + +loop3: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt3 +sql select * from streamt3; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 + +if $rows != 5 then + print =====rows=$rows + goto loop3 +endi + +if $data01 != 2 then + print =====data01=$data01 + goto loop3 +endi + +$loop_count = 0 + +loop5: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt5 +sql select * from streamt5; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 + +if $rows != 5 then + print =====rows=$rows + goto loop5 +endi + +if $data01 != 2 then + print =====data01=$data01 + goto loop5 +endi + + +sql create database test2 vgroups 4; +sql use test2; +sql create table st(ts timestamp, a int, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); +sql create table streamt6(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); +sql create stream streams6 trigger at_once ignore expired 0 ignore update 0 into streamt6 tags(ta) as select _wstart, count(*) c1, max(b) from st partition by tbname ta state_window(a); + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,3,1.0); + +sleep 500 + +sql insert into t1 values(1648791210001,1,2,3,4.1); + +sql insert into t1 values(1648791220000,2,2,3,1.1); +sql insert into t1 values(1648791230000,3,2,3,2.1); +sql insert into t1 values(1648791240000,4,2,3,3.1); +sql insert into t1 values(1648791250000,5,2,3,3.1); + +$loop_count = 0 + +loop6: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt6 +sql select * from streamt6; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 + +if $rows != 5 then + print =====rows=$rows + goto loop6 +endi + +if $data01 != 2 then + print =====data01=$data01 + goto loop6 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/stream/streamPrimaryKey1.sim b/tests/script/tsim/stream/streamPrimaryKey1.sim new file mode 100644 index 0000000000..71971166d6 --- /dev/null +++ b/tests/script/tsim/stream/streamPrimaryKey1.sim @@ -0,0 +1,123 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c debugflag -v 135 +system sh/cfg.sh -n dnode1 -c streamBufferSize -v 10 +system sh/exec.sh -n dnode1 -s start + +sleep 500 + +sql connect + +print step1============= + +sql create database test vgroups 4; +sql use test; +sql create table st(ts timestamp, a int, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); +sql create table streamt1(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); + +sql create stream streams1 trigger at_once ignore expired 0 ignore update 0 into streamt1 as select _wstart, count(*) c1, max(b) from st interval(1s); + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,3,1.0); + +sleep 500 + +sql insert into t1 values(1648791210001,4,2,3,4.1); + +sql insert into t1 values(1648791220000,2,2,3,1.1); +sql insert into t1 values(1648791230000,3,2,3,2.1); +sql insert into t1 values(1648791240000,4,2,3,3.1); +sql insert into t1 values(1648791250000,4,2,3,3.1); + +$loop_count = 0 + +loop1: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt1 +sql select * from streamt1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 + +if $rows != 5 then + print =====rows=$rows + goto loop1 +endi + +if $data01 != 2 then + print =====data00=$data00 + goto loop1 +endi + + +print step2============= + +sql create database test1 vgroups 4; +sql use test1; +sql create table st(ts timestamp, a int, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); +sql create table streamt3(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); +sql create stream streams3 trigger at_once ignore expired 0 ignore update 0 into streamt3 as select _wstart, count(*) c1, max(b) from st session(ts,1s); + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,3,1.0); + +sleep 500 + +sql insert into t1 values(1648791210001,4,2,3,4.1); + +sql insert into t1 values(1648791220000,2,2,3,1.1); +sql insert into t1 values(1648791230000,3,2,3,2.1); +sql insert into t1 values(1648791240000,4,2,3,3.1); +sql insert into t1 values(1648791250000,4,2,3,3.1); + +$loop_count = 0 + +loop3: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt3 +sql select * from streamt3; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 + +if $rows != 5 then + print =====rows=$rows + goto loop3 +endi + +if $data01 != 2 then + print =====data00=$data00 + goto loop3 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/stream/streamPrimaryKey2.sim b/tests/script/tsim/stream/streamPrimaryKey2.sim new file mode 100644 index 0000000000..c47dc2bb4b --- /dev/null +++ b/tests/script/tsim/stream/streamPrimaryKey2.sim @@ -0,0 +1,141 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c debugflag -v 135 +system sh/cfg.sh -n dnode1 -c streamBufferSize -v 10 +system sh/exec.sh -n dnode1 -s start + +sleep 500 + +sql connect + +print step1============= + +sql create database test vgroups 4; +sql use test; +sql create table st(ts timestamp, a int, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); +sql create table streamt1(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); + +sql create stream streams1 trigger at_once ignore expired 0 ignore update 0 into streamt1 tags(ta) as select _wstart, count(*) c1, max(b) from st partition by tbname ta EVENT_WINDOW start with a = 1 end with a = 3; + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,3,1.0); +sql insert into t1 values(1648791210010,3,2,3,1.0); + +sleep 500 + +sql insert into t1 values(1648791210001,2,2,3,1.0); + +sql insert into t1 values(1648791220000,1,2,3,1.1); +sql insert into t1 values(1648791220001,3,2,3,1.1); + +sql insert into t1 values(1648791230000,1,2,3,2.1); +sql insert into t1 values(1648791230001,3,2,3,2.1); + +sql insert into t1 values(1648791240000,1,2,3,3.1); +sql insert into t1 values(1648791240001,3,2,3,3.1); + +sql insert into t1 values(1648791250000,1,2,3,3.1); +sql insert into t1 values(1648791250001,3,2,3,3.1); + + +$loop_count = 0 + +loop1: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt1 +sql select * from streamt1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 + +if $rows != 5 then + print =====rows=$rows + goto loop1 +endi + +if $data01 != 3 then + print =====data01=$data01 + goto loop1 +endi + + +print step2============= + +sql create database test1 vgroups 4; +sql use test1; +sql create table st(ts timestamp, a int, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); +sql create table streamt3(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); +sql create stream streams3 trigger at_once ignore expired 1 ignore update 0 WATERMARK 1000s into streamt3 tags(ta) as select _wstart, count(*) c1, max(b) from st partition by tbname ta COUNT_WINDOW(2); + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,3,1.0); + +sleep 500 + +sql insert into t1 values(1648791210001,4,2,3,4.1); + +sql insert into t1 values(1648791220000,2,2,3,1.1); +sql insert into t1 values(1648791220001,2,2,3,1.1); + +sql insert into t1 values(1648791230000,3,2,3,2.1); +sql insert into t1 values(1648791230001,3,2,3,2.1); + +sql insert into t1 values(1648791240000,4,2,3,3.1); +sql insert into t1 values(1648791240001,4,2,3,3.1); + +sql insert into t1 values(1648791250000,4,2,3,3.1); +sql insert into t1 values(1648791250001,4,2,3,3.1); + + + +$loop_count = 0 + +loop3: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt3 +sql select * from streamt3; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 + +if $rows != 5 then + print =====rows=$rows + goto loop3 +endi + +if $data01 != 2 then + print =====data01=$data01 + goto loop3 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/stream/streamPrimaryKey3.sim b/tests/script/tsim/stream/streamPrimaryKey3.sim new file mode 100644 index 0000000000..73038b6732 --- /dev/null +++ b/tests/script/tsim/stream/streamPrimaryKey3.sim @@ -0,0 +1,368 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c debugflag -v 135 +system sh/cfg.sh -n dnode1 -c streamBufferSize -v 10 +system sh/exec.sh -n dnode1 -s start + +sleep 500 + +sql connect + +print step1============= + +sql create database test vgroups 4; +sql use test; +sql create table st(ts timestamp, a int primary key, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); + +sql create stream streams1 trigger at_once ignore expired 0 ignore update 0 into streamt1(ts, a primary key, b) as select ts, a, b from t1 partition by b; + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,3,1.0); +sql insert into t1 values(1648791210000,2,4,3,1.0); + +sleep 500 + +sql insert into t1 values(1648791210000,1,3,3,1.0); + + +$loop_count = 0 + +loop0: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt1 order by 1,2 +sql select * from streamt1 order by 1,2; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 + +if $rows != 2 then + print =====rows=$rows + goto loop0 +endi + +if $data01 != 1 then + print =====data01=$data01 + goto loop0 +endi + +if $data02 != 3 then + print =====data02=$data02 + goto loop0 +endi + +if $data11 != 2 then + print =====data11=$data11 + goto loop0 +endi + +if $data12 != 4 then + print =====data12=$data12 + goto loop0 +endi + +print step2============= + +sql create database test1 vgroups 4; +sql use test1; +sql create table st(ts timestamp, a int primary key, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); + +sql create stream streams2 trigger at_once ignore expired 0 ignore update 0 into streamt2(ts, a primary key, b) as select _wstart, max(b), count(*) from t1 partition by b interval(10s); + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,1,1.0); +sql insert into t1 values(1648791210000,2,4,2,1.0); + +sleep 500 + +sql insert into t1 values(1648791210000,1,3,3,1.0); + + +$loop_count = 0 + +loop1: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt2 order by 1,2 +sql select * from streamt2 order by 1,2; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 + +if $rows != 2 then + print =====rows=$rows + goto loop1 +endi + +if $data01 != 3 then + print =====data01=$data01 + goto loop1 +endi + +if $data02 != 1 then + print =====data02=$data02 + goto loop1 +endi + +if $data11 != 4 then + print =====data11=$data11 + goto loop1 +endi + +if $data12 != 1 then + print =====data12=$data12 + goto loop1 +endi + +sql insert into t1 values(1648791210000,3,5,3,1.0); + +sql insert into t1 values(1648791210001,1,3,3,1.0); +sql insert into t1 values(1648791210001,2,4,3,1.0); +sql insert into t1 values(1648791210001,3,5,3,1.0); + +$loop_count = 0 + +loop2: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt2 order by 1,2 +sql select * from streamt2 order by 1,2; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 + +if $rows != 3 then + print =====rows=$rows + goto loop2 +endi + +if $data02 != 2 then + print =====data02=$data02 + goto loop2 +endi + +if $data12 != 2 then + print =====data12=$data12 + goto loop2 +endi + +if $data22 != 2 then + print =====data22=$data22 + goto loop2 +endi + +print delete from t1 where ts = 1648791210000; +sql delete from t1 where ts = 1648791210000; + +$loop_count = 0 + +loop3: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt2 order by 1,2 +sql select * from streamt2 order by 1,2; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 + +if $rows != 3 then + print =====rows=$rows + goto loop3 +endi + +if $data02 != 1 then + print =====data02=$data02 + goto loop3 +endi + +if $data12 != 1 then + print =====data12=$data12 + goto loop3 +endi + +if $data22 != 1 then + print =====data22=$data22 + goto loop3 +endi + +print step3============= + +sql create database test2 vgroups 4; +sql use test2; +sql create table st(ts timestamp, a int primary key, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); + +sql create stream streams3 trigger at_once ignore expired 0 ignore update 0 into streamt3(ts, a primary key, b) as select _wstart, max(b), count(*) from t1 partition by b session(ts, 10s); + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,1,1.0); +sql insert into t1 values(1648791210000,2,4,2,1.0); + +sleep 500 + +sql insert into t1 values(1648791210000,1,3,3,1.0); + + +$loop_count = 0 + +loop6: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt3 order by 1,2 +sql select * from streamt3 order by 1,2; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 + +if $rows != 2 then + print =====rows=$rows + goto loop6 +endi + +if $data01 != 3 then + print =====data01=$data01 + goto loop6 +endi + +if $data02 != 1 then + print =====data02=$data02 + goto loop6 +endi + +if $data11 != 4 then + print =====data11=$data11 + goto loop6 +endi + +if $data12 != 1 then + print =====data12=$data12 + goto loop6 +endi + +sql insert into t1 values(1648791210000,3,5,3,1.0); + +sql insert into t1 values(1648791210001,1,3,3,1.0); +sql insert into t1 values(1648791210001,2,4,3,1.0); +sql insert into t1 values(1648791210001,3,5,3,1.0); + +$loop_count = 0 + +loop7: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt3 order by 1,2 +sql select * from streamt3 order by 1,2; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 + +if $rows != 3 then + print =====rows=$rows + goto loop7 +endi + +if $data02 != 2 then + print =====data02=$data02 + goto loop7 +endi + +if $data12 != 2 then + print =====data12=$data12 + goto loop7 +endi + +if $data22 != 2 then + print =====data22=$data22 + goto loop7 +endi + +print delete from t1 where ts = 1648791210000; +sql delete from t1 where ts = 1648791210000; + +$loop_count = 0 + +loop8: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt3 order by 1,2 +sql select * from streamt3 order by 1,2; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 + +if $rows != 3 then + print =====rows=$rows + goto loop8 +endi + +if $data02 != 1 then + print =====data02=$data02 + goto loop8 +endi + +if $data12 != 1 then + print =====data12=$data12 + goto loop8 +endi + +if $data22 != 1 then + print =====data22=$data22 + goto loop8 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/stream/udTableAndCol0.sim b/tests/script/tsim/stream/udTableAndCol0.sim new file mode 100644 index 0000000000..9c8a5aaaad --- /dev/null +++ b/tests/script/tsim/stream/udTableAndCol0.sim @@ -0,0 +1,111 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 + +print ===== step1 + +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print ===== step2 +print ===== table name + +sql create database test vgroups 4; +sql use test; + + +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql_error create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1(a, b, c, d) as select _wstart, count(*) c1, max(a) from st interval(10s); +sql_error create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2(a, b) as select _wstart, count(*) c1, max(a) from st interval(10s); + + +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3(a, b) as select count(*) c1, max(a) from st interval(10s); + +sleep 1000 + +sql desc streamt3; + +print $data00 +print $data10 +print $data20 +print $data30 +print $data40 + +if $rows != 4 then + return -1 +endi + +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4(a, b, c) as select _wstart, count(*) c1, max(a) from st interval(10s); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt5(a, b, c) as select _wstart, count(*) c1, max(a) from st partition by tbname interval(10s); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt6(a, b, c) tags(tbn varchar(60)) as select _wstart, count(*) c1, max(a) from st partition by tbname tbn interval(10s); + + + +sql create stream streams7 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt7(a, b primary key, c) tags(tbn varchar(60)) as select _wstart, count(*) c1, max(a) from st partition by tbname tbn interval(10s); +sql_error create stream streams8 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt8(a, b, c primary key) as select _wstart, count(*) c1, max(a) from st interval(10s); + +sql create stream streams9 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt9(a primary key, b) as select count(*) c1, max(a) from st interval(10s); + +sql_error create stream streams10 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt10(a, b primary key, c) as select count(*) c1, max(a), max(b) from st interval(10s); +sql_error create stream streams11 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt11(a, b , a) as select count(*) c1, max(a), max(b) from st interval(10s); +sql_error create stream streams12 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt12(a, b , c) tags(c varchar(60)) as select count(*) c1, max(a), max(b) from st partition by tbname c interval(10s); + +sql_error create stream streams13 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt13(a, b , c) tags(tc varchar(60)) as select count(*) c1, max(a) c1, max(b) from st partition by tbname tc interval(10s); + +sql_error create stream streams14 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt14 tags(tc varchar(60)) as select count(*) tc, max(a) c1, max(b) from st partition by tbname tc interval(10s); + +sql_error create stream streams15 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt15 tags(tc varchar(100) primary key) as select _wstart, count(*) c1, max(a) from st partition by tbname tc interval(10s); + + +sql create database test1 vgroups 4; +sql use test1; + + +sql create stable st(ts timestamp, a int primary key, b int, c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql_error create stream streams16 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt16 as select _wstart, count(*) c1, max(a) from st partition by tbname tc state_window(b); +sql_error create stream streams17 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt17 as select _wstart, count(*) c1, max(a) from st partition by tbname tc event_window start with a = 0 end with a = 9; +sql_error create stream streams18 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 watermark 10s into streamt18 as select _wstart, count(*) c1, max(a) from st partition by tbname tc count_window(2); + +print ===== step2 +print ===== scalar + +sql create database test2 vgroups 4; +sql use test2; + +sql create table t1 (ts timestamp, a int, b int); + +sql create table rst(ts timestamp, a int primary key, b int) tags(ta varchar(100)); +sql create table rct1 using rst tags("aa"); + +sql create table rst6(ts timestamp, a int primary key, b int) tags(ta varchar(100)); +sql create table rst7(ts timestamp, a int primary key, b int) tags(ta varchar(100)); + +sql create stream streams19 trigger at_once ignore expired 0 ignore update 0 into streamt19 as select ts,a, b from t1; + +sql create stream streams20 trigger at_once ignore expired 0 ignore update 0 into streamt20(ts, a primary key, b) as select ts,a, b from t1; +sql create stream streams21 trigger at_once ignore expired 0 ignore update 0 into rst as select ts,a, b from t1; + +sql_error create stream streams22 trigger at_once ignore expired 0 ignore update 0 into streamt22 as select ts,1, b from rct1; + +sql_error create stream streams23 trigger at_once ignore expired 0 ignore update 0 into streamt23 as select ts, a, b from rct1; + +sql create stream streams24 trigger at_once ignore expired 0 ignore update 0 into streamt24(ts, a primary key, b) as select ts, a, b from rct1; +sql create stream streams25 trigger at_once ignore expired 0 ignore update 0 into rst6 as select ts, a, b from rct1; + +sql_error create stream streams26 trigger at_once ignore expired 0 ignore update 0 into rst7 as select ts, 1,b from rct1; + +sql_error create stream streams27 trigger at_once ignore expired 0 ignore update 0 into streamt27(ts, a primary key, b) as select ts, 1,b from rct1; + + + + + +print ======over + +system sh/stop_dnodes.sh diff --git a/tests/script/tsim/stream/udTableAndTag1.sim b/tests/script/tsim/stream/udTableAndTag1.sim index e6427aab10..b109a4dbc9 100644 --- a/tests/script/tsim/stream/udTableAndTag1.sim +++ b/tests/script/tsim/stream/udTableAndTag1.sim @@ -339,6 +339,65 @@ if $data22 != t3 then goto loop8 endi +print ===== step6 + +sql create database test5 vgroups 4; +sql use test5; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stable streamt5(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create stream streams5 trigger at_once ignore expired 0 ignore update 0 into streamt5(ts,b,a) as select _wstart, count(*), 1000 c1 from t1 interval(10s); + +sleep 1000 + +sql insert into t1 values(1648791213000,1,2,3,1.0); +sql insert into t1 values(1648791223001,2,2,3,1.1); +sql insert into t1 values(1648791233002,3,2,3,2.1); +sql insert into t1 values(1648791243003,4,2,3,3.1); + +$loop_count = 0 +loop9: + +sleep 1000 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt5; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 + +if $rows != 4 then + print =====rows=$rows + goto loop9 +endi + +if $data01 != 1000 then + print =====data01=$data01 + goto loop9 +endi + +if $data02 != 1 then + print =====data02=$data02 + goto loop9 +endi + + +if $data31 != 1000 then + print =====data31=$data31 + goto loop9 +endi + +if $data32 != 1 then + print =====data32=$data32 + goto loop9 +endi + print ======over system sh/stop_dnodes.sh diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py index 63718417b4..c3d65482fc 100644 --- a/tests/system-test/0-others/information_schema.py +++ b/tests/system-test/0-others/information_schema.py @@ -50,10 +50,11 @@ class TDTestCase: self.tbnum = 20 self.rowNum = 10 self.tag_dict = { - 't0':'int' + 't0':'int', + 't1':f'nchar({self.nchar_length})' } self.tag_values = [ - f'1' + f'1', '""' ] self.binary_str = 'taosdata' self.nchar_str = '涛思数据' @@ -72,7 +73,7 @@ class TDTestCase: tdSql.execute(f'use {self.dbname}') tdSql.execute(self.setsql.set_create_stable_sql(self.stbname,self.column_dict,self.tag_dict)) for i in range(self.tbnum): - tdSql.execute(f"create table {self.stbname}_{i} using {self.stbname} tags({self.tag_values[0]})") + tdSql.execute(f"create table {self.stbname}_{i} using {self.stbname} tags({self.tag_values[0]}, {self.tag_values[1]})") self.insert_data(self.column_dict,f'{self.stbname}_{i}',self.rowNum) def count_check(self): tdSql.query('select count(*) from information_schema.ins_tables') @@ -313,6 +314,11 @@ class TDTestCase: tdSql.error('alter cluster "activeCode" ""') tdSql.execute('alter cluster "activeCode" "revoked"') + def test_query_ins_tags(self): + sql = f'select tag_name, tag_value from information_schema.ins_tags where table_name = "{self.stbname}_0"' + tdSql.query(sql) + tdSql.checkRows(2) + def run(self): self.prepare_data() self.count_check() @@ -322,6 +328,7 @@ class TDTestCase: self.ins_stable_check2() self.ins_dnodes_check() self.ins_grants_check() + self.test_query_ins_tags() def stop(self): diff --git a/tests/system-test/2-query/interp.py b/tests/system-test/2-query/interp.py index 86d010209d..81c5b66185 100644 --- a/tests/system-test/2-query/interp.py +++ b/tests/system-test/2-query/interp.py @@ -3390,8 +3390,6 @@ class TDTestCase: tdSql.execute(f"insert into {dbname}.{ctbname1} values ('2020-02-01 00:00:15', 15, 15, 15, 15, 15.0, 15.0, true, 'varchar', 'nchar')") tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)") - tdSql.error(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} range('2020-02-01 00:00:00', '2020-02-01 00:00:15') every(1s) fill(null)") - tdSql.error(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(null)") tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(null)") tdLog.printNoPrefix("======step 14: test interp ignore null values") diff --git a/tests/system-test/7-tmq/tmq_ts4563.py b/tests/system-test/7-tmq/tmq_ts4563.py index fc1cc259ce..13f510ffe6 100644 --- a/tests/system-test/7-tmq/tmq_ts4563.py +++ b/tests/system-test/7-tmq/tmq_ts4563.py @@ -29,9 +29,11 @@ class TDTestCase: tdSql.execute(f'use db_stmt') tdSql.query("select ts,k from st") - tdSql.checkRows(2) + tdSql.checkRows(self.expected_affected_rows) tdSql.execute(f'create topic t_unorder_data as select ts,k from st') + tdSql.execute(f'create topic t_unorder_data_none as select i,k from st') + consumer_dict = { "group.id": "g1", "td.connect.user": "root", @@ -41,7 +43,7 @@ class TDTestCase: consumer = Consumer(consumer_dict) try: - consumer.subscribe(["t_unorder_data"]) + consumer.subscribe(["t_unorder_data", "t_unorder_data_none"]) except TmqError: tdLog.exit(f"subscribe error") @@ -51,18 +53,15 @@ class TDTestCase: res = consumer.poll(1) print(res) if not res: - if cnt == 0: + if cnt == 0 or cnt != 2*self.expected_affected_rows: tdLog.exit("consume error") break val = res.value() if val is None: continue for block in val: + print(block.fetchall(),len(block.fetchall())) cnt += len(block.fetchall()) - - if cnt != 2: - tdLog.exit("consume error") - finally: consumer.close() @@ -110,20 +109,32 @@ class TDTestCase: params = new_multi_binds(2) params[0].timestamp((1626861392589, 1626861392590)) params[1].int([3, None]) - + # print(type(stmt)) tdLog.debug("bind_param_batch start") stmt.bind_param_batch(params) + tdLog.debug("bind_param_batch end") stmt.execute() tdLog.debug("execute end") + conn.execute("flush database %s" % dbname) + + params1 = new_multi_binds(2) + params1[0].timestamp((1626861392587,1626861392586)) + params1[1].int([None,3]) + stmt.bind_param_batch(params1) + stmt.execute() + end = datetime.now() print("elapsed time: ", end - start) - assert stmt.affected_rows == 2 + print(stmt.affected_rows) + self.expected_affected_rows = 4 + if stmt.affected_rows != self.expected_affected_rows : + tdLog.exit("affected_rows error") tdLog.debug("close start") stmt.close() - + # conn.execute("drop database if exists %s" % dbname) conn.close() diff --git a/tests/system-test/8-stream/stream_basic.py b/tests/system-test/8-stream/stream_basic.py index 3ebc255114..ff16bee787 100644 --- a/tests/system-test/8-stream/stream_basic.py +++ b/tests/system-test/8-stream/stream_basic.py @@ -78,14 +78,55 @@ class TDTestCase: tdLog.info(cmd) os.system(cmd) + def case1(self): + + tdSql.execute(f'create database if not exists d1 vgroups 1') + tdSql.execute(f'use d1') + tdSql.execute(f'create table st(ts timestamp, i int) tags(t int)') + tdSql.execute(f'insert into t1 using st tags(1) values(now, 1) (now+1s, 2)') + tdSql.execute(f'insert into t2 using st tags(2) values(now, 1) (now+1s, 2)') + tdSql.execute(f'insert into t3 using st tags(3) values(now, 1) (now+1s, 2)') + + tdSql.execute("create stream stream1 fill_history 1 into sta subtable(concat('new-', tname)) AS SELECT " + "_wstart, count(*), avg(i) FROM st PARTITION BY tbname tname INTERVAL(1m)", show=True) + + tdSql.execute("create stream stream2 fill_history 1 into stb subtable(concat('new-', tname)) AS SELECT " + "_wstart, count(*), avg(i) FROM st PARTITION BY tbname tname INTERVAL(1m)", show=True) + + time.sleep(2) + tdSql.query("select * from sta") + tdSql.checkRows(3) + tdSql.query("select tbname from sta order by tbname") + if not tdSql.getData(0, 0).startswith('new-t1_1.d1.sta_'): + tdLog.exit("error1") + + if not tdSql.getData(1, 0).startswith('new-t2_1.d1.sta_'): + tdLog.exit("error2") + + if not tdSql.getData(2, 0).startswith('new-t3_1.d1.sta_'): + tdLog.exit("error3") + + tdSql.query("select * from stb") + tdSql.checkRows(3) + tdSql.query("select tbname from stb order by tbname") + if not tdSql.getData(0, 0).startswith('new-t1_1.d1.stb_'): + tdLog.exit("error4") + + if not tdSql.getData(1, 0).startswith('new-t2_1.d1.stb_'): + tdLog.exit("error5") + + if not tdSql.getData(2, 0).startswith('new-t3_1.d1.stb_'): + tdLog.exit("error6") + # run def run(self): + self.case1() # gen data random.seed(int(time.time())) self.taosBenchmark(" -d db -t 2 -v 2 -n 1000000 -y") # create stream tdSql.execute("use db") - tdSql.execute("create stream stream1 fill_history 1 into sta as select count(*) as cnt from meters interval(10a);",show=True) + tdSql.execute("create stream stream3 fill_history 1 into sta as select count(*) as cnt from meters interval(10a);",show=True) sql = "select count(*) from sta" # loop wait max 60s to check count is ok tdLog.info("loop wait result ...") diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index a1c5405253..188abb4b58 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -18,7 +18,7 @@ IF (TD_WEBSOCKET) COMMAND git clean -f -d BUILD_COMMAND COMMAND cargo update - COMMAND RUSTFLAGS=-Ctarget-feature=-crt-static cargo build --release -p taos-ws-sys --features native-tls + COMMAND RUSTFLAGS=-Ctarget-feature=-crt-static cargo build --release -p taos-ws-sys --features rustls INSTALL_COMMAND COMMAND cp target/release/${websocket_lib_file} ${CMAKE_BINARY_DIR}/build/lib COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/build/include @@ -37,7 +37,7 @@ IF (TD_WEBSOCKET) COMMAND git clean -f -d BUILD_COMMAND COMMAND cargo update - COMMAND cargo build --release -p taos-ws-sys --features native-tls-vendored + COMMAND cargo build --release -p taos-ws-sys --features rustls INSTALL_COMMAND COMMAND cp target/release/taosws.dll ${CMAKE_BINARY_DIR}/build/lib COMMAND cp target/release/taosws.dll.lib ${CMAKE_BINARY_DIR}/build/lib/taosws.lib @@ -57,7 +57,7 @@ IF (TD_WEBSOCKET) COMMAND git clean -f -d BUILD_COMMAND COMMAND cargo update - COMMAND cargo build --release -p taos-ws-sys --features native-tls-vendored + COMMAND cargo build --release -p taos-ws-sys --features rustls INSTALL_COMMAND COMMAND cp target/release/${websocket_lib_file} ${CMAKE_BINARY_DIR}/build/lib COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/build/include diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index 01619decc5..9e04cfb75b 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -1841,12 +1841,119 @@ int sml_td18789_Test() { return code; } +int sml_td29373_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "drop database if exists td29373"); + taos_free_result(pRes); + + pRes = taos_query(taos, "create database if not exists td29373"); + taos_free_result(pRes); + + pRes = taos_query(taos, "use td29373"); + taos_free_result(pRes); + + pRes = taos_query(taos, "create table pktable (ts timestamp, f1 int primary key, f2 binary(10)) tags (t1 int)"); + taos_free_result(pRes); + + // case 1 + const char *sql[] = { + "pktable,t1=1 f1=283i32,f2=b\"hello\" 1632299372000", + "pktable,t1=2 f1=232i32,f2=b\"he3llo\" 1632299373000", + }; + + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + int code = taos_errno(pRes); + printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); + ASSERT(code == TSDB_CODE_SML_NOT_SUPPORT_PK); + taos_free_result(pRes); + + // case 2 + const char *sql1[] = { + "pktable,t1=2 f2=b\"he3llo\",f1=232i32 1632299373000", + "pktable,t1=1 f1=283i32,f2=b\"hello\" 1632299372000" + }; + + pRes = taos_schemaless_insert(taos, (char **)sql1, sizeof(sql1) / sizeof(sql1[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + code = taos_errno(pRes); + printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); + ASSERT(code == TSDB_CODE_SML_NOT_SUPPORT_PK); + taos_free_result(pRes); + + // case 3 + pRes = taos_query(taos, "create table pktablejson (ts timestamp, f1 int primary key, f2 binary(10)) tags (`host` varchar(8), dc varchar(8))"); + taos_free_result(pRes); + const char *sql2[] = { "" + "[\n" + " {\n" + " \"metric\": \"pktablejson\",\n" + " \"timestamp\": 1346846400001,\n" + " \"value\": 18,\n" + " \"tags\": {\n" + " \"host\": \"web01\",\n" + " \"dc\": \"lga\"\n" + " }\n" + " },\n" + " {\n" + " \"metric\": \"pktablejson\",\n" + " \"timestamp\": 1346846400002,\n" + " \"value\": 9,\n" + " \"tags\": {\n" + " \"host\": \"web02\",\n" + " \"dc\": \"lga\"\n" + " }\n" + " }\n" + "]" + }; + char *sql3[1] = {0}; + for (int i = 0; i < 1; i++) { + sql3[i] = taosMemoryCalloc(1, 1024); + strncpy(sql3[i], sql2[i], 1023); + } + + pRes = taos_schemaless_insert(taos, (char **)sql3, sizeof(sql3) / sizeof(sql3[0]), TSDB_SML_JSON_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + code = taos_errno(pRes); + printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); + ASSERT(code == TSDB_CODE_SML_NOT_SUPPORT_PK); + taos_free_result(pRes); + + for (int i = 0; i < 1; i++) { + taosMemoryFree(sql3[i]); + } + + // case 4 + const char *sql4[] = { + "pktablejson 1479496100 1.3E0 host=web01 dc=eth0", + "pktablejson 1479496100 1.2E0 dc=web01 host=eth0", + }; + + pRes = taos_schemaless_insert(taos, (char **)sql4, sizeof(sql4) / sizeof(sql4[0]), TSDB_SML_TELNET_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + code = taos_errno(pRes); + printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); + ASSERT(code == TSDB_CODE_SML_NOT_SUPPORT_PK); + taos_free_result(pRes); + + taos_close(taos); + + return code; +} + int main(int argc, char *argv[]) { if (argc == 2) { taos_options(TSDB_OPTION_CONFIGDIR, argv[1]); } int ret = 0; + ret = sml_td29373_Test(); + ASSERT(ret); ret = sml_td24559_Test(); ASSERT(!ret); ret = sml_td18789_Test();