diff --git a/README.md b/README.md index 05c1c075f0..885f91cb4e 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,12 @@ [![Build status](https://ci.appveyor.com/api/projects/status/kf3pwh2or5afsgl9/branch/master?svg=true)](https://ci.appveyor.com/project/sangshuduo/tdengine-2n8ge/branch/master) [![Coverage Status](https://coveralls.io/repos/github/taosdata/TDengine/badge.svg?branch=develop)](https://coveralls.io/github/taosdata/TDengine?branch=develop) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4201/badge)](https://bestpractices.coreinfrastructure.org/projects/4201) +
+[![Twitter Follow](https://img.shields.io/twitter/follow/tdenginedb?label=TDengine&style=social)](https://twitter.com/tdenginedb) +[![YouTube Channel](https://img.shields.io/badge/Subscribe_@tdengine--white?logo=youtube&style=social)](https://www.youtube.com/@tdengine) +[![Discord Community](https://img.shields.io/badge/Join_Discord--white?logo=discord&style=social)](https://discord.com/invite/VZdSuUg4pS) +[![LinkedIn](https://img.shields.io/badge/Follow_LinkedIn--white?logo=linkedin&style=social)](https://www.linkedin.com/company/tdengine) +[![StackOverflow](https://img.shields.io/badge/Ask_StackOverflow--white?logo=stackoverflow&style=social&logoColor=orange)](https://stackoverflow.com/questions/tagged/tdengine) English | [简体中文](README-CN.md) | [TDengine Cloud](https://cloud.tdengine.com) | [Learn more about TSDB](https://tdengine.com/tsdb/) diff --git a/cmake/cmake.platform b/cmake/cmake.platform index a4bfcaf609..61eb66f675 100644 --- a/cmake/cmake.platform +++ b/cmake/cmake.platform @@ -37,6 +37,21 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin SET(TD_LINUX_32 TRUE) ENDIF () + EXECUTE_PROCESS(COMMAND chmod 777 ${CMAKE_CURRENT_LIST_DIR}/../packaging/tools/get_os.sh) + EXECUTE_PROCESS(COMMAND readlink /bin/sh OUTPUT_VARIABLE SHELL_LINK) + MESSAGE(STATUS "The shell is: " ${SHELL_LINK}) + + IF (${SHELL_LINK} MATCHES "dash") + EXECUTE_PROCESS(COMMAND ${CMAKE_CURRENT_LIST_DIR}/../packaging/tools/get_os.sh "" OUTPUT_VARIABLE TD_OS_INFO) + ELSE () + EXECUTE_PROCESS(COMMAND sh ${CMAKE_CURRENT_LIST_DIR}/../packaging/tools/get_os.sh "" OUTPUT_VARIABLE TD_OS_INFO) + ENDIF () + MESSAGE(STATUS "The current OS is " ${TD_OS_INFO}) + IF (${TD_OS_INFO} MATCHES "Alpine") + SET(TD_ALPINE TRUE) + ADD_DEFINITIONS("-D_ALPINE") + ENDIF () + ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") SET(TD_DARWIN TRUE) diff --git a/cmake/cmake.version b/cmake/cmake.version index a4c783b6c8..a30618157b 100644 --- a/cmake/cmake.version +++ b/cmake/cmake.version @@ -2,7 +2,7 @@ IF (DEFINED VERNUMBER) SET(TD_VER_NUMBER ${VERNUMBER}) ELSE () - SET(TD_VER_NUMBER "3.0.2.4") + SET(TD_VER_NUMBER "3.0.2.5") ENDIF () IF (DEFINED VERCOMPATIBLE) diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in index d156057459..8df50af03c 100644 --- a/cmake/taosadapter_CMakeLists.txt.in +++ b/cmake/taosadapter_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taosadapter ExternalProject_Add(taosadapter GIT_REPOSITORY https://github.com/taosdata/taosadapter.git - GIT_TAG 3e08996 + GIT_TAG db6c843 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter" BINARY_DIR "" #BUILD_IN_SOURCE TRUE diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index 37dd448b87..05191138e5 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG 6a2d9fc + GIT_TAG 22627d7 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE diff --git a/cmake/taosws_CMakeLists.txt.in b/cmake/taosws_CMakeLists.txt.in index e79c6b799f..b013d45911 100644 --- a/cmake/taosws_CMakeLists.txt.in +++ b/cmake/taosws_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taosws-rs ExternalProject_Add(taosws-rs GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git - GIT_TAG f406d51 + GIT_TAG main SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs" BINARY_DIR "" #BUILD_IN_SOURCE TRUE diff --git a/docs/en/07-develop/03-insert-data/_py_kafka.mdx b/docs/en/07-develop/03-insert-data/_py_kafka.mdx index dc43a0d415..c71821dad1 100644 --- a/docs/en/07-develop/03-insert-data/_py_kafka.mdx +++ b/docs/en/07-develop/03-insert-data/_py_kafka.mdx @@ -53,8 +53,69 @@ for p in ps: In addition to python's built-in multithreading and multiprocessing library, we can also use the third-party library gunicorn. -### Examples +### examples + +
+kafka_example_perform + +`kafka_example_perform` is the entry point of the examples. ```py -{{#include docs/examples/python/kafka_example.py}} +{{#include docs/examples/python/kafka_example_perform.py}} ``` +
+ +
+kafka_example_common + +`kafka_example_common` is the common code of the examples. + +```py +{{#include docs/examples/python/kafka_example_common.py}} +``` +
+ +
+kafka_example_producer + +`kafka_example_producer` is `producer`, which is responsible for generating test data and sending it to kafka. + +```py +{{#include docs/examples/python/kafka_example_producer.py}} +``` +
+ +
+kafka_example_consumer + +`kafka_example_consumer` is `consumer`,which is responsible for consuming data from kafka and writing it to TDengine. + +```py +{{#include docs/examples/python/kafka_example_consumer.py}} +``` +
+ +### execute Python examples + +
+ execute Python examples + + 1. install and start up `kafka` + 2. install python3 and pip + 3. install `taospy` by pip + 4. install `kafka-python` by pip + 5. execute this example + + The entry point of this example is `kafka_example_perform.py`. For more information about usage, please use `--help` command. + + ``` + python3 kafka_example_perform.py --help + ``` + + For example, the following command is creating 100 sub-table and inserting 20000 data for each table and the kafka max poll is 100 and 1 thread and 1 process per thread. + + ``` + python3 kafka_example_perform.py -table-count=100 -table-items=20000 -max-poll=100 -threads=1 -processes=1 + ``` + +
diff --git a/docs/en/12-taos-sql/06-select.md b/docs/en/12-taos-sql/06-select.md index 183ab58726..3099e3a541 100644 --- a/docs/en/12-taos-sql/06-select.md +++ b/docs/en/12-taos-sql/06-select.md @@ -13,6 +13,7 @@ SELECT [DISTINCT] select_list from_clause [WHERE condition] [partition_by_clause] + [interp_clause] [window_clause] [group_by_clause] [order_by_clasue] @@ -53,8 +54,11 @@ window_clause: { | STATE_WINDOW(col) | INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [WATERMARK(watermark_val)] [FILL(fill_mod_and_val)] +interp_clause: + RANGE(ts_val, ts_val), EVERY(every_val), FILL(fill_mod_and_val) + partition_by_clause: - PARTITION BY expr [, expr] ... + PARTITION BY expr [, expr] ... group_by_clause: GROUP BY expr [, expr] ... HAVING condition diff --git a/docs/en/12-taos-sql/10-function.md b/docs/en/12-taos-sql/10-function.md index b2d44f1a1d..d2aca5c361 100644 --- a/docs/en/12-taos-sql/10-function.md +++ b/docs/en/12-taos-sql/10-function.md @@ -873,9 +873,9 @@ INTERP(expr) - `INTERP` is used to get the value that matches the specified time slice from a column. If no such value exists an interpolation value will be returned based on `FILL` parameter. - The input data of `INTERP` is the value of the specified column and a `where` clause can be used to filter the original data. If no `where` condition is specified then all original data is the input. - `INTERP` must be used along with `RANGE`, `EVERY`, `FILL` keywords. -- The output time range of `INTERP` is specified by `RANGE(timestamp1,timestamp2)` parameter, with timestamp1<=timestamp2. timestamp1 is the starting point of the output time range and must be specified. timestamp2 is the ending point of the output time range and must be specified. -- The number of rows in the result set of `INTERP` is determined by the parameter `EVERY`. Starting from timestamp1, one interpolation is performed for every time interval specified `EVERY` parameter. The parameter `EVERY` must be an integer, with no quotes, with a time unit of: b(nanosecond), u(microsecond), a(millisecond)), s(second), m(minute), h(hour), d(day), or w(week). For example, `EVERY(500a)` will interpolate every 500 milliseconds. -- Interpolation is performed based on `FILL` parameter. +- The output time range of `INTERP` is specified by `RANGE(timestamp1,timestamp2)` parameter, with timestamp1 <= timestamp2. timestamp1 is the starting point of the output time range and must be specified. timestamp2 is the ending point of the output time range and must be specified. +- The number of rows in the result set of `INTERP` is determined by the parameter `EVERY(time_unit)`. Starting from timestamp1, one interpolation is performed for every time interval specified `time_unit` parameter. The parameter `time_unit` must be an integer, with no quotes, with a time unit of: a(millisecond)), s(second), m(minute), h(hour), d(day), or w(week). For example, `EVERY(500a)` will interpolate every 500 milliseconds. +- Interpolation is performed based on `FILL` parameter. For more information about FILL clause, see [FILL Clause](../distinguished/#fill-clause). - `INTERP` can only be used to interpolate in single timeline. So it must be used with `partition by tbname` when it's used on a STable. - Pseudocolumn `_irowts` can be used along with `INTERP` to return the timestamps associated with interpolation points(support after version 3.0.1.4). - Pseudocolumn `_isfilled` can be used along with `INTERP` to indicate whether the results are original records or data points generated by interpolation algorithm(support after version 3.0.2.3). diff --git a/docs/en/14-reference/07-tdinsight/assets/TDinsight-8-taosadapter.webp b/docs/en/14-reference/07-tdinsight/assets/TDinsight-8-taosadapter.webp index 942130d4fa..a90477880f 100644 Binary files a/docs/en/14-reference/07-tdinsight/assets/TDinsight-8-taosadapter.webp and b/docs/en/14-reference/07-tdinsight/assets/TDinsight-8-taosadapter.webp differ diff --git a/docs/en/14-reference/07-tdinsight/index.md b/docs/en/14-reference/07-tdinsight/index.md index 1c58dd6a76..652d5ded0b 100644 --- a/docs/en/14-reference/07-tdinsight/index.md +++ b/docs/en/14-reference/07-tdinsight/index.md @@ -326,11 +326,12 @@ Currently, only the number of logins per minute is reported. Support monitoring taosAdapter request statistics and status details. Includes. -1. **http_request_inflight**: number of real-time requests. -2. **http_request_total**: number of total requests. -3. **http_request_fail**: number of failed requets. -4. **CPU Used**: CPU usage of taosAdapter. -5. **Memory Used**: Memory usage of taosAdapter. +1. **Http Request Total**: number of total requests. +2. **Http Request Fail**: number of failed requests. +3. **CPU Used**: CPU usage of taosAdapter. +4. **Memory Used**: Memory usage of taosAdapter. +5. **Http Request Inflight**: number of real-time requests. +6. **Http Status Code**: taosAdapter http status code. ## Upgrade diff --git a/docs/en/20-third-party/01-grafana.mdx b/docs/en/20-third-party/01-grafana.mdx index b33e1c1199..5a2942b144 100644 --- a/docs/en/20-third-party/01-grafana.mdx +++ b/docs/en/20-third-party/01-grafana.mdx @@ -156,13 +156,13 @@ You can setup a zero-configuration stack for TDengine + Grafana by [docker-compo services: tdengine: - image: tdengine/tdengine:2.6.0.2 + image: tdengine/tdengine:3.0.2.4 environment: TAOS_FQDN: tdengine volumes: - tdengine-data:/var/lib/taos/ grafana: - image: grafana/grafana:8.5.6 + image: grafana/grafana:9.3.6 volumes: - ./tdengine.yml/:/etc/grafana/provisioning/tdengine.yml - grafana-data:/var/lib/grafana @@ -197,11 +197,18 @@ As shown above, select the `TDengine` data source in the `Query` and enter the c - INPUT SQL: Enter the desired query (the results being two columns and multiple rows), such as `select _wstart, avg(mem_system) from log.dnodes_info where ts >= $from and ts < $to interval($interval)`. In this statement, $from, $to, and $interval are variables that Grafana replaces with the query time range and interval. In addition to the built-in variables, custom template variables are also supported. - ALIAS BY: This allows you to set the current query alias. - GENERATE SQL: Clicking this button will automatically replace the corresponding variables and generate the final executed statement. +- Group by column name(s): `group by` or `partition by` columns name split by comma. By setting `Group by column name(s)`, it can show multi-dimension data if Sql is `group by` or `partition by`. Such as, it can show data by `dnode_ep` if sql is `select _wstart as ts, avg(mem_system), dnode_ep from log.dnodes_info where ts>=$from and ts<=$to partition by dnode_ep interval($interval)` and `Group by column name(s)` is `dnode_ep`. +- Format to: format legend for `group by` or `partition by`. Such as it can display series data by `dnode_ep` if sql is `select _wstart as ts, avg(mem_system), dnode_ep from log.dnodes_info where ts>=$from and ts<=$to partition by dnode_ep interval($interval)` and `Group by column name(s)` is `dnode_ep` and `Format to` is `mem_system_{{dnode_ep}}`. Follow the default prompt to query the average system memory usage for the specified interval on the server where the current TDengine deployment is located as follows. ![TDengine Database TDinsight plugin create dashboard 2](./grafana/create_dashboard2.webp) +查询每台 TDengine 服务器指定间隔系统内存平均使用量如下. +The example to query the average system memory usage for the specified interval on each server as follows. + +![TDengine Database TDinsight plugin create dashboard 2](./grafana/create_dashboard3.webp) + > For more information on how to use Grafana to create the appropriate monitoring interface and for more details on using Grafana, refer to the official Grafana [documentation](https://grafana.com/docs/). ### Importing the Dashboard diff --git a/docs/en/20-third-party/grafana/create_dashboard1.webp b/docs/en/20-third-party/grafana/create_dashboard1.webp index 55eb388833..df41d66d50 100644 Binary files a/docs/en/20-third-party/grafana/create_dashboard1.webp and b/docs/en/20-third-party/grafana/create_dashboard1.webp differ diff --git a/docs/en/20-third-party/grafana/create_dashboard2.webp b/docs/en/20-third-party/grafana/create_dashboard2.webp index bb40e40718..ba50f52996 100644 Binary files a/docs/en/20-third-party/grafana/create_dashboard2.webp and b/docs/en/20-third-party/grafana/create_dashboard2.webp differ diff --git a/docs/en/20-third-party/grafana/create_dashboard3.webp b/docs/en/20-third-party/grafana/create_dashboard3.webp new file mode 100644 index 0000000000..84f387f87b Binary files /dev/null and b/docs/en/20-third-party/grafana/create_dashboard3.webp differ diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md index a6a28e04c4..0c5ccf3aef 100644 --- a/docs/en/28-releases/01-tdengine.md +++ b/docs/en/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ For TDengine 2.x installation packages by version, please visit [here](https://w import Release from "/components/ReleaseV3"; +## 3.0.2.5 + + + ## 3.0.2.4 diff --git a/docs/en/28-releases/02-tools.md b/docs/en/28-releases/02-tools.md index 3c1dc32f8d..29dd605c8c 100644 --- a/docs/en/28-releases/02-tools.md +++ b/docs/en/28-releases/02-tools.md @@ -10,6 +10,10 @@ For other historical version installers, please visit [here](https://www.taosdat import Release from "/components/ReleaseV3"; +## 2.4.3 + + + ## 2.4.2 diff --git a/docs/examples/python/kafka_example.py b/docs/examples/python/kafka_example.py deleted file mode 100644 index 5b81706ef7..0000000000 --- a/docs/examples/python/kafka_example.py +++ /dev/null @@ -1,241 +0,0 @@ -#! encoding = utf-8 -import json -import time -from json import JSONDecodeError -from typing import Callable -import logging -from concurrent.futures import ThreadPoolExecutor, Future - -import taos -from kafka import KafkaConsumer -from kafka.consumer.fetcher import ConsumerRecord - - -class Consumer(object): - DEFAULT_CONFIGS = { - 'kafka_brokers': 'localhost:9092', - 'kafka_topic': 'python_kafka', - 'kafka_group_id': 'taos', - 'taos_host': 'localhost', - 'taos_user': 'root', - 'taos_password': 'taosdata', - 'taos_database': 'power', - 'taos_port': 6030, - 'timezone': None, - 'clean_after_testing': False, - 'bath_consume': True, - 'batch_size': 1000, - 'async_model': True, - 'workers': 10, - 'testing': False - } - - LOCATIONS = ['California.SanFrancisco', 'California.LosAngles', 'California.SanDiego', 'California.SanJose', - 'California.PaloAlto', 'California.Campbell', 'California.MountainView', 'California.Sunnyvale', - 'California.SantaClara', 'California.Cupertino'] - - CREATE_DATABASE_SQL = 'create database if not exists {} keep 365 duration 10 buffer 16 wal_level 1' - USE_DATABASE_SQL = 'use {}' - DROP_TABLE_SQL = 'drop table if exists meters' - DROP_DATABASE_SQL = 'drop database if exists {}' - CREATE_STABLE_SQL = 'create stable meters (ts timestamp, current float, voltage int, phase float) ' \ - 'tags (location binary(64), groupId int)' - CREATE_TABLE_SQL = 'create table if not exists {} using meters tags (\'{}\', {})' - INSERT_SQL_HEADER = "insert into " - INSERT_PART_SQL = 'power.{} values (\'{}\', {}, {}, {})' - - def __init__(self, **configs): - self.config: dict = self.DEFAULT_CONFIGS - self.config.update(configs) - if not self.config.get('testing'): - self.consumer = KafkaConsumer( - self.config.get('kafka_topic'), # topic - bootstrap_servers=self.config.get('kafka_brokers'), - group_id=self.config.get('kafka_group_id'), - ) - self.taos = taos.connect( - host=self.config.get('taos_host'), - user=self.config.get('taos_user'), - password=self.config.get('taos_password'), - port=self.config.get('taos_port'), - timezone=self.config.get('timezone'), - ) - if self.config.get('async_model'): - self.pool = ThreadPoolExecutor(max_workers=self.config.get('workers')) - self.tasks = [] - # tags and table mapping # key: {location}_{groupId} value: - self.tag_table_mapping = {} - i = 0 - for location in self.LOCATIONS: - for j in range(1, 11): - table_name = 'd{}'.format(i) - self._cache_table(location=location, group_id=j, table_name=table_name) - i += 1 - - def init_env(self): - # create database and table - self.taos.execute(self.DROP_DATABASE_SQL.format(self.config.get('taos_database'))) - self.taos.execute(self.CREATE_DATABASE_SQL.format(self.config.get('taos_database'))) - self.taos.execute(self.USE_DATABASE_SQL.format(self.config.get('taos_database'))) - self.taos.execute(self.DROP_TABLE_SQL) - self.taos.execute(self.CREATE_STABLE_SQL) - for tags, table_name in self.tag_table_mapping.items(): - location, group_id = _get_location_and_group(tags) - self.taos.execute(self.CREATE_TABLE_SQL.format(table_name, location, group_id)) - - def consume(self): - logging.warning('## start consumer topic-[%s]', self.config.get('kafka_topic')) - try: - if self.config.get('bath_consume'): - self._run_batch(self._to_taos_batch) - else: - self._run(self._to_taos) - except KeyboardInterrupt: - logging.warning("## caught keyboard interrupt, stopping") - finally: - self.stop() - - def stop(self): - # close consumer - if self.consumer is not None: - self.consumer.commit() - self.consumer.close() - - # multi thread - if self.config.get('async_model'): - for task in self.tasks: - while not task.done(): - pass - if self.pool is not None: - self.pool.shutdown() - - # clean data - if self.config.get('clean_after_testing'): - self.taos.execute(self.DROP_TABLE_SQL) - self.taos.execute(self.DROP_DATABASE_SQL.format(self.config.get('taos_database'))) - # close taos - if self.taos is not None: - self.taos.close() - - def _run(self, f): - for message in self.consumer: - if self.config.get('async_model'): - self.pool.submit(f(message)) - else: - f(message) - - def _run_batch(self, f): - while True: - messages = self.consumer.poll(timeout_ms=500, max_records=self.config.get('batch_size')) - if messages: - if self.config.get('async_model'): - self.pool.submit(f, messages.values()) - else: - f(list(messages.values())) - if not messages: - time.sleep(0.1) - - def _to_taos(self, message: ConsumerRecord) -> bool: - sql = self.INSERT_SQL_HEADER + self._build_sql(message.value) - if len(sql) == 0: # decode error, skip - return True - logging.info('## insert sql %s', sql) - return self.taos.execute(sql=sql) == 1 - - def _to_taos_batch(self, messages): - sql = self._build_sql_batch(messages=messages) - if len(sql) == 0: # decode error, skip - return - self.taos.execute(sql=sql) - - def _build_sql(self, msg_value: str) -> str: - try: - data = json.loads(msg_value) - except JSONDecodeError as e: - logging.error('## decode message [%s] error ', msg_value, e) - return '' - location = data.get('location') - group_id = data.get('groupId') - ts = data.get('ts') - current = data.get('current') - voltage = data.get('voltage') - phase = data.get('phase') - - table_name = self._get_table_name(location=location, group_id=group_id) - return self.INSERT_PART_SQL.format(table_name, ts, current, voltage, phase) - - def _build_sql_batch(self, messages) -> str: - sql_list = [] - for partition_messages in messages: - for message in partition_messages: - sql_list.append(self._build_sql(message.value)) - - return self.INSERT_SQL_HEADER + ' '.join(sql_list) - - def _cache_table(self, location: str, group_id: int, table_name: str): - self.tag_table_mapping[_tag_table_mapping_key(location=location, group_id=group_id)] = table_name - - def _get_table_name(self, location: str, group_id: int) -> str: - return self.tag_table_mapping.get(_tag_table_mapping_key(location=location, group_id=group_id)) - - -def _tag_table_mapping_key(location: str, group_id: int): - return '{}_{}'.format(location, group_id) - - -def _get_location_and_group(key: str) -> (str, int): - fields = key.split('_') - return fields[0], fields[1] - - -def test_to_taos(consumer: Consumer): - msg = { - 'location': 'California.SanFrancisco', - 'groupId': 1, - 'ts': '2022-12-06 15:13:38.643', - 'current': 3.41, - 'voltage': 105, - 'phase': 0.02027, - } - record = ConsumerRecord(checksum=None, headers=None, offset=1, key=None, value=json.dumps(msg), partition=1, - topic='test', serialized_key_size=None, serialized_header_size=None, - serialized_value_size=None, timestamp=time.time(), timestamp_type=None) - assert consumer._to_taos(message=record) - - -def test_to_taos_batch(consumer: Consumer): - records = [ - [ - ConsumerRecord(checksum=None, headers=None, offset=1, key=None, - value=json.dumps({'location': 'California.SanFrancisco', - 'groupId': 1, - 'ts': '2022-12-06 15:13:38.643', - 'current': 3.41, - 'voltage': 105, - 'phase': 0.02027, }), - partition=1, topic='test', serialized_key_size=None, serialized_header_size=None, - serialized_value_size=None, timestamp=time.time(), timestamp_type=None), - ConsumerRecord(checksum=None, headers=None, offset=1, key=None, - value=json.dumps({'location': 'California.LosAngles', - 'groupId': 2, - 'ts': '2022-12-06 15:13:39.643', - 'current': 3.41, - 'voltage': 102, - 'phase': 0.02027, }), - partition=1, topic='test', serialized_key_size=None, serialized_header_size=None, - serialized_value_size=None, timestamp=time.time(), timestamp_type=None), - ] - ] - - consumer._to_taos_batch(messages=records) - - -if __name__ == '__main__': - consumer = Consumer(async_model=True, testing=True) - # init env - consumer.init_env() - # consumer.consume() - # test build sql - # test build sql batch - test_to_taos(consumer) - test_to_taos_batch(consumer) diff --git a/docs/examples/python/kafka_example_common.py b/docs/examples/python/kafka_example_common.py new file mode 100644 index 0000000000..566748c94e --- /dev/null +++ b/docs/examples/python/kafka_example_common.py @@ -0,0 +1,65 @@ +#! encoding = utf-8 +import taos + +LOCATIONS = ['California.SanFrancisco', 'California.LosAngles', 'California.SanDiego', 'California.SanJose', + 'California.PaloAlto', 'California.Campbell', 'California.MountainView', 'California.Sunnyvale', + 'California.SantaClara', 'California.Cupertino'] + +CREATE_DATABASE_SQL = 'create database if not exists {} keep 365 duration 10 buffer 16 wal_level 1' +USE_DATABASE_SQL = 'use {}' +DROP_TABLE_SQL = 'drop table if exists meters' +DROP_DATABASE_SQL = 'drop database if exists {}' +CREATE_STABLE_SQL = 'create stable meters (ts timestamp, current float, voltage int, phase float) tags ' \ + '(location binary(64), groupId int)' +CREATE_TABLE_SQL = 'create table if not exists {} using meters tags (\'{}\', {})' + + +def create_database_and_tables(host, port, user, password, db, table_count): + tags_tables = _init_tags_table_names(table_count=table_count) + conn = taos.connect(host=host, port=port, user=user, password=password) + + conn.execute(DROP_DATABASE_SQL.format(db)) + conn.execute(CREATE_DATABASE_SQL.format(db)) + conn.execute(USE_DATABASE_SQL.format(db)) + conn.execute(DROP_TABLE_SQL) + conn.execute(CREATE_STABLE_SQL) + for tags in tags_tables: + location, group_id = _get_location_and_group(tags) + tables = tags_tables[tags] + for table_name in tables: + conn.execute(CREATE_TABLE_SQL.format(table_name, location, group_id)) + conn.close() + + +def clean(host, port, user, password, db): + conn = taos.connect(host=host, port=port, user=user, password=password) + conn.execute(DROP_DATABASE_SQL.format(db)) + conn.close() + + +def _init_tags_table_names(table_count): + tags_table_names = {} + group_id = 0 + for i in range(table_count): + table_name = 'd{}'.format(i) + location_idx = i % len(LOCATIONS) + location = LOCATIONS[location_idx] + if location_idx == 0: + group_id += 1 + if group_id > 10: + group_id -= 10 + key = _tag_table_mapping_key(location=location, group_id=group_id) + if key not in tags_table_names: + tags_table_names[key] = [] + tags_table_names[key].append(table_name) + + return tags_table_names + + +def _tag_table_mapping_key(location, group_id): + return '{}_{}'.format(location, group_id) + + +def _get_location_and_group(key): + fields = key.split('_') + return fields[0], fields[1] diff --git a/docs/examples/python/kafka_example_consumer.py b/docs/examples/python/kafka_example_consumer.py new file mode 100644 index 0000000000..e2d5cf535b --- /dev/null +++ b/docs/examples/python/kafka_example_consumer.py @@ -0,0 +1,231 @@ +#! encoding = utf-8 +import json +import logging +import time +from concurrent.futures import ThreadPoolExecutor, Future +from json import JSONDecodeError +from typing import Callable + +import taos +from kafka import KafkaConsumer +from kafka.consumer.fetcher import ConsumerRecord + +import kafka_example_common as common + + +class Consumer(object): + DEFAULT_CONFIGS = { + 'kafka_brokers': 'localhost:9092', # kafka broker + 'kafka_topic': 'tdengine_kafka_practices', + 'kafka_group_id': 'taos', + 'taos_host': 'localhost', # TDengine host + 'taos_port': 6030, # TDengine port + 'taos_user': 'root', # TDengine user name + 'taos_password': 'taosdata', # TDengine password + 'taos_database': 'power', # TDengine database + 'message_type': 'json', # message format, 'json' or 'line' + 'clean_after_testing': False, # if drop database after testing + 'max_poll': 1000, # poll size for batch mode + 'workers': 10, # thread count for multi-threading + 'testing': False + } + + INSERT_SQL_HEADER = "insert into " + INSERT_PART_SQL = '{} values (\'{}\', {}, {}, {})' + + def __init__(self, **configs): + self.config = self.DEFAULT_CONFIGS + self.config.update(configs) + + self.consumer = None + if not self.config.get('testing'): + self.consumer = KafkaConsumer( + self.config.get('kafka_topic'), + bootstrap_servers=self.config.get('kafka_brokers'), + group_id=self.config.get('kafka_group_id'), + ) + + self.conns = taos.connect( + host=self.config.get('taos_host'), + port=self.config.get('taos_port'), + user=self.config.get('taos_user'), + password=self.config.get('taos_password'), + db=self.config.get('taos_database'), + ) + if self.config.get('workers') > 1: + self.pool = ThreadPoolExecutor(max_workers=self.config.get('workers')) + self.tasks = [] + # tags and table mapping # key: {location}_{groupId} value: + + def consume(self): + """ + + consume data from kafka and deal. Base on `message_type`, `bath_consume`, `insert_by_table`, + there are several deal function. + :return: + """ + self.conns.execute(common.USE_DATABASE_SQL.format(self.config.get('taos_database'))) + try: + if self.config.get('message_type') == 'line': # line + self._run(self._line_to_taos) + if self.config.get('message_type') == 'json': # json + self._run(self._json_to_taos) + except KeyboardInterrupt: + logging.warning("## caught keyboard interrupt, stopping") + finally: + self.stop() + + def stop(self): + """ + + stop consuming + :return: + """ + # close consumer + if self.consumer is not None: + self.consumer.commit() + self.consumer.close() + + # multi thread + if self.config.get('workers') > 1: + if self.pool is not None: + self.pool.shutdown() + for task in self.tasks: + while not task.done(): + time.sleep(0.01) + + # clean data + if self.config.get('clean_after_testing'): + self.conns.execute(common.DROP_TABLE_SQL) + self.conns.execute(common.DROP_DATABASE_SQL.format(self.config.get('taos_database'))) + # close taos + if self.conns is not None: + self.conns.close() + + def _run(self, f): + """ + + run in batch consuming mode + :param f: + :return: + """ + i = 0 # just for test. + while True: + messages = self.consumer.poll(timeout_ms=100, max_records=self.config.get('max_poll')) + if messages: + if self.config.get('workers') > 1: + self.pool.submit(f, messages.values()) + else: + f(list(messages.values())) + if not messages: + i += 1 # just for test. + time.sleep(0.1) + if i > 3: # just for test. + logging.warning('## test over.') # just for test. + return # just for test. + + def _json_to_taos(self, messages): + """ + + convert a batch of json data to sql, and insert into TDengine + :param messages: + :return: + """ + sql = self._build_sql_from_json(messages=messages) + self.conns.execute(sql=sql) + + def _line_to_taos(self, messages): + """ + + convert a batch of lines data to sql, and insert into TDengine + :param messages: + :return: + """ + lines = [] + for partition_messages in messages: + for message in partition_messages: + lines.append(message.value.decode()) + sql = self.INSERT_SQL_HEADER + ' '.join(lines) + self.conns.execute(sql=sql) + + def _build_single_sql_from_json(self, msg_value): + try: + data = json.loads(msg_value) + except JSONDecodeError as e: + logging.error('## decode message [%s] error ', msg_value, e) + return '' + # location = data.get('location') + # group_id = data.get('groupId') + ts = data.get('ts') + current = data.get('current') + voltage = data.get('voltage') + phase = data.get('phase') + table_name = data.get('table_name') + + return self.INSERT_PART_SQL.format(table_name, ts, current, voltage, phase) + + def _build_sql_from_json(self, messages): + sql_list = [] + for partition_messages in messages: + for message in partition_messages: + sql_list.append(self._build_single_sql_from_json(message.value)) + return self.INSERT_SQL_HEADER + ' '.join(sql_list) + + +def test_json_to_taos(consumer: Consumer): + records = [ + [ + ConsumerRecord(checksum=None, headers=None, offset=1, key=None, + value=json.dumps({'table_name': 'd0', + 'ts': '2022-12-06 15:13:38.643', + 'current': 3.41, + 'voltage': 105, + 'phase': 0.02027, }), + partition=1, topic='test', serialized_key_size=None, serialized_header_size=None, + serialized_value_size=None, timestamp=time.time(), timestamp_type=None), + ConsumerRecord(checksum=None, headers=None, offset=1, key=None, + value=json.dumps({'table_name': 'd1', + 'ts': '2022-12-06 15:13:39.643', + 'current': 3.41, + 'voltage': 102, + 'phase': 0.02027, }), + partition=1, topic='test', serialized_key_size=None, serialized_header_size=None, + serialized_value_size=None, timestamp=time.time(), timestamp_type=None), + ] + ] + + consumer._json_to_taos(messages=records) + + +def test_line_to_taos(consumer: Consumer): + records = [ + [ + ConsumerRecord(checksum=None, headers=None, offset=1, key=None, + value="d0 values('2023-01-01 00:00:00.001', 3.49, 109, 0.02737)".encode('utf-8'), + partition=1, topic='test', serialized_key_size=None, serialized_header_size=None, + serialized_value_size=None, timestamp=time.time(), timestamp_type=None), + ConsumerRecord(checksum=None, headers=None, offset=1, key=None, + value="d1 values('2023-01-01 00:00:00.002', 6.19, 112, 0.09171)".encode('utf-8'), + partition=1, topic='test', serialized_key_size=None, serialized_header_size=None, + serialized_value_size=None, timestamp=time.time(), timestamp_type=None), + ] + ] + consumer._line_to_taos(messages=records) + + +def consume(kafka_brokers, kafka_topic, kafka_group_id, taos_host, taos_port, taos_user, + taos_password, taos_database, message_type, max_poll, workers): + c = Consumer(kafka_brokers=kafka_brokers, kafka_topic=kafka_topic, kafka_group_id=kafka_group_id, + taos_host=taos_host, taos_port=taos_port, taos_user=taos_user, taos_password=taos_password, + taos_database=taos_database, message_type=message_type, max_poll=max_poll, workers=workers) + c.consume() + + +if __name__ == '__main__': + consumer = Consumer(testing=True) + common.create_database_and_tables(host='localhost', port=6030, user='root', password='taosdata', db='py_kafka_test', + table_count=10) + consumer.conns.execute(common.USE_DATABASE_SQL.format('py_kafka_test')) + test_json_to_taos(consumer) + test_line_to_taos(consumer) + common.clean(host='localhost', port=6030, user='root', password='taosdata', db='py_kafka_test') diff --git a/docs/examples/python/kafka_example_perform.py b/docs/examples/python/kafka_example_perform.py new file mode 100644 index 0000000000..23ae4b48c8 --- /dev/null +++ b/docs/examples/python/kafka_example_perform.py @@ -0,0 +1,103 @@ +#! encoding=utf-8 + +import argparse +import logging +import multiprocessing +import time +from multiprocessing import pool + +import kafka_example_common as common +import kafka_example_consumer as consumer +import kafka_example_producer as producer + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('-kafka-broker', type=str, default='localhost:9092', + help='kafka borker host. default is `localhost:9200`') + parser.add_argument('-kafka-topic', type=str, default='tdengine-kafka-practices', + help='kafka topic. default is `tdengine-kafka-practices`') + parser.add_argument('-kafka-group', type=str, default='kafka_practices', + help='kafka consumer group. default is `kafka_practices`') + parser.add_argument('-taos-host', type=str, default='localhost', + help='TDengine host. default is `localhost`') + parser.add_argument('-taos-port', type=int, default=6030, help='TDengine port. default is 6030') + parser.add_argument('-taos-user', type=str, default='root', help='TDengine username, default is `root`') + parser.add_argument('-taos-password', type=str, default='taosdata', help='TDengine password, default is `taosdata`') + parser.add_argument('-taos-db', type=str, default='tdengine_kafka_practices', + help='TDengine db name, default is `tdengine_kafka_practices`') + parser.add_argument('-table-count', type=int, default=100, help='TDengine sub-table count, default is 100') + parser.add_argument('-table-items', type=int, default=1000, help='items in per sub-tables, default is 1000') + parser.add_argument('-message-type', type=str, default='line', + help='kafka message type. `line` or `json`. default is `line`') + parser.add_argument('-max-poll', type=int, default=1000, help='max poll for kafka consumer') + parser.add_argument('-threads', type=int, default=10, help='thread count for deal message') + parser.add_argument('-processes', type=int, default=1, help='process count') + + args = parser.parse_args() + total = args.table_count * args.table_items + + logging.warning("## start to prepare testing data...") + prepare_data_start = time.time() + producer.produce_total(100, args.kafka_broker, args.kafka_topic, args.message_type, total, args.table_count) + prepare_data_end = time.time() + logging.warning("## prepare testing data finished! spend-[%s]", prepare_data_end - prepare_data_start) + + logging.warning("## start to create database and tables ...") + create_db_start = time.time() + # create database and table + common.create_database_and_tables(host=args.taos_host, port=args.taos_port, user=args.taos_user, + password=args.taos_password, db=args.taos_db, table_count=args.table_count) + create_db_end = time.time() + logging.warning("## create database and tables finished! spend [%s]", create_db_end - create_db_start) + + processes = args.processes + + logging.warning("## start to consume data and insert into TDengine...") + consume_start = time.time() + if processes > 1: # multiprocess + multiprocessing.set_start_method("spawn") + pool = pool.Pool(processes) + + consume_start = time.time() + for _ in range(processes): + pool.apply_async(func=consumer.consume, args=( + args.kafka_broker, args.kafka_topic, args.kafka_group, args.taos_host, args.taos_port, args.taos_user, + args.taos_password, args.taos_db, args.message_type, args.max_poll, args.threads)) + pool.close() + pool.join() + else: + consume_start = time.time() + consumer.consume(kafka_brokers=args.kafka_broker, kafka_topic=args.kafka_topic, kafka_group_id=args.kafka_group, + taos_host=args.taos_host, taos_port=args.taos_port, taos_user=args.taos_user, + taos_password=args.taos_password, taos_database=args.taos_db, message_type=args.message_type, + max_poll=args.max_poll, workers=args.threads) + consume_end = time.time() + logging.warning("## consume data and insert into TDengine over! spend-[%s]", consume_end - consume_start) + + # print report + logging.warning( + "\n#######################\n" + " Prepare data \n" + "#######################\n" + "# data_type # %s \n" + "# total # %s \n" + "# spend # %s s\n" + "#######################\n" + " Create database \n" + "#######################\n" + "# stable # 1 \n" + "# sub-table # 100 \n" + "# spend # %s s \n" + "#######################\n" + " Consume \n" + "#######################\n" + "# data_type # %s \n" + "# threads # %s \n" + "# processes # %s \n" + "# total_count # %s \n" + "# spend # %s s\n" + "# per_second # %s \n" + "#######################\n", + args.message_type, total, prepare_data_end - prepare_data_start, create_db_end - create_db_start, + args.message_type, args.threads, processes, total, consume_end - consume_start, + total / (consume_end - consume_start)) diff --git a/docs/examples/python/kafka_example_producer.py b/docs/examples/python/kafka_example_producer.py new file mode 100644 index 0000000000..51468c7e37 --- /dev/null +++ b/docs/examples/python/kafka_example_producer.py @@ -0,0 +1,97 @@ +#! encoding = utf-8 +import json +import random +import threading +from concurrent.futures import ThreadPoolExecutor, Future +from datetime import datetime + +from kafka import KafkaProducer + +locations = ['California.SanFrancisco', 'California.LosAngles', 'California.SanDiego', 'California.SanJose', + 'California.PaloAlto', 'California.Campbell', 'California.MountainView', 'California.Sunnyvale', + 'California.SantaClara', 'California.Cupertino'] + +producers: list[KafkaProducer] = [] + +lock = threading.Lock() +start = 1640966400 + + +def produce_total(workers, broker, topic, message_type, total, table_count): + if len(producers) == 0: + lock.acquire() + if len(producers) == 0: + _init_kafka_producers(broker=broker, count=10) + lock.release() + pool = ThreadPoolExecutor(max_workers=workers) + futures = [] + for _ in range(0, workers): + futures.append(pool.submit(_produce_total, topic, message_type, int(total / workers), table_count)) + pool.shutdown() + for f in futures: + f.result() + _close_kafka_producers() + + +def _produce_total(topic, message_type, total, table_count): + producer = _get_kafka_producer() + for _ in range(total): + message = _get_fake_date(message_type=message_type, table_count=table_count) + producer.send(topic=topic, value=message.encode(encoding='utf-8')) + + +def _init_kafka_producers(broker, count): + for _ in range(count): + p = KafkaProducer(bootstrap_servers=broker, batch_size=64 * 1024, linger_ms=300, acks=0) + producers.append(p) + + +def _close_kafka_producers(): + for p in producers: + p.close() + + +def _get_kafka_producer(): + return producers[random.randint(0, len(producers) - 1)] + + +def _get_fake_date(table_count, message_type='json'): + if message_type == 'json': + return _get_json_message(table_count=table_count) + if message_type == 'line': + return _get_line_message(table_count=table_count) + return '' + + +def _get_json_message(table_count): + return json.dumps({ + 'ts': _get_timestamp(), + 'current': random.randint(0, 1000) / 100, + 'voltage': random.randint(105, 115), + 'phase': random.randint(0, 32000) / 100000, + 'location': random.choice(locations), + 'groupId': random.randint(1, 10), + 'table_name': _random_table_name(table_count) + }) + + +def _get_line_message(table_count): + return "{} values('{}', {}, {}, {})".format( + _random_table_name(table_count), # table + _get_timestamp(), # ts + random.randint(0, 1000) / 100, # current + random.randint(105, 115), # voltage + random.randint(0, 32000) / 100000, # phase + ) + + +def _random_table_name(table_count): + return 'd{}'.format(random.randint(0, table_count - 1)) + + +def _get_timestamp(): + global start + lock.acquire(blocking=True) + start += 0.001 + lock.release() + return datetime.fromtimestamp(start).strftime('%Y-%m-%d %H:%M:%S.%f')[:-3] diff --git a/docs/zh/07-develop/03-insert-data/_py_kafka.mdx b/docs/zh/07-develop/03-insert-data/_py_kafka.mdx index cd7edf557d..d656325674 100644 --- a/docs/zh/07-develop/03-insert-data/_py_kafka.mdx +++ b/docs/zh/07-develop/03-insert-data/_py_kafka.mdx @@ -55,6 +55,70 @@ for p in ps: ### 完整示例 +
+kafka_example_perform + +`kafka_example_perform` 是示例程序的入口 + ```py -{{#include docs/examples/python/kafka_example.py}} +{{#include docs/examples/python/kafka_example_perform.py}} ``` +
+ +
+kafka_example_common + +`kafka_example_common` 是示例程序的公共代码 + +```py +{{#include docs/examples/python/kafka_example_common.py}} +``` +
+ +
+kafka_example_producer + +`kafka_example_producer` 是示例程序的 producer 代码,负责生成并发送测试数据到 kafka + +```py +{{#include docs/examples/python/kafka_example_producer.py}} +``` +
+ +
+kafka_example_consumer + +`kafka_example_consumer` 是示例程序的 consumer 代码,负责从 kafka 消费数据,并写入到 TDengine + +```py +{{#include docs/examples/python/kafka_example_consumer.py}} +``` +
+ +### 执行步骤 + +
+ 执行 Python 示例程序 + + 1. 安装并启动 kafka + + 2. python 环境准备 + - 安装 python3 + - 安装 taospy + - 安装 kafka-python + + 3. 执行示例程序 + + 程序的执行入口是 `kafka_example_perform.py`,获取程序完整的执行参数,请执行 help 命令。 + + ``` + python3 kafka_example_perform.py --help + ``` + + 以下为创建 100 个子表,每个子表 20000 条数据,kafka max poll 为 100,一个进程,每个进程一个处理线程的程序执行命令 + + ``` + python3 kafka_example_perform.py -table-count=100 -table-items=20000 -max-poll=100 -threads=1 -processes=1 + ``` + +
diff --git a/docs/zh/12-taos-sql/03-table.md b/docs/zh/12-taos-sql/03-table.md index 045abcde95..5687c7e740 100644 --- a/docs/zh/12-taos-sql/03-table.md +++ b/docs/zh/12-taos-sql/03-table.md @@ -57,7 +57,7 @@ table_option: { 3. MAX_DELAY:用于控制推送计算结果的最大延迟,默认值为 interval 的值(但不能超过最大值),最小单位毫秒,范围为 1 毫秒到 15 分钟,多个以逗号分隔。注:不建议 MAX_DELAY 设置太小,否则会过于频繁的推送结果,影响存储和查询性能,如无特殊需求,取默认值即可。只可用于超级表,且只有当数据库使用了 RETENTIONS 参数时,才可以使用此表参数。 4. ROLLUP:Rollup 指定的聚合函数,提供基于多层级的降采样聚合结果。只可用于超级表。只有当数据库使用了 RETENTIONS 参数时,才可以使用此表参数。作用于超级表除 TS 列外的其它所有列,但是只能定义一个聚合函数。 聚合函数支持 avg, sum, min, max, last, first。 5. SMA:Small Materialized Aggregates,提供基于数据块的自定义预计算功能。预计算类型包括 MAX、MIN 和 SUM。可用于超级表/普通表。 -6. TTL:Time to Live,是用户用来指定表的生命周期的参数。如果创建表时指定了这个参数,当该表的存在时间超过 TTL 指定的时间后,TDengine 自动删除该表。这个 TTL 的时间只是一个大概时间,系统不保证到了时间一定会将其删除,而只保证存在这样一个机制且最终一定会删除。TTL 单位是天,默认为 0,表示不限制,到期时间为表创建时间加上 TTL 时间。 +6. TTL:Time to Live,是用户用来指定表的生命周期的参数。如果创建表时指定了这个参数,当该表的存在时间超过 TTL 指定的时间后,TDengine 自动删除该表。这个 TTL 的时间只是一个大概时间,系统不保证到了时间一定会将其删除,而只保证存在这样一个机制且最终一定会删除。TTL 单位是天,默认为 0,表示不限制,到期时间为表创建时间加上 TTL 时间。TTL 与数据库 KEEP 参数没有关联,如果 KEEP 比 TTL 小,在表被删除之前数据也可能已经被删除。 ## 创建子表 diff --git a/docs/zh/12-taos-sql/06-select.md b/docs/zh/12-taos-sql/06-select.md index 8244c0f27a..dcc085b3bd 100644 --- a/docs/zh/12-taos-sql/06-select.md +++ b/docs/zh/12-taos-sql/06-select.md @@ -13,6 +13,7 @@ SELECT [DISTINCT] select_list from_clause [WHERE condition] [partition_by_clause] + [interp_clause] [window_clause] [group_by_clause] [order_by_clasue] @@ -53,8 +54,11 @@ window_clause: { | STATE_WINDOW(col) | INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [WATERMARK(watermark_val)] [FILL(fill_mod_and_val)] +interp_clause: + RANGE(ts_val, ts_val), EVERY(every_val), FILL(fill_mod_and_val) + partition_by_clause: - PARTITION BY expr [, expr] ... + PARTITION BY expr [, expr] ... group_by_clause: GROUP BY expr [, expr] ... HAVING condition diff --git a/docs/zh/12-taos-sql/10-function.md b/docs/zh/12-taos-sql/10-function.md index 81fdb46f25..b21d9c25dd 100644 --- a/docs/zh/12-taos-sql/10-function.md +++ b/docs/zh/12-taos-sql/10-function.md @@ -875,9 +875,9 @@ INTERP(expr) - INTERP 用于在指定时间断面获取指定列的记录值,如果该时间断面不存在符合条件的行数据,那么会根据 FILL 参数的设定进行插值。 - INTERP 的输入数据为指定列的数据,可以通过条件语句(where 子句)来对原始列数据进行过滤,如果没有指定过滤条件则输入为全部数据。 - INTERP 需要同时与 RANGE,EVERY 和 FILL 关键字一起使用。 -- INTERP 的输出时间范围根据 RANGE(timestamp1,timestamp2)字段来指定,需满足 timestamp1<=timestamp2。其中 timestamp1(必选值)为输出时间范围的起始值,即如果 timestamp1 时刻符合插值条件则 timestamp1 为输出的第一条记录,timestamp2(必选值)为输出时间范围的结束值,即输出的最后一条记录的 timestamp 不能大于 timestamp2。 -- INTERP 根据 EVERY 字段来确定输出时间范围内的结果条数,即从 timestamp1 开始每隔固定长度的时间(EVERY 值)进行插值。 -- INTERP 根据 FILL 字段来决定在每个符合输出条件的时刻如何进行插值。 +- INTERP 的输出时间范围根据 RANGE(timestamp1,timestamp2)字段来指定,需满足 timestamp1 <= timestamp2。其中 timestamp1(必选值)为输出时间范围的起始值,即如果 timestamp1 时刻符合插值条件则 timestamp1 为输出的第一条记录,timestamp2(必选值)为输出时间范围的结束值,即输出的最后一条记录的 timestamp 不能大于 timestamp2。 +- INTERP 根据 EVERY(time_unit) 字段来确定输出时间范围内的结果条数,即从 timestamp1 开始每隔固定长度的时间(time_unit 值)进行插值,time_unit 可取值时间单位:1a(毫秒),1s(秒),1m(分),1h(小时),1d(天),1w(周)。例如 EVERY(500a) 将对于指定数据每500毫秒间隔进行一次插值. +- INTERP 根据 FILL 字段来决定在每个符合输出条件的时刻如何进行插值。关于 FILL 子句如何使用请参考 [FILL 子句](../distinguished/#fill-子句) - INTERP 只能在一个时间序列内进行插值,因此当作用于超级表时必须跟 partition by tbname 一起使用。 - INTERP 可以与伪列 _irowts 一起使用,返回插值点所对应的时间戳(3.0.1.4版本以后支持)。 - INTERP 可以与伪列 _isfilled 一起使用,显示返回结果是否为原始记录或插值算法产生的数据(3.0.2.3版本以后支持)。 diff --git a/docs/zh/14-reference/07-tdinsight/assets/TDinsight-8-taosadapter.webp b/docs/zh/14-reference/07-tdinsight/assets/TDinsight-8-taosadapter.webp index 942130d4fa..a90477880f 100644 Binary files a/docs/zh/14-reference/07-tdinsight/assets/TDinsight-8-taosadapter.webp and b/docs/zh/14-reference/07-tdinsight/assets/TDinsight-8-taosadapter.webp differ diff --git a/docs/zh/14-reference/07-tdinsight/index.mdx b/docs/zh/14-reference/07-tdinsight/index.mdx index 7f4c46a636..8ec11378ee 100644 --- a/docs/zh/14-reference/07-tdinsight/index.mdx +++ b/docs/zh/14-reference/07-tdinsight/index.mdx @@ -345,11 +345,12 @@ TDinsight 仪表盘旨在提供 TDengine 相关资源的使用情况和状态, 支持监控 taosAdapter 请求统计和状态详情。包括: -1. **http_request_inflight**: 即时处理请求数 -2. **http_request_total**: 请求总数。 -3. **http_request_fail**: 请求总数。 -4. **CPU Used**: taosAdapter CPU 使用情况。 -5. **Memory Used**: taosAdapter 内存使用情况。 +1. **Http Request Total**: 请求总数。 +2. **Http Request Fail**: 请求总数。 +3. **CPU Used**: taosAdapter CPU 使用情况。 +4. **Memory Used**: taosAdapter 内存使用情况。 +5. **Http Request Inflight**: 即时处理请求数。 +6. **Http Status Code**: taosAdapter http 状态码。 ## 升级 diff --git a/docs/zh/20-third-party/01-grafana.mdx b/docs/zh/20-third-party/01-grafana.mdx index d5cfe847ca..5927dc4fca 100644 --- a/docs/zh/20-third-party/01-grafana.mdx +++ b/docs/zh/20-third-party/01-grafana.mdx @@ -77,7 +77,7 @@ sudo -u grafana grafana-cli plugins install tdengine-datasource 或者从 [GitHub](https://github.com/taosdata/grafanaplugin/releases/tag/latest) 或 [Grafana](https://grafana.com/grafana/plugins/tdengine-datasource/?tab=installation) 下载 .zip 文件到本地并解压到 Grafana 插件目录。命令行下载示例如下: ```bash -GF_VERSION=3.2.7 +GF_VERSION=3.2.9 # from GitHub wget https://github.com/taosdata/grafanaplugin/releases/download/v$GF_VERSION/tdengine-datasource-$GF_VERSION.zip # from Grafana @@ -156,13 +156,13 @@ docker run -d \ services: tdengine: - image: tdengine/tdengine:2.6.0.2 + image: tdengine/tdengine:3.0.2.4 environment: TAOS_FQDN: tdengine volumes: - tdengine-data:/var/lib/taos/ grafana: - image: grafana/grafana:8.5.6 + image: grafana/grafana:9.3.6 volumes: - ./tdengine.yml/:/etc/grafana/provisioning/tdengine.yml - grafana-data:/var/lib/grafana @@ -197,11 +197,17 @@ docker run -d \ - INPUT SQL:输入要查询的语句(该 SQL 语句的结果集应为两列多行),例如:`select _wstart, avg(mem_system) from log.dnodes_info where ts >= $from and ts < $to interval($interval)` ,其中,from、to 和 interval 为 TDengine 插件的内置变量,表示从 Grafana 插件面板获取的查询范围和时间间隔。除了内置变量外,`也支持可以使用自定义模板变量`。 - ALIAS BY:可设置当前查询别名。 - GENERATE SQL: 点击该按钮会自动替换相应变量,并生成最终执行的语句。 +- Group by column name(s): **半角**逗号分隔的 `group by` 或 `partition by` 列名。如果是 `group by` or `partition by` 查询语句,设置 `Group by` 列,可以展示多维数据。例如:INPUT SQL 为 `select _wstart as ts, avg(mem_system), dnode_ep from log.dnodes_info where ts>=$from and ts<=$to partition by dnode_ep interval($interval)`,设置 Group by 列名为 `dnode_ep`,可以按 `dnode_ep` 展示数据。 +- Format to: Group by 或 Partition by 场景下多维数据 legend 格式化格式。例如上述 INPUT SQL,将 Format to 设置为 `mem_system_{{dnode_ep}}`,展示的 legend 名字为格式化的列名。 按照默认提示查询当前 TDengine 部署所在服务器指定间隔系统内存平均使用量如下: ![TDengine Database Grafana plugin create dashboard](./create_dashboard2.webp) +查询每台 TDengine 服务器指定间隔系统内存平均使用量如下: + +![TDengine Database Grafana plugin create dashboard](./create_dashboard3.webp) + > 关于如何使用 Grafana 创建相应的监测界面以及更多有关使用 Grafana 的信息,请参考 Grafana 官方的[文档](https://grafana.com/docs/)。 ### 导入 Dashboard diff --git a/docs/zh/20-third-party/create_dashboard1.webp b/docs/zh/20-third-party/create_dashboard1.webp index 55eb388833..df41d66d50 100644 Binary files a/docs/zh/20-third-party/create_dashboard1.webp and b/docs/zh/20-third-party/create_dashboard1.webp differ diff --git a/docs/zh/20-third-party/create_dashboard2.webp b/docs/zh/20-third-party/create_dashboard2.webp index bb40e40718..ba50f52996 100644 Binary files a/docs/zh/20-third-party/create_dashboard2.webp and b/docs/zh/20-third-party/create_dashboard2.webp differ diff --git a/docs/zh/20-third-party/create_dashboard3.webp b/docs/zh/20-third-party/create_dashboard3.webp new file mode 100644 index 0000000000..84f387f87b Binary files /dev/null and b/docs/zh/20-third-party/create_dashboard3.webp differ diff --git a/docs/zh/27-train-faq/01-faq.md b/docs/zh/27-train-faq/01-faq.md index c6ecbe471a..b000619630 100644 --- a/docs/zh/27-train-faq/01-faq.md +++ b/docs/zh/27-train-faq/01-faq.md @@ -243,8 +243,8 @@ sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist ``` launchctl limit maxfiles ``` -### 19 建库时提示Out of dnode -该提示是创建db的vnode数量不够了,需要的vnode不能超过了dnode中vnode的上限。因为系统默认是一个dnode中有cpu核数两倍的vnode,也可以通过配置文件中的参数supportVnodes控制。 -正常调大taos.cfg种这个supportVnodes参数即可。 +### 20 建库时提示 Out of dnodes +该提示是创建 db 的 vnode 数量不够了,需要的 vnode 不能超过了 dnode 中 vnode 的上限。因为系统默认是一个 dnode 中有 CPU 核数两倍的 vnode,也可以通过配置文件中的参数 supportVnodes 控制。 +正常调大 taos.cfg 中 supportVnodes 参数即可。 diff --git a/docs/zh/28-releases/01-tdengine.md b/docs/zh/28-releases/01-tdengine.md index 2ec1e6cc54..cf7bf83164 100644 --- a/docs/zh/28-releases/01-tdengine.md +++ b/docs/zh/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ TDengine 2.x 各版本安装包请访问[这里](https://www.taosdata.com/all-do import Release from "/components/ReleaseV3"; +## 3.0.2.5 + + + ## 3.0.2.4 diff --git a/docs/zh/28-releases/02-tools.md b/docs/zh/28-releases/02-tools.md index 421cbd39e3..5f277b4873 100644 --- a/docs/zh/28-releases/02-tools.md +++ b/docs/zh/28-releases/02-tools.md @@ -10,6 +10,10 @@ taosTools 各版本安装包下载链接如下: import Release from "/components/ReleaseV3"; +## 2.4.3 + + + ## 2.4.2 diff --git a/examples/JDBC/readme.md b/examples/JDBC/readme.md index c7d7875308..c5588a5b25 100644 --- a/examples/JDBC/readme.md +++ b/examples/JDBC/readme.md @@ -10,4 +10,4 @@ | 6 | taosdemo | This is an internal tool for testing Our JDBC-JNI, JDBC-RESTful, RESTful interfaces | -more detail: https://docs.taosdata.com/reference/connector/java/ \ No newline at end of file +more detail: https://docs.taosdata.com/connector/java/ diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h index b5971d8a9e..d7a62f5402 100644 --- a/include/common/tdataformat.h +++ b/include/common/tdataformat.h @@ -109,7 +109,7 @@ void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal); void tRowDestroy(SRow *pRow); void tRowSort(SArray *aRowP); int32_t tRowMerge(SArray *aRowP, STSchema *pTSchema, int8_t flag); -int32_t tRowAppendToColData(SRow *pRow, STSchema *pTSchema, SColData *aColData, int32_t nColData); +int32_t tRowUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *aColData, int32_t nColData, int32_t flag); // SRowIter ================================ int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter); @@ -137,6 +137,7 @@ void tColDataInit(SColData *pColData, int16_t cid, int8_t type, int8_t smaOn) void tColDataClear(SColData *pColData); void tColDataDeepClear(SColData *pColData); int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal); +int32_t tColDataUpdateValue(SColData *pColData, SColVal *pColVal, bool forward); void tColDataGetValue(SColData *pColData, int32_t iVal, SColVal *pColVal); uint8_t tColDataGetBitValue(const SColData *pColData, int32_t iVal); int32_t tColDataCopy(SColData *pColDataFrom, SColData *pColData, xMallocFn xMalloc, void *arg); @@ -200,6 +201,9 @@ struct SColData { int16_t cid; int8_t type; int8_t smaOn; + int32_t numOfNone; // # of none + int32_t numOfNull; // # of null + int32_t numOfValue; // # of vale int32_t nVal; uint8_t flag; uint8_t *pBitMap; diff --git a/include/common/tmsg.h b/include/common/tmsg.h index c0e8cbae49..a82364f347 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -58,7 +58,7 @@ extern int32_t tMsgDict[]; #define TMSG_INFO(TYPE) \ ((TYPE) < TDMT_DND_MAX_MSG || (TYPE) < TDMT_MND_MAX_MSG || (TYPE) < TDMT_VND_MAX_MSG || (TYPE) < TDMT_SCH_MAX_MSG || \ (TYPE) < TDMT_STREAM_MAX_MSG || (TYPE) < TDMT_MON_MAX_MSG || (TYPE) < TDMT_SYNC_MAX_MSG) || \ - (TYPE) < TDMT_VND_STREAM_MSG || (TYPE) < TDMT_VND_TMQ_MSG \ + (TYPE) < TDMT_VND_STREAM_MSG || (TYPE) < TDMT_VND_TMQ_MSG || (TYPE) < TDMT_VND_TMQ_MAX_MSG \ ? tMsgInfo[tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE)] \ : 0 @@ -145,12 +145,14 @@ typedef enum _mgmt_table { #define TSDB_ALTER_TABLE_UPDATE_OPTIONS 9 #define TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME 10 -#define TSDB_FILL_NONE 0 -#define TSDB_FILL_NULL 1 -#define TSDB_FILL_SET_VALUE 2 -#define TSDB_FILL_LINEAR 3 -#define TSDB_FILL_PREV 4 -#define TSDB_FILL_NEXT 5 +#define TSDB_FILL_NONE 0 +#define TSDB_FILL_NULL 1 +#define TSDB_FILL_NULL_F 2 +#define TSDB_FILL_SET_VALUE 3 +#define TSDB_FILL_SET_VALUE_F 4 +#define TSDB_FILL_LINEAR 5 +#define TSDB_FILL_PREV 6 +#define TSDB_FILL_NEXT 7 #define TSDB_ALTER_USER_PASSWD 0x1 #define TSDB_ALTER_USER_SUPERUSER 0x2 @@ -1241,7 +1243,7 @@ int32_t tDeserializeSDropVnodeReq(void* buf, int32_t bufLen, SDropVnodeReq* pReq typedef struct { int64_t dbUid; char db[TSDB_DB_FNAME_LEN]; - int64_t reserved[8]; + int64_t compactStartTime; } SCompactVnodeReq; int32_t tSerializeSCompactVnodeReq(void* buf, int32_t bufLen, SCompactVnodeReq* pReq); @@ -1280,8 +1282,8 @@ int32_t tSerializeSAlterVnodeReplicaReq(void* buf, int32_t bufLen, SAlterVnodeRe int32_t tDeserializeSAlterVnodeReplicaReq(void* buf, int32_t bufLen, SAlterVnodeReplicaReq* pReq); typedef struct { - int32_t vgId; - int8_t disable; + int32_t vgId; + int8_t disable; } SDisableVnodeWriteReq; int32_t tSerializeSDisableVnodeWriteReq(void* buf, int32_t bufLen, SDisableVnodeWriteReq* pReq); @@ -1781,6 +1783,7 @@ typedef struct { #define STREAM_FILL_HISTORY_ON 1 #define STREAM_FILL_HISTORY_OFF 0 #define STREAM_DEFAULT_FILL_HISTORY STREAM_FILL_HISTORY_OFF +#define STREAM_DEFAULT_IGNORE_UPDATE 0 #define STREAM_CREATE_STABLE_TRUE 1 #define STREAM_CREATE_STABLE_FALSE 0 @@ -1809,7 +1812,8 @@ typedef struct { // 3.0.2.3 int8_t createStb; uint64_t targetStbUid; - SArray* fillNullCols; // array of SColLocation + SArray* fillNullCols; // array of SColLocation + int8_t igUpdate; } SCMCreateStreamReq; typedef struct { diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 597371d9d1..ada3fd20e8 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -16,331 +16,333 @@ #ifndef _TD_COMMON_TOKEN_H_ #define _TD_COMMON_TOKEN_H_ -#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_USER 33 -#define TK_ENABLE 34 -#define TK_NK_INTEGER 35 -#define TK_SYSINFO 36 -#define TK_DROP 37 -#define TK_GRANT 38 -#define TK_ON 39 -#define TK_TO 40 -#define TK_REVOKE 41 -#define TK_FROM 42 -#define TK_SUBSCRIBE 43 -#define TK_NK_COMMA 44 -#define TK_READ 45 -#define TK_WRITE 46 -#define TK_NK_DOT 47 -#define TK_DNODE 48 -#define TK_PORT 49 -#define TK_DNODES 50 -#define TK_NK_IPTOKEN 51 -#define TK_FORCE 52 -#define TK_LOCAL 53 -#define TK_QNODE 54 -#define TK_BNODE 55 -#define TK_SNODE 56 -#define TK_MNODE 57 -#define TK_DATABASE 58 -#define TK_USE 59 -#define TK_FLUSH 60 -#define TK_TRIM 61 -#define TK_IF 62 -#define TK_NOT 63 -#define TK_EXISTS 64 -#define TK_BUFFER 65 -#define TK_CACHEMODEL 66 -#define TK_CACHESIZE 67 -#define TK_COMP 68 -#define TK_DURATION 69 -#define TK_NK_VARIABLE 70 -#define TK_MAXROWS 71 -#define TK_MINROWS 72 -#define TK_KEEP 73 -#define TK_PAGES 74 -#define TK_PAGESIZE 75 -#define TK_TSDB_PAGESIZE 76 -#define TK_PRECISION 77 -#define TK_REPLICA 78 -#define TK_VGROUPS 79 -#define TK_SINGLE_STABLE 80 -#define TK_RETENTIONS 81 -#define TK_SCHEMALESS 82 -#define TK_WAL_LEVEL 83 -#define TK_WAL_FSYNC_PERIOD 84 -#define TK_WAL_RETENTION_PERIOD 85 -#define TK_WAL_RETENTION_SIZE 86 -#define TK_WAL_ROLL_PERIOD 87 -#define TK_WAL_SEGMENT_SIZE 88 -#define TK_STT_TRIGGER 89 -#define TK_TABLE_PREFIX 90 -#define TK_TABLE_SUFFIX 91 -#define TK_NK_COLON 92 -#define TK_MAX_SPEED 93 -#define TK_TABLE 94 -#define TK_NK_LP 95 -#define TK_NK_RP 96 -#define TK_STABLE 97 -#define TK_ADD 98 -#define TK_COLUMN 99 -#define TK_MODIFY 100 -#define TK_RENAME 101 -#define TK_TAG 102 -#define TK_SET 103 -#define TK_NK_EQ 104 -#define TK_USING 105 -#define TK_TAGS 106 -#define TK_COMMENT 107 -#define TK_BOOL 108 -#define TK_TINYINT 109 -#define TK_SMALLINT 110 -#define TK_INT 111 -#define TK_INTEGER 112 -#define TK_BIGINT 113 -#define TK_FLOAT 114 -#define TK_DOUBLE 115 -#define TK_BINARY 116 -#define TK_TIMESTAMP 117 -#define TK_NCHAR 118 -#define TK_UNSIGNED 119 -#define TK_JSON 120 -#define TK_VARCHAR 121 -#define TK_MEDIUMBLOB 122 -#define TK_BLOB 123 -#define TK_VARBINARY 124 -#define TK_DECIMAL 125 -#define TK_MAX_DELAY 126 -#define TK_WATERMARK 127 -#define TK_ROLLUP 128 -#define TK_TTL 129 -#define TK_SMA 130 -#define TK_DELETE_MARK 131 -#define TK_FIRST 132 -#define TK_LAST 133 -#define TK_SHOW 134 -#define TK_PRIVILEGES 135 -#define TK_DATABASES 136 -#define TK_TABLES 137 -#define TK_STABLES 138 -#define TK_MNODES 139 -#define TK_QNODES 140 -#define TK_FUNCTIONS 141 -#define TK_INDEXES 142 -#define TK_ACCOUNTS 143 -#define TK_APPS 144 -#define TK_CONNECTIONS 145 -#define TK_LICENCES 146 -#define TK_GRANTS 147 -#define TK_QUERIES 148 -#define TK_SCORES 149 -#define TK_TOPICS 150 -#define TK_VARIABLES 151 -#define TK_CLUSTER 152 -#define TK_BNODES 153 -#define TK_SNODES 154 -#define TK_TRANSACTIONS 155 -#define TK_DISTRIBUTED 156 -#define TK_CONSUMERS 157 -#define TK_SUBSCRIPTIONS 158 -#define TK_VNODES 159 -#define TK_ALIVE 160 -#define TK_LIKE 161 -#define TK_TBNAME 162 -#define TK_QTAGS 163 -#define TK_AS 164 -#define TK_INDEX 165 -#define TK_FUNCTION 166 -#define TK_INTERVAL 167 -#define TK_COUNT 168 -#define TK_LAST_ROW 169 -#define TK_TOPIC 170 -#define TK_WITH 171 -#define TK_META 172 -#define TK_CONSUMER 173 -#define TK_GROUP 174 -#define TK_DESC 175 -#define TK_DESCRIBE 176 -#define TK_RESET 177 -#define TK_QUERY 178 -#define TK_CACHE 179 -#define TK_EXPLAIN 180 -#define TK_ANALYZE 181 -#define TK_VERBOSE 182 -#define TK_NK_BOOL 183 -#define TK_RATIO 184 -#define TK_NK_FLOAT 185 -#define TK_OUTPUTTYPE 186 -#define TK_AGGREGATE 187 -#define TK_BUFSIZE 188 -#define TK_STREAM 189 -#define TK_INTO 190 -#define TK_TRIGGER 191 -#define TK_AT_ONCE 192 -#define TK_WINDOW_CLOSE 193 -#define TK_IGNORE 194 -#define TK_EXPIRED 195 -#define TK_FILL_HISTORY 196 -#define TK_SUBTABLE 197 -#define TK_KILL 198 -#define TK_CONNECTION 199 -#define TK_TRANSACTION 200 -#define TK_BALANCE 201 -#define TK_VGROUP 202 -#define TK_MERGE 203 -#define TK_REDISTRIBUTE 204 -#define TK_SPLIT 205 -#define TK_DELETE 206 -#define TK_INSERT 207 -#define TK_NULL 208 -#define TK_NK_QUESTION 209 -#define TK_NK_ARROW 210 -#define TK_ROWTS 211 -#define TK_QSTART 212 -#define TK_QEND 213 -#define TK_QDURATION 214 -#define TK_WSTART 215 -#define TK_WEND 216 -#define TK_WDURATION 217 -#define TK_IROWTS 218 -#define TK_ISFILLED 219 -#define TK_CAST 220 -#define TK_NOW 221 -#define TK_TODAY 222 -#define TK_TIMEZONE 223 -#define TK_CLIENT_VERSION 224 -#define TK_SERVER_VERSION 225 -#define TK_SERVER_STATUS 226 -#define TK_CURRENT_USER 227 -#define TK_CASE 228 -#define TK_END 229 -#define TK_WHEN 230 -#define TK_THEN 231 -#define TK_ELSE 232 -#define TK_BETWEEN 233 -#define TK_IS 234 -#define TK_NK_LT 235 -#define TK_NK_GT 236 -#define TK_NK_LE 237 -#define TK_NK_GE 238 -#define TK_NK_NE 239 -#define TK_MATCH 240 -#define TK_NMATCH 241 -#define TK_CONTAINS 242 -#define TK_IN 243 -#define TK_JOIN 244 -#define TK_INNER 245 -#define TK_SELECT 246 -#define TK_DISTINCT 247 -#define TK_WHERE 248 -#define TK_PARTITION 249 -#define TK_BY 250 -#define TK_SESSION 251 -#define TK_STATE_WINDOW 252 -#define TK_EVENT_WINDOW 253 -#define TK_START 254 -#define TK_SLIDING 255 -#define TK_FILL 256 -#define TK_VALUE 257 -#define TK_NONE 258 -#define TK_PREV 259 -#define TK_LINEAR 260 -#define TK_NEXT 261 -#define TK_HAVING 262 -#define TK_RANGE 263 -#define TK_EVERY 264 -#define TK_ORDER 265 -#define TK_SLIMIT 266 -#define TK_SOFFSET 267 -#define TK_LIMIT 268 -#define TK_OFFSET 269 -#define TK_ASC 270 -#define TK_NULLS 271 -#define TK_ABORT 272 -#define TK_AFTER 273 -#define TK_ATTACH 274 -#define TK_BEFORE 275 -#define TK_BEGIN 276 -#define TK_BITAND 277 -#define TK_BITNOT 278 -#define TK_BITOR 279 -#define TK_BLOCKS 280 -#define TK_CHANGE 281 -#define TK_COMMA 282 -#define TK_COMPACT 283 -#define TK_CONCAT 284 -#define TK_CONFLICT 285 -#define TK_COPY 286 -#define TK_DEFERRED 287 -#define TK_DELIMITERS 288 -#define TK_DETACH 289 -#define TK_DIVIDE 290 -#define TK_DOT 291 -#define TK_EACH 292 -#define TK_FAIL 293 -#define TK_FILE 294 -#define TK_FOR 295 -#define TK_GLOB 296 -#define TK_ID 297 -#define TK_IMMEDIATE 298 -#define TK_IMPORT 299 -#define TK_INITIALLY 300 -#define TK_INSTEAD 301 -#define TK_ISNULL 302 -#define TK_KEY 303 -#define TK_MODULES 304 -#define TK_NK_BITNOT 305 -#define TK_NK_SEMI 306 -#define TK_NOTNULL 307 -#define TK_OF 308 -#define TK_PLUS 309 -#define TK_PRIVILEGE 310 -#define TK_RAISE 311 -#define TK_REPLACE 312 -#define TK_RESTRICT 313 -#define TK_ROW 314 -#define TK_SEMI 315 -#define TK_STAR 316 -#define TK_STATEMENT 317 -#define TK_STRICT 318 -#define TK_STRING 319 -#define TK_TIMES 320 -#define TK_UPDATE 321 -#define TK_VALUES 322 -#define TK_VARIABLE 323 -#define TK_VIEW 324 -#define TK_WAL 325 +#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_USER 33 +#define TK_ENABLE 34 +#define TK_NK_INTEGER 35 +#define TK_SYSINFO 36 +#define TK_DROP 37 +#define TK_GRANT 38 +#define TK_ON 39 +#define TK_TO 40 +#define TK_REVOKE 41 +#define TK_FROM 42 +#define TK_SUBSCRIBE 43 +#define TK_NK_COMMA 44 +#define TK_READ 45 +#define TK_WRITE 46 +#define TK_NK_DOT 47 +#define TK_DNODE 48 +#define TK_PORT 49 +#define TK_DNODES 50 +#define TK_NK_IPTOKEN 51 +#define TK_FORCE 52 +#define TK_LOCAL 53 +#define TK_QNODE 54 +#define TK_BNODE 55 +#define TK_SNODE 56 +#define TK_MNODE 57 +#define TK_DATABASE 58 +#define TK_USE 59 +#define TK_FLUSH 60 +#define TK_TRIM 61 +#define TK_COMPACT 62 +#define TK_IF 63 +#define TK_NOT 64 +#define TK_EXISTS 65 +#define TK_BUFFER 66 +#define TK_CACHEMODEL 67 +#define TK_CACHESIZE 68 +#define TK_COMP 69 +#define TK_DURATION 70 +#define TK_NK_VARIABLE 71 +#define TK_MAXROWS 72 +#define TK_MINROWS 73 +#define TK_KEEP 74 +#define TK_PAGES 75 +#define TK_PAGESIZE 76 +#define TK_TSDB_PAGESIZE 77 +#define TK_PRECISION 78 +#define TK_REPLICA 79 +#define TK_VGROUPS 80 +#define TK_SINGLE_STABLE 81 +#define TK_RETENTIONS 82 +#define TK_SCHEMALESS 83 +#define TK_WAL_LEVEL 84 +#define TK_WAL_FSYNC_PERIOD 85 +#define TK_WAL_RETENTION_PERIOD 86 +#define TK_WAL_RETENTION_SIZE 87 +#define TK_WAL_ROLL_PERIOD 88 +#define TK_WAL_SEGMENT_SIZE 89 +#define TK_STT_TRIGGER 90 +#define TK_TABLE_PREFIX 91 +#define TK_TABLE_SUFFIX 92 +#define TK_NK_COLON 93 +#define TK_MAX_SPEED 94 +#define TK_TABLE 95 +#define TK_NK_LP 96 +#define TK_NK_RP 97 +#define TK_STABLE 98 +#define TK_ADD 99 +#define TK_COLUMN 100 +#define TK_MODIFY 101 +#define TK_RENAME 102 +#define TK_TAG 103 +#define TK_SET 104 +#define TK_NK_EQ 105 +#define TK_USING 106 +#define TK_TAGS 107 +#define TK_COMMENT 108 +#define TK_BOOL 109 +#define TK_TINYINT 110 +#define TK_SMALLINT 111 +#define TK_INT 112 +#define TK_INTEGER 113 +#define TK_BIGINT 114 +#define TK_FLOAT 115 +#define TK_DOUBLE 116 +#define TK_BINARY 117 +#define TK_TIMESTAMP 118 +#define TK_NCHAR 119 +#define TK_UNSIGNED 120 +#define TK_JSON 121 +#define TK_VARCHAR 122 +#define TK_MEDIUMBLOB 123 +#define TK_BLOB 124 +#define TK_VARBINARY 125 +#define TK_DECIMAL 126 +#define TK_MAX_DELAY 127 +#define TK_WATERMARK 128 +#define TK_ROLLUP 129 +#define TK_TTL 130 +#define TK_SMA 131 +#define TK_DELETE_MARK 132 +#define TK_FIRST 133 +#define TK_LAST 134 +#define TK_SHOW 135 +#define TK_PRIVILEGES 136 +#define TK_DATABASES 137 +#define TK_TABLES 138 +#define TK_STABLES 139 +#define TK_MNODES 140 +#define TK_QNODES 141 +#define TK_FUNCTIONS 142 +#define TK_INDEXES 143 +#define TK_ACCOUNTS 144 +#define TK_APPS 145 +#define TK_CONNECTIONS 146 +#define TK_LICENCES 147 +#define TK_GRANTS 148 +#define TK_QUERIES 149 +#define TK_SCORES 150 +#define TK_TOPICS 151 +#define TK_VARIABLES 152 +#define TK_CLUSTER 153 +#define TK_BNODES 154 +#define TK_SNODES 155 +#define TK_TRANSACTIONS 156 +#define TK_DISTRIBUTED 157 +#define TK_CONSUMERS 158 +#define TK_SUBSCRIPTIONS 159 +#define TK_VNODES 160 +#define TK_ALIVE 161 +#define TK_LIKE 162 +#define TK_TBNAME 163 +#define TK_QTAGS 164 +#define TK_AS 165 +#define TK_INDEX 166 +#define TK_FUNCTION 167 +#define TK_INTERVAL 168 +#define TK_COUNT 169 +#define TK_LAST_ROW 170 +#define TK_TOPIC 171 +#define TK_WITH 172 +#define TK_META 173 +#define TK_CONSUMER 174 +#define TK_GROUP 175 +#define TK_DESC 176 +#define TK_DESCRIBE 177 +#define TK_RESET 178 +#define TK_QUERY 179 +#define TK_CACHE 180 +#define TK_EXPLAIN 181 +#define TK_ANALYZE 182 +#define TK_VERBOSE 183 +#define TK_NK_BOOL 184 +#define TK_RATIO 185 +#define TK_NK_FLOAT 186 +#define TK_OUTPUTTYPE 187 +#define TK_AGGREGATE 188 +#define TK_BUFSIZE 189 +#define TK_STREAM 190 +#define TK_INTO 191 +#define TK_TRIGGER 192 +#define TK_AT_ONCE 193 +#define TK_WINDOW_CLOSE 194 +#define TK_IGNORE 195 +#define TK_EXPIRED 196 +#define TK_FILL_HISTORY 197 +#define TK_UPDATE 198 +#define TK_SUBTABLE 199 +#define TK_KILL 200 +#define TK_CONNECTION 201 +#define TK_TRANSACTION 202 +#define TK_BALANCE 203 +#define TK_VGROUP 204 +#define TK_MERGE 205 +#define TK_REDISTRIBUTE 206 +#define TK_SPLIT 207 +#define TK_DELETE 208 +#define TK_INSERT 209 +#define TK_NULL 210 +#define TK_NK_QUESTION 211 +#define TK_NK_ARROW 212 +#define TK_ROWTS 213 +#define TK_QSTART 214 +#define TK_QEND 215 +#define TK_QDURATION 216 +#define TK_WSTART 217 +#define TK_WEND 218 +#define TK_WDURATION 219 +#define TK_IROWTS 220 +#define TK_ISFILLED 221 +#define TK_CAST 222 +#define TK_NOW 223 +#define TK_TODAY 224 +#define TK_TIMEZONE 225 +#define TK_CLIENT_VERSION 226 +#define TK_SERVER_VERSION 227 +#define TK_SERVER_STATUS 228 +#define TK_CURRENT_USER 229 +#define TK_CASE 230 +#define TK_END 231 +#define TK_WHEN 232 +#define TK_THEN 233 +#define TK_ELSE 234 +#define TK_BETWEEN 235 +#define TK_IS 236 +#define TK_NK_LT 237 +#define TK_NK_GT 238 +#define TK_NK_LE 239 +#define TK_NK_GE 240 +#define TK_NK_NE 241 +#define TK_MATCH 242 +#define TK_NMATCH 243 +#define TK_CONTAINS 244 +#define TK_IN 245 +#define TK_JOIN 246 +#define TK_INNER 247 +#define TK_SELECT 248 +#define TK_DISTINCT 249 +#define TK_WHERE 250 +#define TK_PARTITION 251 +#define TK_BY 252 +#define TK_SESSION 253 +#define TK_STATE_WINDOW 254 +#define TK_EVENT_WINDOW 255 +#define TK_START 256 +#define TK_SLIDING 257 +#define TK_FILL 258 +#define TK_VALUE 259 +#define TK_VALUE_F 260 +#define TK_NONE 261 +#define TK_PREV 262 +#define TK_NULL_F 263 +#define TK_LINEAR 264 +#define TK_NEXT 265 +#define TK_HAVING 266 +#define TK_RANGE 267 +#define TK_EVERY 268 +#define TK_ORDER 269 +#define TK_SLIMIT 270 +#define TK_SOFFSET 271 +#define TK_LIMIT 272 +#define TK_OFFSET 273 +#define TK_ASC 274 +#define TK_NULLS 275 +#define TK_ABORT 276 +#define TK_AFTER 277 +#define TK_ATTACH 278 +#define TK_BEFORE 279 +#define TK_BEGIN 280 +#define TK_BITAND 281 +#define TK_BITNOT 282 +#define TK_BITOR 283 +#define TK_BLOCKS 284 +#define TK_CHANGE 285 +#define TK_COMMA 286 +#define TK_CONCAT 287 +#define TK_CONFLICT 288 +#define TK_COPY 289 +#define TK_DEFERRED 290 +#define TK_DELIMITERS 291 +#define TK_DETACH 292 +#define TK_DIVIDE 293 +#define TK_DOT 294 +#define TK_EACH 295 +#define TK_FAIL 296 +#define TK_FILE 297 +#define TK_FOR 298 +#define TK_GLOB 299 +#define TK_ID 300 +#define TK_IMMEDIATE 301 +#define TK_IMPORT 302 +#define TK_INITIALLY 303 +#define TK_INSTEAD 304 +#define TK_ISNULL 305 +#define TK_KEY 306 +#define TK_MODULES 307 +#define TK_NK_BITNOT 308 +#define TK_NK_SEMI 309 +#define TK_NOTNULL 310 +#define TK_OF 311 +#define TK_PLUS 312 +#define TK_PRIVILEGE 313 +#define TK_RAISE 314 +#define TK_REPLACE 315 +#define TK_RESTRICT 316 +#define TK_ROW 317 +#define TK_SEMI 318 +#define TK_STAR 319 +#define TK_STATEMENT 320 +#define TK_STRICT 321 +#define TK_STRING 322 +#define TK_TIMES 323 +#define TK_VALUES 324 +#define TK_VARIABLE 325 +#define TK_VIEW 326 +#define TK_WAL 327 #define TK_NK_SPACE 600 #define TK_NK_COMMENT 601 diff --git a/include/libs/cache/cache.h b/include/libs/cache/cache.h deleted file mode 100644 index 6a2587ee96..0000000000 --- a/include/libs/cache/cache.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * This program is free software: you can use, redistribute, and/or modify - * it under the terms of the GNU Affero General Public License, version 3 - * or later ("AGPL"), as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -#ifndef _TD_CACHE_H_ -#define _TD_CACHE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif /*_TD_CACHE_H_*/ \ No newline at end of file diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index e98e341f15..7b65c06b85 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -219,6 +219,7 @@ bool fmIsKeepOrderFunc(int32_t funcId); bool fmIsCumulativeFunc(int32_t funcId); bool fmIsInterpPseudoColumnFunc(int32_t funcId); bool fmIsGroupKeyFunc(int32_t funcId); +bool fmIsBlockDistFunc(int32_t funcId); void getLastCacheDataType(SDataType* pType); diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index d77f2b6233..164fbf018c 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -124,6 +124,11 @@ typedef struct STrimDatabaseStmt { int32_t maxSpeed; } STrimDatabaseStmt; +typedef struct SCompactDatabaseStmt { + ENodeType type; + char dbName[TSDB_DB_NAME_LEN]; +} SCompactDatabaseStmt; + typedef struct STableOptions { ENodeType type; bool commentNull; @@ -395,6 +400,7 @@ typedef struct SStreamOptions { SNode* pDeleteMark; int8_t fillHistory; int8_t ignoreExpired; + int8_t ignoreUpdate; } SStreamOptions; typedef struct SCreateStreamStmt { diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 24b436ec99..a2e4c76adc 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -155,7 +155,7 @@ typedef enum ENodeType { QUERY_NODE_EXPLAIN_STMT, QUERY_NODE_DESCRIBE_STMT, QUERY_NODE_RESET_QUERY_CACHE_STMT, - QUERY_NODE_COMPACT_STMT, + QUERY_NODE_COMPACT_DATABASE_STMT, QUERY_NODE_CREATE_FUNCTION_STMT, QUERY_NODE_DROP_FUNCTION_STMT, QUERY_NODE_CREATE_STREAM_STMT, diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index 3602225789..ad4b59714c 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -93,6 +93,7 @@ typedef struct SScanLogicNode { int64_t watermark; int64_t deleteMark; int8_t igExpired; + int8_t igCheckUpdate; SArray* pSmaIndexes; SNodeList* pGroupTags; bool groupSort; @@ -224,6 +225,7 @@ typedef struct SWindowLogicNode { int64_t watermark; int64_t deleteMark; int8_t igExpired; + int8_t igCheckUpdate; EWindowAlgorithm windowAlgo; EOrder inputTsOrder; EOrder outputTsOrder; @@ -364,6 +366,7 @@ typedef struct STableScanPhysiNode { int64_t watermark; int8_t igExpired; bool assignBlockUid; + int8_t igCheckUpdate; } STableScanPhysiNode; typedef STableScanPhysiNode STableSeqScanPhysiNode; @@ -562,6 +565,7 @@ typedef struct SQueryInserterNode { char tableName[TSDB_TABLE_NAME_LEN]; int32_t vgId; SEpSet epSet; + bool explain; } SQueryInserterNode; typedef struct SDataDeleterNode { diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index 2d14391247..1a9700907e 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -233,8 +233,10 @@ typedef struct SEventWindowNode { typedef enum EFillMode { FILL_MODE_NONE = 1, FILL_MODE_VALUE, + FILL_MODE_VALUE_F, FILL_MODE_PREV, FILL_MODE_NULL, + FILL_MODE_NULL_F, FILL_MODE_LINEAR, FILL_MODE_NEXT } EFillMode; diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h index f7bd68393e..41c0e98084 100644 --- a/include/libs/planner/planner.h +++ b/include/libs/planner/planner.h @@ -36,6 +36,7 @@ typedef struct SPlanContext { int64_t watermark; int64_t deleteMark; int8_t igExpired; + int8_t igCheckUpdate; char* pMsg; int32_t msgLen; const char* pUser; diff --git a/include/libs/wal/wal.h b/include/libs/wal/wal.h index a0f421212a..1eed342f8c 100644 --- a/include/libs/wal/wal.h +++ b/include/libs/wal/wal.h @@ -191,6 +191,7 @@ int32_t walApplyVer(SWal *, int64_t ver); // read SWalReader *walOpenReader(SWal *, SWalFilterCond *pCond); void walCloseReader(SWalReader *pRead); +void walReadReset(SWalReader *pReader); int32_t walReadVer(SWalReader *pRead, int64_t ver); int32_t walReadSeekVer(SWalReader *pRead, int64_t ver); int32_t walNextValidMsg(SWalReader *pRead); diff --git a/include/os/os.h b/include/os/os.h index 809b814491..309a977ff6 100644 --- a/include/os/os.h +++ b/include/os/os.h @@ -27,7 +27,11 @@ extern "C" { #if !defined(WINDOWS) #include + +#if !defined(_ALPINE) #include +#endif + #include #include #include diff --git a/include/os/osFile.h b/include/os/osFile.h index ae77e0f27a..0e93002706 100644 --- a/include/os/osFile.h +++ b/include/os/osFile.h @@ -110,6 +110,8 @@ bool taosValidFile(TdFilePtr pFile); int32_t taosGetErrorFile(TdFilePtr pFile); +int32_t taosCompressFile(char *srcFileName, char *destFileName); + #ifdef __cplusplus } #endif diff --git a/include/os/osSysinfo.h b/include/os/osSysinfo.h index dbe4d6801e..a8ccb67bfb 100644 --- a/include/os/osSysinfo.h +++ b/include/os/osSysinfo.h @@ -60,6 +60,13 @@ void taosSetCoreDump(bool enable); #endif // WINDOWS +#if defined(_ALPINE) + +#define _UTSNAME_LENGTH 65 +#define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH + +#endif + typedef struct { char sysname[_UTSNAME_MACHINE_LENGTH]; char nodename[_UTSNAME_MACHINE_LENGTH]; diff --git a/include/os/osSystem.h b/include/os/osSystem.h index 5154c56e4b..ba9f137b40 100644 --- a/include/os/osSystem.h +++ b/include/os/osSystem.h @@ -16,6 +16,11 @@ #ifndef _TD_OS_SYSTEM_H_ #define _TD_OS_SYSTEM_H_ +#ifdef _ALPINE +#define UNW_LOCAL_ONLY +#include +#endif + #ifdef __cplusplus extern "C" { #endif @@ -29,46 +34,124 @@ extern "C" { #define tcgetattr TCGETATTR_FUNC_TAOS_FORBID #endif -typedef struct TdCmd* TdCmdPtr; +typedef struct TdCmd *TdCmdPtr; -TdCmdPtr taosOpenCmd(const char* cmd); -int64_t taosGetsCmd(TdCmdPtr pCmd, int32_t maxSize, char* __restrict buf); -int64_t taosGetLineCmd(TdCmdPtr pCmd, char** __restrict ptrBuf); -int32_t taosEOFCmd(TdCmdPtr pCmd); -int64_t taosCloseCmd(TdCmdPtr* ppCmd); +TdCmdPtr taosOpenCmd(const char *cmd); -void* taosLoadDll(const char* filename); -void* taosLoadSym(void* handle, char* name); -void taosCloseDll(void* handle); +int64_t taosGetsCmd(TdCmdPtr pCmd, int32_t maxSize, char *__restrict buf); + +int64_t taosGetLineCmd(TdCmdPtr pCmd, char **__restrict ptrBuf); + +int32_t taosEOFCmd(TdCmdPtr pCmd); + +int64_t taosCloseCmd(TdCmdPtr *ppCmd); + +void *taosLoadDll(const char *filename); + +void *taosLoadSym(void *handle, char *name); + +void taosCloseDll(void *handle); int32_t taosSetConsoleEcho(bool on); -void taosSetTerminalMode(); + +void taosSetTerminalMode(); + int32_t taosGetOldTerminalMode(); -void taosResetTerminalMode(); + +void taosResetTerminalMode(); #define STACKSIZE 100 -#if !defined(WINDOWS) -#define taosLogTraceToBuf(buf, bufSize, ignoreNum) { \ - void* array[STACKSIZE]; \ - int32_t size = backtrace(array, STACKSIZE); \ - char** strings = backtrace_symbols(array, size); \ - int32_t offset = 0; \ - if (strings != NULL) { \ - offset = snprintf(buf, bufSize - 1, "obtained %d stack frames\n", (ignoreNum > 0) ? size - ignoreNum : size); \ - for (int32_t i = (ignoreNum > 0) ? ignoreNum : 0; i < size; i++) { \ - offset += snprintf(buf + offset, bufSize - 1 - offset, "frame:%d, %s\n", (ignoreNum > 0) ? i - ignoreNum : i, strings[i]); \ - } \ - } \ - \ - taosMemoryFree(strings); \ -} +#if defined(_ALPINE) +#define taosLogTraceToBuf(buf, bufSize, ignoreNum) \ + { \ + unw_cursor_t cursor; \ + unw_context_t context; \ + \ + unw_getcontext(&context); \ + unw_init_local(&cursor, &context); \ + \ + char *array[STACKSIZE]; \ + int32_t size = 0; \ + int32_t ignores = ignoreNum; \ + int32_t offset = 0; \ + while (unw_step(&cursor) > 0 && size < STACKSIZE) { \ + unw_word_t offset, pc; \ + char fname[64]; \ + unw_get_reg(&cursor, UNW_REG_IP, &pc); \ + fname[0] = '\0'; \ + (void)unw_get_proc_name(&cursor, fname, sizeof(fname), &offset); \ + size += 1; \ + array[size] = (char *)taosMemoryMalloc(sizeof(char) * STACKSIZE + 1); \ + snprintf(array[size], STACKSIZE, "0x%lx : (%s+0x%lx) [0x%lx]\n", (long)pc, fname, (long)offset, (long)pc); \ + } \ + if (ignoreNum < size && size > 0) { \ + offset = snprintf(buf, bufSize - 1, "obtained %d stack frames\n", (ignoreNum > 0) ? size - ignoreNum : size); \ + for (int32_t i = (ignoreNum > 0) ? ignoreNum : 0; i < size; i++) { \ + offset += snprintf(buf + offset, bufSize - 1 - offset, "frame:%d, %s\n", (ignoreNum > 0) ? i - ignoreNum : i, \ + array[i]); \ + } \ + } \ + for (int i = 0; i < size; i++) { \ + taosMemoryFree(array[i]); \ + } \ + } + +#define taosPrintTrace(flags, level, dflag, ignoreNum) \ + { \ + unw_cursor_t cursor; \ + unw_context_t context; \ + \ + unw_getcontext(&context); \ + unw_init_local(&cursor, &context); \ + \ + char *array[STACKSIZE]; \ + int32_t size = 0; \ + while (unw_step(&cursor) > 0 && size < STACKSIZE) { \ + unw_word_t offset, pc; \ + char fname[64]; \ + unw_get_reg(&cursor, UNW_REG_IP, &pc); \ + fname[0] = '\0'; \ + (void)unw_get_proc_name(&cursor, fname, sizeof(fname), &offset); \ + size += 1; \ + array[size] = (char *)taosMemoryMalloc(sizeof(char) * STACKSIZE + 1); \ + snprintf(array[size], STACKSIZE, "frame:%d, 0x%lx : (%s+0x%lx) [0x%lx]\n", size, (long)pc, fname, (long)offset, \ + (long)pc); \ + } \ + if (ignoreNum < size && size > 0) { \ + taosPrintLog(flags, level, dflag, "obtained %d stack frames", (ignoreNum > 0) ? size - ignoreNum : size); \ + for (int32_t i = (ignoreNum > 0) ? ignoreNum : 0; i < size; i++) { \ + taosPrintLog(flags, level, dflag, "frame:%d, %s", (ignoreNum > 0) ? i - ignoreNum : i, array[i]); \ + } \ + } \ + for (int i = 0; i < size; i++) { \ + taosMemoryFree(array[i]); \ + } \ + } + +#elif !defined(WINDOWS) +#define taosLogTraceToBuf(buf, bufSize, ignoreNum) \ + { \ + void *array[STACKSIZE]; \ + int32_t size = backtrace(array, STACKSIZE); \ + char **strings = backtrace_symbols(array, size); \ + int32_t offset = 0; \ + if (strings != NULL) { \ + offset = snprintf(buf, bufSize - 1, "obtained %d stack frames\n", (ignoreNum > 0) ? size - ignoreNum : size); \ + for (int32_t i = (ignoreNum > 0) ? ignoreNum : 0; i < size; i++) { \ + offset += snprintf(buf + offset, bufSize - 1 - offset, "frame:%d, %s\n", (ignoreNum > 0) ? i - ignoreNum : i, \ + strings[i]); \ + } \ + } \ + \ + taosMemoryFree(strings); \ + } #define taosPrintTrace(flags, level, dflag, ignoreNum) \ { \ - void* array[STACKSIZE]; \ - int32_t size = backtrace(array, STACKSIZE); \ - char** strings = backtrace_symbols(array, size); \ + void *array[STACKSIZE]; \ + int32_t size = backtrace(array, STACKSIZE); \ + char **strings = backtrace_symbols(array, size); \ if (strings != NULL) { \ taosPrintLog(flags, level, dflag, "obtained %d stack frames", (ignoreNum > 0) ? size - ignoreNum : size); \ for (int32_t i = (ignoreNum > 0) ? ignoreNum : 0; i < size; i++) { \ @@ -80,65 +163,70 @@ void taosResetTerminalMode(); } #else -#include #include +#include -#define taosLogTraceToBuf(buf, bufSize, ignoreNum) { \ - unsigned int i; \ - void* stack[STACKSIZE]; \ - unsigned short frames; \ - SYMBOL_INFO* symbol; \ - HANDLE process; \ - int32_t offset = 0; \ - \ - process = GetCurrentProcess(); \ - \ - SymInitialize(process, NULL, TRUE); \ - \ - frames = CaptureStackBackTrace(0, STACKSIZE, stack, NULL); \ - symbol = (SYMBOL_INFO*)calloc(sizeof(SYMBOL_INFO) + 256 * sizeof(char), 1); \ - if (symbol != NULL) { \ - symbol->MaxNameLen = 255; \ - symbol->SizeOfStruct = sizeof(SYMBOL_INFO); \ - \ - if (frames > 0) { \ - offset = snprintf(buf, bufSize - 1, "obtained %d stack frames\n", (ignoreNum > 0) ? frames - ignoreNum : frames); \ - for (i = (ignoreNum > 0) ? ignoreNum : 0; i < frames; i++) { \ - SymFromAddr(process, (DWORD64)(stack[i]), 0, symbol); \ - offset += snprintf(buf + offset, bufSize - 1 - offset, "frame:%i, %s - 0x%0X\n", (ignoreNum > 0) ? i - ignoreNum : i, symbol->Name, symbol->Address); \ - } \ - } \ - free(symbol); \ - } \ +#define taosLogTraceToBuf(buf, bufSize, ignoreNum) \ + { \ + unsigned int i; \ + void *stack[STACKSIZE]; \ + unsigned short frames; \ + SYMBOL_INFO *symbol; \ + HANDLE process; \ + int32_t offset = 0; \ + \ + process = GetCurrentProcess(); \ + \ + SymInitialize(process, NULL, TRUE); \ + \ + frames = CaptureStackBackTrace(0, STACKSIZE, stack, NULL); \ + symbol = (SYMBOL_INFO *)calloc(sizeof(SYMBOL_INFO) + 256 * sizeof(char), 1); \ + if (symbol != NULL) { \ + symbol->MaxNameLen = 255; \ + symbol->SizeOfStruct = sizeof(SYMBOL_INFO); \ + \ + if (frames > 0) { \ + offset = \ + snprintf(buf, bufSize - 1, "obtained %d stack frames\n", (ignoreNum > 0) ? frames - ignoreNum : frames); \ + for (i = (ignoreNum > 0) ? ignoreNum : 0; i < frames; i++) { \ + SymFromAddr(process, (DWORD64)(stack[i]), 0, symbol); \ + offset += snprintf(buf + offset, bufSize - 1 - offset, "frame:%i, %s - 0x%0X\n", \ + (ignoreNum > 0) ? i - ignoreNum : i, symbol->Name, symbol->Address); \ + } \ + } \ + free(symbol); \ + } \ } -#define taosPrintTrace(flags, level, dflag, ignoreNum) \ +#define taosPrintTrace(flags, level, dflag, ignoreNum) \ { \ - unsigned int i; \ - void* stack[STACKSIZE]; \ - unsigned short frames; \ - SYMBOL_INFO* symbol; \ - HANDLE process; \ - \ - process = GetCurrentProcess(); \ - \ - SymInitialize(process, NULL, TRUE); \ - \ - frames = CaptureStackBackTrace(0, STACKSIZE, stack, NULL); \ - symbol = (SYMBOL_INFO*)calloc(sizeof(SYMBOL_INFO) + 256 * sizeof(char), 1); \ - if (symbol != NULL) { \ - symbol->MaxNameLen = 255; \ - symbol->SizeOfStruct = sizeof(SYMBOL_INFO); \ - \ - if (frames > 0) { \ - taosPrintLog(flags, level, dflag, "obtained %d stack frames\n", (ignoreNum > 0) ? frames - ignoreNum : frames); \ - for (i = (ignoreNum > 0) ? ignoreNum : 0; i < frames; i++) { \ - SymFromAddr(process, (DWORD64)(stack[i]), 0, symbol); \ - taosPrintLog(flags, level, dflag, "frame:%i, %s - 0x%0X\n", (ignoreNum > 0) ? i - ignoreNum : i, symbol->Name, symbol->Address); \ - } \ - } \ - free(symbol); \ - } \ + unsigned int i; \ + void *stack[STACKSIZE]; \ + unsigned short frames; \ + SYMBOL_INFO *symbol; \ + HANDLE process; \ + \ + process = GetCurrentProcess(); \ + \ + SymInitialize(process, NULL, TRUE); \ + \ + frames = CaptureStackBackTrace(0, STACKSIZE, stack, NULL); \ + symbol = (SYMBOL_INFO *)calloc(sizeof(SYMBOL_INFO) + 256 * sizeof(char), 1); \ + if (symbol != NULL) { \ + symbol->MaxNameLen = 255; \ + symbol->SizeOfStruct = sizeof(SYMBOL_INFO); \ + \ + if (frames > 0) { \ + taosPrintLog(flags, level, dflag, "obtained %d stack frames\n", \ + (ignoreNum > 0) ? frames - ignoreNum : frames); \ + for (i = (ignoreNum > 0) ? ignoreNum : 0; i < frames; i++) { \ + SymFromAddr(process, (DWORD64)(stack[i]), 0, symbol); \ + taosPrintLog(flags, level, dflag, "frame:%i, %s - 0x%0X\n", (ignoreNum > 0) ? i - ignoreNum : i, \ + symbol->Name, symbol->Address); \ + } \ + } \ + free(symbol); \ + } \ } #endif diff --git a/include/os/osThread.h b/include/os/osThread.h index 916d463733..aa0dc066c6 100644 --- a/include/os/osThread.h +++ b/include/os/osThread.h @@ -22,7 +22,7 @@ extern "C" { #endif -#ifndef WINDOWS +#if !defined(WINDOWS) && !defined(_ALPINE) #ifndef __USE_XOPEN2K #define TD_USE_SPINLOCK_AS_MUTEX typedef pthread_mutex_t pthread_spinlock_t; @@ -100,7 +100,11 @@ typedef pthread_key_t TdThreadKey; #define pthread_condattr_init PTHREAD_CONDATTR_INIT_FUNC_TAOS_FORBID #define pthread_condattr_setpshared PTHREAD_CONDATTR_SETPSHARED_FUNC_TAOS_FORBID #define pthread_detach PTHREAD_DETACH_FUNC_TAOS_FORBID + +#if !defined(_ALPINE) #define pthread_equal PTHREAD_EQUAL_FUNC_TAOS_FORBID +#endif + #define pthread_exit PTHREAD_EXIT_FUNC_TAOS_FORBID #define pthread_getschedparam PTHREAD_GETSCHEDPARAM_FUNC_TAOS_FORBID #define pthread_getspecific PTHREAD_GETSPECIFIC_FUNC_TAOS_FORBID diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 52d8a75ee0..c75425425b 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -111,6 +111,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x012A) #define TSDB_CODE_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x012B) #define TSDB_CODE_TIMEOUT_ERROR TAOS_DEF_ERROR_CODE(0, 0x012C) +#define TSDB_CODE_MSG_ENCODE_ERROR TAOS_DEF_ERROR_CODE(0, 0x012D) #define TSDB_CODE_APP_IS_STARTING TAOS_DEF_ERROR_CODE(0, 0x0130) // #define TSDB_CODE_APP_IS_STOPPING TAOS_DEF_ERROR_CODE(0, 0x0131) // @@ -357,6 +358,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_MND_STREAM_MUST_BE_DELETED TAOS_DEF_ERROR_CODE(0, 0x03F3) #define TSDB_CODE_MND_STREAM_TASK_DROPPED TAOS_DEF_ERROR_CODE(0, 0x03F4) #define TSDB_CODE_MND_MULTI_REPLICA_SOURCE_DB TAOS_DEF_ERROR_CODE(0, 0x03F5) +#define TSDB_CODE_MND_TOO_MANY_STREAMS TAOS_DEF_ERROR_CODE(0, 0x03F6) // mnode-sma #define TSDB_CODE_MND_SMA_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0480) diff --git a/include/util/trbtree.h b/include/util/trbtree.h index 7c93c8dd8d..e226419440 100644 --- a/include/util/trbtree.h +++ b/include/util/trbtree.h @@ -33,9 +33,12 @@ typedef int32_t (*tRBTreeCmprFn)(const SRBTreeNode *, const SRBTreeNode *); #define tRBTreeMax(T) ((T)->max == ((T)->NIL) ? NULL : (T)->max) void tRBTreeCreate(SRBTree *pTree, tRBTreeCmprFn cmprFn); +void tRBTreeClear(SRBTree *pTree); SRBTreeNode *tRBTreePut(SRBTree *pTree, SRBTreeNode *z); void tRBTreeDrop(SRBTree *pTree, SRBTreeNode *z); SRBTreeNode *tRBTreeDropByKey(SRBTree *pTree, void *pKey); +SRBTreeNode *tRBTreeDropMin(SRBTree *pTree); +SRBTreeNode *tRBTreeDropMax(SRBTree *pTree); SRBTreeNode *tRBTreeGet(SRBTree *pTree, const SRBTreeNode *pKeyNode); // SRBTreeIter ============================================= diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index dfdbaa6fdd..5aeff0e2fa 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -35,6 +35,20 @@ dumpName="taosdump" demoName="taosdemo" xname="taosx" +clientName2="taos" +serverName2="taosd" +productName2="TDengine" +emailName2="taosdata.com" + +benchmarkName2="${clientName2}Benchmark" +dumpName2="${clientName2}dump" +uninstallScript2="rm${clientName2}" + +historyFile="${clientName2}_history" +logDir="/var/log/${clientName2}" +configDir="/etc/${clientName2}" +installDir="/usr/local/${clientName}" + data_dir=${dataDir} log_dir=${logDir} cfg_install_dir=${configDir} @@ -217,6 +231,13 @@ function install_bin() { [ -x ${install_main_dir}/bin/TDinsight.sh ] && ${csudo}ln -s ${install_main_dir}/bin/TDinsight.sh ${bin_link_dir}/TDinsight.sh || : [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} || : [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || : + + if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then + [ -x ${install_main_dir}/bin/${clientName} ] && ${csudo}ln -s ${install_main_dir}/bin/${clientName} ${bin_link_dir}/${clientName2} || : + [ -x ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -s ${install_main_dir}/bin/${benchmarkName} ${bin_link_dir}/${benchmarkName2} || : + [ -x ${install_main_dir}/bin/${dumpName} ] && ${csudo}ln -s ${install_main_dir}/bin/${dumpName} ${bin_link_dir}/${dumpName2} || : + [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript2} || : + fi } function install_lib() { @@ -518,7 +539,7 @@ function install_config() { local_fqdn_check echo - echo -e -n "${GREEN}Enter FQDN:port (like h1.${emailName}:6030) of an existing ${productName} cluster node to join${NC}" + echo -e -n "${GREEN}Enter FQDN:port (like h1.${emailName2}:6030) of an existing ${productName2} cluster node to join${NC}" echo echo -e -n "${GREEN}OR leave it blank to build one${NC}:" read firstEp @@ -655,6 +676,9 @@ function clean_service_on_systemd() { fi ${csudo}systemctl disable tarbitratord &>/dev/null || echo &>/dev/null ${csudo}rm -f ${tarbitratord_service_config} + # if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then + # ${csudo}rm -f ${service_config_dir}/${serverName2}.service + # fi } function install_service_on_systemd() { @@ -663,6 +687,13 @@ function install_service_on_systemd() { [ -f ${script_dir}/cfg/${serverName}.service ] && ${csudo}cp ${script_dir}/cfg/${serverName}.service \ ${service_config_dir}/ || : + + # if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then + # [ -f ${script_dir}/cfg/${serverName}.service ] && + # ${csudo}cp ${script_dir}/cfg/${serverName}.service \ + # ${service_config_dir}/${serverName2}.service || : + # fi + ${csudo}systemctl daemon-reload ${csudo}systemctl enable ${serverName} @@ -793,7 +824,7 @@ function updateProduct() { tar -zxf ${tarName} install_jemalloc - echo -e "${GREEN}Start to update ${productName}...${NC}" + echo -e "${GREEN}Start to update ${productName2}...${NC}" # Stop the service if running if ps aux | grep -v grep | grep ${serverName} &>/dev/null; then if ((${service_mod} == 0)); then @@ -830,25 +861,25 @@ function updateProduct() { echo echo -e "${GREEN_DARK}To configure ${productName} ${NC}: edit ${cfg_install_dir}/${configFile}" [ -f ${configDir}/taosadapter.toml ] && [ -f ${installDir}/bin/taosadapter ] && \ - echo -e "${GREEN_DARK}To configure Taos Adapter ${NC}: edit ${configDir}/taosadapter.toml" + echo -e "${GREEN_DARK}To configure Adapter ${NC}: edit ${configDir}/taosadapter.toml" if ((${service_mod} == 0)); then echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}systemctl start ${serverName}${NC}" [ -f ${service_config_dir}/taosadapter.service ] && [ -f ${installDir}/bin/taosadapter ] && \ - echo -e "${GREEN_DARK}To start Taos Adatper ${NC}: ${csudo}systemctl start taosadapter ${NC}" + echo -e "${GREEN_DARK}To start Adatper ${NC}: ${csudo}systemctl start taosadapter ${NC}" elif ((${service_mod} == 1)); then echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}service ${serverName} start${NC}" [ -f ${service_config_dir}/taosadapter.service ] && [ -f ${installDir}/bin/taosadapter ] && \ - echo -e "${GREEN_DARK}To start Taos Adapter ${NC}: ${csudo}service taosadapter start${NC}" + echo -e "${GREEN_DARK}To start Adapter ${NC}: ${csudo}service taosadapter start${NC}" else echo -e "${GREEN_DARK}To start ${productName} ${NC}: ./${serverName}${NC}" [ -f ${installDir}/bin/taosadapter ] && \ - echo -e "${GREEN_DARK}To start Taos Adapter ${NC}: taosadapter &${NC}" + echo -e "${GREEN_DARK}To start ${clientName} Adapter ${NC}: taosadapter &${NC}" fi if [ ${openresty_work} = 'true' ]; then - echo -e "${GREEN_DARK}To access ${productName} ${NC}: use ${GREEN_UNDERLINE}${clientName} -h $serverFqdn${NC} in shell OR from ${GREEN_UNDERLINE}http://127.0.0.1:${web_port}${NC}" + echo -e "${GREEN_DARK}To access ${productName2} ${NC}: use ${GREEN_UNDERLINE}${clientName2} -h $serverFqdn${NC} in shell OR from ${GREEN_UNDERLINE}http://127.0.0.1:${web_port}${NC}" else - echo -e "${GREEN_DARK}To access ${productName} ${NC}: use ${GREEN_UNDERLINE}${clientName} -h $serverFqdn${NC} in shell${NC}" + echo -e "${GREEN_DARK}To access ${productName2} ${NC}: use ${GREEN_UNDERLINE}${clientName2} -h $serverFqdn${NC} in shell${NC}" fi if ((${prompt_force} == 1)); then @@ -856,13 +887,13 @@ function updateProduct() { echo -e "${RED}Please run '${serverName} --force-keep-file' at first time for the exist ${productName} $exist_version!${NC}" fi echo - echo -e "\033[44;32;1m${productName} is updated successfully!${NC}" + echo -e "\033[44;32;1m${productName2} is updated successfully!${NC}" else install_bin install_config echo - echo -e "\033[44;32;1m${productName} client is updated successfully!${NC}" + echo -e "\033[44;32;1m${productName2} client is updated successfully!${NC}" fi rm -rf $(tar -tf ${tarName} | grep -v "^\./$") @@ -876,7 +907,7 @@ function installProduct() { fi tar -zxf ${tarName} - echo -e "${GREEN}Start to install ${productName}...${NC}" + echo -e "${GREEN}Start to install ${productName2}...${NC}" install_main_path @@ -965,7 +996,7 @@ serverFqdn=$(hostname) if [ "$verType" == "server" ]; then # Check default 2.x data file. if [ -x ${data_dir}/dnode/dnodeCfg.json ]; then - echo -e "\033[44;31;5mThe default data directory ${data_dir} contains old data of tdengine 2.x, please clear it before installing!\033[0m" + echo -e "\033[44;31;5mThe default data directory ${data_dir} contains old data of ${productName2} 2.x, please clear it before installing!\033[0m" else # Install server and client if [ -x ${bin_dir}/${serverName} ]; then diff --git a/packaging/tools/install_client.sh b/packaging/tools/install_client.sh index f7d677c982..1543c59297 100755 --- a/packaging/tools/install_client.sh +++ b/packaging/tools/install_client.sh @@ -23,6 +23,16 @@ osType=Linux pagMode=full verMode=edge +clientName2="taos" +serverName2="taosd" +productName2="TDengine" +emailName2="taosdata.com" + +benchmarkName2="${clientName2}Benchmark" +dumpName2="${clientName2}dump" +demoName2="${clientName2}demo" +uninstallScript2="rm${clientName2}" + if [ "$osType" != "Darwin" ]; then script_dir=$(dirname $(readlink -f "$0")) # Dynamic directory @@ -112,6 +122,15 @@ function install_bin() { fi [ -x ${install_main_dir}/bin/remove_client.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_client.sh ${bin_link_dir}/${uninstallScript} || : [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || : + + if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then + #Make link + [ -x ${install_main_dir}/bin/${clientName} ] && ${csudo}ln -s ${install_main_dir}/bin/${clientName} ${bin_link_dir}/${clientName2} || : + if [ "$osType" != "Darwin" ]; then + [ -x ${install_main_dir}/bin/taosdemo ] && ${csudo}ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/${demoName2} || : + fi + [ -x ${install_main_dir}/bin/remove_client.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_client.sh ${bin_link_dir}/${uninstallScript2} || : + fi } function clean_lib() { @@ -263,9 +282,9 @@ function update_TDengine() { exit 1 fi tar -zxf ${tarName} - echo -e "${GREEN}Start to update ${productName} client...${NC}" + echo -e "${GREEN}Start to update ${productName2} client...${NC}" # Stop the client shell if running - if ps aux | grep -v grep | grep ${clientName} &> /dev/null; then + if ps aux | grep -v grep | grep ${clientName2} &> /dev/null; then kill_client sleep 1 fi @@ -284,7 +303,7 @@ function update_TDengine() { install_config echo - echo -e "\033[44;32;1m${productName} client is updated successfully!${NC}" + echo -e "\033[44;32;1m${productName2} client is updated successfully!${NC}" rm -rf $(tar -tf ${tarName}) } @@ -296,7 +315,7 @@ function install_TDengine() { exit 1 fi tar -zxf ${tarName} - echo -e "${GREEN}Start to install ${productName} client...${NC}" + echo -e "${GREEN}Start to install ${productName2} client...${NC}" install_main_path install_log @@ -311,7 +330,7 @@ function install_TDengine() { install_config echo - echo -e "\033[44;32;1m${productName} client is installed successfully!${NC}" + echo -e "\033[44;32;1m${productName2} client is installed successfully!${NC}" rm -rf $(tar -tf ${tarName}) } @@ -321,7 +340,7 @@ function install_TDengine() { # Install or updata client and client # if server is already install, don't install client if [ -e ${bin_dir}/${serverName} ]; then - echo -e "\033[44;32;1mThere are already installed ${productName} server, so don't need install client!${NC}" + echo -e "\033[44;32;1mThere are already installed ${productName2} server, so don't need install client!${NC}" exit 0 fi diff --git a/packaging/tools/make_install.bat b/packaging/tools/make_install.bat index bf7418ad79..f5ed1cdf66 100644 --- a/packaging/tools/make_install.bat +++ b/packaging/tools/make_install.bat @@ -2,12 +2,20 @@ for /F %%a in ('echo prompt $E ^| cmd') do set "ESC=%%a" -goto %1 +if "%1" NEQ "" goto %1 + :needAdmin if exist C:\\TDengine\\data\\dnode\\dnodeCfg.json ( echo The default data directory C:/TDengine/data contains old data of tdengine 2.x, please clear it before installing! ) + +rem // stop and delete service +mshta vbscript:createobject("shell.application").shellexecute("%~s0",":stop_delete","","runas",1)(window.close) +echo This might take a few moment to accomplish deleting service taosd/taosadapter ... +call :check_svc taosd +call :check_svc taosadapter + set source_dir=%2 set source_dir=%source_dir:/=\\% set binary_dir=%3 @@ -87,7 +95,6 @@ if %Enterprise% == TRUE ( copy %binary_dir%\\build\\bin\\taosd.exe %target_dir% > nul copy %binary_dir%\\build\\bin\\udfd.exe %target_dir% > nul - if exist %binary_dir%\\build\\bin\\taosadapter.exe ( copy %binary_dir%\\build\\bin\\taosadapter.exe %target_dir% > nul ) @@ -107,22 +114,23 @@ goto :eof :hasAdmin -sc query "taosd" && sc stop taosd && sc delete taosd -sc query "taosadapter" && sc stop taosadapter && sc delete taosd +call :stop_delete +call :check_svc taosd +call :check_svc taosadapter copy /y C:\\TDengine\\driver\\taos.dll C:\\Windows\\System32 > nul if exist C:\\TDengine\\driver\\taosws.dll ( copy /y C:\\TDengine\\driver\\taosws.dll C:\\Windows\\System32 > nul ) -sc query "taosd" >nul || sc create "taosd" binPath= "C:\\TDengine\\taosd.exe --win_service" start= DEMAND -sc query "taosadapter" >nul || sc create "taosadapter" binPath= "C:\\TDengine\\taosadapter.exe" start= DEMAND +rem // create services +sc create "taosd" binPath= "C:\\TDengine\\taosd.exe --win_service" start= DEMAND +sc create "taosadapter" binPath= "C:\\TDengine\\taosadapter.exe" start= DEMAND set "env=HKLM\System\CurrentControlSet\Control\Session Manager\Environment" for /f "tokens=2*" %%I in ('reg query "%env%" /v Path ^| findstr /i "\"') do ( - rem // make addition persistent through reboots - reg add "%env%" /f /v Path /t REG_EXPAND_SZ /d "%%J;C:\TDengine" + call :append_if_not_exists %%J rem // apply change to the current process for %%a in ("%%J;C:\TDengine") do path %%~a @@ -132,3 +140,36 @@ rem // use setx to set a temporary throwaway value to trigger a WM_SETTINGCHANGE rem // applies change to new console windows without requiring a reboot (setx /m foo bar & reg delete "%env%" /f /v foo) >NUL 2>NUL +goto :end + +:append_if_not_exists +set "_origin_paths=%*" +set "_paths=%*" +set "_found=0" +:loop +for /f "tokens=1* delims=;" %%x in ("%_paths%") do ( + if "%%x" EQU "C:\TDengine" ( + set "_found=1" + ) else ( + set "_paths=%%y" + goto :loop + ) +) +if "%_found%" == "0" ( + rem // make addition persistent through reboots + reg add "%env%" /f /v Path /t REG_EXPAND_SZ /d "%_origin_paths%;C:\TDengine" +) +exit /B 0 + +:stop_delete +sc stop taosd +sc delete taosd +sc stop taosadapter +sc delete taosadapter +exit /B 0 + +:check_svc +sc query %1 >nul 2>nul && goto :check_svc %1 +exit /B 0 + +:end diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index 9034fd85f5..cb99f67e70 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # This file is used to install TAOS time-series database on linux systems. The operating system # is required to use systemd to manage services at boot @@ -340,7 +340,7 @@ function install_lib() { #install_avro lib64 if [ "$osType" != "Darwin" ]; then - ${csudo}ldconfig + ${csudo}ldconfig /etc/ld.so.conf.d fi } diff --git a/packaging/tools/makeclient.sh b/packaging/tools/makeclient.sh index db28de8dec..208bfc183c 100755 --- a/packaging/tools/makeclient.sh +++ b/packaging/tools/makeclient.sh @@ -13,7 +13,13 @@ osType=$5 verMode=$6 verType=$7 pagMode=$8 -dbName=$9 +#comVersion=$9 +dbName=$10 + +productName2="${11}" +#serverName2="${12}d" +clientName2="${12}" +# cusEmail2=${13} productName="TDengine" clientName="taos" @@ -38,15 +44,21 @@ release_dir="${top_dir}/release" #package_name='linux' if [ "$verMode" == "cluster" ]; then - install_dir="${release_dir}/${productName}-enterprise-client-${version}" + install_dir="${release_dir}/${productName2}-enterprise-client-${version}" elif [ "$verMode" == "cloud" ]; then - install_dir="${release_dir}/${productName}-cloud-client-${version}" + install_dir="${release_dir}/${productName2}-cloud-client-${version}" else - install_dir="${release_dir}/${productName}-client-${version}" + install_dir="${release_dir}/${productName2}-client-${version}" fi # Directories and files. +if [ "$verMode" == "cluster" ]; then + sed -i 's/verMode=edge/verMode=cluster/g' ${script_dir}/remove_client.sh + sed -i "s/clientName2=\"taos\"/clientName2=\"${clientName2}\"/g" ${script_dir}/remove_client.sh + sed -i "s/productName2=\"TDengine\"/productName2=\"${productName2}\"/g" ${script_dir}/remove_client.sh +fi + if [ "$osType" != "Darwin" ]; then if [ "$pagMode" == "lite" ]; then strip ${build_dir}/bin/${clientName} @@ -131,22 +143,28 @@ fi cd ${curr_dir} cp ${install_files} ${install_dir} +cp ${install_dir}/install_client.sh install_client_temp.sh if [ "$osType" == "Darwin" ]; then - sed 's/osType=Linux/osType=Darwin/g' ${install_dir}/install_client.sh >>install_client_temp.sh + sed -i 's/osType=Linux/osType=Darwin/g' install_client_temp.sh mv install_client_temp.sh ${install_dir}/install_client.sh fi if [ "$verMode" == "cluster" ]; then - sed 's/verMode=edge/verMode=cluster/g' ${install_dir}/install_client.sh >>install_client_temp.sh + sed -i 's/verMode=edge/verMode=cluster/g' install_client_temp.sh + sed -i "s/serverName2=\"taosd\"/serverName2=\"${serverName2}\"/g" install_client_temp.sh + sed -i "s/clientName2=\"taos\"/clientName2=\"${clientName2}\"/g" install_client_temp.sh + sed -i "s/productName2=\"TDengine\"/productName2=\"${productName2}\"/g" install_client_temp.sh + sed -i "s/emailName2=\"taosdata.com\"/emailName2=\"${cusEmail2}\"/g" install_client_temp.sh + mv install_client_temp.sh ${install_dir}/install_client.sh fi if [ "$verMode" == "cloud" ]; then - sed 's/verMode=edge/verMode=cloud/g' ${install_dir}/install_client.sh >>install_client_temp.sh + sed -i 's/verMode=edge/verMode=cloud/g' install_client_temp.sh mv install_client_temp.sh ${install_dir}/install_client.sh fi if [ "$pagMode" == "lite" ]; then - sed 's/pagMode=full/pagMode=lite/g' ${install_dir}/install_client.sh >>install_client_temp.sh + sed -i 's/pagMode=full/pagMode=lite/g' install_client_temp.sh mv install_client_temp.sh ${install_dir}/install_client.sh fi chmod a+x ${install_dir}/install_client.sh diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index 0ee548242f..0a34d81b7f 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -16,6 +16,10 @@ verType=$7 pagMode=$8 versionComp=$9 dbName=${10} +productName2="${11}" +serverName2="${12}d" +clientName2="${12}" +cusEmail2="${13}" script_dir="$(dirname $(readlink -f $0))" top_dir="$(readlink -f ${script_dir}/../..)" @@ -38,11 +42,11 @@ release_dir="${top_dir}/release" #package_name='linux' if [ "$verMode" == "cluster" ]; then - install_dir="${release_dir}/${productName}-enterprise-server-${version}" + install_dir="${release_dir}/${productName2}-enterprise-server-${version}" elif [ "$verMode" == "cloud" ]; then - install_dir="${release_dir}/${productName}-cloud-server-${version}" + install_dir="${release_dir}/${productName2}-cloud-server-${version}" else - install_dir="${release_dir}/${productName}-server-${version}" + install_dir="${release_dir}/${productName2}-server-${version}" fi if [ -d ${top_dir}/tools/taos-tools/packaging/deb ]; then @@ -50,11 +54,11 @@ if [ -d ${top_dir}/tools/taos-tools/packaging/deb ]; then [ -z "$taos_tools_ver" ] && taos_tools_ver="0.1.0" taostools_ver=$(git tag |grep -v taos | sort | tail -1) - taostools_install_dir="${release_dir}/${clientName}Tools-${taostools_ver}" + taostools_install_dir="${release_dir}/${clientName2}Tools-${taostools_ver}" cd ${curr_dir} else - taostools_install_dir="${release_dir}/${clientName}Tools-${version}" + taostools_install_dir="${release_dir}/${clientName2}Tools-${version}" fi # Directories and files @@ -225,6 +229,10 @@ fi if [ "$verMode" == "cluster" ]; then sed 's/verMode=edge/verMode=cluster/g' ${install_dir}/bin/remove.sh >>remove_temp.sh + sed -i "s/serverName2=\"taosd\"/serverName2=\"${serverName2}\"/g" remove_temp.sh + sed -i "s/clientName2=\"taos\"/clientName2=\"${clientName2}\"/g" remove_temp.sh + sed -i "s/productName2=\"TDengine\"/productName2=\"${productName2}\"/g" remove_temp.sh + sed -i "s/emailName2=\"taosdata.com\"/emailName2=\"${cusEmail2}\"/g" remove_temp.sh mv remove_temp.sh ${install_dir}/bin/remove.sh fi if [ "$verMode" == "cloud" ]; then @@ -247,16 +255,21 @@ fi cd ${curr_dir} cp ${install_files} ${install_dir} +cp ${install_dir}/install.sh install_temp.sh if [ "$verMode" == "cluster" ]; then - sed 's/verMode=edge/verMode=cluster/g' ${install_dir}/install.sh >>install_temp.sh + sed -i 's/verMode=edge/verMode=cluster/g' install_temp.sh + sed -i "s/serverName2=\"taosd\"/serverName2=\"${serverName2}\"/g" install_temp.sh + sed -i "s/clientName2=\"taos\"/clientName2=\"${clientName2}\"/g" install_temp.sh + sed -i "s/productName2=\"TDengine\"/productName2=\"${productName2}\"/g" install_temp.sh + sed -i "s/emailName2=\"taosdata.com\"/emailName2=\"${cusEmail2}\"/g" install_temp.sh mv install_temp.sh ${install_dir}/install.sh fi if [ "$verMode" == "cloud" ]; then - sed 's/verMode=edge/verMode=cloud/g' ${install_dir}/install.sh >>install_temp.sh + sed -i 's/verMode=edge/verMode=cloud/g' install_temp.sh mv install_temp.sh ${install_dir}/install.sh fi if [ "$pagMode" == "lite" ]; then - sed 's/pagMode=full/pagMode=lite/g' ${install_dir}/install.sh >>install_temp.sh + sed -i 's/pagMode=full/pagMode=lite/g' install_temp.sh mv install_temp.sh ${install_dir}/install.sh fi chmod a+x ${install_dir}/install.sh diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index 8e5630ec2f..9c50c4582d 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -36,6 +36,16 @@ clientName="taos" uninstallScript="rmtaos" productName="TDengine" +serverName2="taosd" +clientName2="taos" +productName2="TDengine" + +benchmarkName2="${clientName2}Benchmark" +dumpName2="${clientName2}dump" +uninstallScript2="rm${clientName2}" + +installDir="/usr/local/${clientName}" + #install main path install_main_dir=${installDir} data_link_dir=${installDir}/data @@ -107,6 +117,15 @@ function clean_bin() { ${csudo}rm -f ${bin_link_dir}/tarbitrator || : ${csudo}rm -f ${bin_link_dir}/set_core || : ${csudo}rm -f ${bin_link_dir}/TDinsight.sh || : + ${csudo}rm -f ${bin_link_dir}/taoskeeper || : + ${csudo}rm -f ${bin_link_dir}/taosx || : + + if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then + ${csudo}rm -f ${bin_link_dir}/${clientName2} || : + ${csudo}rm -f ${bin_link_dir}/${benchmarkName2} || : + ${csudo}rm -f ${bin_link_dir}/${dumpName2} || : + ${csudo}rm -f ${bin_link_dir}/${uninstallScript2} || : + fi } function clean_local_bin() { @@ -147,7 +166,7 @@ function clean_log() { function clean_service_on_systemd() { taosd_service_config="${service_config_dir}/${taos_service_name}.service" if systemctl is-active --quiet ${taos_service_name}; then - echo "${productName} ${serverName} is running, stopping it..." + echo "${productName2} ${serverName2} is running, stopping it..." ${csudo}systemctl stop ${taos_service_name} &>/dev/null || echo &>/dev/null fi ${csudo}systemctl disable ${taos_service_name} &>/dev/null || echo &>/dev/null @@ -155,7 +174,7 @@ function clean_service_on_systemd() { taosadapter_service_config="${service_config_dir}/taosadapter.service" if systemctl is-active --quiet ${taosadapter_service_name}; then - echo "${productName} taosAdapter is running, stopping it..." + echo "${productName2} ${clientName2}Adapter is running, stopping it..." ${csudo}systemctl stop ${taosadapter_service_name} &>/dev/null || echo &>/dev/null fi ${csudo}systemctl disable ${taosadapter_service_name} &>/dev/null || echo &>/dev/null @@ -163,7 +182,7 @@ function clean_service_on_systemd() { tarbitratord_service_config="${service_config_dir}/${tarbitrator_service_name}.service" if systemctl is-active --quiet ${tarbitrator_service_name}; then - echo "${productName} tarbitrator is running, stopping it..." + echo "${productName2} tarbitrator is running, stopping it..." ${csudo}systemctl stop ${tarbitrator_service_name} &>/dev/null || echo &>/dev/null fi ${csudo}systemctl disable ${tarbitrator_service_name} &>/dev/null || echo &>/dev/null @@ -172,12 +191,12 @@ function clean_service_on_systemd() { function clean_service_on_sysvinit() { if ps aux | grep -v grep | grep ${serverName} &>/dev/null; then - echo "${productName} ${serverName} is running, stopping it..." + echo "${productName2} ${serverName2} is running, stopping it..." ${csudo}service ${serverName} stop || : fi if ps aux | grep -v grep | grep tarbitrator &>/dev/null; then - echo "${productName} tarbitrator is running, stopping it..." + echo "${productName2} tarbitrator is running, stopping it..." ${csudo}service tarbitratord stop || : fi @@ -272,5 +291,5 @@ if [ "$osType" = "Darwin" ]; then ${csudo}rm -rf /Applications/TDengine.app fi -echo -e "${GREEN}${productName} is removed successfully!${NC}" +echo -e "${GREEN}${productName2} is removed successfully!${NC}" echo diff --git a/packaging/tools/remove_client.sh b/packaging/tools/remove_client.sh index 7ab7fa8599..10a0fb5e02 100755 --- a/packaging/tools/remove_client.sh +++ b/packaging/tools/remove_client.sh @@ -12,6 +12,15 @@ installDir="/usr/local/taos" clientName="taos" uninstallScript="rmtaos" +clientName2="taos" +productName2="TDengine" + +benchmarkName2="${clientName}Benchmark" +dumpName2="${clientName}dump" +uninstallScript2="rm${clientName}" + +installDir="/usr/local/${clientName}" + #install main path install_main_dir=${installDir} @@ -40,6 +49,12 @@ function clean_bin() { ${csudo}rm -f ${bin_link_dir}/taosdump || : ${csudo}rm -f ${bin_link_dir}/${uninstallScript} || : ${csudo}rm -f ${bin_link_dir}/set_core || : + + if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then + ${csudo}rm -f ${bin_link_dir}/${clientName2} || : + ${csudo}rm -f ${bin_link_dir}/${dumpName2} || : + ${csudo}rm -f ${bin_link_dir}/${uninstallScript2} || : + fi } function clean_lib() { @@ -82,5 +97,5 @@ clean_config ${csudo}rm -rf ${install_main_dir} -echo -e "${GREEN}TDengine client is removed successfully!${NC}" +echo -e "${GREEN}${productName2} client is removed successfully!${NC}" echo diff --git a/packaging/tools/tdengine.iss b/packaging/tools/tdengine.iss index 3a22c73774..91c6ad1c66 100644 --- a/packaging/tools/tdengine.iss +++ b/packaging/tools/tdengine.iss @@ -18,7 +18,6 @@ #define MyAppDLLName "\driver\*.dll" ;#define MyAppVersion "3.0" ;#define MyAppInstallName "TDengine" -;#define MyAppInstallName "TDengine" [Setup] VersionInfoVersion={#MyAppVersion} AppId={{A0F7A93C-79C4-485D-B2B8-F0D03DF42FAB} @@ -59,11 +58,14 @@ Source: {#MyAppSourceDir}{#MyAppDriverName}; DestDir: "{app}\driver"; Flags: igN Source: {#MyAppSourceDir}{#MyAppIncludeName}; DestDir: "{app}\include"; Flags: igNoreversion recursesubdirs createallsubdirs Source: {#MyAppSourceDir}{#MyAppExeName}; DestDir: "{app}"; Excludes: {#MyAppExcludeSource} ; Flags: igNoreversion recursesubdirs createallsubdirs Source: {#MyAppSourceDir}{#MyAppTaosdemoExeName}; DestDir: "{app}"; Flags: igNoreversion recursesubdirs createallsubdirs +Source: {#MyAppSourceDir}\taos.exe; DestDir: "{app}"; DestName: "{#CusPrompt}.EXE"; Flags: igNoreversion recursesubdirs createallsubdirs +Source: {#MyAppSourceDir}\taosBenchmark.exe; DestDir: "{app}"; DestName: "{#CusPrompt}Benchmark.EXE"; Flags: igNoreversion recursesubdirs createallsubdirs +Source: {#MyAppSourceDir}\taosdump.exe; DestDir: "{app}"; DestName: "{#CusPrompt}dump.EXE"; Flags: igNoreversion recursesubdirs createallsubdirs [run] -Filename: {sys}\sc.exe; Parameters: "create taosd start= DEMAND binPath= ""C:\\TDengine\\taosd.exe --win_service""" ; Flags: runhidden -Filename: {sys}\sc.exe; Parameters: "create taosadapter start= DEMAND binPath= ""C:\\TDengine\\taosadapter.exe""" ; Flags: runhidden +Filename: {sys}\sc.exe; Parameters: "create taosd start= DEMAND binPath= ""C:\\{#CusName}\\taosd.exe --win_service""" ; Flags: runhidden +Filename: {sys}\sc.exe; Parameters: "create taosadapter start= DEMAND binPath= ""C:\\{#CusName}\\taosadapter.exe""" ; Flags: runhidden [UninstallRun] RunOnceId: "stoptaosd"; Filename: {sys}\sc.exe; Parameters: "stop taosd" ; Flags: runhidden @@ -73,8 +75,8 @@ RunOnceId: "deltaosadapter"; Filename: {sys}\sc.exe; Parameters: "delete taosada [Registry] Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \ - ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};C:\TDengine"; \ - Check: NeedsAddPath('C:\TDengine') + ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};C:\{#CusName}"; \ + Check: NeedsAddPath('C:\{#CusName}') [Code] function NeedsAddPath(Param: string): boolean; @@ -104,11 +106,11 @@ Name: "desktopicon";Description: "{cm:CreateDesktopIcon}"; GroupDescription:"{cm [Icons] Name:"{group}\Taos Shell"; Filename: "{app}\include\{#MyAppTaosExeName}" ; Parameters: "taos.exe" ; IconFilename: "{app}\include\{#MyAppIco}" -Name:"{group}\Open TDengine Directory"; Filename: "{app}\" +Name:"{group}\Open {#CusName} Directory"; Filename: "{app}\" Name:"{group}\Taosdemo"; Filename: "{app}\include\{#MyAppTaosExeName}" ; Parameters: "taosdemo.exe" ; IconFilename: "{app}\include\{#MyAppIco}" Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" ; IconFilename: "{app}\include\{#MyAppIco}" Name:"{commondesktop}\Taos Shell"; Filename: "{app}\include\{#MyAppTaosExeName}" ; Parameters: "taos.exe" ; Tasks: desktopicon; WorkingDir: "{app}" ; IconFilename: "{app}\include\{#MyAppIco}" [Messages] -ConfirmUninstall=Do you really want to uninstall TDengine from your computer?%n%nPress [Y] to completely delete %1 and all its components;%nPress [N] to keep the software on your computer. +ConfirmUninstall=Do you really want to uninstall {#CusName} from your computer?%n%nPress [Y] to completely delete %1 and all its components;%nPress [N] to keep the software on your computer. diff --git a/source/client/CMakeLists.txt b/source/client/CMakeLists.txt index 0c445c7fbf..d0cfd38fb9 100644 --- a/source/client/CMakeLists.txt +++ b/source/client/CMakeLists.txt @@ -62,4 +62,4 @@ target_link_libraries( if(${BUILD_TEST}) ADD_SUBDIRECTORY(test) -endif(${BUILD_TEST}) \ No newline at end of file +endif(${BUILD_TEST}) diff --git a/source/client/inc/clientSml.h b/source/client/inc/clientSml.h index 311260e3fb..3dcba673bf 100644 --- a/source/client/inc/clientSml.h +++ b/source/client/inc/clientSml.h @@ -99,6 +99,7 @@ typedef struct { char *tags; char *cols; char *timestamp; + char *measureTag; int32_t measureLen; int32_t measureTagsLen; @@ -114,7 +115,7 @@ typedef struct { int32_t sTableNameLen; char childTableName[TSDB_TABLE_NAME_LEN]; uint64_t uid; - void *key; // for openTsdb +// void *key; // for openTsdb SArray *tags; @@ -166,8 +167,8 @@ typedef struct { int32_t ttl; int32_t uid; // used for automatic create child table - NodeList *childTables; - NodeList *superTables; + SHashObj *childTables; + SHashObj *superTables; SHashObj *pVgHash; STscObj *taos; diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 2c53fe4080..f63a2ebde0 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -138,6 +138,12 @@ STscObj* taos_connect_internal(const char* ip, const char* user, const char* pas p->mgmtEp = epSet; taosThreadMutexInit(&p->qnodeMutex, NULL); p->pTransporter = openTransporter(user, secretEncrypt, tsNumOfCores / 2); + if (p->pTransporter == NULL) { + taosThreadMutexUnlock(&appInfo.mutex); + taosMemoryFreeClear(key); + taosMemoryFree(p); + return NULL; + } p->pAppHbMgr = appHbMgrInit(p, key); if (NULL == p->pAppHbMgr) { destroyAppInst(p); @@ -1386,8 +1392,6 @@ int32_t doProcessMsgFromServer(void* param) { tscError("0x%" PRIx64 " rsp msg:%s, code:%s rspLen:%d, elapsed time:%d ms, reqId:0x%" PRIx64, pRequest->self, TMSG_INFO(pMsg->msgType), tstrerror(pMsg->code), pMsg->contLen, elapsed / 1000, pRequest->requestId); } - - taosReleaseRef(clientReqRefPool, pSendInfo->requestObjRefId); } } @@ -1407,6 +1411,11 @@ int32_t doProcessMsgFromServer(void* param) { } pSendInfo->fp(pSendInfo->param, &buf, pMsg->code); + + if (pTscObj) { + taosReleaseRef(clientReqRefPool, pSendInfo->requestObjRefId); + } + rpcFreeCont(pMsg->pCont); destroySendMsgInfo(pSendInfo); @@ -1444,6 +1453,7 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { tscError("failed to sched msg to tsc, tsc ready to quit"); rpcFreeCont(pMsg->pCont); taosMemoryFree(arg->pEpset); + destroySendMsgInfo(pMsg->info.ahandle); taosMemoryFree(arg); } } diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 95e1255827..191d028cec 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -694,7 +694,11 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) { pReq.numOfColumns = req.schemaRow.nCols; pReq.numOfTags = req.schemaTag.nCols; pReq.commentLen = -1; +<<<<<<< HEAD pReq.suid = processSuid(req.suid, pRequest->pDb);; +======= + pReq.suid = processSuid(req.suid, pRequest->pDb); +>>>>>>> 6483b92f0c645b36facfb2f3415b8df9449264cf pReq.source = TD_REQ_FROM_TAOX; pReq.igExists = true; @@ -1512,11 +1516,11 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) { } SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(rspObj.rsp.blockSchema, rspObj.resIter); - TAOS_FIELD* fields = taosMemoryCalloc(pSW->nCols, sizeof(TAOS_FIELD)); - if(fields == NULL){ + TAOS_FIELD* fields = taosMemoryCalloc(pSW->nCols, sizeof(TAOS_FIELD)); + if (fields == NULL) { goto end; } - for(int i = 0; i < pSW->nCols; i++){ + for (int i = 0; i < pSW->nCols; i++) { fields[i].type = pSW->pSchema[i].type; fields[i].bytes = pSW->pSchema[i].bytes; tstrncpy(fields[i].name, pSW->pSchema[i].name, tListLen(pSW->pSchema[i].name)); @@ -1627,7 +1631,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) void** dataTmp = taosArrayGet(rspObj.rsp.createTableReq, j); int32_t* lenTmp = taosArrayGet(rspObj.rsp.createTableLen, j); - SDecoder decoderTmp = {0}; + SDecoder decoderTmp = {0}; SVCreateTbReq pCreateReq = {0}; tDecoderInit(&decoderTmp, *dataTmp, *lenTmp); if (tDecodeSVCreateTbReq(&decoderTmp, &pCreateReq) < 0) { @@ -1651,9 +1655,9 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) tDecoderClear(&decoderTmp); } - if(pCreateReqDst){ + if (pCreateReqDst) { strcpy(pName.tname, pCreateReqDst->ctb.stbName); - }else{ + } else { strcpy(pName.tname, tbName); } code = catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta); @@ -1674,9 +1678,9 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) goto end; } - if(pCreateReqDst){ + if (pCreateReqDst) { pTableMeta->vgId = vg.vgId; - pTableMeta->uid = pCreateReqDst->uid; + pTableMeta->uid = pCreateReqDst->uid; } void* hData = taosHashGet(pVgHash, &vg.vgId, sizeof(vg.vgId)); if (hData == NULL) { @@ -1684,11 +1688,11 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) } SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(rspObj.rsp.blockSchema, rspObj.resIter); - TAOS_FIELD* fields = taosMemoryCalloc(pSW->nCols, sizeof(TAOS_FIELD)); - if(fields == NULL){ + TAOS_FIELD* fields = taosMemoryCalloc(pSW->nCols, sizeof(TAOS_FIELD)); + if (fields == NULL) { goto end; } - for(int i = 0; i < pSW->nCols; i++){ + for (int i = 0; i < pSW->nCols; i++) { fields[i].type = pSW->pSchema[i].type; fields[i].bytes = pSW->pSchema[i].bytes; tstrncpy(fields[i].name, pSW->pSchema[i].name, tListLen(pSW->pSchema[i].name)); diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index e21fcd64b8..60002425f7 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -759,13 +759,13 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { conn.requestObjRefId = info->pRequest->self; conn.mgmtEps = getEpSet_s(&info->taos->pAppInfo->mgmtEp); - NodeList *tmp = info->superTables; + SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashIterate(info->superTables, NULL); while (tmp) { - SSmlSTableMeta *sTableData = (SSmlSTableMeta *)tmp->data.value; + SSmlSTableMeta *sTableData = *tmp; bool needCheckMeta = false; // for multi thread - size_t superTableLen = (size_t)tmp->data.keyLen; - const void *superTable = tmp->data.key; + size_t superTableLen = 0; + void *superTable = taosHashGetKey(tmp, &superTableLen); memset(pName.tname, 0, TSDB_TABLE_NAME_LEN); memcpy(pName.tname, superTable, superTableLen); @@ -914,7 +914,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { sTableData->tableMeta = pTableMeta; - tmp = tmp->next; + tmp = (SSmlSTableMeta **)taosHashIterate(info->superTables, tmp); } return 0; @@ -1017,11 +1017,11 @@ void smlDestroyTableInfo(SSmlHandle *info, SSmlTableInfo *tag) { taosHashCleanup(kvHash); } - if (info->parseJsonByLib) { - SSmlLineInfo *key = (SSmlLineInfo *)(tag->key); - if (key != NULL) taosMemoryFree(key->tags); - } - taosMemoryFree(tag->key); + // if (info->parseJsonByLib) { + // SSmlLineInfo *key = (SSmlLineInfo *)(tag->key); + // if (key != NULL) taosMemoryFree(key->tags); + // } + // taosMemoryFree(tag->key); taosArrayDestroy(tag->cols); taosArrayDestroy(tag->tags); taosMemoryFree(tag); @@ -1042,29 +1042,23 @@ void smlDestroyInfo(SSmlHandle *info) { qDestroyQuery(info->pQuery); // destroy info->childTables - NodeList *tmp = info->childTables; - while (tmp) { - if (tmp->data.used) { - smlDestroyTableInfo(info, (SSmlTableInfo *)tmp->data.value); - } - NodeList *t = tmp->next; - taosMemoryFree(tmp); - tmp = t; + SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, NULL); + while (oneTable) { + smlDestroyTableInfo(info, *oneTable); + oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, oneTable); } // destroy info->superTables - tmp = info->superTables; - while (tmp) { - if (tmp->data.used) { - smlDestroySTableMeta((SSmlSTableMeta *)tmp->data.value); - } - NodeList *t = tmp->next; - taosMemoryFree(tmp); - tmp = t; + SSmlSTableMeta **oneSTable = (SSmlSTableMeta **)taosHashIterate(info->superTables, NULL); + while (oneSTable) { + smlDestroySTableMeta(*oneSTable); + oneSTable = (SSmlSTableMeta **)taosHashIterate(info->superTables, oneSTable); } // destroy info->pVgHash taosHashCleanup(info->pVgHash); + taosHashCleanup(info->childTables); + taosHashCleanup(info->superTables); for (int i = 0; i < taosArrayGetSize(info->tagJsonArray); i++) { cJSON *tags = (cJSON *)taosArrayGetP(info->tagJsonArray, i); @@ -1088,6 +1082,7 @@ void smlDestroyInfo(SSmlHandle *info) { if (info->parseJsonByLib) { taosMemoryFree(info->lines[i].tags); } + if (info->lines[i].measureTagsLen != 0) taosMemoryFree(info->lines[i].measureTag); } taosMemoryFree(info->lines); } @@ -1112,6 +1107,9 @@ SSmlHandle *smlBuildSmlInfo(TAOS *taos) { } info->pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); + info->childTables = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + info->superTables = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + info->id = smlGenId(); info->pQuery = smlInitHandle(); info->dataFormat = true; @@ -1122,7 +1120,7 @@ SSmlHandle *smlBuildSmlInfo(TAOS *taos) { info->maxTagKVs = taosArrayInit(8, sizeof(SSmlKv)); info->preLineColKV = taosArrayInit(8, sizeof(SSmlKv)); - if (NULL == info->pVgHash) { + if (NULL == info->pVgHash || NULL == info->childTables || NULL == info->superTables) { uError("create SSmlHandle failed"); goto cleanup; } @@ -1156,11 +1154,13 @@ static int32_t smlParseLineBottom(SSmlHandle *info) { SSmlLineInfo *elements = info->lines + i; SSmlTableInfo *tinfo = NULL; if (info->protocol == TSDB_SML_LINE_PROTOCOL) { - tinfo = (SSmlTableInfo *)nodeListGet(info->childTables, elements->measure, elements->measureTagsLen, NULL); + tinfo = *(SSmlTableInfo **)taosHashGet(info->childTables, elements->measure, elements->measureTagsLen); } else if (info->protocol == TSDB_SML_TELNET_PROTOCOL) { - tinfo = (SSmlTableInfo *)nodeListGet(info->childTables, elements, POINTER_BYTES, is_same_child_table_telnet); + tinfo = *(SSmlTableInfo **)taosHashGet(info->childTables, elements->measureTag, + elements->measureLen + elements->tagsLen); } else { - tinfo = (SSmlTableInfo *)nodeListGet(info->childTables, elements, POINTER_BYTES, is_same_child_table_telnet); + tinfo = *(SSmlTableInfo **)taosHashGet(info->childTables, elements->measureTag, + elements->measureLen + elements->tagsLen); } if (tinfo == NULL) { @@ -1184,12 +1184,12 @@ static int32_t smlParseLineBottom(SSmlHandle *info) { return ret; } - SSmlSTableMeta *tableMeta = - (SSmlSTableMeta *)nodeListGet(info->superTables, elements->measure, elements->measureLen, NULL); + SSmlSTableMeta **tableMeta = + (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); if (tableMeta) { // update meta - ret = smlUpdateMeta(tableMeta->colHash, tableMeta->cols, elements->colArray, false, &info->msgBuf); + ret = smlUpdateMeta((*tableMeta)->colHash, (*tableMeta)->cols, elements->colArray, false, &info->msgBuf); if (ret == TSDB_CODE_SUCCESS) { - ret = smlUpdateMeta(tableMeta->tagHash, tableMeta->tags, tinfo->tags, true, &info->msgBuf); + ret = smlUpdateMeta((*tableMeta)->tagHash, (*tableMeta)->tags, tinfo->tags, true, &info->msgBuf); } if (ret != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlUpdateMeta failed", info->id); @@ -1205,7 +1205,7 @@ static int32_t smlParseLineBottom(SSmlHandle *info) { SSmlSTableMeta *meta = smlBuildSTableMeta(info->dataFormat); smlInsertMeta(meta->tagHash, meta->tags, tinfo->tags); smlInsertMeta(meta->colHash, meta->cols, elements->colArray); - nodeListSet(&info->superTables, elements->measure, elements->measureLen, meta, NULL); + taosHashPut(info->superTables, elements->measure, elements->measureLen, &meta, POINTER_BYTES); } } @@ -1215,9 +1215,9 @@ static int32_t smlParseLineBottom(SSmlHandle *info) { static int32_t smlInsertData(SSmlHandle *info) { int32_t code = TSDB_CODE_SUCCESS; - NodeList *tmp = info->childTables; - while (tmp) { - SSmlTableInfo *tableData = (SSmlTableInfo *)tmp->data.value; + SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, NULL); + while (oneTable) { + SSmlTableInfo *tableData = *oneTable; SName pName = {TSDB_TABLE_NAME_T, info->taos->acctId, {0}, {0}}; tstrncpy(pName.dbname, info->pRequest->pDb, sizeof(pName.dbname)); @@ -1237,25 +1237,25 @@ static int32_t smlInsertData(SSmlHandle *info) { } taosHashPut(info->pVgHash, (const char *)&vg.vgId, sizeof(vg.vgId), (char *)&vg, sizeof(vg)); - SSmlSTableMeta *pMeta = - (SSmlSTableMeta *)nodeListGet(info->superTables, tableData->sTableName, tableData->sTableNameLen, NULL); - if (unlikely(NULL == pMeta || NULL == pMeta->tableMeta)) { + SSmlSTableMeta **pMeta = + (SSmlSTableMeta **)taosHashGet(info->superTables, tableData->sTableName, tableData->sTableNameLen); + if (unlikely(NULL == pMeta || NULL == (*pMeta)->tableMeta)) { uError("SML:0x%" PRIx64 " NULL == pMeta. table name: %s", info->id, tableData->childTableName); return TSDB_CODE_SML_INTERNAL_ERROR; } // use tablemeta of stable to save vgid and uid of child table - pMeta->tableMeta->vgId = vg.vgId; - pMeta->tableMeta->uid = tableData->uid; // one table merge data block together according uid + (*pMeta)->tableMeta->vgId = vg.vgId; + (*pMeta)->tableMeta->uid = tableData->uid; // one table merge data block together according uid - code = smlBindData(info->pQuery, info->dataFormat, tableData->tags, pMeta->cols, tableData->cols, pMeta->tableMeta, - tableData->childTableName, tableData->sTableName, tableData->sTableNameLen, info->ttl, - info->msgBuf.buf, info->msgBuf.len); + code = smlBindData(info->pQuery, info->dataFormat, tableData->tags, (*pMeta)->cols, tableData->cols, + (*pMeta)->tableMeta, tableData->childTableName, tableData->sTableName, tableData->sTableNameLen, + info->ttl, info->msgBuf.buf, info->msgBuf.len); if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlBindData failed", info->id); return code; } - tmp = tmp->next; + oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, oneTable); } code = smlBuildOutput(info->pQuery, info->pVgHash); @@ -1288,25 +1288,22 @@ static void smlPrintStatisticInfo(SSmlHandle *info) { int32_t smlClearForRerun(SSmlHandle *info) { info->reRun = false; // clear info->childTables - NodeList *pList = info->childTables; - while (pList) { - if (pList->data.used) { - smlDestroyTableInfo(info, (SSmlTableInfo *)pList->data.value); - pList->data.used = false; - } - pList = pList->next; + SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, NULL); + while (oneTable) { + smlDestroyTableInfo(info, *oneTable); + oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, oneTable); } // clear info->superTables - pList = info->superTables; - while (pList) { - if (pList->data.used) { - smlDestroySTableMeta((SSmlSTableMeta *)pList->data.value); - pList->data.used = false; - } - pList = pList->next; + SSmlSTableMeta **oneSTable = (SSmlSTableMeta **)taosHashIterate(info->superTables, NULL); + while (oneSTable) { + smlDestroySTableMeta(*oneSTable); + oneSTable = (SSmlSTableMeta **)taosHashIterate(info->superTables, oneSTable); } + taosHashClear(info->childTables); + taosHashClear(info->superTables); + if (!info->dataFormat) { if (unlikely(info->lines != NULL)) { uError("SML:0x%" PRIx64 " info->lines != NULL", info->id); @@ -1375,6 +1372,7 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char if (info->dataFormat) { SSmlLineInfo element = {0}; code = smlParseTelnetString(info, (char *)tmp, (char *)tmp + len, &element); + if (element.measureTagsLen != 0) taosMemoryFree(element.measureTag); } else { code = smlParseTelnetString(info, (char *)tmp, (char *)tmp + len, info->lines + i); } @@ -1418,15 +1416,15 @@ static int smlProcess(SSmlHandle *info, char *lines[], char *rawLine, char *rawL } info->cost.lineNum = info->lineNum; - info->cost.numOfSTables = nodeListSize(info->superTables); - info->cost.numOfCTables = nodeListSize(info->childTables); + info->cost.numOfSTables = taosHashGetSize(info->superTables); + info->cost.numOfCTables = taosHashGetSize(info->childTables); info->cost.schemaTime = taosGetTimestampUs(); do { code = smlModifyDBSchemas(info); if (code == 0) break; - } while (retryNum++ < nodeListSize(info->superTables) * MAX_RETRY_TIMES); + } while (retryNum++ < taosHashGetSize(info->superTables) * MAX_RETRY_TIMES); if (code != 0) { uError("SML:0x%" PRIx64 " smlModifyDBSchemas error : %s", info->id, tstrerror(code)); @@ -1504,7 +1502,7 @@ TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine, request->code = code; info->cost.endTime = taosGetTimestampUs(); info->cost.code = code; - // smlPrintStatisticInfo(info); + smlPrintStatisticInfo(info); end: smlDestroyInfo(info); diff --git a/source/client/src/clientSmlJson.c b/source/client/src/clientSmlJson.c index db1ca5a421..a437fd238c 100644 --- a/source/client/src/clientSmlJson.c +++ b/source/client/src/clientSmlJson.c @@ -256,7 +256,7 @@ int smlJsonParseObjFirst(char **start, SSmlLineInfo *element, int8_t *offset){ if(unlikely(index >= OTD_JSON_FIELDS_NUM)) { uError("index >= %d, %s", OTD_JSON_FIELDS_NUM, *start) - break; + return -1; } char *sTmp = *start; @@ -275,6 +275,7 @@ int smlJsonParseObjFirst(char **start, SSmlLineInfo *element, int8_t *offset){ } if(unlikely(isInQuote && *(*start) == '"')){ element->measureLen = (*start) - element->measure; + (*start)++; break; } (*start)++; @@ -384,7 +385,7 @@ int smlJsonParseObj(char **start, SSmlLineInfo *element, int8_t *offset){ if(unlikely(index >= OTD_JSON_FIELDS_NUM)) { uError("index >= %d, %s", OTD_JSON_FIELDS_NUM, *start) - break; + return -1; } if((*start)[1] == 'm'){ @@ -393,6 +394,7 @@ int smlJsonParseObj(char **start, SSmlLineInfo *element, int8_t *offset){ while(*(*start)){ if(unlikely(*(*start) == '"')){ element->measureLen = (*start) - element->measure; + (*start)++; break; } (*start)++; @@ -406,15 +408,14 @@ int smlJsonParseObj(char **start, SSmlLineInfo *element, int8_t *offset){ element->timestampLen = tmp - (*start); *start = tmp; } - continue; - } - - while(*(*start)){ - if(unlikely(*(*start) == ',' || *(*start) == '}' || (*(*start)) <= 32)){ - element->timestampLen = (*start) - element->timestamp; - break; + }else{ + while(*(*start)){ + if(unlikely(*(*start) == ',' || *(*start) == '}' || (*(*start)) <= 32)){ + element->timestampLen = (*start) - element->timestamp; + break; + } + (*start)++; } - (*start)++; } }else if((*start)[1] == 'v'){ (*start) += offset[index++]; @@ -425,14 +426,14 @@ int smlJsonParseObj(char **start, SSmlLineInfo *element, int8_t *offset){ element->colsLen = tmp - (*start); *start = tmp; } - continue; - } - while(*(*start)){ - if(unlikely( *(*start) == ',' || *(*start) == '}' || (*(*start)) <= 32)){ - element->colsLen = (*start) - element->cols; - break; + }else{ + while(*(*start)){ + if(unlikely( *(*start) == ',' || *(*start) == '}' || (*(*start)) <= 32)){ + element->colsLen = (*start) - element->cols; + break; + } + (*start)++; } - (*start)++; } }else if((*start)[1] == 't' && (*start)[2] == 'a'){ (*start) += offset[index++]; @@ -442,7 +443,6 @@ int smlJsonParseObj(char **start, SSmlLineInfo *element, int8_t *offset){ element->tagsLen = tmp - (*start); *start = tmp; } - continue; } if(*(*start) == '}'){ (*start)++; @@ -694,9 +694,9 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo SArray *superKV = NULL; if(info->dataFormat){ if(unlikely(!isSameMeasure)){ - SSmlSTableMeta *sMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, elements->measure, elements->measureLen, NULL); - - if(unlikely(sMeta == NULL)){ + SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); + SSmlSTableMeta *sMeta = NULL; + if(unlikely(tmp == NULL)){ STableMeta * pTableMeta = smlGetMeta(info, elements->measure, elements->measureLen); if(pTableMeta == NULL){ info->dataFormat = false; @@ -705,10 +705,11 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo } sMeta = smlBuildSTableMeta(info->dataFormat); sMeta->tableMeta = pTableMeta; - nodeListSet(&info->superTables, elements->measure, elements->measureLen, sMeta, NULL); + taosHashPut(info->superTables, elements->measure, elements->measureLen, &sMeta, POINTER_BYTES); + tmp = &sMeta; } - info->currSTableMeta = sMeta->tableMeta; - superKV = sMeta->tags; + info->currSTableMeta = (*tmp)->tableMeta; + superKV = (*tmp)->tags; if(unlikely(taosArrayGetSize(superKV) == 0)){ isSuperKVInit = false; @@ -761,13 +762,13 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo SSmlKv *maxKV = (SSmlKv *)taosArrayGet(maxKVs, cnt); if(unlikely(kv.length > maxKV->length)){ maxKV->length = kv.length; - SSmlSTableMeta *tableMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, elements->measure, elements->measureLen, NULL); + SSmlSTableMeta **tableMeta = (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); if(unlikely(NULL == tableMeta)){ uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id); return TSDB_CODE_SML_INTERNAL_ERROR; } - SSmlKv *oldKV = (SSmlKv *)taosArrayGet(tableMeta->tags, cnt); + SSmlKv *oldKV = (SSmlKv *)taosArrayGet((*tableMeta)->tags, cnt); oldKV->length = kv.length; info->needModifySchema = true; } @@ -808,8 +809,14 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo cnt++; } - SSmlTableInfo *tinfo = (SSmlTableInfo *)nodeListGet(info->childTables, elements, POINTER_BYTES, is_same_child_table_telnet); - if (unlikely(tinfo == NULL)) { + elements->measureTag = (char*)taosMemoryMalloc(elements->measureLen + elements->tagsLen); + memcpy(elements->measureTag, elements->measure, elements->measureLen); + memcpy(elements->measureTag + elements->measureLen, elements->tags, elements->tagsLen); + elements->measureTagsLen = elements->measureLen + elements->tagsLen; + + SSmlTableInfo **tmp = (SSmlTableInfo **)taosHashGet(info->childTables, elements->measureTag, elements->measureLen + elements->tagsLen); + SSmlTableInfo *tinfo = NULL; + if (unlikely(tmp == NULL)) { tinfo = smlBuildTableInfo(1, elements->measure, elements->measureLen); if (unlikely(!tinfo)) { return TSDB_CODE_OUT_OF_MEMORY; @@ -828,17 +835,18 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo } } - SSmlLineInfo *key = (SSmlLineInfo *)taosMemoryMalloc(sizeof(SSmlLineInfo)); - *key = *elements; - if(info->parseJsonByLib){ - key->tags = taosMemoryMalloc(elements->tagsLen + 1); - memcpy(key->tags, elements->tags, elements->tagsLen); - key->tags[elements->tagsLen] = 0; - } - tinfo->key = key; - nodeListSet(&info->childTables, key, POINTER_BYTES, tinfo, is_same_child_table_telnet); +// SSmlLineInfo *key = (SSmlLineInfo *)taosMemoryMalloc(sizeof(SSmlLineInfo)); +// *key = *elements; +// if(info->parseJsonByLib){ +// key->tags = taosMemoryMalloc(elements->tagsLen + 1); +// memcpy(key->tags, elements->tags, elements->tagsLen); +// key->tags[elements->tagsLen] = 0; +// } +// tinfo->key = key; + taosHashPut(info->childTables, elements->measureTag, elements->measureLen + elements->tagsLen, &tinfo, POINTER_BYTES); + tmp = &tinfo; } - if (info->dataFormat) info->currTableDataCtx = tinfo->tableDataCtx; + if (info->dataFormat) info->currTableDataCtx = (*tmp)->tableDataCtx; return ret; } @@ -1011,6 +1019,8 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo elements->tags = NULL; return ret; } + }else{ + elements->measureTag = info->preLine.measureTag; } if(needFree){ @@ -1189,6 +1199,8 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo * uError("OTD:0x%" PRIx64 " Unable to parse tags from JSON payload", info->id); return ret; } + }else{ + elements->measureTag = info->preLine.measureTag; } if(unlikely(info->reRun)){ @@ -1259,6 +1271,7 @@ int32_t smlParseJSON(SSmlHandle *info, char *payload) { if(info->dataFormat) { SSmlLineInfo element = {0}; ret = smlParseJSONString(info, &dataPointStart, &element); + if(element.measureTagsLen != 0) taosMemoryFree(element.measureTag); }else{ if(cnt >= payloadNum){ payloadNum = payloadNum << 1; @@ -1269,6 +1282,7 @@ int32_t smlParseJSON(SSmlHandle *info, char *payload) { } } ret = smlParseJSONString(info, &dataPointStart, info->lines + cnt); + if((info->lines + cnt)->measure == NULL) break; } if (unlikely(ret != TSDB_CODE_SUCCESS)) { uError("SML:0x%" PRIx64 " Invalid JSON Payload 1:%s", info->id, payload); diff --git a/source/client/src/clientSmlLine.c b/source/client/src/clientSmlLine.c index 890245f53d..e1fd8c2a81 100644 --- a/source/client/src/clientSmlLine.c +++ b/source/client/src/clientSmlLine.c @@ -148,9 +148,9 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SArray *superKV = NULL; if(info->dataFormat){ if(unlikely(!isSameMeasure)){ - SSmlSTableMeta *sMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, currElement->measure, currElement->measureLen, NULL); - - if(unlikely(sMeta == NULL)){ + SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, currElement->measure, currElement->measureLen); + SSmlSTableMeta *sMeta = NULL; + if(unlikely(tmp == NULL)){ STableMeta * pTableMeta = smlGetMeta(info, currElement->measure, currElement->measureLen); if(pTableMeta == NULL){ info->dataFormat = false; @@ -159,10 +159,11 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, } sMeta = smlBuildSTableMeta(info->dataFormat); sMeta->tableMeta = pTableMeta; - nodeListSet(&info->superTables, currElement->measure, currElement->measureLen, sMeta, NULL); + taosHashPut(info->superTables, currElement->measure, currElement->measureLen, &sMeta, POINTER_BYTES); + tmp = &sMeta; } - info->currSTableMeta = sMeta->tableMeta; - superKV = sMeta->tags; + info->currSTableMeta = (*tmp)->tableMeta; + superKV = (*tmp)->tags; if(unlikely(taosArrayGetSize(superKV) == 0)){ isSuperKVInit = false; @@ -258,13 +259,13 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlKv *maxKV = (SSmlKv *)taosArrayGet(maxKVs, cnt); if(unlikely(kv.length > maxKV->length)){ maxKV->length = kv.length; - SSmlSTableMeta *tableMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, currElement->measure, currElement->measureLen, NULL); + SSmlSTableMeta **tableMeta = (SSmlSTableMeta **)taosHashGet(info->superTables, currElement->measure, currElement->measureLen); if(unlikely(NULL == tableMeta)){ uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id); return TSDB_CODE_SML_INTERNAL_ERROR; } - SSmlKv *oldKV = (SSmlKv *)taosArrayGet(tableMeta->tags, cnt); + SSmlKv *oldKV = (SSmlKv *)taosArrayGet((*tableMeta)->tags, cnt); oldKV->length = kv.length; info->needModifySchema = true; } @@ -310,7 +311,7 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, (*sql)++; } - void* oneTable = nodeListGet(info->childTables, currElement->measure, currElement->measureTagsLen, NULL); + void* oneTable = taosHashGet(info->childTables, currElement->measure, currElement->measureTagsLen); if ((oneTable != NULL)) { return TSDB_CODE_SUCCESS; } @@ -332,7 +333,7 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, } } - nodeListSet(&info->childTables, currElement->measure, currElement->measureTagsLen, tinfo, NULL); + taosHashPut(info->childTables, currElement->measure, currElement->measureTagsLen, &tinfo, POINTER_BYTES); return TSDB_CODE_SUCCESS; } @@ -345,18 +346,18 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SArray *superKV = NULL; if(info->dataFormat){ if(unlikely(!isSameCTable)){ - SSmlTableInfo *oneTable = (SSmlTableInfo *)nodeListGet(info->childTables, currElement->measure, currElement->measureTagsLen, NULL); + SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashGet(info->childTables, currElement->measure, currElement->measureTagsLen); if (unlikely(oneTable == NULL)) { smlBuildInvalidDataMsg(&info->msgBuf, "child table should inside", currElement->measure); return TSDB_CODE_SML_INVALID_DATA; } - info->currTableDataCtx = oneTable->tableDataCtx; + info->currTableDataCtx = (*oneTable)->tableDataCtx; } if(unlikely(!isSameMeasure)){ - SSmlSTableMeta *sMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, currElement->measure, currElement->measureLen, NULL); - - if(unlikely(sMeta == NULL)){ + SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, currElement->measure, currElement->measureLen); + SSmlSTableMeta *sMeta = NULL; + if(unlikely(tmp == NULL)){ STableMeta * pTableMeta = smlGetMeta(info, currElement->measure, currElement->measureLen); if(pTableMeta == NULL){ info->dataFormat = false; @@ -365,10 +366,11 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, } sMeta = smlBuildSTableMeta(info->dataFormat); sMeta->tableMeta = pTableMeta; - nodeListSet(&info->superTables, currElement->measure, currElement->measureLen, sMeta, NULL); + taosHashPut(info->superTables, currElement->measure, currElement->measureLen, &sMeta, POINTER_BYTES); + tmp = &sMeta; } - info->currSTableMeta = sMeta->tableMeta; - superKV = sMeta->cols; + info->currSTableMeta = (*tmp)->tableMeta; + superKV = (*tmp)->cols; if(unlikely(taosArrayGetSize(superKV) == 0)){ isSuperKVInit = false; } @@ -487,13 +489,13 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, if(unlikely(IS_VAR_DATA_TYPE(kv.type) && kv.length > maxKV->length)){ maxKV->length = kv.length; - SSmlSTableMeta *tableMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, currElement->measure, currElement->measureLen, NULL); + SSmlSTableMeta **tableMeta = (SSmlSTableMeta **)taosHashGet(info->superTables, currElement->measure, currElement->measureLen); if(unlikely(NULL == tableMeta)){ uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id); return TSDB_CODE_SML_INTERNAL_ERROR; } - SSmlKv *oldKV = (SSmlKv *)taosArrayGet(tableMeta->cols, cnt); + SSmlKv *oldKV = (SSmlKv *)taosArrayGet((*tableMeta)->cols, cnt); oldKV->length = kv.length; info->needModifySchema = true; } diff --git a/source/client/src/clientSmlTelnet.c b/source/client/src/clientSmlTelnet.c index d43ab6c9f9..7f669ffead 100644 --- a/source/client/src/clientSmlTelnet.c +++ b/source/client/src/clientSmlTelnet.c @@ -71,6 +71,7 @@ static void smlParseTelnetElement(char **sql, char *sqlEnd, char **data, int32_t static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SSmlLineInfo *elements, SSmlMsgBuf *msg) { if(is_same_child_table_telnet(elements, &info->preLine) == 0){ + elements->measureTag = info->preLine.measureTag; return TSDB_CODE_SUCCESS; } @@ -83,9 +84,9 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS SArray *superKV = NULL; if(info->dataFormat){ if(!isSameMeasure){ - SSmlSTableMeta *sMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, elements->measure, elements->measureLen, NULL); - - if(unlikely(sMeta == NULL)){ + SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); + SSmlSTableMeta *sMeta = NULL; + if(unlikely(tmp == NULL)){ STableMeta * pTableMeta = smlGetMeta(info, elements->measure, elements->measureLen); if(pTableMeta == NULL){ info->dataFormat = false; @@ -94,10 +95,11 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS } sMeta = smlBuildSTableMeta(info->dataFormat); sMeta->tableMeta = pTableMeta; - nodeListSet(&info->superTables, elements->measure, elements->measureLen, sMeta, NULL); + taosHashPut(info->superTables, elements->measure, elements->measureLen, &sMeta, POINTER_BYTES); + tmp = &sMeta; } - info->currSTableMeta = sMeta->tableMeta; - superKV = sMeta->tags; + info->currSTableMeta = (*tmp)->tableMeta; + superKV = (*tmp)->tags; if(unlikely(taosArrayGetSize(superKV) == 0)){ isSuperKVInit = false; @@ -183,13 +185,13 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS SSmlKv *maxKV = (SSmlKv *)taosArrayGet(maxKVs, cnt); if(unlikely(kv.length > maxKV->length)){ maxKV->length = kv.length; - SSmlSTableMeta *tableMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, elements->measure, elements->measureLen, NULL); + SSmlSTableMeta **tableMeta = (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); if(unlikely(NULL == tableMeta)){ uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id); return TSDB_CODE_SML_INTERNAL_ERROR; } - SSmlKv *oldKV = (SSmlKv *)taosArrayGet(tableMeta->tags, cnt); + SSmlKv *oldKV = (SSmlKv *)taosArrayGet((*tableMeta)->tags, cnt); oldKV->length = kv.length; info->needModifySchema = true; } @@ -229,8 +231,15 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS taosArrayPush(preLineKV, &kv); cnt++; } - SSmlTableInfo *tinfo = (SSmlTableInfo *)nodeListGet(info->childTables, elements, POINTER_BYTES, is_same_child_table_telnet); - if (unlikely(tinfo == NULL)) { + + elements->measureTag = (char*)taosMemoryMalloc(elements->measureLen + elements->tagsLen); + memcpy(elements->measureTag, elements->measure, elements->measureLen); + memcpy(elements->measureTag + elements->measureLen, elements->tags, elements->tagsLen); + elements->measureTagsLen = elements->measureLen + elements->tagsLen; + + SSmlTableInfo **tmp = (SSmlTableInfo **)taosHashGet(info->childTables, elements->measureTag, elements->measureLen + elements->tagsLen); + SSmlTableInfo *tinfo = NULL; + if (unlikely(tmp == NULL)) { tinfo = smlBuildTableInfo(1, elements->measure, elements->measureLen); if (!tinfo) { return TSDB_CODE_OUT_OF_MEMORY; @@ -249,12 +258,13 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS } } - SSmlLineInfo *key = (SSmlLineInfo *)taosMemoryMalloc(sizeof(SSmlLineInfo)); - *key = *elements; - tinfo->key = key; - nodeListSet(&info->childTables, key, POINTER_BYTES, tinfo, is_same_child_table_telnet); +// SSmlLineInfo *key = (SSmlLineInfo *)taosMemoryMalloc(sizeof(SSmlLineInfo)); +// *key = *elements; +// tinfo->key = key; + taosHashPut(info->childTables, elements->measureTag, elements->measureLen + elements->tagsLen, &tinfo, POINTER_BYTES); + tmp = &tinfo; } - if (info->dataFormat) info->currTableDataCtx = tinfo->tableDataCtx; + if (info->dataFormat) info->currTableDataCtx = (*tmp)->tableDataCtx; return TSDB_CODE_SUCCESS; } diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp index 82202b8820..a75411a854 100644 --- a/source/client/test/clientTests.cpp +++ b/source/client/test/clientTests.cpp @@ -112,7 +112,7 @@ void createNewTable(TAOS* pConn, int32_t index) { } taos_free_result(pRes); - for(int32_t i = 0; i < 20; i += 20) { + for(int32_t i = 0; i < 2000; i += 20) { char sql[1024] = {0}; sprintf(sql, "insert into tu%d values(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)" @@ -692,6 +692,7 @@ TEST(testCase, insert_test) { taos_free_result(pRes); taos_close(pConn); } +#endif TEST(testCase, projection_query_tables) { TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); @@ -725,7 +726,7 @@ TEST(testCase, projection_query_tables) { } taos_free_result(pRes); - for (int32_t i = 0; i < 200000; ++i) { + for (int32_t i = 0; i < 2; ++i) { printf("create table :%d\n", i); createNewTable(pConn, i); } @@ -751,6 +752,7 @@ TEST(testCase, projection_query_tables) { taos_close(pConn); } +#if 0 TEST(testCase, tsbs_perf_test) { TdThread qid[20] = {0}; @@ -760,8 +762,6 @@ TEST(testCase, tsbs_perf_test) { getchar(); } -#endif - TEST(testCase, projection_query_stables) { TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); ASSERT_NE(pConn, nullptr); @@ -790,7 +790,6 @@ TEST(testCase, projection_query_stables) { taos_close(pConn); } -#if 0 TEST(testCase, agg_query_tables) { TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); ASSERT_NE(pConn, nullptr); @@ -831,7 +830,7 @@ TEST(testCase, async_api_test) { ASSERT_NE(pConn, nullptr); taos_query(pConn, "use abc1"); -#if 0 + TAOS_RES* pRes = taos_query(pConn, "insert into tu(ts) values('2022-02-27 12:12:61')"); if (taos_errno(pRes) != 0) { printf("failed, reason:%s\n", taos_errstr(pRes)); @@ -854,7 +853,6 @@ TEST(testCase, async_api_test) { printf("%s\n", str); memset(str, 0, sizeof(str)); } -#endif taos_query_a(pConn, "select count(*) from tu", queryCallback, pConn); getchar(); diff --git a/source/common/src/systable.c b/source/common/src/systable.c index 8791a81bbe..0e185fa1c0 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -230,6 +230,7 @@ static const SSysDbTableSchema vgroupsSchema[] = { {.name = "v4_status", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "cacheload", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true}, {.name = "tsma", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true}, + // {.name = "compact_start_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false}, }; static const SSysDbTableSchema smaSchema[] = { diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 7b3038280a..7c0de3d6f0 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -21,6 +21,7 @@ #include "tlog.h" static int32_t (*tColDataAppendValueImpl[8][3])(SColData *pColData, uint8_t *pData, uint32_t nData); +static int32_t (*tColDataUpdateValueImpl[8][3])(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward); // SBuffer ================================ void tBufferDestroy(SBuffer *pBuffer) { @@ -850,19 +851,19 @@ _exit: return &pIter->cv; } -static int32_t tRowAppendNoneToColData(SColData *aColData, int32_t nColData) { +static int32_t tRowNoneUpsertColData(SColData *aColData, int32_t nColData, int32_t flag) { int32_t code = 0; + if (flag) return code; + for (int32_t iColData = 0; iColData < nColData; iColData++) { - SColData *pColData = &aColData[iColData]; - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0); - if (code) goto _exit; + code = tColDataAppendValueImpl[aColData[iColData].flag][CV_FLAG_NONE](&aColData[iColData], NULL, 0); + if (code) return code; } -_exit: return code; } -static int32_t tRowAppendNullToColData(SColData *aColData, int32_t nColData, STSchema *pSchema) { +static int32_t tRowNullUpsertColData(SColData *aColData, int32_t nColData, STSchema *pSchema, int32_t flag) { int32_t code = 0; int32_t iColData = 0; @@ -873,21 +874,23 @@ static int32_t tRowAppendNullToColData(SColData *aColData, int32_t nColData, STS while (pColData) { if (pTColumn) { if (pTColumn->colId == pColData->cid) { // NULL - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0); + if (flag == 0) { + code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0); + } else { + code = tColDataUpdateValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0, flag > 0); + } if (code) goto _exit; + pColData = (++iColData < nColData) ? &aColData[iColData] : NULL; pTColumn = (++iTColumn < pSchema->numOfCols) ? &pSchema->columns[iTColumn] : NULL; } else if (pTColumn->colId > pColData->cid) { // NONE - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0); - if (code) goto _exit; + if (flag == 0 && (code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0))) goto _exit; pColData = (++iColData < nColData) ? &aColData[iColData] : NULL; } else { pTColumn = (++iTColumn < pSchema->numOfCols) ? &pSchema->columns[iTColumn] : NULL; } - } else { - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0); - if (code) goto _exit; - + } else { // NONE + if (flag == 0 && (code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0))) goto _exit; pColData = (++iColData < nColData) ? &aColData[iColData] : NULL; } } @@ -895,7 +898,8 @@ static int32_t tRowAppendNullToColData(SColData *aColData, int32_t nColData, STS _exit: return code; } -static int32_t tRowAppendTupleToColData(SRow *pRow, STSchema *pTSchema, SColData *aColData, int32_t nColData) { +static int32_t tRowTupleUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *aColData, int32_t nColData, + int32_t flag) { int32_t code = 0; int32_t iColData = 0; @@ -955,11 +959,15 @@ static int32_t tRowAppendTupleToColData(SRow *pRow, STSchema *pTSchema, SColData } if (bv == BIT_FLG_NONE) { - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0); - if (code) goto _exit; + if (flag == 0 && (code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0))) + goto _exit; goto _continue; } else if (bv == BIT_FLG_NULL) { - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0); + if (flag == 0) { + code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0); + } else { + code = tColDataUpdateValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0, flag > 0); + } if (code) goto _exit; goto _continue; } @@ -969,11 +977,20 @@ static int32_t tRowAppendTupleToColData(SRow *pRow, STSchema *pTSchema, SColData uint8_t *pData = pv + *(int32_t *)(pf + pTColumn->offset); uint32_t nData; pData += tGetU32v(pData, &nData); - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, pData, nData); + if (flag == 0) { + code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, pData, nData); + } else { + code = tColDataUpdateValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, pData, nData, flag > 0); + } if (code) goto _exit; } else { - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, pf + pTColumn->offset, - TYPE_BYTES[pColData->type]); + if (flag == 0) { + code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, pf + pTColumn->offset, + TYPE_BYTES[pColData->type]); + } else { + code = tColDataUpdateValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, pf + pTColumn->offset, + TYPE_BYTES[pColData->type], flag > 0); + } if (code) goto _exit; } @@ -981,17 +998,13 @@ static int32_t tRowAppendTupleToColData(SRow *pRow, STSchema *pTSchema, SColData pColData = (++iColData < nColData) ? &aColData[iColData] : NULL; pTColumn = (++iTColumn < pTSchema->numOfCols) ? &pTSchema->columns[iTColumn] : NULL; } else if (pTColumn->colId > pColData->cid) { // NONE - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0); - if (code) goto _exit; - + if (flag == 0 && (code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0))) goto _exit; pColData = (++iColData < nColData) ? &aColData[iColData] : NULL; } else { pTColumn = (++iTColumn < pTSchema->numOfCols) ? &pTSchema->columns[iTColumn] : NULL; } } else { - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0); - if (code) goto _exit; - + if (flag == 0 && (code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0))) goto _exit; pColData = (++iColData < nColData) ? &aColData[iColData] : NULL; } } @@ -999,7 +1012,7 @@ static int32_t tRowAppendTupleToColData(SRow *pRow, STSchema *pTSchema, SColData _exit: return code; } -static int32_t tRowAppendKVToColData(SRow *pRow, STSchema *pTSchema, SColData *aColData, int32_t nColData) { +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; @@ -1040,18 +1053,25 @@ static int32_t tRowAppendKVToColData(SRow *pRow, STSchema *pTSchema, SColData *a if (TABS(cid) == pTColumn->colId) { if (cid < 0) { - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0); + if (flag == 0) { + code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0); + } else { + code = tColDataUpdateValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0, flag > 0); + } if (code) goto _exit; } else { + uint32_t nData; if (IS_VAR_DATA_TYPE(pTColumn->type)) { - uint32_t nData; pData += tGetU32v(pData, &nData); - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, pData, nData); - if (code) goto _exit; } else { - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, pData, 0); - if (code) goto _exit; + nData = 0; } + if (flag == 0) { + code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, pData, nData); + } else { + code = tColDataUpdateValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, pData, nData, flag > 0); + } + if (code) goto _exit; } iCol++; goto _continue; @@ -1062,22 +1082,19 @@ static int32_t tRowAppendKVToColData(SRow *pRow, STSchema *pTSchema, SColData *a } } - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0); - if (code) goto _exit; + if (flag == 0 && (code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0))) goto _exit; _continue: pColData = (++iColData < nColData) ? &aColData[iColData] : NULL; pTColumn = (++iTColumn < pTSchema->numOfCols) ? &pTSchema->columns[iTColumn] : NULL; } else if (pTColumn->colId > pColData->cid) { - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0); - if (code) goto _exit; + if (flag == 0 && (code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0))) goto _exit; pColData = (++iColData < nColData) ? &aColData[iColData] : NULL; } else { pTColumn = (++iTColumn < pTSchema->numOfCols) ? &pTSchema->columns[iTColumn] : NULL; } } else { - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0); - if (code) goto _exit; + if (flag == 0 && (code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0))) goto _exit; pColData = (++iColData < nColData) ? &aColData[iColData] : NULL; } } @@ -1085,30 +1102,23 @@ static int32_t tRowAppendKVToColData(SRow *pRow, STSchema *pTSchema, SColData *a _exit: return code; } -int32_t tRowAppendToColData(SRow *pRow, STSchema *pTSchema, SColData *aColData, int32_t nColData) { +/* flag > 0: forward update + * flag == 0: append + * flag < 0: backward update + */ +int32_t tRowUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *aColData, int32_t nColData, int32_t flag) { ASSERT(pRow->sver == pTSchema->version); ASSERT(nColData > 0); - int32_t code = 0; - if (pRow->flag == HAS_NONE) { - code = tRowAppendNoneToColData(aColData, nColData); - goto _exit; + return tRowNoneUpsertColData(aColData, nColData, flag); } else if (pRow->flag == HAS_NULL) { - code = tRowAppendNullToColData(aColData, nColData, pTSchema); - goto _exit; + return tRowNullUpsertColData(aColData, nColData, pTSchema, flag); + } else if (pRow->flag >> 4) { // KV row + return tRowKVUpsertColData(pRow, pTSchema, aColData, nColData, flag); + } else { // TUPLE row + return tRowTupleUpsertColData(pRow, pTSchema, aColData, nColData, flag); } - - if (pRow->flag >> 4) { // KV row - code = tRowAppendKVToColData(pRow, pTSchema, aColData, nColData); - if (code) goto _exit; - } else { - code = tRowAppendTupleToColData(pRow, pTSchema, aColData, nColData); - if (code) goto _exit; - } - -_exit: - return code; } // STag ======================================== @@ -1549,6 +1559,9 @@ void tColDataInit(SColData *pColData, int16_t cid, int8_t type, int8_t smaOn) { } void tColDataClear(SColData *pColData) { + pColData->numOfNone = 0; + pColData->numOfNull = 0; + pColData->numOfValue = 0; pColData->nVal = 0; pColData->flag = 0; pColData->nData = 0; @@ -1594,15 +1607,18 @@ _exit: } static FORCE_INLINE int32_t tColDataAppendValue00(SColData *pColData, uint8_t *pData, uint32_t nData) { pColData->flag = HAS_VALUE; + pColData->numOfValue++; return tColDataPutValue(pColData, pData, nData); } static FORCE_INLINE int32_t tColDataAppendValue01(SColData *pColData, uint8_t *pData, uint32_t nData) { pColData->flag = HAS_NONE; + pColData->numOfNone++; pColData->nVal++; return 0; } static FORCE_INLINE int32_t tColDataAppendValue02(SColData *pColData, uint8_t *pData, uint32_t nData) { pColData->flag = HAS_NULL; + pColData->numOfNull++; pColData->nVal++; return 0; } @@ -1617,6 +1633,7 @@ static FORCE_INLINE int32_t tColDataAppendValue10(SColData *pColData, uint8_t *p SET_BIT1_EX(pColData->pBitMap, pColData->nVal, 1); pColData->flag |= HAS_VALUE; + pColData->numOfValue++; if (pColData->nVal) { if (IS_VAR_DATA_TYPE(pColData->type)) { @@ -1636,6 +1653,7 @@ static FORCE_INLINE int32_t tColDataAppendValue10(SColData *pColData, uint8_t *p } static FORCE_INLINE int32_t tColDataAppendValue11(SColData *pColData, uint8_t *pData, uint32_t nData) { pColData->nVal++; + pColData->numOfNone++; return 0; } static FORCE_INLINE int32_t tColDataAppendValue12(SColData *pColData, uint8_t *pData, uint32_t nData) { @@ -1649,6 +1667,7 @@ static FORCE_INLINE int32_t tColDataAppendValue12(SColData *pColData, uint8_t *p SET_BIT1_EX(pColData->pBitMap, pColData->nVal, 1); pColData->flag |= HAS_NULL; + pColData->numOfNull++; pColData->nVal++; return code; @@ -1664,6 +1683,7 @@ static FORCE_INLINE int32_t tColDataAppendValue20(SColData *pColData, uint8_t *p SET_BIT1_EX(pColData->pBitMap, pColData->nVal, 1); pColData->flag |= HAS_VALUE; + pColData->numOfValue++; if (pColData->nVal) { if (IS_VAR_DATA_TYPE(pColData->type)) { @@ -1692,18 +1712,21 @@ static FORCE_INLINE int32_t tColDataAppendValue21(SColData *pColData, uint8_t *p SET_BIT1_EX(pColData->pBitMap, pColData->nVal, 0); pColData->flag |= HAS_NONE; + pColData->numOfNone++; pColData->nVal++; return code; } static FORCE_INLINE int32_t tColDataAppendValue22(SColData *pColData, uint8_t *pData, uint32_t nData) { pColData->nVal++; + pColData->numOfNull++; return 0; } static FORCE_INLINE int32_t tColDataAppendValue30(SColData *pColData, uint8_t *pData, uint32_t nData) { int32_t code = 0; pColData->flag |= HAS_VALUE; + pColData->numOfValue++; uint8_t *pBitMap = NULL; code = tRealloc(&pBitMap, BIT2_SIZE(pColData->nVal + 1)); @@ -1740,6 +1763,7 @@ static FORCE_INLINE int32_t tColDataAppendValue31(SColData *pColData, uint8_t *p if (code) return code; SET_BIT1_EX(pColData->pBitMap, pColData->nVal, 0); + pColData->numOfNone++; pColData->nVal++; return code; @@ -1751,15 +1775,20 @@ static FORCE_INLINE int32_t tColDataAppendValue32(SColData *pColData, uint8_t *p if (code) return code; SET_BIT1_EX(pColData->pBitMap, pColData->nVal, 1); + pColData->numOfNull++; pColData->nVal++; return code; } -#define tColDataAppendValue40 tColDataPutValue +static FORCE_INLINE int32_t tColDataAppendValue40(SColData *pColData, uint8_t *pData, uint32_t nData) { + pColData->numOfValue++; + return tColDataPutValue(pColData, pData, nData); +} static FORCE_INLINE int32_t tColDataAppendValue41(SColData *pColData, uint8_t *pData, uint32_t nData) { int32_t code = 0; pColData->flag |= HAS_NONE; + pColData->numOfNone++; int32_t nBit = BIT1_SIZE(pColData->nVal + 1); code = tRealloc(&pColData->pBitMap, nBit); @@ -1774,6 +1803,7 @@ static FORCE_INLINE int32_t tColDataAppendValue42(SColData *pColData, uint8_t *p int32_t code = 0; pColData->flag |= HAS_NULL; + pColData->numOfNull++; int32_t nBit = BIT1_SIZE(pColData->nVal + 1); code = tRealloc(&pColData->pBitMap, nBit); @@ -1791,6 +1821,7 @@ static FORCE_INLINE int32_t tColDataAppendValue50(SColData *pColData, uint8_t *p if (code) return code; SET_BIT1_EX(pColData->pBitMap, pColData->nVal, 1); + pColData->numOfValue++; return tColDataPutValue(pColData, pData, nData); } @@ -1801,6 +1832,7 @@ static FORCE_INLINE int32_t tColDataAppendValue51(SColData *pColData, uint8_t *p if (code) return code; SET_BIT1_EX(pColData->pBitMap, pColData->nVal, 0); + pColData->numOfNone++; return tColDataPutValue(pColData, NULL, 0); } @@ -1808,6 +1840,7 @@ static FORCE_INLINE int32_t tColDataAppendValue52(SColData *pColData, uint8_t *p int32_t code = 0; pColData->flag |= HAS_NULL; + pColData->numOfNull++; uint8_t *pBitMap = NULL; code = tRealloc(&pBitMap, BIT2_SIZE(pColData->nVal + 1)); @@ -1829,6 +1862,7 @@ static FORCE_INLINE int32_t tColDataAppendValue60(SColData *pColData, uint8_t *p code = tRealloc(&pColData->pBitMap, BIT1_SIZE(pColData->nVal + 1)); if (code) return code; SET_BIT1_EX(pColData->pBitMap, pColData->nVal, 1); + pColData->numOfValue++; return tColDataPutValue(pColData, pData, nData); } @@ -1836,6 +1870,7 @@ static FORCE_INLINE int32_t tColDataAppendValue61(SColData *pColData, uint8_t *p int32_t code = 0; pColData->flag |= HAS_NONE; + pColData->numOfNone++; uint8_t *pBitMap = NULL; code = tRealloc(&pBitMap, BIT2_SIZE(pColData->nVal + 1)); @@ -1857,6 +1892,7 @@ static FORCE_INLINE int32_t tColDataAppendValue62(SColData *pColData, uint8_t *p code = tRealloc(&pColData->pBitMap, BIT1_SIZE(pColData->nVal + 1)); if (code) return code; SET_BIT1_EX(pColData->pBitMap, pColData->nVal, 0); + pColData->numOfNull++; return tColDataPutValue(pColData, NULL, 0); } @@ -1866,6 +1902,7 @@ static FORCE_INLINE int32_t tColDataAppendValue70(SColData *pColData, uint8_t *p code = tRealloc(&pColData->pBitMap, BIT2_SIZE(pColData->nVal + 1)); if (code) return code; SET_BIT2_EX(pColData->pBitMap, pColData->nVal, 2); + pColData->numOfValue++; return tColDataPutValue(pColData, pData, nData); } @@ -1875,6 +1912,7 @@ static FORCE_INLINE int32_t tColDataAppendValue71(SColData *pColData, uint8_t *p code = tRealloc(&pColData->pBitMap, BIT2_SIZE(pColData->nVal + 1)); if (code) return code; SET_BIT2_EX(pColData->pBitMap, pColData->nVal, 0); + pColData->numOfNone++; return tColDataPutValue(pColData, NULL, 0); } @@ -1884,6 +1922,7 @@ static FORCE_INLINE int32_t tColDataAppendValue72(SColData *pColData, uint8_t *p code = tRealloc(&pColData->pBitMap, BIT2_SIZE(pColData->nVal + 1)); if (code) return code; SET_BIT2_EX(pColData->pBitMap, pColData->nVal, 1); + pColData->numOfNull++; return tColDataPutValue(pColData, NULL, 0); } @@ -1896,6 +1935,8 @@ static int32_t (*tColDataAppendValueImpl[8][3])(SColData *pColData, uint8_t *pDa {tColDataAppendValue50, tColDataAppendValue51, tColDataAppendValue52}, // HAS_VALUE|HAS_NONE {tColDataAppendValue60, tColDataAppendValue61, tColDataAppendValue62}, // HAS_VALUE|HAS_NULL {tColDataAppendValue70, tColDataAppendValue71, tColDataAppendValue72}, // HAS_VALUE|HAS_NULL|HAS_NONE + + // VALUE NONE NULL }; int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal) { ASSERT(pColData->cid == pColVal->cid && pColData->type == pColVal->type); @@ -1904,6 +1945,282 @@ int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal) { pColVal->value.nData); } +static FORCE_INLINE int32_t tColDataUpdateValue10(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward) { + pColData->numOfNone--; + pColData->nVal--; + if (pColData->numOfNone) { + return tColDataAppendValue10(pColData, pData, nData); + } else { + pColData->flag = 0; + return tColDataAppendValue00(pColData, pData, nData); + } +} +static FORCE_INLINE int32_t tColDataUpdateValue12(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward) { + pColData->numOfNone--; + pColData->nVal--; + if (pColData->numOfNone) { + return tColDataAppendValue12(pColData, pData, nData); + } else { + pColData->flag = 0; + return tColDataAppendValue02(pColData, pData, nData); + } + return 0; +} +static FORCE_INLINE int32_t tColDataUpdateValue20(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward) { + if (forward) { + pColData->numOfNull--; + pColData->nVal--; + if (pColData->numOfNull) { + return tColDataAppendValue20(pColData, pData, nData); + } else { + pColData->flag = 0; + return tColDataAppendValue00(pColData, pData, nData); + } + } + return 0; +} +static FORCE_INLINE int32_t tColDataUpdateValue30(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward) { + uint8_t bv = GET_BIT1(pColData->pBitMap, pColData->nVal - 1); + if (bv == 0) { // NONE == > VALUE + pColData->numOfNone--; + pColData->nVal--; + if (pColData->numOfNone) { + return tColDataAppendValue30(pColData, pData, nData); + } else { + pColData->flag = HAS_NULL; + return tColDataAppendValue20(pColData, pData, nData); + } + } else if (forward) { // NULL == > VALUE + pColData->numOfNull--; + pColData->nVal--; + if (pColData->numOfNull) { + return tColDataAppendValue30(pColData, pData, nData); + } else { + pColData->flag = HAS_NONE; + return tColDataAppendValue10(pColData, pData, nData); + } + } + return 0; +} +static FORCE_INLINE int32_t tColDataUpdateValue32(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward) { + if (GET_BIT1(pColData->pBitMap, pColData->nVal - 1) == 0) { // NONE ==> NULL + pColData->numOfNone--; + pColData->numOfNull++; + if (pColData->numOfNone) { + SET_BIT1(pColData->pBitMap, pColData->nVal - 1, 1); + } else { + pColData->flag = HAS_NULL; + } + } + return 0; +} +static FORCE_INLINE int32_t tColDataUpdateValue40(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward) { + if (forward) { + pColData->numOfValue--; + pColData->nVal--; + if (pColData->numOfValue) { + return tColDataAppendValue40(pColData, pData, nData); + } else { + pColData->flag = 0; + return tColDataAppendValue00(pColData, pData, nData); + } + } + return 0; +} +static FORCE_INLINE int32_t tColDataUpdateValue42(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward) { + if (forward) { + pColData->numOfValue--; + pColData->nVal--; + if (pColData->numOfValue) { + return tColDataAppendValue42(pColData, pData, nData); + } else { + pColData->flag = 0; + return tColDataAppendValue02(pColData, pData, nData); + } + } + return 0; +} +static FORCE_INLINE int32_t tColDataUpdateValue50(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward) { + uint8_t bv = GET_BIT1(pColData->pBitMap, pColData->nVal - 1); + if (bv == 0) { // NONE ==> VALUE + pColData->numOfNone--; + pColData->nVal--; + if (pColData->numOfNone) { + return tColDataAppendValue50(pColData, pData, nData); + } else { + pColData->flag = HAS_VALUE; + return tColDataAppendValue40(pColData, pData, nData); + } + } else if (forward) { // VALUE ==> VALUE + pColData->numOfValue--; + pColData->nVal--; + if (pColData->numOfValue) { + return tColDataAppendValue50(pColData, pData, nData); + } else { + pColData->flag = HAS_NONE; + return tColDataAppendValue10(pColData, pData, nData); + } + } + return 0; +} +static FORCE_INLINE int32_t tColDataUpdateValue52(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward) { + uint8_t bv = GET_BIT1(pColData->pBitMap, pColData->nVal - 1); + if (bv == 0) { // NONE ==> NULL + pColData->numOfNone--; + pColData->nVal--; + if (pColData->numOfNone) { + return tColDataAppendValue52(pColData, pData, nData); + } else { + pColData->flag &= ~HAS_NONE; + return tColDataAppendValue42(pColData, pData, nData); + } + } else if (forward) { // VALUE ==> NULL + pColData->numOfValue--; + pColData->nVal--; + if (pColData->numOfValue) { + return tColDataAppendValue52(pColData, pData, nData); + } else { + pColData->flag &= ~HAS_VALUE; + return tColDataAppendValue12(pColData, pData, nData); + } + } + return 0; +} +static FORCE_INLINE int32_t tColDataUpdateValue60(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward) { + if (forward) { + if (GET_BIT1(pColData->pBitMap, pColData->nVal - 1) == 0) { // NULL ==> VALUE + pColData->numOfNull--; + pColData->nVal--; + if (pColData->numOfNull) { + return tColDataAppendValue60(pColData, pData, nData); + } else { + pColData->flag = HAS_VALUE; + return tColDataAppendValue40(pColData, pData, nData); + } + } else { // VALUE ==> VALUE + pColData->numOfValue--; + pColData->nVal--; + if (pColData->numOfValue) { + return tColDataAppendValue60(pColData, pData, nData); + } else { + pColData->flag = HAS_NULL; + return tColDataAppendValue20(pColData, pData, nData); + } + } + } + return 0; +} +static FORCE_INLINE int32_t tColDataUpdateValue62(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward) { + if (forward && (GET_BIT1(pColData->pBitMap, pColData->nVal - 1) == 1)) { // VALUE ==> NULL + pColData->numOfValue--; + pColData->nVal--; + if (pColData->numOfValue) { + return tColDataAppendValue62(pColData, pData, nData); + } else { + pColData->flag = HAS_NULL; + return tColDataAppendValue20(pColData, pData, nData); + } + } + return 0; +} +static FORCE_INLINE int32_t tColDataUpdateValue70(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward) { + int32_t code = 0; + + uint8_t bv = GET_BIT2(pColData->pBitMap, pColData->nVal - 1); + if (bv == 0) { // NONE ==> VALUE + pColData->numOfNone--; + pColData->nVal--; + if (pColData->numOfNone) { + return tColDataAppendValue70(pColData, pData, nData); + } else { + for (int32_t iVal = 0; iVal < pColData->nVal; ++iVal) { + SET_BIT1(pColData->pBitMap, iVal, GET_BIT2(pColData->pBitMap, iVal) - 1); + } + pColData->flag &= ~HAS_NONE; + return tColDataAppendValue60(pColData, pData, nData); + } + } else if (bv == 1) { // NULL ==> VALUE + if (forward) { + pColData->numOfNull--; + pColData->nVal--; + if (pColData->numOfNull) { + return tColDataAppendValue70(pColData, pData, nData); + } else { + for (int32_t iVal = 0; iVal < pColData->nVal; ++iVal) { + SET_BIT1(pColData->pBitMap, iVal, GET_BIT2(pColData->pBitMap, iVal) ? 1 : 0); + } + pColData->flag &= ~HAS_NULL; + return tColDataAppendValue50(pColData, pData, nData); + } + } + } else if (bv == 2) { // VALUE ==> VALUE + if (forward) { + pColData->numOfValue--; + pColData->nVal--; + if (pColData->numOfValue) { + return tColDataAppendValue70(pColData, pData, nData); + } else { + return tColDataPutValue(pColData, pData, nData); + } + } + } else { + ASSERT(0); + } + return 0; +} +static int32_t tColDataUpdateValue72(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward) { + uint8_t bv = GET_BIT2(pColData->pBitMap, pColData->nVal - 1); + ASSERT(bv < 3); + if (bv == 0) { // NONE ==> NULL + pColData->numOfNone--; + pColData->nVal--; + if (pColData->numOfNone) { + return tColDataAppendValue72(pColData, pData, nData); + } else { + for (int32_t iVal = 0; iVal < pColData->nVal; ++iVal) { + SET_BIT1(pColData->pBitMap, iVal, GET_BIT2(pColData->pBitMap, iVal) - 1); + } + pColData->flag &= ~HAS_NONE; + return tColDataAppendValue62(pColData, pData, nData); + } + } else if (bv == 2 && forward) { // VALUE ==> NULL + pColData->numOfValue--; + pColData->nVal--; + if (pColData->numOfValue) { + return tColDataAppendValue72(pColData, pData, nData); + } else { + for (int32_t iVal = 0; iVal < pColData->nVal; ++iVal) { + SET_BIT1(pColData->pBitMap, iVal, GET_BIT2(pColData->pBitMap, iVal)); + } + pColData->flag &= ~HAS_VALUE; + return tColDataAppendValue32(pColData, pData, nData); + } + } + return 0; +} +static int32_t (*tColDataUpdateValueImpl[8][3])(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward) = { + {NULL, NULL, NULL}, // 0 + {tColDataUpdateValue10, NULL, tColDataUpdateValue12}, // HAS_NONE + {tColDataUpdateValue20, NULL, NULL}, // HAS_NULL + {tColDataUpdateValue30, NULL, tColDataUpdateValue32}, // HAS_NULL|HAS_NONE + {tColDataUpdateValue40, NULL, tColDataUpdateValue42}, // HAS_VALUE + {tColDataUpdateValue50, NULL, tColDataUpdateValue52}, // HAS_VALUE|HAS_NONE + {tColDataUpdateValue60, NULL, tColDataUpdateValue62}, // HAS_VALUE|HAS_NULL + {tColDataUpdateValue70, NULL, tColDataUpdateValue72}, // HAS_VALUE|HAS_NULL|HAS_NONE + + // VALUE NONE NULL +}; +int32_t tColDataUpdateValue(SColData *pColData, SColVal *pColVal, bool forward) { + ASSERT(pColData->cid == pColVal->cid && pColData->type == pColVal->type); + ASSERT(pColData->nVal > 0); + + if (tColDataUpdateValueImpl[pColData->flag][pColVal->flag] == NULL) return 0; + + return tColDataUpdateValueImpl[pColData->flag][pColVal->flag]( + pColData, IS_VAR_DATA_TYPE(pColData->type) ? pColVal->value.pData : (uint8_t *)&pColVal->value.val, + pColVal->value.nData, forward); +} + static FORCE_INLINE void tColDataGetValue1(SColData *pColData, int32_t iVal, SColVal *pColVal) { // HAS_NONE *pColVal = COL_VAL_NONE(pColData->cid, pColData->type); } diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 370a232827..d08110becd 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -351,7 +351,9 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) { if (cfgAddBool(pCfg, "SIMD-builtins", tsSIMDBuiltins, 0) != 0) return -1; if (cfgAddInt64(pCfg, "openMax", tsOpenMax, 0, INT64_MAX, 1) != 0) return -1; +#if !defined(_ALPINE) if (cfgAddInt64(pCfg, "streamMax", tsStreamMax, 0, INT64_MAX, 1) != 0) return -1; +#endif if (cfgAddInt32(pCfg, "pageSizeKB", tsPageSizeKB, 0, INT64_MAX, 1) != 0) return -1; if (cfgAddInt64(pCfg, "totalMemoryKB", tsTotalMemoryKB, 0, INT64_MAX, 1) != 0) return -1; if (cfgAddString(pCfg, "os sysname", info.sysname, 1) != 0) return -1; diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 322143b71f..2ceeeefa5f 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -3992,9 +3992,7 @@ int32_t tSerializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq * if (tStartEncode(&encoder) < 0) return -1; if (tEncodeI64(&encoder, pReq->dbUid) < 0) return -1; if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; - for (int32_t i = 0; i < 8; ++i) { - if (tEncodeI64(&encoder, pReq->reserved[i]) < 0) return -1; - } + if (tEncodeI64(&encoder, pReq->compactStartTime) < 0) return -1; tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -4009,9 +4007,7 @@ int32_t tDeserializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq if (tStartDecode(&decoder) < 0) return -1; if (tDecodeI64(&decoder, &pReq->dbUid) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; - for (int32_t i = 0; i < 8; ++i) { - if (tDecodeI64(&decoder, &pReq->reserved[i]) < 0) return -1; - } + if (tDecodeI64(&decoder, &pReq->compactStartTime) < 0) return -1; tEndDecode(&decoder); tDecoderClear(&decoder); @@ -5489,6 +5485,7 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; if (tEncodeCStr(&encoder, pField->name) < 0) return -1; } + if (tEncodeI8(&encoder, pReq->createStb) < 0) return -1; if (tEncodeU64(&encoder, pReq->targetStbUid) < 0) return -1; if (tEncodeI32(&encoder, taosArrayGetSize(pReq->fillNullCols)) < 0) return -1; @@ -5498,6 +5495,7 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS if (tEncodeI16(&encoder, pCol->colId) < 0) return -1; if (tEncodeI8(&encoder, pCol->type) < 0) return -1; } + if (tEncodeI8(&encoder, pReq->igUpdate) < 0) return -1; tEndEncode(&encoder); @@ -5581,6 +5579,8 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea } } + if (tDecodeI8(&decoder, &pReq->igUpdate) < 0) return -1; + tEndDecode(&decoder); tDecoderClear(&decoder); diff --git a/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h b/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h index ff32cbcb08..600a1f6829 100644 --- a/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h +++ b/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h @@ -48,7 +48,7 @@ int32_t dmProcessAuthRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg); int32_t dmProcessGrantRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg); int32_t dmProcessServerRunStatus(SDnodeMgmt *pMgmt, SRpcMsg *pMsg); int32_t dmProcessRetrieve(SDnodeMgmt *pMgmt, SRpcMsg *pMsg); -int32_t dmProcessGrantReq(SRpcMsg *pMsg); +int32_t dmProcessGrantReq(void *pInfo, SRpcMsg *pMsg); // dmWorker.c int32_t dmPutNodeMsgToMgmtQueue(SDnodeMgmt *pMgmt, SRpcMsg *pMsg); diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c index 76c8e09b70..0d3b423771 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c @@ -234,7 +234,7 @@ static void dmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { code = dmProcessRetrieve(pMgmt, pMsg); break; case TDMT_MND_GRANT: - code = dmProcessGrantReq(pMsg); + code = dmProcessGrantReq(&pMgmt->pData->clusterId, pMsg); break; default: terrno = TSDB_CODE_MSG_NOT_PROCESSED; diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c b/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c index 095857825d..b0810d528f 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c @@ -49,7 +49,7 @@ static void mmProcessRpcMsg(SQueueInfo *pInfo, SRpcMsg *pMsg) { pMsg->info.node = pMgmt->pMnode; const STraceId *trace = &pMsg->info.traceId; - dGTrace("msg:%p, get from mnode queue", pMsg); + dGTrace("msg:%p, get from mnode queue, type:%s", pMsg, TMSG_INFO(pMsg->msgType)); int32_t code = mndProcessRpcMsg(pMsg); diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 1c1b8e32cd..2d6a4954e9 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -311,7 +311,7 @@ int32_t vmProcessAlterHashRangeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { int32_t srcVgId = req.srcVgId; int32_t dstVgId = req.dstVgId; - dInfo("vgId:%d, start to alter vnode hashrange[%u, %u), dstVgId:%d", req.srcVgId, req.hashBegin, req.hashEnd, + dInfo("vgId:%d, start to alter vnode hashrange:[%u, %u], dstVgId:%d", req.srcVgId, req.hashBegin, req.hashEnd, req.dstVgId); SVnodeObj *pVnode = vmAcquireVnode(pMgmt, srcVgId); @@ -342,7 +342,7 @@ int32_t vmProcessAlterHashRangeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { return -1; } - dInfo("vgId:%d, start to open vnode", dstVgId); + dInfo("vgId:%d, open vnode", dstVgId); SVnode *pImpl = vnodeOpen(dstPath, pMgmt->pTfs, pMgmt->msgCb); if (pImpl == NULL) { dError("vgId:%d, failed to open vnode at %s since %s", dstVgId, dstPath, terrstr()); @@ -376,7 +376,7 @@ int32_t vmProcessAlterVnodeReplicaReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { } int32_t vgId = alterReq.vgId; - dInfo("vgId:%d, start to alter vnode, replica:%d selfIndex:%d strict:%d", vgId, alterReq.replica, alterReq.selfIndex, + dInfo("vgId:%d, start to alter vnode replica:%d selfIndex:%d strict:%d", vgId, alterReq.replica, alterReq.selfIndex, alterReq.strict); for (int32_t i = 0; i < alterReq.replica; ++i) { SReplica *pReplica = &alterReq.replicas[i]; @@ -423,7 +423,7 @@ int32_t vmProcessAlterVnodeReplicaReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { return -1; } - dInfo("vgId:%d, start to open vnode", vgId); + dInfo("vgId:%d, close vnode", vgId); SVnode *pImpl = vnodeOpen(path, pMgmt->pTfs, pMgmt->msgCb); if (pImpl == NULL) { dError("vgId:%d, failed to open vnode at %s since %s", vgId, path, terrstr()); diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index 600dd3671d..027b9b7d48 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -57,7 +57,7 @@ static void vmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { if (IsReq(pMsg)) { if (code != 0) { if (terrno != 0) code = terrno; - dGError("msg:%p, failed to process since %s", pMsg, terrstr(code)); + dGError("msg:%p, failed to process since %s, type:%s", pMsg, terrstr(code), TMSG_INFO(pMsg->msgType)); } vmSendRsp(pMsg, code); } diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 1cbd9bfb66..6ff1dc576e 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -328,6 +328,7 @@ typedef struct { SDbCfg cfg; SRWLatch lock; int64_t stateTs; + int64_t compactStartTime; } SDbObj; typedef struct { @@ -649,6 +650,7 @@ typedef struct { int64_t checkpointFreq; // ms int64_t currentTick; // do not serialize int64_t deleteMark; + int8_t igCheckUpdate; } SStreamObj; int32_t tEncodeSStreamObj(SEncoder* pEncoder, const SStreamObj* pObj); diff --git a/source/dnode/mnode/impl/inc/mndTrans.h b/source/dnode/mnode/impl/inc/mndTrans.h index 07066d2251..d6e5d322ba 100644 --- a/source/dnode/mnode/impl/inc/mndTrans.h +++ b/source/dnode/mnode/impl/inc/mndTrans.h @@ -81,7 +81,7 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans); int32_t mndTransProcessRsp(SRpcMsg *pRsp); void mndTransPullup(SMnode *pMnode); int32_t mndKillTrans(SMnode *pMnode, STrans *pTrans); -void mndTransExecute(SMnode *pMnode, STrans *pTrans); +void mndTransExecute(SMnode *pMnode, STrans *pTrans, bool isLeader); int32_t mndSetRpcInfoForDbTrans(SMnode *pMnode, SRpcMsg *pMsg, EOperType oper, const char *dbname); #ifdef __cplusplus diff --git a/source/dnode/mnode/impl/inc/mndVgroup.h b/source/dnode/mnode/impl/inc/mndVgroup.h index 765d4fd33d..51eb24f402 100644 --- a/source/dnode/mnode/impl/inc/mndVgroup.h +++ b/source/dnode/mnode/impl/inc/mndVgroup.h @@ -43,6 +43,7 @@ int32_t mndAddDropVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVg int32_t mndSetMoveVgroupsInfoToTrans(SMnode *, STrans *pTrans, int32_t dropDnodeId, bool force); int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb, SVgObj *pVgroup, SArray *pArray); +int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs); void *mndBuildCreateVnodeReq(SMnode *, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen); void *mndBuildDropVnodeReq(SMnode *, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen); diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index ea1d3281d4..1943ab0b0f 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -30,7 +30,7 @@ #include "systable.h" #define DB_VER_NUMBER 1 -#define DB_RESERVE_SIZE 54 +#define DB_RESERVE_SIZE 46 static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw); static int32_t mndDbActionInsert(SSdb *pSdb, SDbObj *pDb); @@ -126,6 +126,7 @@ SSdbRaw *mndDbActionEncode(SDbObj *pDb) { SDB_SET_INT16(pRaw, dataPos, pDb->cfg.hashPrefix, _OVER) SDB_SET_INT16(pRaw, dataPos, pDb->cfg.hashSuffix, _OVER) SDB_SET_INT32(pRaw, dataPos, pDb->cfg.tsdbPageSize, _OVER) + SDB_SET_INT64(pRaw, dataPos, pDb->compactStartTime, _OVER) SDB_SET_RESERVE(pRaw, dataPos, DB_RESERVE_SIZE, _OVER) SDB_SET_DATALEN(pRaw, dataPos, _OVER) @@ -215,6 +216,7 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) { SDB_GET_INT16(pRaw, dataPos, &pDb->cfg.hashPrefix, _OVER) SDB_GET_INT16(pRaw, dataPos, &pDb->cfg.hashSuffix, _OVER) SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.tsdbPageSize, _OVER) + SDB_GET_INT64(pRaw, dataPos, &pDb->compactStartTime, _OVER) SDB_GET_RESERVE(pRaw, dataPos, DB_RESERVE_SIZE, _OVER) taosInitRWLatch(&pDb->lock); @@ -274,6 +276,7 @@ static int32_t mndDbActionUpdate(SSdb *pSdb, SDbObj *pOld, SDbObj *pNew) { pOld->cfg.replications = pNew->cfg.replications; pOld->cfg.sstTrigger = pNew->cfg.sstTrigger; pOld->cfg.tsdbPageSize = pNew->cfg.tsdbPageSize; + pOld->compactStartTime = pNew->compactStartTime; taosWUnLockLatch(&pOld->lock); return 0; } @@ -1378,7 +1381,63 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs, return 0; } -static int32_t mndCompactDb(SMnode *pMnode, SDbObj *pDb) { return 0; } +static int32_t mndSetCompactDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, int64_t compactTs) { + SDbObj dbObj = {0}; + memcpy(&dbObj, pDb, sizeof(SDbObj)); + dbObj.compactStartTime = compactTs; + + SSdbRaw *pCommitRaw = mndDbActionEncode(&dbObj); + if (pCommitRaw == NULL) return -1; + if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) { + sdbFreeRaw(pCommitRaw); + return -1; + } + + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); + return 0; +} + +static int32_t mndSetCompactDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, int64_t compactTs) { + SSdb *pSdb = pMnode->pSdb; + void *pIter = NULL; + + while (1) { + SVgObj *pVgroup = NULL; + pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); + if (pIter == NULL) break; + + if (mndVgroupInDb(pVgroup, pDb->uid)) { + if (mndBuildCompactVgroupAction(pMnode, pTrans, pDb, pVgroup, compactTs) != 0) { + sdbCancelFetch(pSdb, pIter); + sdbRelease(pSdb, pVgroup); + return -1; + } + } + + sdbRelease(pSdb, pVgroup); + } + + return 0; +} + +static int32_t mndCompactDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb) { + int64_t compactTs = taosGetTimestampMs(); + int32_t code = -1; + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "compact-db"); + if (pTrans == NULL) goto _OVER; + + mInfo("trans:%d, used to compact db:%s", pTrans->id, pDb->name); + mndTransSetDbName(pTrans, pDb->name, NULL); + if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; + if (mndSetCompactDbCommitLogs(pMnode, pTrans, pDb, compactTs) != 0) goto _OVER; + if (mndSetCompactDbRedoActions(pMnode, pTrans, pDb, compactTs) != 0) goto _OVER; + if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; + code = 0; + +_OVER: + mndTransDrop(pTrans); + return code; +} static int32_t mndProcessCompactDbReq(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; @@ -1402,10 +1461,11 @@ static int32_t mndProcessCompactDbReq(SRpcMsg *pReq) { goto _OVER; } - code = mndCompactDb(pMnode, pDb); + code = mndCompactDb(pMnode, pReq, pDb); + if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; _OVER: - if (code != 0) { + if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("db:%s, failed to process compact db req since %s", compactReq.db, terrstr()); } diff --git a/source/dnode/mnode/impl/src/mndDef.c b/source/dnode/mnode/impl/src/mndDef.c index 8983d73c70..da2ad158e3 100644 --- a/source/dnode/mnode/impl/src/mndDef.c +++ b/source/dnode/mnode/impl/src/mndDef.c @@ -78,6 +78,7 @@ int32_t tEncodeSStreamObj(SEncoder *pEncoder, const SStreamObj *pObj) { // 3.0.20 if (tEncodeI64(pEncoder, pObj->checkpointFreq) < 0) return -1; + if (tEncodeI8(pEncoder, pObj->igCheckUpdate) < 0) return -1; tEndEncode(pEncoder); return pEncoder->pos; @@ -145,6 +146,7 @@ int32_t tDecodeSStreamObj(SDecoder *pDecoder, SStreamObj *pObj, int32_t sver) { // 3.0.20 if (sver >= 2) { if (tDecodeI64(pDecoder, &pObj->checkpointFreq) < 0) return -1; + if (tDecodeI8(pDecoder, &pObj->igCheckUpdate) < 0) return -1; } tEndDecode(pDecoder); return 0; @@ -493,7 +495,7 @@ int32_t tEncodeSubscribeObj(void **buf, const SMqSubscribeObj *pSub) { tlen += tEncodeSMqConsumerEp(buf, pConsumerEp); cnt++; } - if(cnt != sz) return -1; + if (cnt != sz) return -1; tlen += taosEncodeArray(buf, pSub->unassignedVgs, (FEncode)tEncodeSMqVgEp); tlen += taosEncodeString(buf, pSub->dbName); return tlen; diff --git a/source/dnode/mnode/impl/src/mndGrant.c b/source/dnode/mnode/impl/src/mndGrant.c index 396de7eed3..42851bd16a 100644 --- a/source/dnode/mnode/impl/src/mndGrant.c +++ b/source/dnode/mnode/impl/src/mndGrant.c @@ -129,7 +129,7 @@ void grantParseParameter() { mError("can't parsed parameter k"); } void grantReset(SMnode *pMnode, EGrantType grant, uint64_t value) {} void grantAdd(EGrantType grant, uint64_t value) {} void grantRestore(EGrantType grant, uint64_t value) {} -int32_t dmProcessGrantReq(SRpcMsg *pMsg) { return TSDB_CODE_SUCCESS; } +int32_t dmProcessGrantReq(void* pInfo, SRpcMsg *pMsg) { return TSDB_CODE_SUCCESS; } #endif diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 854535c82f..c3f37d86e3 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -669,9 +669,9 @@ _OVER: mGDebug( "msg:%p, type:%s failed to process since %s, mnode restored:%d stopped:%d, sync restored:%d " - "role:%s, redirect numOfEps:%d inUse:%d", + "role:%s, redirect numOfEps:%d inUse:%d, type:%s", pMsg, TMSG_INFO(pMsg->msgType), terrstr(), pMnode->restored, pMnode->stopped, state.restored, - syncStr(state.restored), epSet.numOfEps, epSet.inUse); + syncStr(state.restored), epSet.numOfEps, epSet.inUse, TMSG_INFO(pMsg->msgType)); if (epSet.numOfEps <= 0) return -1; diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 6b54a36a6f..bf9168ac8f 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -31,6 +31,8 @@ #define MND_STREAM_VER_NUMBER 2 #define MND_STREAM_RESERVE_SIZE 64 +#define MND_STREAM_MAX_NUM 10 + static int32_t mndStreamActionInsert(SSdb *pSdb, SStreamObj *pStream); static int32_t mndStreamActionDelete(SSdb *pSdb, SStreamObj *pStream); static int32_t mndStreamActionUpdate(SSdb *pSdb, SStreamObj *pStream, SStreamObj *pNewStream); @@ -295,6 +297,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, pObj->triggerParam = pCreate->maxDelay; pObj->watermark = pCreate->watermark; pObj->fillHistory = pCreate->fillHistory; + pObj->igCheckUpdate = pCreate->igUpdate; memcpy(pObj->sourceDb, pCreate->sourceDB, TSDB_DB_FNAME_LEN); SDbObj *pSourceDb = mndAcquireDb(pMnode, pCreate->sourceDB); @@ -377,6 +380,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, .triggerType = pObj->trigger == STREAM_TRIGGER_MAX_DELAY ? STREAM_TRIGGER_WINDOW_CLOSE : pObj->trigger, .watermark = pObj->watermark, .igExpired = pObj->igExpired, + .igCheckUpdate = pObj->igCheckUpdate, }; // using ast and param to build physical plan @@ -666,6 +670,35 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { goto _OVER; } + { + int32_t numOfStream = 0; + + SStreamObj *pStream = NULL; + void *pIter = NULL; + + while (1) { + pIter = sdbFetch(pMnode->pSdb, SDB_STREAM, pIter, (void **)&pStream); + if (pIter == NULL) { + if (numOfStream > MND_STREAM_MAX_NUM) { + mError("too many streams, no more than 10 for each database"); + terrno = TSDB_CODE_MND_TOO_MANY_STREAMS; + goto _OVER; + } + break; + } + + if (pStream->sourceDbUid == streamObj.sourceDbUid) { + ++numOfStream; + } + sdbRelease(pMnode->pSdb, pStream); + if (numOfStream > MND_STREAM_MAX_NUM) { + mError("too many streams, no more than 10 for each database"); + terrno = TSDB_CODE_MND_TOO_MANY_STREAMS; + goto _OVER; + } + } + } + pDb = mndAcquireDb(pMnode, streamObj.sourceDb); if (pDb->cfg.replications != 1) { mError("stream source db must have only 1 replica, but %s has %d", pDb->name, pDb->cfg.replications); diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index 7dc0912403..f618b8afae 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -85,7 +85,11 @@ int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta pRaw, pMgmt->transSec, pMgmt->transSeq); if (pMeta->code == 0) { - sdbWriteWithoutFree(pMnode->pSdb, pRaw); + int32_t code = sdbWriteWithoutFree(pMnode->pSdb, pRaw); + if (code != 0) { + mError("trans:%d, failed to write to sdb since %s", transId, terrstr()); + return 0; + } sdbSetApplyInfo(pMnode->pSdb, pMeta->index, pMeta->term, pMeta->lastConfigIndex); } @@ -110,8 +114,9 @@ int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta taosThreadMutexUnlock(&pMgmt->lock); STrans *pTrans = mndAcquireTrans(pMnode, transId); if (pTrans != NULL) { - mInfo("trans:%d, execute in mnode which not leader or sync timeout", transId); - mndTransExecute(pMnode, pTrans); + mInfo("trans:%d, execute in mnode which not leader or sync timeout, createTime:%" PRId64 " saved trans:%d", + transId, pTrans->createdTime, pMgmt->transId); + mndTransExecute(pMnode, pTrans, false); mndReleaseTrans(pMnode, pTrans); // sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA); } else { @@ -368,7 +373,7 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) { taosThreadMutexLock(&pMgmt->lock); pMgmt->errCode = 0; - if (pMgmt->transId != 0) { + if (pMgmt->transId != 0 /* && pMgmt->transId != transId*/) { mError("trans:%d, can't be proposed since trans:%d already waiting for confirm", transId, pMgmt->transId); taosThreadMutexUnlock(&pMgmt->lock); rpcFreeCont(req.pCont); diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index dfcd55bcba..6bb286cd6f 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -572,8 +572,20 @@ static void mndTransUpdateActions(SArray *pOldArray, SArray *pNewArray) { } static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) { - mTrace("trans:%d, perform update action, old row:%p stage:%s, new row:%p stage:%s", pOld->id, pOld, - mndTransStr(pOld->stage), pNew, mndTransStr(pNew->stage)); + mTrace("trans:%d, perform update action, old row:%p stage:%s create:%" PRId64 ", new row:%p stage:%s create:%" PRId64, + pOld->id, pOld, mndTransStr(pOld->stage), pOld->createdTime, pNew, mndTransStr(pNew->stage), + pNew->createdTime); + + if (pOld->createdTime != pNew->createdTime) { + mError("trans:%d, failed to perform update action since createTime not match, old row:%p stage:%s create:%" PRId64 + ", new row:%p stage:%s create:%" PRId64, + pOld->id, pOld, mndTransStr(pOld->stage), pOld->createdTime, pNew, mndTransStr(pNew->stage), + pNew->createdTime); + // only occured while sync timeout + terrno = TSDB_CODE_MND_TRNAS_SYNC_TIMEOUT; + return -1; + } + mndTransUpdateActions(pOld->redoActions, pNew->redoActions); mndTransUpdateActions(pOld->undoActions, pNew->undoActions); mndTransUpdateActions(pOld->commitActions, pNew->commitActions); @@ -779,16 +791,18 @@ static int32_t mndTransSync(SMnode *pMnode, STrans *pTrans) { } (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); - mInfo("trans:%d, sync to other mnodes, stage:%s", pTrans->id, mndTransStr(pTrans->stage)); + mInfo("trans:%d, sync to other mnodes, stage:%s createTime:%" PRId64, pTrans->id, mndTransStr(pTrans->stage), + pTrans->createdTime); int32_t code = mndSyncPropose(pMnode, pRaw, pTrans->id); if (code != 0) { - mError("trans:%d, failed to sync, errno:%s code:%s", pTrans->id, terrstr(), tstrerror(code)); + mError("trans:%d, failed to sync, errno:%s code:%s createTime:%" PRId64 " saved trans:%d", pTrans->id, terrstr(), + tstrerror(code), pTrans->createdTime, pMnode->syncMgmt.transId); sdbFreeRaw(pRaw); return -1; } sdbFreeRaw(pRaw); - mInfo("trans:%d, sync finished", pTrans->id); + mInfo("trans:%d, sync finished, createTime:%" PRId64, pTrans->id, pTrans->createdTime); return 0; } @@ -891,7 +905,7 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) { pTrans->rpcRsp = NULL; pTrans->rpcRspLen = 0; - mndTransExecute(pMnode, pNew); + mndTransExecute(pMnode, pNew, true); mndReleaseTrans(pMnode, pNew); return 0; } @@ -1054,7 +1068,7 @@ int32_t mndTransProcessRsp(SRpcMsg *pRsp) { mInfo("trans:%d, %s:%d response is received, code:0x%x, accept:0x%x retry:0x%x", transId, mndTransStr(pAction->stage), action, pRsp->code, pAction->acceptableCode, pAction->retryCode); - mndTransExecute(pMnode, pTrans); + mndTransExecute(pMnode, pTrans, true); _OVER: mndReleaseTrans(pMnode, pTrans); @@ -1483,15 +1497,17 @@ static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans) { mError("trans:%d, failed to write sdb since %s", pTrans->id, terrstr()); } - mInfo("trans:%d, execute finished, code:0x%x, failedTimes:%d", pTrans->id, pTrans->code, pTrans->failedTimes); + mInfo("trans:%d, execute finished, code:0x%x, failedTimes:%d createTime:%" PRId64, pTrans->id, pTrans->code, + pTrans->failedTimes, pTrans->createdTime); return continueExec; } -void mndTransExecute(SMnode *pMnode, STrans *pTrans) { +void mndTransExecute(SMnode *pMnode, STrans *pTrans, bool isLeader) { bool continueExec = true; while (continueExec) { - mInfo("trans:%d, continue to execute, stage:%s", pTrans->id, mndTransStr(pTrans->stage)); + mInfo("trans:%d, continue to execute, stage:%s createTime:%" PRId64 " leader:%d", pTrans->id, + mndTransStr(pTrans->stage), pTrans->createdTime, isLeader); pTrans->lastExecTime = taosGetTimestampMs(); switch (pTrans->stage) { case TRN_STAGE_PREPARE: @@ -1501,13 +1517,23 @@ void mndTransExecute(SMnode *pMnode, STrans *pTrans) { continueExec = mndTransPerformRedoActionStage(pMnode, pTrans); break; case TRN_STAGE_COMMIT: - continueExec = mndTransPerformCommitStage(pMnode, pTrans); + if (isLeader) { + continueExec = mndTransPerformCommitStage(pMnode, pTrans); + } else { + mInfo("trans:%d, can not commit since not leader", pTrans->id); + continueExec = false; + } break; case TRN_STAGE_COMMIT_ACTION: continueExec = mndTransPerformCommitActionStage(pMnode, pTrans); break; case TRN_STAGE_ROLLBACK: - continueExec = mndTransPerformRollbackStage(pMnode, pTrans); + if (isLeader) { + continueExec = mndTransPerformRollbackStage(pMnode, pTrans); + } else { + mInfo("trans:%d, can not rollback since not leader", pTrans->id); + continueExec = false; + } break; case TRN_STAGE_UNDO_ACTION: continueExec = mndTransPerformUndoActionStage(pMnode, pTrans); @@ -1550,7 +1576,7 @@ int32_t mndKillTrans(SMnode *pMnode, STrans *pTrans) { pAction->errCode = 0; } - mndTransExecute(pMnode, pTrans); + mndTransExecute(pMnode, pTrans, true); return 0; } @@ -1608,7 +1634,7 @@ void mndTransPullup(SMnode *pMnode) { int32_t *pTransId = taosArrayGet(pArray, i); STrans *pTrans = mndAcquireTrans(pMnode, *pTransId); if (pTrans != NULL) { - mndTransExecute(pMnode, pTrans); + mndTransExecute(pMnode, pTrans, true); } mndReleaseTrans(pMnode, pTrans); } diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index 67780a7369..171916b637 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -428,7 +428,7 @@ static void *mndBuildAlterVnodeHashRangeReq(SMnode *pMnode, SVgObj *pVgroup, int .hashEnd = pVgroup->hashEnd, }; - mInfo("vgId:%d, build alter vnode hashrange req, dstVgId:%d, begin:%u, end:%u", pVgroup->vgId, dstVgId, + mInfo("vgId:%d, build alter vnode hashrange req, dstVgId:%d, hashrange:[%u, %u]", pVgroup->vgId, dstVgId, pVgroup->hashBegin, pVgroup->hashEnd); int32_t contLen = tSerializeSAlterVnodeHashRangeReq(NULL, 0, &alterReq); if (contLen < 0) { @@ -528,7 +528,12 @@ SArray *mndBuildDnodesArray(SMnode *pMnode, int32_t exceptDnodeId) { return pArray; } -static int32_t mndCompareDnodeId(int32_t *dnode1Id, int32_t *dnode2Id) { return *dnode1Id >= *dnode2Id ? 1 : 0; } +static int32_t mndCompareDnodeId(int32_t *dnode1Id, int32_t *dnode2Id) { + if (*dnode1Id == *dnode2Id) { + return 0; + } + return *dnode1Id > *dnode2Id ? 1 : -1; +} static float mndGetDnodeScore(SDnodeObj *pDnode, int32_t additionDnodes, float ratio) { float totalDnodes = pDnode->numOfVnodes + (float)pDnode->numOfOtherNodes * ratio + additionDnodes; @@ -536,9 +541,12 @@ static float mndGetDnodeScore(SDnodeObj *pDnode, int32_t additionDnodes, float r } static int32_t mndCompareDnodeVnodes(SDnodeObj *pDnode1, SDnodeObj *pDnode2) { - float d1Score = mndGetDnodeScore(pDnode1, 0, 0.9); - float d2Score = mndGetDnodeScore(pDnode2, 0, 0.9); - return d1Score >= d2Score ? 1 : 0; + float d1Score = mndGetDnodeScore(pDnode1, 0, 0.9); + float d2Score = mndGetDnodeScore(pDnode2, 0, 0.9); + if (d1Score == d2Score) { + return 0; + } + return d1Score > d2Score ? 1 : -1; } void mndSortVnodeGid(SVgObj *pVgroup) { @@ -796,6 +804,13 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataAppend(pColInfo, numOfRows, (const char *)&pVgroup->isTsma, false); + // pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + // if (pDb == NULL || pDb->compactStartTime <= 0) { + // colDataAppendNULL(pColInfo, numOfRows); + // } else { + // colDataAppend(pColInfo, numOfRows, (const char *)&pDb->compactStartTime, false); + // } + numOfRows++; sdbRelease(pSdb, pVgroup); } @@ -1168,7 +1183,8 @@ int32_t mndAddAlterVnodeReplicaAction(SMnode *pMnode, STrans *pTrans, SDbObj *pD return 0; } -static int32_t mndAddDisableVnodeWriteAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int32_t dnodeId) { +static int32_t mndAddDisableVnodeWriteAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, + int32_t dnodeId) { SDnodeObj *pDnode = mndAcquireDnode(pMnode, dnodeId); if (pDnode == NULL) return -1; @@ -1894,12 +1910,6 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj } if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg1) != 0) goto _OVER; - mInfo("vgId:%d, vgroup info after adjust replica, replica:%d hashBegin:%u hashEnd:%u vnode:0 dnode:%d", newVg1.vgId, - newVg1.replica, newVg1.hashBegin, newVg1.hashEnd, newVg1.vnodeGid[0].dnodeId); - for (int32_t i = 0; i < newVg1.replica; ++i) { - mInfo("vgId:%d, vnode:%d dnode:%d", newVg1.vgId, i, newVg1.vnodeGid[i].dnodeId); - } - SVgObj newVg2 = {0}; memcpy(&newVg2, &newVg1, sizeof(SVgObj)); newVg1.replica = 1; @@ -1911,13 +1921,13 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj memcpy(&newVg2.vnodeGid[0], &newVg2.vnodeGid[1], sizeof(SVnodeGid)); memset(&newVg2.vnodeGid[1], 0, sizeof(SVnodeGid)); - mInfo("vgId:%d, vgroup info after adjust hash, replica:%d hashBegin:%u hashEnd:%u vnode:0 dnode:%d", newVg1.vgId, - newVg1.replica, newVg1.hashBegin, newVg1.hashEnd, newVg1.vnodeGid[0].dnodeId); + mInfo("vgId:%d, vgroup info after split, replica:%d hashrange:[%u, %u] vnode:0 dnode:%d", newVg1.vgId, newVg1.replica, + newVg1.hashBegin, newVg1.hashEnd, newVg1.vnodeGid[0].dnodeId); for (int32_t i = 0; i < newVg1.replica; ++i) { mInfo("vgId:%d, vnode:%d dnode:%d", newVg1.vgId, i, newVg1.vnodeGid[i].dnodeId); } - mInfo("vgId:%d, vgroup info after adjust hash, replica:%d hashBegin:%u hashEnd:%u vnode:0 dnode:%d", newVg2.vgId, - newVg2.replica, newVg2.hashBegin, newVg2.hashEnd, newVg2.vnodeGid[0].dnodeId); + mInfo("vgId:%d, vgroup info after split, replica:%d hashrange:[%u, %u] vnode:0 dnode:%d", newVg2.vgId, newVg2.replica, + newVg2.hashBegin, newVg2.hashEnd, newVg2.vnodeGid[0].dnodeId); for (int32_t i = 0; i < newVg1.replica; ++i) { mInfo("vgId:%d, vnode:%d dnode:%d", newVg2.vgId, i, newVg2.vnodeGid[i].dnodeId); } @@ -2198,3 +2208,59 @@ _OVER: } bool mndVgroupInDb(SVgObj *pVgroup, int64_t dbUid) { return !pVgroup->isTsma && pVgroup->dbUid == dbUid; } + +static void *mndBuildCompactVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen, + int64_t compactTs) { + SCompactVnodeReq compactReq = {0}; + compactReq.dbUid = pDb->uid; + compactReq.compactStartTime = compactTs; + tstrncpy(compactReq.db, pDb->name, TSDB_DB_FNAME_LEN); + + mInfo("vgId:%d, build compact vnode config req", pVgroup->vgId); + int32_t contLen = tSerializeSCompactVnodeReq(NULL, 0, &compactReq); + if (contLen < 0) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + contLen += sizeof(SMsgHead); + + void *pReq = taosMemoryMalloc(contLen); + if (pReq == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + + SMsgHead *pHead = pReq; + pHead->contLen = htonl(contLen); + pHead->vgId = htonl(pVgroup->vgId); + + tSerializeSCompactVnodeReq((char *)pReq + sizeof(SMsgHead), contLen, &compactReq); + *pContLen = contLen; + return pReq; +} + +static int32_t mndAddCompactVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, + int64_t compactTs) { + STransAction action = {0}; + action.epSet = mndGetVgroupEpset(pMnode, pVgroup); + + int32_t contLen = 0; + void *pReq = mndBuildCompactVnodeReq(pMnode, pDb, pVgroup, &contLen, compactTs); + if (pReq == NULL) return -1; + + action.pCont = pReq; + action.contLen = contLen; + action.msgType = TDMT_VND_COMPACT; + + if (mndTransAppendRedoAction(pTrans, &action) != 0) { + taosMemoryFree(pReq); + return -1; + } + + return 0; +} + +int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs) { + if (mndAddCompactVnodeAction(pMnode, pTrans, pDb, pVgroup, compactTs) != 0) return -1; + return 0; +} \ No newline at end of file diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index 1f7a059ffc..ea7046886e 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -14,6 +14,7 @@ target_sources( "src/vnd/vnodeSvr.c" "src/vnd/vnodeSync.c" "src/vnd/vnodeSnapshot.c" + "src/vnd/vnodeCompact.c" # meta "src/meta/metaOpen.c" @@ -53,6 +54,7 @@ target_sources( "src/tsdb/tsdbDiskData.c" "src/tsdb/tsdbCompact.c" "src/tsdb/tsdbMergeTree.c" + "src/tsdb/tsdbDataIter.c" # tq "src/tq/tq.c" diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 4bd8353a11..680cbbf929 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -181,7 +181,6 @@ int32_t tsdbReaderOpen(SVnode *pVnode, SQueryTableDataCond *pCond, void *pTableL void tsdbReaderClose(STsdbReader *pReader); bool tsdbNextDataBlock(STsdbReader *pReader); -void tsdbRetrieveDataBlockInfo(const STsdbReader *pReader, int32_t *rows, uint64_t *uid, STimeWindow *pWindow); int32_t tsdbRetrieveDatablockSMA(STsdbReader *pReader, SSDataBlock *pDataBlock, bool *allHave); void tsdbReleaseDataBlock(STsdbReader *pReader); SSDataBlock *tsdbRetrieveDataBlock(STsdbReader *pTsdbReadHandle, SArray *pColumnIdList); diff --git a/source/dnode/vnode/src/inc/sma.h b/source/dnode/vnode/src/inc/sma.h index 0072075623..c3e8d7ef1d 100644 --- a/source/dnode/vnode/src/inc/sma.h +++ b/source/dnode/vnode/src/inc/sma.h @@ -209,6 +209,8 @@ static FORCE_INLINE void tdUnRefSmaStat(SSma *pSma, SSmaStat *pStat) { smaDebug("vgId:%d, unref sma stat:%p, val:%d", SMA_VID(pSma), pStat, ref); } +int32_t smaPreClose(SSma *pSma); + // rsma void *tdFreeRSmaInfo(SSma *pSma, SRSmaInfo *pInfo, bool isDeepFree); int32_t tdRSmaFSOpen(SSma *pSma, int64_t version, int8_t rollback); diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 6ff085c8f1..5e97e75025 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -69,6 +69,8 @@ typedef struct SDiskCol SDiskCol; typedef struct SDiskData SDiskData; typedef struct SDiskDataBuilder SDiskDataBuilder; typedef struct SBlkInfo SBlkInfo; +typedef struct STsdbDataIter2 STsdbDataIter2; +typedef struct STsdbFilterInfo STsdbFilterInfo; #define TSDBROW_ROW_FMT ((int8_t)0x0) #define TSDBROW_COL_FMT ((int8_t)0x1) @@ -163,6 +165,8 @@ void tBlockDataDestroy(SBlockData *pBlockData); int32_t tBlockDataInit(SBlockData *pBlockData, TABLEID *pId, STSchema *pTSchema, int16_t *aCid, int32_t nCid); void tBlockDataReset(SBlockData *pBlockData); int32_t tBlockDataAppendRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTSchema, int64_t uid); +int32_t tBlockDataTryUpsertRow(SBlockData *pBlockData, TSDBROW *pRow, int64_t uid); +int32_t tBlockDataUpsertRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTSchema, int64_t uid); void tBlockDataClear(SBlockData *pBlockData); void tBlockDataGetColData(SBlockData *pBlockData, int16_t cid, SColData **ppColData); int32_t tCmprBlockData(SBlockData *pBlockData, int8_t cmprAlg, uint8_t **ppOut, int32_t *szOut, uint8_t *aBuf[], @@ -277,6 +281,7 @@ int32_t tsdbReadDataBlk(SDataFReader *pReader, SBlockIdx *pBlockIdx, SMapData *m int32_t tsdbReadSttBlk(SDataFReader *pReader, int32_t iStt, SArray *aSttBlk); int32_t tsdbReadBlockSma(SDataFReader *pReader, SDataBlk *pBlock, SArray *aColumnDataAgg); int32_t tsdbReadDataBlock(SDataFReader *pReader, SDataBlk *pBlock, SBlockData *pBlockData); +int32_t tsdbReadDataBlockEx(SDataFReader *pReader, SDataBlk *pDataBlk, SBlockData *pBlockData); int32_t tsdbReadSttBlock(SDataFReader *pReader, int32_t iStt, SSttBlk *pSttBlk, SBlockData *pBlockData); int32_t tsdbReadSttBlockEx(SDataFReader *pReader, int32_t iStt, SSttBlk *pSttBlk, SBlockData *pBlockData); // SDelFWriter @@ -308,6 +313,26 @@ int32_t tDiskDataBuilderInit(SDiskDataBuilder *pBuilder, STSchema *pTSchema, TAB int32_t tDiskDataBuilderClear(SDiskDataBuilder *pBuilder); int32_t tDiskDataAddRow(SDiskDataBuilder *pBuilder, TSDBROW *pRow, STSchema *pTSchema, TABLEID *pId); int32_t tGnrtDiskData(SDiskDataBuilder *pBuilder, const SDiskData **ppDiskData, const SBlkInfo **ppBlkInfo); +// tsdbDataIter.c ============================================================================================== +#define TSDB_MEM_TABLE_DATA_ITER 0 +#define TSDB_DATA_FILE_DATA_ITER 1 +#define TSDB_STT_FILE_DATA_ITER 2 +#define TSDB_TOMB_FILE_DATA_ITER 3 + +#define TSDB_FILTER_FLAG_BY_VERSION 0x1 +#define TSDB_FILTER_FLAG_BY_TABLEID 0x2 + +#define TSDB_RBTN_TO_DATA_ITER(pNode) ((STsdbDataIter2 *)(((char *)pNode) - offsetof(STsdbDataIter2, rbtn))) +/* open */ +int32_t tsdbOpenDataFileDataIter(SDataFReader *pReader, STsdbDataIter2 **ppIter); +int32_t tsdbOpenSttFileDataIter(SDataFReader *pReader, int32_t iStt, STsdbDataIter2 **ppIter); +int32_t tsdbOpenTombFileDataIter(SDelFReader *pReader, STsdbDataIter2 **ppIter); +/* close */ +void tsdbCloseDataIter2(STsdbDataIter2 *pIter); +/* cmpr */ +int32_t tsdbDataIterCmprFn(const SRBTreeNode *pNode1, const SRBTreeNode *pNode2); +/* next */ +int32_t tsdbDataIterNext2(STsdbDataIter2 *pIter, STsdbFilterInfo *pFilterInfo); // structs ======================= struct STsdbFS { @@ -325,6 +350,8 @@ struct STsdb { STsdbFS fs; SLRUCache *lruCache; TdThreadMutex lruMutex; + SLRUCache *biCache; + TdThreadMutex biMutex; }; struct TSDBKEY { @@ -642,6 +669,7 @@ struct SDataFReader { uint8_t *aBuf[3]; }; +// NOTE: do NOT change the order of the fields typedef struct { int64_t suid; int64_t uid; @@ -764,6 +792,9 @@ int32_t tsdbCacheGetLastH(SLRUCache *pCache, tb_uid_t uid, SCacheRowsReader *pr, int32_t tsdbCacheGetLastrowH(SLRUCache *pCache, tb_uid_t uid, SCacheRowsReader *pr, LRUHandle **h); int32_t tsdbCacheRelease(SLRUCache *pCache, LRUHandle *h); +int32_t tsdbCacheGetBlockIdx(SLRUCache *pCache, SDataFReader *pFileReader, LRUHandle **handle); +int32_t tsdbBICacheRelease(SLRUCache *pCache, LRUHandle *h); + int32_t tsdbCacheDeleteLastrow(SLRUCache *pCache, tb_uid_t uid, TSKEY eKey); int32_t tsdbCacheDeleteLast(SLRUCache *pCache, tb_uid_t uid, TSKEY eKey); int32_t tsdbCacheDelete(SLRUCache *pCache, tb_uid_t uid, TSKEY eKey); @@ -825,6 +856,65 @@ static FORCE_INLINE TSDBROW *tsdbTbDataIterGet(STbDataIter *pIter) { return pIter->pRow; } +int32_t tRowInfoCmprFn(const void *p1, const void *p2); + +typedef struct { + int64_t suid; + int64_t uid; + SDelData delData; +} SDelInfo; + +struct STsdbDataIter2 { + STsdbDataIter2 *next; + SRBTreeNode rbtn; + + int32_t type; + SRowInfo rowInfo; + SDelInfo delInfo; + union { + // TSDB_MEM_TABLE_DATA_ITER + struct { + SMemTable *pMemTable; + } mIter; + + // TSDB_DATA_FILE_DATA_ITER + struct { + SDataFReader *pReader; + SArray *aBlockIdx; // SArray + SMapData mDataBlk; + SBlockData bData; + int32_t iBlockIdx; + int32_t iDataBlk; + int32_t iRow; + } dIter; + + // TSDB_STT_FILE_DATA_ITER + struct { + SDataFReader *pReader; + int32_t iStt; + SArray *aSttBlk; + SBlockData bData; + int32_t iSttBlk; + int32_t iRow; + } sIter; + // TSDB_TOMB_FILE_DATA_ITER + struct { + SDelFReader *pReader; + SArray *aDelIdx; + SArray *aDelData; + int32_t iDelIdx; + int32_t iDelData; + } tIter; + }; +}; + +struct STsdbFilterInfo { + int32_t flag; + int64_t sver; + int64_t ever; + TABLEID tbid; +}; + #ifdef __cplusplus } #endif diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index e0d0e9408b..88cd1d99e1 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -100,12 +100,16 @@ int32_t vnodeShouldCommit(SVnode* pVnode); void vnodeUpdCommitSched(SVnode* pVnode); void vnodeRollback(SVnode* pVnode); int32_t vnodeSaveInfo(const char* dir, const SVnodeInfo* pCfg); -int32_t vnodeCommitInfo(const char* dir, const SVnodeInfo* pInfo); +int32_t vnodeCommitInfo(const char* dir); int32_t vnodeLoadInfo(const char* dir, SVnodeInfo* pInfo); int32_t vnodeSyncCommit(SVnode* pVnode); int32_t vnodeAsyncCommit(SVnode* pVnode); bool vnodeShouldRollback(SVnode* pVnode); +// vnodeCompact.c +int32_t vnodeAsyncCompact(SVnode* pVnode); +int32_t vnodeSyncCompact(SVnode* pVnode); + // vnodeSync.c int32_t vnodeSyncOpen(SVnode* pVnode, char* path); int32_t vnodeSyncStart(SVnode* pVnode); diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index 84330b279f..4c44d799b1 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -76,6 +76,7 @@ typedef struct SRSmaSnapReader SRSmaSnapReader; typedef struct SRSmaSnapWriter SRSmaSnapWriter; typedef struct SSnapDataHdr SSnapDataHdr; typedef struct SCommitInfo SCommitInfo; +typedef struct SCompactInfo SCompactInfo; typedef struct SQueryNode SQueryNode; #define VNODE_META_DIR "meta" @@ -173,6 +174,7 @@ int tsdbClose(STsdb** pTsdb); int32_t tsdbBegin(STsdb* pTsdb); int32_t tsdbPrepareCommit(STsdb* pTsdb); int32_t tsdbCommit(STsdb* pTsdb, SCommitInfo* pInfo); +int32_t tsdbCompact(STsdb* pTsdb, SCompactInfo* pInfo); int32_t tsdbFinishCommit(STsdb* pTsdb); int32_t tsdbRollbackCommit(STsdb* pTsdb); int32_t tsdbDoRetention(STsdb* pTsdb, int64_t now); @@ -452,6 +454,12 @@ struct SCommitInfo { TXN* txn; }; +struct SCompactInfo { + SVnode* pVnode; + int32_t flag; + int64_t commitID; +}; + #ifdef __cplusplus } #endif diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 78e0643e10..335cfc32d5 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -1409,6 +1409,9 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) { int32_t ret = 0; // get super table if (tdbTbGet(pMeta->pUidIdx, &pCtbEntry->ctbEntry.suid, sizeof(tb_uid_t), &pData, &nData) != 0) { + metaError("vgId:%d, failed to get stable suid for update. version:%" PRId64, TD_VID(pMeta->pVnode), + pCtbEntry->version); + terrno = TSDB_CODE_TDB_INVALID_TABLE_ID; ret = -1; goto end; } diff --git a/source/dnode/vnode/src/sma/smaCommit.c b/source/dnode/vnode/src/sma/smaCommit.c index 38f04bb8e8..51011ef791 100644 --- a/source/dnode/vnode/src/sma/smaCommit.c +++ b/source/dnode/vnode/src/sma/smaCommit.c @@ -17,18 +17,26 @@ extern SSmaMgmt smaMgmt; -static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma); +static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma, bool isCommit); static int32_t tdProcessRSmaAsyncCommitImpl(SSma *pSma, SCommitInfo *pInfo); static int32_t tdProcessRSmaAsyncPostCommitImpl(SSma *pSma); static int32_t tdUpdateQTaskInfoFiles(SSma *pSma, SRSmaStat *pRSmaStat); +/** + * @brief only applicable to Rollup SMA + * + * @param pSma + * @return int32_t + */ +int32_t smaPreClose(SSma *pSma) { return tdProcessRSmaAsyncPreCommitImpl(pSma, false); } + /** * @brief async commit, only applicable to Rollup SMA * * @param pSma * @return int32_t */ -int32_t smaPrepareAsyncCommit(SSma *pSma) { return tdProcessRSmaAsyncPreCommitImpl(pSma); } +int32_t smaPrepareAsyncCommit(SSma *pSma) { return tdProcessRSmaAsyncPreCommitImpl(pSma, true); } /** * @brief async commit, only applicable to Rollup SMA @@ -122,9 +130,10 @@ _exit: * 2) Wait all running fetch task finish to fetch and put submitMsg into level 2/3 wQueue(blocking level 1 write) * * @param pSma + * @param isCommit * @return int32_t */ -static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) { +static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma, bool isCommit) { int32_t code = 0; int32_t lino = 0; @@ -139,28 +148,30 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) { // step 1: set rsma stat atomic_store_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_PAUSED); - while (atomic_val_compare_exchange_8(RSMA_COMMIT_STAT(pRSmaStat), 0, 1) != 0) { - ++nLoops; - if (nLoops > 1000) { - sched_yield(); - nLoops = 0; + if (isCommit) { + while (atomic_val_compare_exchange_8(RSMA_COMMIT_STAT(pRSmaStat), 0, 1) != 0) { + ++nLoops; + if (nLoops > 1000) { + sched_yield(); + nLoops = 0; + } + } + + pRSmaStat->commitAppliedVer = pSma->pVnode->state.applied; + if (ASSERTS(pRSmaStat->commitAppliedVer >= -1, "commit applied version %" PRIi64 " < -1", + pRSmaStat->commitAppliedVer)) { + code = TSDB_CODE_APP_ERROR; + TSDB_CHECK_CODE(code, lino, _exit); } } - pRSmaStat->commitAppliedVer = pSma->pVnode->state.applied; - if (ASSERTS(pRSmaStat->commitAppliedVer >= 0, "commit applied version %" PRIi64 " < 0", - pRSmaStat->commitAppliedVer)) { - code = TSDB_CODE_APP_ERROR; - TSDB_CHECK_CODE(code, lino, _exit); - } - // step 2: wait for all triggered fetch tasks to finish nLoops = 0; while (1) { - if (T_REF_VAL_GET(pStat) == 0) { - smaDebug("vgId:%d, rsma commit, fetch tasks are all finished", SMA_VID(pSma)); + if (atomic_load_32(&pRSmaStat->nFetchAll) <= 0) { + smaDebug("vgId:%d, rsma commit:%d, fetch tasks are all finished", SMA_VID(pSma), isCommit); break; } else { - smaDebug("vgId:%d, rsma commit, fetch tasks are not all finished yet", SMA_VID(pSma)); + smaDebug("vgId:%d, rsma commit%d, fetch tasks are not all finished yet", SMA_VID(pSma), isCommit); } ++nLoops; if (nLoops > 1000) { @@ -174,7 +185,7 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) { * 1) This is high cost task and should not put in asyncPreCommit originally. * 2) But, if put in asyncCommit, would trigger taskInfo cloning frequently. */ - smaInfo("vgId:%d, rsma commit, wait for all items to be consumed, TID:%p", SMA_VID(pSma), + smaInfo("vgId:%d, rsma commit:%d, wait for all items to be consumed, TID:%p", SMA_VID(pSma), isCommit, (void *)taosGetSelfPthreadId()); nLoops = 0; while (atomic_load_64(&pRSmaStat->nBufItems) > 0) { @@ -184,10 +195,13 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) { nLoops = 0; } } + + if (!isCommit) goto _exit; + smaInfo("vgId:%d, rsma commit, all items are consumed, TID:%p", SMA_VID(pSma), (void *)taosGetSelfPthreadId()); code = tdRSmaPersistExecImpl(pRSmaStat, RSMA_INFO_HASH(pRSmaStat)); TSDB_CHECK_CODE(code, lino, _exit); - + smaInfo("vgId:%d, rsma commit, operator state committed, TID:%p", SMA_VID(pSma), (void *)taosGetSelfPthreadId()); #if 0 // consuming task of qTaskInfo clone @@ -223,7 +237,7 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) { _exit: if (code) { - smaError("vgId:%d, %s failed at line %d since %s", SMA_VID(pSma), __func__, lino, tstrerror(code)); + smaError("vgId:%d, %s failed at line %d since %s(%d)", SMA_VID(pSma), __func__, lino, tstrerror(code), isCommit); } return code; } @@ -243,7 +257,7 @@ static int32_t tdProcessRSmaAsyncCommitImpl(SSma *pSma, SCommitInfo *pInfo) { if (!pSmaEnv) { goto _exit; } - + code = tdRSmaFSCommit(pSma); TSDB_CHECK_CODE(code, lino, _exit); diff --git a/source/dnode/vnode/src/sma/smaOpen.c b/source/dnode/vnode/src/sma/smaOpen.c index 21c2839943..00000cb129 100644 --- a/source/dnode/vnode/src/sma/smaOpen.c +++ b/source/dnode/vnode/src/sma/smaOpen.c @@ -167,6 +167,7 @@ _exit: int32_t smaClose(SSma *pSma) { if (pSma) { + smaPreClose(pSma); taosThreadMutexDestroy(&pSma->mutex); SMA_TSMA_ENV(pSma) = tdFreeSmaEnv(SMA_TSMA_ENV(pSma)); SMA_RSMA_ENV(pSma) = tdFreeSmaEnv(SMA_RSMA_ENV(pSma)); diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index d18014c37b..c67fa4bdf1 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -15,6 +15,34 @@ #include "tsdb.h" +static int32_t tsdbOpenBICache(STsdb *pTsdb) { + int32_t code = 0; + SLRUCache *pCache = taosLRUCacheInit(5 * 1024 * 1024, -1, .5); + if (pCache == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _err; + } + + taosLRUCacheSetStrictCapacity(pCache, false); + + taosThreadMutexInit(&pTsdb->biMutex, NULL); + +_err: + pTsdb->biCache = pCache; + return code; +} + +static void tsdbCloseBICache(STsdb *pTsdb) { + SLRUCache *pCache = pTsdb->biCache; + if (pCache) { + taosLRUCacheEraseUnrefEntries(pCache); + + taosLRUCacheCleanup(pCache); + + taosThreadMutexDestroy(&pTsdb->biMutex); + } +} + int32_t tsdbOpenCache(STsdb *pTsdb) { int32_t code = 0; SLRUCache *pCache = NULL; @@ -26,6 +54,12 @@ int32_t tsdbOpenCache(STsdb *pTsdb) { goto _err; } + code = tsdbOpenBICache(pTsdb); + if (code != TSDB_CODE_SUCCESS) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _err; + } + taosLRUCacheSetStrictCapacity(pCache, false); taosThreadMutexInit(&pTsdb->lruMutex, NULL); @@ -44,6 +78,8 @@ void tsdbCloseCache(STsdb *pTsdb) { taosThreadMutexDestroy(&pTsdb->lruMutex); } + + tsdbCloseBICache(pTsdb); } static void getTableCacheKey(tb_uid_t uid, int cacheType, char *key, int *len) { @@ -1538,3 +1574,84 @@ size_t tsdbCacheGetUsage(SVnode *pVnode) { return usage; } + +static void getBICacheKey(int32_t fid, int64_t commitID, char *key, int *len) { + struct { + int32_t fid; + int64_t commitID; + } biKey = {0}; + + biKey.fid = fid; + biKey.commitID = commitID; + + *len = sizeof(biKey); + memcpy(key, &biKey, *len); +} + +static int32_t tsdbCacheLoadBlockIdx(SDataFReader *pFileReader, SArray **aBlockIdx) { + SArray *pArray = taosArrayInit(8, sizeof(SBlockIdx)); + int32_t code = tsdbReadBlockIdx(pFileReader, pArray); + + if (code != TSDB_CODE_SUCCESS) { + taosArrayDestroy(pArray); + code = TSDB_CODE_OUT_OF_MEMORY; + return code; + } + + *aBlockIdx = pArray; + + return code; +} + +static void deleteBICache(const void *key, size_t keyLen, void *value) { + SArray *pArray = (SArray *)value; + + taosArrayDestroy(pArray); +} + +int32_t tsdbCacheGetBlockIdx(SLRUCache *pCache, SDataFReader *pFileReader, LRUHandle **handle) { + int32_t code = 0; + char key[128] = {0}; + int keyLen = 0; + + getBICacheKey(pFileReader->pSet->fid, pFileReader->pSet->pHeadF->commitID, key, &keyLen); + LRUHandle *h = taosLRUCacheLookup(pCache, key, keyLen); + if (!h) { + STsdb *pTsdb = pFileReader->pTsdb; + taosThreadMutexLock(&pTsdb->biMutex); + + h = taosLRUCacheLookup(pCache, key, keyLen); + if (!h) { + SArray *pArray = NULL; + code = tsdbCacheLoadBlockIdx(pFileReader, &pArray); + // if table's empty or error, return code of -1 + if (code != TSDB_CODE_SUCCESS || pArray == NULL) { + taosThreadMutexUnlock(&pTsdb->biMutex); + + *handle = NULL; + return 0; + } + + size_t charge = pArray->capacity * pArray->elemSize + sizeof(*pArray); + _taos_lru_deleter_t deleter = deleteBICache; + LRUStatus status = taosLRUCacheInsert(pCache, key, keyLen, pArray, charge, deleter, &h, TAOS_LRU_PRIORITY_LOW); + if (status != TAOS_LRU_STATUS_OK) { + code = -1; + } + } + + taosThreadMutexUnlock(&pTsdb->biMutex); + } + + *handle = h; + + return code; +} + +int32_t tsdbBICacheRelease(SLRUCache *pCache, LRUHandle *h) { + int32_t code = 0; + + taosLRUCacheRelease(pCache, h, false); + + return code; +} diff --git a/source/dnode/vnode/src/tsdb/tsdbCompact.c b/source/dnode/vnode/src/tsdb/tsdbCompact.c index fb3917be64..fc7df98217 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCompact.c +++ b/source/dnode/vnode/src/tsdb/tsdbCompact.c @@ -15,13 +15,653 @@ #include "tsdb.h" +extern int32_t tsdbUpdateTableSchema(SMeta *pMeta, int64_t suid, int64_t uid, SSkmInfo *pSkmInfo); +extern int32_t tsdbWriteDataBlock(SDataFWriter *pWriter, SBlockData *pBlockData, SMapData *mDataBlk, int8_t cmprAlg); +extern int32_t tsdbWriteSttBlock(SDataFWriter *pWriter, SBlockData *pBlockData, SArray *aSttBlk, int8_t cmprAlg); + typedef struct { STsdb *pTsdb; + int64_t commitID; + int8_t cmprAlg; + int32_t maxRows; + int32_t minRows; + STsdbFS fs; + + int32_t fid; + TABLEID tbid; + SSkmInfo tbSkm; + + // Tombstone + SDelFReader *pDelFReader; + SArray *aDelIdx; // SArray + SArray *aDelData; // SArray + SArray *aSkyLine; // SArray + int32_t iDelIdx; + int32_t iSkyLine; + TSDBKEY *pDKey; + TSDBKEY dKey; + + // Reader + SDataFReader *pReader; + STsdbDataIter2 *iterList; // list of iterators + STsdbDataIter2 *pIter; + SRBTree rbt; + + // Writer + SDataFWriter *pWriter; + SArray *aBlockIdx; // SArray + SMapData mDataBlk; // SMapData + SArray *aSttBlk; // SArray + SBlockData bData; + SBlockData sData; } STsdbCompactor; -int32_t tsdbCompact(STsdb *pTsdb) { +static int32_t tsdbCommitCompact(STsdbCompactor *pCompactor) { int32_t code = 0; - // TODO + int32_t lino = 0; + + STsdb *pTsdb = pCompactor->pTsdb; + + code = tsdbFSPrepareCommit(pTsdb, &pCompactor->fs); + TSDB_CHECK_CODE(code, lino, _exit); + + taosThreadRwlockWrlock(&pTsdb->rwLock); + + code = tsdbFSCommit(pTsdb); + if (code) { + taosThreadRwlockUnlock(&pTsdb->rwLock); + TSDB_CHECK_CODE(code, lino, _exit); + } + + taosThreadRwlockUnlock(&pTsdb->rwLock); + +_exit: + if (code) { + tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code)); + } + return code; +} + +static int32_t tsdbAbortCompact(STsdbCompactor *pCompactor) { + int32_t code = 0; + int32_t lino = 0; + + STsdb *pTsdb = pCompactor->pTsdb; + code = tsdbFSRollback(pTsdb); + TSDB_CHECK_CODE(code, lino, _exit); + +_exit: + if (code) { + tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code)); + } else { + tsdbInfo("vgId:%d %s done", TD_VID(pTsdb->pVnode), __func__); + } + return code; +} + +static int32_t tsdbCompactWriteTableDataStart(STsdbCompactor *pCompactor, TABLEID *pId) { + int32_t code = 0; + int32_t lino = 0; + + pCompactor->tbid = *pId; + + // tombstone + for (;;) { + if (pCompactor->iDelIdx >= taosArrayGetSize(pCompactor->aDelIdx)) { + pCompactor->pDKey = NULL; + break; + } + + SDelIdx *pDelIdx = (SDelIdx *)taosArrayGet(pCompactor->aDelIdx, pCompactor->iDelIdx); + int32_t c = tTABLEIDCmprFn(pDelIdx, &pCompactor->tbid); + if (c < 0) { + pCompactor->iDelIdx++; + } else if (c == 0) { + pCompactor->iDelIdx++; + + code = tsdbReadDelData(pCompactor->pDelFReader, pDelIdx, pCompactor->aDelData); + TSDB_CHECK_CODE(code, lino, _exit); + + code = tsdbBuildDeleteSkyline(pCompactor->aDelData, 0, taosArrayGetSize(pCompactor->aDelData) - 1, + pCompactor->aSkyLine); + TSDB_CHECK_CODE(code, lino, _exit); + + pCompactor->iSkyLine = 0; + if (pCompactor->iSkyLine < taosArrayGetSize(pCompactor->aSkyLine)) { + TSDBKEY *pKey = (TSDBKEY *)taosArrayGet(pCompactor->aSkyLine, pCompactor->iSkyLine); + + pCompactor->dKey.version = 0; + pCompactor->dKey.ts = pKey->ts; + pCompactor->pDKey = &pCompactor->dKey; + } else { + pCompactor->pDKey = NULL; + } + break; + } else { + pCompactor->pDKey = NULL; + break; + } + } + + // writer + code = tsdbUpdateTableSchema(pCompactor->pTsdb->pVnode->pMeta, pId->suid, pId->uid, &pCompactor->tbSkm); + TSDB_CHECK_CODE(code, lino, _exit); + + tMapDataReset(&pCompactor->mDataBlk); + + code = tBlockDataInit(&pCompactor->bData, pId, pCompactor->tbSkm.pTSchema, NULL, 0); + TSDB_CHECK_CODE(code, lino, _exit); + + if (!TABLE_SAME_SCHEMA(pCompactor->sData.suid, pCompactor->sData.uid, pId->suid, pId->uid)) { + if (pCompactor->sData.nRow > 0) { + code = tsdbWriteSttBlock(pCompactor->pWriter, &pCompactor->sData, pCompactor->aSttBlk, pCompactor->cmprAlg); + TSDB_CHECK_CODE(code, lino, _exit); + } + + TABLEID tbid = {.suid = pId->suid, .uid = pId->suid ? 0 : pId->uid}; + code = tBlockDataInit(&pCompactor->sData, &tbid, pCompactor->tbSkm.pTSchema, NULL, 0); + TSDB_CHECK_CODE(code, lino, _exit); + } + +_exit: + if (code) { + tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, + tstrerror(code)); + } else { + tsdbDebug("vgId:%d %s done, suid:%" PRId64 " uid:%" PRId64, TD_VID(pCompactor->pTsdb->pVnode), __func__, pId->suid, + pId->uid); + } + return code; +} + +static int32_t tsdbCompactWriteTableDataEnd(STsdbCompactor *pCompactor) { + int32_t code = 0; + int32_t lino = 0; + + if (pCompactor->bData.nRow > 0) { + if (pCompactor->bData.nRow < pCompactor->minRows) { + for (int32_t iRow = 0; iRow < pCompactor->bData.nRow; iRow++) { + code = tBlockDataAppendRow(&pCompactor->sData, &tsdbRowFromBlockData(&pCompactor->bData, iRow), NULL, + pCompactor->tbid.uid); + TSDB_CHECK_CODE(code, lino, _exit); + + if (pCompactor->sData.nRow >= pCompactor->maxRows) { + code = tsdbWriteSttBlock(pCompactor->pWriter, &pCompactor->sData, pCompactor->aSttBlk, pCompactor->cmprAlg); + TSDB_CHECK_CODE(code, lino, _exit); + } + } + tBlockDataClear(&pCompactor->bData); + } else { + code = tsdbWriteDataBlock(pCompactor->pWriter, &pCompactor->bData, &pCompactor->mDataBlk, pCompactor->cmprAlg); + TSDB_CHECK_CODE(code, lino, _exit); + } + } + + if (pCompactor->mDataBlk.nItem > 0) { + SBlockIdx *pBlockIdx = (SBlockIdx *)taosArrayReserve(pCompactor->aBlockIdx, 1); + if (pBlockIdx == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + + pBlockIdx->suid = pCompactor->tbid.suid; + pBlockIdx->uid = pCompactor->tbid.uid; + + code = tsdbWriteDataBlk(pCompactor->pWriter, &pCompactor->mDataBlk, pBlockIdx); + TSDB_CHECK_CODE(code, lino, _exit); + } + +_exit: + if (code) { + tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, + tstrerror(code)); + } else { + tsdbDebug("vgId:%d %s done, suid:%" PRId64 " uid:%" PRId64, TD_VID(pCompactor->pTsdb->pVnode), __func__, + pCompactor->tbid.suid, pCompactor->tbid.uid); + } + return code; +} + +static bool tsdbCompactRowIsDeleted(STsdbCompactor *pCompactor, TSDBROW *pRow) { + TSDBKEY tKey = TSDBROW_KEY(pRow); + TSDBKEY *aKey = (TSDBKEY *)TARRAY_DATA(pCompactor->aSkyLine); + int32_t nKey = TARRAY_SIZE(pCompactor->aSkyLine); + + if (tKey.ts > pCompactor->pDKey->ts) { + do { + pCompactor->pDKey->version = aKey[pCompactor->iSkyLine].version; + pCompactor->iSkyLine++; + if (pCompactor->iSkyLine < nKey) { + pCompactor->dKey.ts = aKey[pCompactor->iSkyLine].ts; + } else { + if (pCompactor->pDKey->version == 0) { + pCompactor->pDKey = NULL; + return false; + } else { + pCompactor->pDKey->ts = INT64_MAX; + } + } + } while (tKey.ts > pCompactor->pDKey->ts); + } + + if (tKey.ts < pCompactor->pDKey->ts) { + if (tKey.version > pCompactor->pDKey->version) { + return false; + } else { + return true; + } + } else if (tKey.ts == pCompactor->pDKey->ts) { + ASSERT(pCompactor->iSkyLine < nKey); + if (tKey.version > TMAX(pCompactor->pDKey->version, aKey[pCompactor->iSkyLine].version)) { + return false; + } else { + return true; + } + } + + return false; +} + +static int32_t tsdbCompactWriteTableData(STsdbCompactor *pCompactor, SRowInfo *pRowInfo) { + int32_t code = 0; + int32_t lino = 0; + + // start a new table data write if need + if (pRowInfo == NULL || pRowInfo->uid != pCompactor->tbid.uid) { + if (pCompactor->tbid.uid) { + code = tsdbCompactWriteTableDataEnd(pCompactor); + TSDB_CHECK_CODE(code, lino, _exit); + } + + if (pRowInfo == NULL) { + if (pCompactor->sData.nRow > 0) { + code = tsdbWriteSttBlock(pCompactor->pWriter, &pCompactor->sData, pCompactor->aSttBlk, pCompactor->cmprAlg); + TSDB_CHECK_CODE(code, lino, _exit); + } + return code; + } + + code = tsdbCompactWriteTableDataStart(pCompactor, (TABLEID *)pRowInfo); + TSDB_CHECK_CODE(code, lino, _exit); + } + + // check if row is deleted + if (pCompactor->pDKey && tsdbCompactRowIsDeleted(pCompactor, &pRowInfo->row)) goto _exit; + + if (tBlockDataTryUpsertRow(&pCompactor->bData, &pRowInfo->row, pRowInfo->uid) > pCompactor->maxRows) { + code = tsdbWriteDataBlock(pCompactor->pWriter, &pCompactor->bData, &pCompactor->mDataBlk, pCompactor->cmprAlg); + TSDB_CHECK_CODE(code, lino, _exit); + } + + code = tBlockDataUpsertRow(&pCompactor->bData, &pRowInfo->row, NULL, pRowInfo->uid); + TSDB_CHECK_CODE(code, lino, _exit); + +_exit: + if (code) { + tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, + tstrerror(code)); + } else if (pRowInfo) { + tsdbTrace("vgId:%d %s done, suid:%" PRId64 " uid:%" PRId64 " ts:%" PRId64 " version:%" PRId64, + TD_VID(pCompactor->pTsdb->pVnode), __func__, pRowInfo->suid, pRowInfo->uid, TSDBROW_TS(&pRowInfo->row), + TSDBROW_VERSION(&pRowInfo->row)); + } + return code; +} + +static bool tsdbCompactTableIsDropped(STsdbCompactor *pCompactor) { + SMetaInfo info; + + if (pCompactor->pIter->rowInfo.uid == pCompactor->tbid.uid) return false; + if (metaGetInfo(pCompactor->pTsdb->pVnode->pMeta, pCompactor->pIter->rowInfo.uid, &info, NULL)) { + return true; + } + return false; +} +static int32_t tsdbCompactNextRow(STsdbCompactor *pCompactor, SRowInfo **ppRowInfo) { + int32_t code = 0; + int32_t lino = 0; + + for (;;) { + if (pCompactor->pIter) { + code = tsdbDataIterNext2(pCompactor->pIter, NULL); + TSDB_CHECK_CODE(code, lino, _exit); + + if (pCompactor->pIter->rowInfo.suid == 0 && pCompactor->pIter->rowInfo.uid == 0) { + pCompactor->pIter = NULL; + } else { + SRBTreeNode *pNode = tRBTreeMin(&pCompactor->rbt); + if (pNode) { + int32_t c = tsdbDataIterCmprFn(&pCompactor->pIter->rbtn, pNode); + if (c > 0) { + tRBTreePut(&pCompactor->rbt, &pCompactor->pIter->rbtn); + pCompactor->pIter = NULL; + } else if (c == 0) { + ASSERT(0); + } + } + } + } + + if (pCompactor->pIter == NULL) { + SRBTreeNode *pNode = tRBTreeDropMin(&pCompactor->rbt); + if (pNode) { + pCompactor->pIter = TSDB_RBTN_TO_DATA_ITER(pNode); + } + } + + if (pCompactor->pIter) { + if (tsdbCompactTableIsDropped(pCompactor)) { + TABLEID tbid = {.suid = pCompactor->pIter->rowInfo.suid, .uid = pCompactor->pIter->rowInfo.uid}; + tRBTreeClear(&pCompactor->rbt); + for (pCompactor->pIter = pCompactor->iterList; pCompactor->pIter; pCompactor->pIter = pCompactor->pIter->next) { + code = tsdbDataIterNext2(pCompactor->pIter, + &(STsdbFilterInfo){.flag = TSDB_FILTER_FLAG_BY_TABLEID, .tbid = tbid}); + TSDB_CHECK_CODE(code, lino, _exit); + + if (pCompactor->pIter->rowInfo.suid || pCompactor->pIter->rowInfo.uid) { + tRBTreePut(&pCompactor->rbt, &pCompactor->pIter->rbtn); + } + } + } else { + *ppRowInfo = &pCompactor->pIter->rowInfo; + break; + } + } else { + *ppRowInfo = NULL; + break; + } + } + +_exit: + if (code) { + tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, + tstrerror(code)); + } + return code; +} + +static int32_t tsdbCompactFileSetStart(STsdbCompactor *pCompactor, SDFileSet *pSet) { + int32_t code = 0; + int32_t lino = 0; + + pCompactor->fid = pSet->fid; + pCompactor->tbid = (TABLEID){0}; + + /* tombstone */ + pCompactor->iDelIdx = 0; + + /* reader */ + code = tsdbDataFReaderOpen(&pCompactor->pReader, pCompactor->pTsdb, pSet); + TSDB_CHECK_CODE(code, lino, _exit); + + code = tsdbOpenDataFileDataIter(pCompactor->pReader, &pCompactor->pIter); + TSDB_CHECK_CODE(code, lino, _exit); + + tRBTreeCreate(&pCompactor->rbt, tsdbDataIterCmprFn); + if (pCompactor->pIter) { + pCompactor->pIter->next = pCompactor->iterList; + pCompactor->iterList = pCompactor->pIter; + + code = tsdbDataIterNext2(pCompactor->pIter, NULL); + TSDB_CHECK_CODE(code, lino, _exit); + + ASSERT(pCompactor->pIter->rowInfo.suid || pCompactor->pIter->rowInfo.uid); + tRBTreePut(&pCompactor->rbt, &pCompactor->pIter->rbtn); + } + + for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) { + code = tsdbOpenSttFileDataIter(pCompactor->pReader, iStt, &pCompactor->pIter); + TSDB_CHECK_CODE(code, lino, _exit); + + if (pCompactor->pIter) { + pCompactor->pIter->next = pCompactor->iterList; + pCompactor->iterList = pCompactor->pIter; + + code = tsdbDataIterNext2(pCompactor->pIter, NULL); + TSDB_CHECK_CODE(code, lino, _exit); + + ASSERT(pCompactor->pIter->rowInfo.suid || pCompactor->pIter->rowInfo.uid); + tRBTreePut(&pCompactor->rbt, &pCompactor->pIter->rbtn); + } + } + pCompactor->pIter = NULL; + + /* writer */ + code = tsdbDataFWriterOpen(&pCompactor->pWriter, pCompactor->pTsdb, + &(SDFileSet){.fid = pCompactor->fid, + .diskId = pSet->diskId, + .pHeadF = &(SHeadFile){.commitID = pCompactor->commitID}, + .pDataF = &(SDataFile){.commitID = pCompactor->commitID}, + .pSmaF = &(SSmaFile){.commitID = pCompactor->commitID}, + .nSttF = 1, + .aSttF = {&(SSttFile){.commitID = pCompactor->commitID}}}); + TSDB_CHECK_CODE(code, lino, _exit); + + if (pCompactor->aBlockIdx) { + taosArrayClear(pCompactor->aBlockIdx); + } else if ((pCompactor->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx))) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + + tMapDataReset(&pCompactor->mDataBlk); + + if (pCompactor->aSttBlk) { + taosArrayClear(pCompactor->aSttBlk); + } else if ((pCompactor->aSttBlk = taosArrayInit(0, sizeof(SSttBlk))) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + + tBlockDataReset(&pCompactor->bData); + tBlockDataReset(&pCompactor->sData); + +_exit: + if (code) { + tsdbError("vgId:%d %s failed at line %d since %s, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, + tstrerror(code), pCompactor->fid); + } else { + tsdbInfo("vgId:%d %s done, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, pCompactor->fid); + } + return code; +} + +static int32_t tsdbCompactFileSetEnd(STsdbCompactor *pCompactor) { + int32_t code = 0; + int32_t lino = 0; + + ASSERT(pCompactor->bData.nRow == 0); + ASSERT(pCompactor->sData.nRow == 0); + + /* update files */ + code = tsdbWriteSttBlk(pCompactor->pWriter, pCompactor->aSttBlk); + TSDB_CHECK_CODE(code, lino, _exit); + + code = tsdbWriteBlockIdx(pCompactor->pWriter, pCompactor->aBlockIdx); + TSDB_CHECK_CODE(code, lino, _exit); + + code = tsdbUpdateDFileSetHeader(pCompactor->pWriter); + TSDB_CHECK_CODE(code, lino, _exit); + + code = tsdbFSUpsertFSet(&pCompactor->fs, &pCompactor->pWriter->wSet); + TSDB_CHECK_CODE(code, lino, _exit); + + code = tsdbDataFWriterClose(&pCompactor->pWriter, 1); + TSDB_CHECK_CODE(code, lino, _exit); + + code = tsdbDataFReaderClose(&pCompactor->pReader); + TSDB_CHECK_CODE(code, lino, _exit); + + /* do clear */ + while ((pCompactor->pIter = pCompactor->iterList) != NULL) { + pCompactor->iterList = pCompactor->pIter->next; + tsdbCloseDataIter2(pCompactor->pIter); + } + + tBlockDataReset(&pCompactor->bData); + tBlockDataReset(&pCompactor->sData); + +_exit: + if (code) { + tsdbError("vgId:%d %s failed at line %d since %s, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, + tstrerror(code), pCompactor->fid); + } else { + tsdbInfo("vgId:%d %s done, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, pCompactor->fid); + } + return code; +} + +static int32_t tsdbCompactFileSet(STsdbCompactor *pCompactor, SDFileSet *pSet) { + int32_t code = 0; + int32_t lino = 0; + + // start compact + code = tsdbCompactFileSetStart(pCompactor, pSet); + TSDB_CHECK_CODE(code, lino, _exit); + + // do compact, end with a NULL row + SRowInfo *pRowInfo; + do { + code = tsdbCompactNextRow(pCompactor, &pRowInfo); + TSDB_CHECK_CODE(code, lino, _exit); + + code = tsdbCompactWriteTableData(pCompactor, pRowInfo); + TSDB_CHECK_CODE(code, lino, _exit); + } while (pRowInfo); + + // end compact + code = tsdbCompactFileSetEnd(pCompactor); + TSDB_CHECK_CODE(code, lino, _exit); + +_exit: + if (code) { + tsdbError("vgId:%d %s failed at line %d since %s, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, + tstrerror(code), pCompactor->fid); + if (pCompactor->pWriter) tsdbDataFWriterClose(&pCompactor->pWriter, 0); + while ((pCompactor->pIter = pCompactor->iterList)) { + pCompactor->iterList = pCompactor->pIter->next; + tsdbCloseDataIter2(pCompactor->pIter); + } + if (pCompactor->pReader) tsdbDataFReaderClose(&pCompactor->pReader); + } + return code; +} + +static void tsdbEndCompact(STsdbCompactor *pCompactor) { + // writer + tBlockDataDestroy(&pCompactor->sData); + tBlockDataDestroy(&pCompactor->bData); + taosArrayDestroy(pCompactor->aSttBlk); + tMapDataClear(&pCompactor->mDataBlk); + taosArrayDestroy(pCompactor->aBlockIdx); + + // reader + + // tombstone + taosArrayDestroy(pCompactor->aSkyLine); + taosArrayDestroy(pCompactor->aDelData); + taosArrayDestroy(pCompactor->aDelIdx); + + // others + tDestroyTSchema(pCompactor->tbSkm.pTSchema); + tsdbFSDestroy(&pCompactor->fs); + + tsdbInfo("vgId:%d %s done, commit ID:%" PRId64, TD_VID(pCompactor->pTsdb->pVnode), __func__, pCompactor->commitID); +} + +static int32_t tsdbBeginCompact(STsdb *pTsdb, SCompactInfo *pInfo, STsdbCompactor *pCompactor) { + int32_t code = 0; + int32_t lino = 0; + + pCompactor->pTsdb = pTsdb; + pCompactor->commitID = pInfo->commitID; + pCompactor->cmprAlg = pTsdb->pVnode->config.tsdbCfg.compression; + pCompactor->maxRows = pTsdb->pVnode->config.tsdbCfg.maxRows; + pCompactor->minRows = pTsdb->pVnode->config.tsdbCfg.minRows; + pCompactor->fid = INT32_MIN; + + code = tsdbFSCopy(pTsdb, &pCompactor->fs); + TSDB_CHECK_CODE(code, lino, _exit); + + /* tombstone */ + if (pCompactor->fs.pDelFile) { + code = tsdbDelFReaderOpen(&pCompactor->pDelFReader, pCompactor->fs.pDelFile, pTsdb); + TSDB_CHECK_CODE(code, lino, _exit); + + if ((pCompactor->aDelIdx = taosArrayInit(0, sizeof(SDelIdx))) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + + if ((pCompactor->aDelData = taosArrayInit(0, sizeof(SDelData))) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + + if ((pCompactor->aSkyLine = taosArrayInit(0, sizeof(TSDBKEY))) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + + code = tsdbReadDelIdx(pCompactor->pDelFReader, pCompactor->aDelIdx); + TSDB_CHECK_CODE(code, lino, _exit); + } + + /* reader */ + + /* writer */ + code = tBlockDataCreate(&pCompactor->bData); + TSDB_CHECK_CODE(code, lino, _exit); + + code = tBlockDataCreate(&pCompactor->sData); + TSDB_CHECK_CODE(code, lino, _exit); + +_exit: + if (code) { + tsdbError("vgId:%d %s failed at line %d since %s, commit ID:%" PRId64, TD_VID(pTsdb->pVnode), __func__, lino, + tstrerror(code), pCompactor->commitID); + tBlockDataDestroy(&pCompactor->sData); + tBlockDataDestroy(&pCompactor->bData); + if (pCompactor->fs.pDelFile) { + taosArrayDestroy(pCompactor->aSkyLine); + taosArrayDestroy(pCompactor->aDelData); + taosArrayDestroy(pCompactor->aDelIdx); + if (pCompactor->pDelFReader) tsdbDelFReaderClose(&pCompactor->pDelFReader); + } + tsdbFSDestroy(&pCompactor->fs); + } else { + tsdbInfo("vgId:%d %s done, commit ID:%" PRId64, TD_VID(pTsdb->pVnode), __func__, pCompactor->commitID); + } + return code; +} + +int32_t tsdbCompact(STsdb *pTsdb, SCompactInfo *pInfo) { + int32_t code = 0; + + STsdbCompactor *pCompactor = &(STsdbCompactor){0}; + + if ((code = tsdbBeginCompact(pTsdb, pInfo, pCompactor))) return code; + + for (;;) { + SDFileSet *pSet = (SDFileSet *)taosArraySearch(pCompactor->fs.aDFileSet, &(SDFileSet){.fid = pCompactor->fid}, + tDFileSetCmprFn, TD_GT); + if (pSet == NULL) { + pCompactor->fid = INT32_MAX; + break; + } + + if ((code = tsdbCompactFileSet(pCompactor, pSet))) goto _exit; + } + + if ((code = tsdbFSUpsertDelFile(&pCompactor->fs, NULL))) goto _exit; + +_exit: + if (code) { + tsdbAbortCompact(pCompactor); + } else { + tsdbCommitCompact(pCompactor); + } + tsdbEndCompact(pCompactor); return code; } diff --git a/source/dnode/vnode/src/tsdb/tsdbDataIter.c b/source/dnode/vnode/src/tsdb/tsdbDataIter.c new file mode 100644 index 0000000000..2f49781276 --- /dev/null +++ b/source/dnode/vnode/src/tsdb/tsdbDataIter.c @@ -0,0 +1,458 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "tsdb.h" + +// STsdbDataIter2 +/* open */ +int32_t tsdbOpenDataFileDataIter(SDataFReader* pReader, STsdbDataIter2** ppIter) { + int32_t code = 0; + int32_t lino = 0; + + // create handle + STsdbDataIter2* pIter = (STsdbDataIter2*)taosMemoryCalloc(1, sizeof(*pIter)); + if (pIter == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + + pIter->type = TSDB_DATA_FILE_DATA_ITER; + pIter->dIter.pReader = pReader; + if ((pIter->dIter.aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx))) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + + code = tBlockDataCreate(&pIter->dIter.bData); + TSDB_CHECK_CODE(code, lino, _exit); + + pIter->dIter.iBlockIdx = 0; + pIter->dIter.iDataBlk = 0; + pIter->dIter.iRow = 0; + + // read data + code = tsdbReadBlockIdx(pReader, pIter->dIter.aBlockIdx); + TSDB_CHECK_CODE(code, lino, _exit); + + if (taosArrayGetSize(pIter->dIter.aBlockIdx) == 0) goto _clear; + +_exit: + if (code) { + if (pIter) { + _clear: + tBlockDataDestroy(&pIter->dIter.bData); + taosArrayDestroy(pIter->dIter.aBlockIdx); + taosMemoryFree(pIter); + pIter = NULL; + } + } + *ppIter = pIter; + return code; +} + +int32_t tsdbOpenSttFileDataIter(SDataFReader* pReader, int32_t iStt, STsdbDataIter2** ppIter) { + int32_t code = 0; + int32_t lino = 0; + + // create handle + STsdbDataIter2* pIter = (STsdbDataIter2*)taosMemoryCalloc(1, sizeof(*pIter)); + if (pIter == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + + pIter->type = TSDB_STT_FILE_DATA_ITER; + pIter->sIter.pReader = pReader; + pIter->sIter.iStt = iStt; + pIter->sIter.aSttBlk = taosArrayInit(0, sizeof(SSttBlk)); + if (pIter->sIter.aSttBlk == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + + code = tBlockDataCreate(&pIter->sIter.bData); + TSDB_CHECK_CODE(code, lino, _exit); + + pIter->sIter.iSttBlk = 0; + pIter->sIter.iRow = 0; + + // read data + code = tsdbReadSttBlk(pReader, iStt, pIter->sIter.aSttBlk); + TSDB_CHECK_CODE(code, lino, _exit); + + if (taosArrayGetSize(pIter->sIter.aSttBlk) == 0) goto _clear; + +_exit: + if (code) { + if (pIter) { + _clear: + taosArrayDestroy(pIter->sIter.aSttBlk); + tBlockDataDestroy(&pIter->sIter.bData); + taosMemoryFree(pIter); + pIter = NULL; + } + } + *ppIter = pIter; + return code; +} + +int32_t tsdbOpenTombFileDataIter(SDelFReader* pReader, STsdbDataIter2** ppIter) { + int32_t code = 0; + int32_t lino = 0; + + STsdbDataIter2* pIter = (STsdbDataIter2*)taosMemoryCalloc(1, sizeof(*pIter)); + if (pIter == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + pIter->type = TSDB_TOMB_FILE_DATA_ITER; + + pIter->tIter.pReader = pReader; + if ((pIter->tIter.aDelIdx = taosArrayInit(0, sizeof(SDelIdx))) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + if ((pIter->tIter.aDelData = taosArrayInit(0, sizeof(SDelData))) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + + code = tsdbReadDelIdx(pReader, pIter->tIter.aDelIdx); + TSDB_CHECK_CODE(code, lino, _exit); + + if (taosArrayGetSize(pIter->tIter.aDelIdx) == 0) goto _clear; + + pIter->tIter.iDelIdx = 0; + pIter->tIter.iDelData = 0; + +_exit: + if (code) { + if (pIter) { + _clear: + taosArrayDestroy(pIter->tIter.aDelIdx); + taosArrayDestroy(pIter->tIter.aDelData); + taosMemoryFree(pIter); + pIter = NULL; + } + } + *ppIter = pIter; + return code; +} + +/* close */ +static void tsdbCloseDataFileDataIter(STsdbDataIter2* pIter) { + tBlockDataDestroy(&pIter->dIter.bData); + tMapDataClear(&pIter->dIter.mDataBlk); + taosArrayDestroy(pIter->dIter.aBlockIdx); + taosMemoryFree(pIter); +} + +static void tsdbCloseSttFileDataIter(STsdbDataIter2* pIter) { + tBlockDataDestroy(&pIter->sIter.bData); + taosArrayDestroy(pIter->sIter.aSttBlk); + taosMemoryFree(pIter); +} + +static void tsdbCloseTombFileDataIter(STsdbDataIter2* pIter) { + taosArrayDestroy(pIter->tIter.aDelData); + taosArrayDestroy(pIter->tIter.aDelIdx); + taosMemoryFree(pIter); +} + +void tsdbCloseDataIter2(STsdbDataIter2* pIter) { + if (pIter->type == TSDB_MEM_TABLE_DATA_ITER) { + ASSERT(0); + } else if (pIter->type == TSDB_DATA_FILE_DATA_ITER) { + tsdbCloseDataFileDataIter(pIter); + } else if (pIter->type == TSDB_STT_FILE_DATA_ITER) { + tsdbCloseSttFileDataIter(pIter); + } else if (pIter->type == TSDB_TOMB_FILE_DATA_ITER) { + tsdbCloseTombFileDataIter(pIter); + } else { + ASSERT(0); + } +} + +/* cmpr */ +int32_t tsdbDataIterCmprFn(const SRBTreeNode* pNode1, const SRBTreeNode* pNode2) { + STsdbDataIter2* pIter1 = TSDB_RBTN_TO_DATA_ITER(pNode1); + STsdbDataIter2* pIter2 = TSDB_RBTN_TO_DATA_ITER(pNode2); + return tRowInfoCmprFn(&pIter1->rowInfo, &pIter2->rowInfo); +} + +/* seek */ + +/* iter next */ +static int32_t tsdbDataFileDataIterNext(STsdbDataIter2* pIter, STsdbFilterInfo* pFilterInfo) { + int32_t code = 0; + int32_t lino = 0; + + for (;;) { + while (pIter->dIter.iRow < pIter->dIter.bData.nRow) { + if (pFilterInfo) { + if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_TABLEID) { + if (pFilterInfo->tbid.uid == pIter->dIter.bData.uid) { + pIter->dIter.iRow = pIter->dIter.bData.nRow; + continue; + } + } + + if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) { + if (pIter->dIter.bData.aVersion[pIter->dIter.iRow] < pFilterInfo->sver || + pIter->dIter.bData.aVersion[pIter->dIter.iRow] > pFilterInfo->ever) { + pIter->dIter.iRow++; + continue; + } + } + } + + ASSERT(pIter->rowInfo.suid == pIter->dIter.bData.suid); + ASSERT(pIter->rowInfo.uid = pIter->dIter.bData.uid); + pIter->rowInfo.row = tsdbRowFromBlockData(&pIter->dIter.bData, pIter->dIter.iRow); + pIter->dIter.iRow++; + goto _exit; + } + + for (;;) { + while (pIter->dIter.iDataBlk < pIter->dIter.mDataBlk.nItem) { + SDataBlk dataBlk; + tMapDataGetItemByIdx(&pIter->dIter.mDataBlk, pIter->dIter.iDataBlk, &dataBlk, tGetDataBlk); + + // filter + if (pFilterInfo) { + if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_TABLEID) { + if (tTABLEIDCmprFn(&pFilterInfo->tbid, &pIter->rowInfo) == 0) { + pIter->dIter.iDataBlk = pIter->dIter.mDataBlk.nItem; + continue; + } + } + + if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) { + if (pFilterInfo->sver > dataBlk.maxVer || pFilterInfo->ever < dataBlk.minVer) { + pIter->dIter.iDataBlk++; + continue; + } + } + } + + code = tsdbReadDataBlockEx(pIter->dIter.pReader, &dataBlk, &pIter->dIter.bData); + TSDB_CHECK_CODE(code, lino, _exit); + + pIter->dIter.iDataBlk++; + pIter->dIter.iRow = 0; + + break; + } + + if (pIter->dIter.iRow < pIter->dIter.bData.nRow) break; + + for (;;) { + if (pIter->dIter.iBlockIdx < taosArrayGetSize(pIter->dIter.aBlockIdx)) { + SBlockIdx* pBlockIdx = taosArrayGet(pIter->dIter.aBlockIdx, pIter->dIter.iBlockIdx); + + if (pFilterInfo && (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_TABLEID)) { + int32_t c = tTABLEIDCmprFn(pBlockIdx, &pFilterInfo->tbid); + if (c == 0) { + pIter->dIter.iBlockIdx++; + continue; + } else if (c < 0) { + ASSERT(0); + } + } + + code = tsdbReadDataBlk(pIter->dIter.pReader, pBlockIdx, &pIter->dIter.mDataBlk); + TSDB_CHECK_CODE(code, lino, _exit); + + pIter->rowInfo.suid = pBlockIdx->suid; + pIter->rowInfo.uid = pBlockIdx->uid; + + pIter->dIter.iBlockIdx++; + pIter->dIter.iDataBlk = 0; + + break; + } else { + pIter->rowInfo = (SRowInfo){0}; + goto _exit; + } + } + } + } + +_exit: + if (code) { + tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +static int32_t tsdbSttFileDataIterNext(STsdbDataIter2* pIter, STsdbFilterInfo* pFilterInfo) { + int32_t code = 0; + int32_t lino = 0; + + for (;;) { + while (pIter->sIter.iRow < pIter->sIter.bData.nRow) { + if (pFilterInfo) { + if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_TABLEID) { + int64_t uid = pIter->sIter.bData.uid ? pIter->sIter.bData.uid : pIter->sIter.bData.aUid[pIter->sIter.iRow]; + if (pFilterInfo->tbid.uid == uid) { + pIter->sIter.iRow++; + continue; + } + } + + if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) { + if (pFilterInfo->sver > pIter->sIter.bData.aVersion[pIter->sIter.iRow] || + pFilterInfo->ever < pIter->sIter.bData.aVersion[pIter->sIter.iRow]) { + pIter->sIter.iRow++; + continue; + } + } + } + + pIter->rowInfo.suid = pIter->sIter.bData.suid; + pIter->rowInfo.uid = pIter->sIter.bData.uid ? pIter->sIter.bData.uid : pIter->sIter.bData.aUid[pIter->sIter.iRow]; + pIter->rowInfo.row = tsdbRowFromBlockData(&pIter->sIter.bData, pIter->sIter.iRow); + pIter->sIter.iRow++; + goto _exit; + } + + for (;;) { + if (pIter->sIter.iSttBlk < taosArrayGetSize(pIter->sIter.aSttBlk)) { + SSttBlk* pSttBlk = taosArrayGet(pIter->sIter.aSttBlk, pIter->sIter.iSttBlk); + + if (pFilterInfo) { + if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_TABLEID) { + if (pSttBlk->suid == pFilterInfo->tbid.suid && pSttBlk->minUid == pFilterInfo->tbid.uid && + pSttBlk->maxUid == pFilterInfo->tbid.uid) { + pIter->sIter.iSttBlk++; + continue; + } + } + + if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) { + if (pFilterInfo->sver > pSttBlk->maxVer || pFilterInfo->ever < pSttBlk->minVer) { + pIter->sIter.iSttBlk++; + continue; + } + } + } + + code = tsdbReadSttBlockEx(pIter->sIter.pReader, pIter->sIter.iStt, pSttBlk, &pIter->sIter.bData); + TSDB_CHECK_CODE(code, lino, _exit); + + pIter->sIter.iRow = 0; + pIter->sIter.iSttBlk++; + break; + } else { + pIter->rowInfo = (SRowInfo){0}; + goto _exit; + } + } + } + +_exit: + if (code) { + tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +static int32_t tsdbTombFileDataIterNext(STsdbDataIter2* pIter, STsdbFilterInfo* pFilterInfo) { + int32_t code = 0; + int32_t lino = 0; + + for (;;) { + while (pIter->tIter.iDelData < taosArrayGetSize(pIter->tIter.aDelData)) { + SDelData* pDelData = taosArrayGet(pIter->tIter.aDelData, pIter->tIter.iDelData); + + if (pFilterInfo) { + if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) { + if (pFilterInfo->sver > pDelData->version || pFilterInfo->ever < pDelData->version) { + pIter->tIter.iDelData++; + continue; + } + } + } + + pIter->delInfo.delData = *pDelData; + pIter->tIter.iDelData++; + goto _exit; + } + + for (;;) { + if (pIter->tIter.iDelIdx < taosArrayGetSize(pIter->tIter.aDelIdx)) { + SDelIdx* pDelIdx = taosArrayGet(pIter->tIter.aDelIdx, pIter->tIter.iDelIdx); + + code = tsdbReadDelData(pIter->tIter.pReader, pDelIdx, pIter->tIter.aDelData); + TSDB_CHECK_CODE(code, lino, _exit); + + pIter->delInfo.suid = pDelIdx->suid; + pIter->delInfo.uid = pDelIdx->uid; + pIter->tIter.iDelData = 0; + pIter->tIter.iDelIdx++; + break; + } else { + pIter->delInfo = (SDelInfo){0}; + goto _exit; + } + } + } + +_exit: + if (code) { + tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +int32_t tsdbDataIterNext2(STsdbDataIter2* pIter, STsdbFilterInfo* pFilterInfo) { + int32_t code = 0; + + if (pIter->type == TSDB_MEM_TABLE_DATA_ITER) { + ASSERT(0); + return code; + } else if (pIter->type == TSDB_DATA_FILE_DATA_ITER) { + return tsdbDataFileDataIterNext(pIter, pFilterInfo); + } else if (pIter->type == TSDB_STT_FILE_DATA_ITER) { + return tsdbSttFileDataIterNext(pIter, pFilterInfo); + } else if (pIter->type == TSDB_TOMB_FILE_DATA_ITER) { + return tsdbTombFileDataIterNext(pIter, pFilterInfo); + } else { + ASSERT(0); + return code; + } +} + +/* get */ + +// STsdbFSetIter +typedef struct STsdbFSetDataIter { + STsdb* pTsdb; + int32_t flags; + + /* tombstone */ + SDelFReader* pDelFReader; + SArray* aDelIdx; // SArray + SArray* aDelData; // SArray + SArray* aSkeyLine; // SArray + int32_t iDelIdx; + int32_t iSkyLine; + + /* time-series data */ + SDataFReader* pReader; + STsdbDataIter2* iterList; + STsdbDataIter2* pIter; + SRBTree rbt; +} STsdbFSetDataIter; diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c index 51fdc69a95..5519d43012 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS.c @@ -629,7 +629,15 @@ static int32_t tsdbFSApplyChange(STsdb *pTsdb, STsdbFS *pFS) { } } } else { - ASSERT(pTsdb->fs.pDelFile == NULL); + if (pTsdb->fs.pDelFile) { + nRef = atomic_sub_fetch_32(&pTsdb->fs.pDelFile->nRef, 1); + if (nRef == 0) { + tsdbDelFileName(pTsdb, pTsdb->fs.pDelFile, fname); + (void)taosRemoveFile(fname); + taosMemoryFree(pTsdb->fs.pDelFile); + } + pTsdb->fs.pDelFile = NULL; + } } // aDFileSet @@ -906,14 +914,21 @@ _exit: int32_t tsdbFSUpsertDelFile(STsdbFS *pFS, SDelFile *pDelFile) { int32_t code = 0; - if (pFS->pDelFile == NULL) { - pFS->pDelFile = (SDelFile *)taosMemoryMalloc(sizeof(SDelFile)); + if (pDelFile) { if (pFS->pDelFile == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _exit; + pFS->pDelFile = (SDelFile *)taosMemoryMalloc(sizeof(SDelFile)); + if (pFS->pDelFile == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _exit; + } + } + *pFS->pDelFile = *pDelFile; + } else { + if (pFS->pDelFile) { + taosMemoryFree(pFS->pDelFile); + pFS->pDelFile = NULL; } } - *pFS->pDelFile = *pDelFile; _exit: return code; diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index 1f99444cf3..a97cd3db27 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -515,7 +515,7 @@ bool tLDataIterNextRow(SLDataIter *pIter, const char *idStr) { pIter->rInfo.row = tsdbRowFromBlockData(pBlockData, pIter->iRow); _exit: - return (terrno == TSDB_CODE_SUCCESS) && (pIter->pSttBlk != NULL); + return (terrno == TSDB_CODE_SUCCESS) && (pIter->pSttBlk != NULL) && (pBlockData != NULL); } SRowInfo *tLDataIterGet(SLDataIter *pIter) { return &pIter->rInfo; } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index fc0678e3e6..4466721fb9 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -79,6 +79,9 @@ typedef struct SIOCostSummary { int64_t composedBlocks; double buildComposedBlockTime; double createScanInfoList; + // double getTbFromMemTime; + // double getTbFromIMemTime; + double initDelSkylineIterTime; } SIOCostSummary; typedef struct SBlockLoadSuppInfo { @@ -176,10 +179,9 @@ struct STsdbReader { SDataFReader* pFileReader; // the file reader SDelFReader* pDelFReader; // the del file reader SArray* pDelIdx; // del file block index; - // SVersionRange verRange; - SBlockInfoBuf blockInfoBuf; - int32_t step; - STsdbReader* innerReader[2]; + SBlockInfoBuf blockInfoBuf; + int32_t step; + STsdbReader* innerReader[2]; }; static SFileDataBlockInfo* getCurrentBlockInfo(SDataBlockIter* pBlockIter); @@ -220,6 +222,8 @@ static bool hasDataInFileBlock(const SBlockData* pBlockData, const SFil static void initBlockDumpInfo(STsdbReader* pReader, SDataBlockIter* pBlockIter); static int32_t getInitialDelIndex(const SArray* pDelSkyline, int32_t order); +static FORCE_INLINE STSchema* getLatestTableSchema(STsdbReader* pReader, uint64_t uid); + static bool outOfTimeWindow(int64_t ts, STimeWindow* pWindow) { return (ts > pWindow->ekey) || (ts < pWindow->skey); } static int32_t setColumnIdSlotList(SBlockLoadSuppInfo* pSupInfo, SColumnInfo* pCols, const int32_t* pSlotIdList, @@ -711,17 +715,21 @@ _end: } static int32_t doLoadBlockIndex(STsdbReader* pReader, SDataFReader* pFileReader, SArray* pIndexList) { - SArray* aBlockIdx = taosArrayInit(8, sizeof(SBlockIdx)); + // SArray* aBlockIdx = taosArrayInit(8, sizeof(SBlockIdx)); int64_t st = taosGetTimestampUs(); - int32_t code = tsdbReadBlockIdx(pFileReader, aBlockIdx); - if (code != TSDB_CODE_SUCCESS) { + // int32_t code = tsdbReadBlockIdx(pFileReader, aBlockIdx); + LRUHandle* handle = NULL; + int32_t code = tsdbCacheGetBlockIdx(pFileReader->pTsdb->biCache, pFileReader, &handle); + if (code != TSDB_CODE_SUCCESS || handle == NULL) { goto _end; } - size_t num = taosArrayGetSize(aBlockIdx); + SArray* aBlockIdx = (SArray*)taosLRUCacheValue(pFileReader->pTsdb->biCache, handle); + size_t num = taosArrayGetSize(aBlockIdx); if (num == 0) { - taosArrayDestroy(aBlockIdx); + tsdbBICacheRelease(pFileReader->pTsdb->biCache, handle); + // taosArrayDestroy(aBlockIdx); return TSDB_CODE_SUCCESS; } @@ -757,7 +765,8 @@ static int32_t doLoadBlockIndex(STsdbReader* pReader, SDataFReader* pFileReader, pReader->cost.headFileLoadTime += (et1 - st) / 1000.0; _end: - taosArrayDestroy(aBlockIdx); + // taosArrayDestroy(aBlockIdx); + tsdbBICacheRelease(pFileReader->pTsdb->biCache, handle); return code; } @@ -1070,7 +1079,7 @@ static void copyNumericCols(const SColData* pData, SFileBlockDumpInfo* pDumpInfo } } -static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo) { +static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader) { SReaderStatus* pStatus = &pReader->status; SDataBlockIter* pBlockIter = &pStatus->blockIter; SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo; @@ -1087,6 +1096,14 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn bool asc = ASCENDING_TRAVERSE(pReader->order); int32_t step = asc ? 1 : -1; + // no data exists, return directly. + if (pBlockData->nRow == 0 || pBlockData->aTSKEY == 0) { + tsdbWarn("%p no need to copy since no data in blockData, table uid:%" PRIu64 " has been dropped, %s", pReader, + pBlockInfo->uid, pReader->idStr); + pResBlock->info.rows = 0; + return 0; + } + if ((pDumpInfo->rowIndex == 0 && asc) || (pDumpInfo->rowIndex == pBlock->nRow - 1 && (!asc))) { if (asc && pReader->window.skey <= pBlock->minKey.ts) { // pDumpInfo->rowIndex = 0; @@ -1186,14 +1203,12 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn setBlockAllDumped(pDumpInfo, ts, pReader->order); } - pBlockScanInfo->lastKey = pDumpInfo->lastKey; - double elapsedTime = (taosGetTimestampUs() - st) / 1000.0; pReader->cost.blockLoadTime += elapsedTime; int32_t unDumpedRows = asc ? pBlock->nRow - pDumpInfo->rowIndex : pDumpInfo->rowIndex + 1; tsdbDebug("%p copy file block to sdatablock, global index:%d, table index:%d, brange:%" PRId64 "-%" PRId64 - ", rows:%d, remain:%d, minVer:%" PRId64 ", maxVer:%" PRId64 ", uid:%"PRIu64" elapsed time:%.2f ms, %s", + ", rows:%d, remain:%d, minVer:%" PRId64 ", maxVer:%" PRId64 ", uid:%" PRIu64 " elapsed time:%.2f ms, %s", pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pBlock->minKey.ts, pBlock->maxKey.ts, dumpedRows, unDumpedRows, pBlock->minVer, pBlock->maxVer, pBlockInfo->uid, elapsedTime, pReader->idStr); @@ -1202,12 +1217,19 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockIter, SBlockData* pBlockData, uint64_t uid) { + int32_t code = 0; int64_t st = taosGetTimestampUs(); tBlockDataReset(pBlockData); - TABLEID tid = {.suid = pReader->suid, .uid = uid}; - int32_t code = - tBlockDataInit(pBlockData, &tid, pReader->pSchema, &pReader->suppInfo.colId[1], pReader->suppInfo.numOfCols - 1); + STSchema* pSchema = getLatestTableSchema(pReader, uid); + if (pSchema == NULL) { + tsdbDebug("%p table uid:%" PRIu64 " has been dropped, no data existed, %s", pReader, uid, pReader->idStr); + return code; + } + + SBlockLoadSuppInfo* pSup = &pReader->suppInfo; + TABLEID tid = {.suid = pReader->suid, .uid = uid}; + code = tBlockDataInit(pBlockData, &tid, pSchema, &pSup->colId[1], pSup->numOfCols - 1); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -1633,7 +1655,7 @@ static bool fileBlockShouldLoad(STsdbReader* pReader, SFileDataBlockInfo* pBlock // log the reason why load the datablock for profile if (loadDataBlock) { tsdbDebug("%p uid:%" PRIu64 - " need to load the datablock, overlapwithneighborblock:%d, hasDup:%d, partiallyRequired:%d, " + " need to load the datablock, overlapneighbor:%d, hasDup:%d, partiallyRequired:%d, " "overlapWithKey:%d, greaterThanBuf:%d, overlapWithDel:%d, overlapWithlastBlock:%d, %s", pReader, pBlockInfo->uid, info.overlapWithNeighborBlock, info.hasDupTs, info.partiallyRequired, info.overlapWithKeyInBuf, info.moreThanCapcity, info.overlapWithDelInfo, info.overlapWithLastBlock, @@ -1669,9 +1691,9 @@ static int32_t buildDataBlockFromBuf(STsdbReader* pReader, STableBlockScanInfo* double elapsedTime = (taosGetTimestampUs() - st) / 1000.0; tsdbDebug("%p build data block from cache completed, elapsed time:%.2f ms, numOfRows:%d, brange:%" PRId64 - " - %" PRId64 " %s", + " - %" PRId64 ", uid:%"PRIu64", %s", pReader, elapsedTime, pBlock->info.rows, pBlock->info.window.skey, pBlock->info.window.ekey, - pReader->idStr); + pBlockScanInfo->uid, pReader->idStr); pReader->cost.buildmemBlock += elapsedTime; return code; @@ -1697,8 +1719,10 @@ static bool tryCopyDistinctRowFromFileBlock(STsdbReader* pReader, SBlockData* pB return false; } -static bool nextRowFromLastBlocks(SLastBlockReader* pLastBlockReader, STableBlockScanInfo* pBlockScanInfo, +static bool nextRowFromLastBlocks(SLastBlockReader* pLastBlockReader, STableBlockScanInfo* pScanInfo, SVersionRange* pVerRange) { + int32_t step = ASCENDING_TRAVERSE(pLastBlockReader->order)? 1:-1; + while (1) { bool hasVal = tMergeTreeNext(&pLastBlockReader->mergeTree); if (!hasVal) { @@ -1707,8 +1731,15 @@ static bool nextRowFromLastBlocks(SLastBlockReader* pLastBlockReader, STableBloc TSDBROW row = tMergeTreeGetRow(&pLastBlockReader->mergeTree); TSDBKEY k = TSDBROW_KEY(&row); - if (!hasBeenDropped(pBlockScanInfo->delSkyline, &pBlockScanInfo->lastBlockDelIndex, &k, pLastBlockReader->order, - pVerRange)) { + if (hasBeenDropped(pScanInfo->delSkyline, &pScanInfo->lastBlockDelIndex, &k, pLastBlockReader->order, pVerRange)) { + pScanInfo->lastKey = k.ts; + } else { + // the qualifed ts may equal to k.ts, only a greater version one. + // here we need to fallback one step. + if (pScanInfo->lastKey == k.ts) { + pScanInfo->lastKey -= step; + } + return true; } } @@ -1731,6 +1762,19 @@ static bool tryCopyDistinctRowFromSttBlock(TSDBROW* fRow, SLastBlockReader* pLas return false; } +static FORCE_INLINE STSchema* getLatestTableSchema(STsdbReader* pReader, uint64_t uid) { + if (pReader->pSchema != NULL) { + return pReader->pSchema; + } + + pReader->pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, uid, -1, 1); + if (pReader->pSchema == NULL) { + tsdbError("failed to get table schema, uid:%" PRIu64 ", it may have been dropped, ver:-1, %s", uid, pReader->idStr); + } + + return pReader->pSchema; +} + static FORCE_INLINE STSchema* doGetSchemaForTSRow(int32_t sversion, STsdbReader* pReader, uint64_t uid) { // always set the newest schema version in pReader->pSchema if (pReader->pSchema == NULL) { @@ -2260,6 +2304,7 @@ static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbRea } int32_t backward = (!ASCENDING_TRAVERSE(pReader->order)); + int64_t st = 0; STbData* d = NULL; if (pReader->pReadSnap->pMem != NULL) { @@ -2303,7 +2348,9 @@ static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbRea tsdbDebug("%p uid:%" PRIu64 ", no data in imem, %s", pReader, pBlockScanInfo->uid, pReader->idStr); } + st = taosGetTimestampUs(); initDelSkylineIterator(pBlockScanInfo, pReader, d, di); + pReader->cost.initDelSkylineIterTime += (taosGetTimestampUs() - st) / 1000.0; pBlockScanInfo->iterInit = true; return TSDB_CODE_SUCCESS; @@ -2360,6 +2407,7 @@ static bool initLastBlockReader(SLastBlockReader* pLBlockReader, STableBlockScan w.ekey = pScanInfo->lastKey + step; } + tsdbDebug("init last block reader, window:%"PRId64"-%"PRId64", uid:%"PRIu64", %s", w.skey, w.ekey, pScanInfo->uid, pReader->idStr); int32_t code = tMergeTreeOpen(&pLBlockReader->mergeTree, (pLBlockReader->order == TSDB_ORDER_DESC), pReader->pFileReader, pReader->suid, pScanInfo->uid, &w, &pLBlockReader->verRange, pLBlockReader->pInfo, false, pReader->idStr); @@ -2533,7 +2581,7 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) { if (isCleanFileDataBlock(pReader, pBlockInfo, pBlock, pBlockScanInfo, keyInBuf, pLastBlockReader) && pBlock->nRow <= pReader->capacity) { if (asc || ((!asc) && (!hasDataInLastBlock(pLastBlockReader)))) { - copyBlockDataToSDataBlock(pReader, pBlockScanInfo); + copyBlockDataToSDataBlock(pReader); // record the last key value pBlockScanInfo->lastKey = asc ? pBlock->maxKey.ts : pBlock->minKey.ts; @@ -2678,21 +2726,39 @@ _err: } TSDBKEY getCurrentKeyInBuf(STableBlockScanInfo* pScanInfo, STsdbReader* pReader) { - TSDBKEY key = {.ts = TSKEY_INITIAL_VAL}; + bool asc = ASCENDING_TRAVERSE(pReader->order); + // TSKEY initialVal = asc? TSKEY_MIN:TSKEY_MAX; + + TSDBKEY key = {.ts = TSKEY_INITIAL_VAL}, ikey = {.ts = TSKEY_INITIAL_VAL}; + + bool hasKey = false, hasIKey = false; TSDBROW* pRow = getValidMemRow(&pScanInfo->iter, pScanInfo->delSkyline, pReader); if (pRow != NULL) { + hasKey = true; key = TSDBROW_KEY(pRow); } - pRow = getValidMemRow(&pScanInfo->iiter, pScanInfo->delSkyline, pReader); - if (pRow != NULL) { - TSDBKEY k = TSDBROW_KEY(pRow); - if (key.ts > k.ts) { - key = k; - } + TSDBROW* pIRow = getValidMemRow(&pScanInfo->iiter, pScanInfo->delSkyline, pReader); + if (pIRow != NULL) { + hasIKey = true; + ikey = TSDBROW_KEY(pIRow); } - return key; + if (hasKey) { + if (hasIKey) { // has data in mem & imem + if (asc) { + return key.ts <= ikey.ts ? key : ikey; + } else { + return key.ts <= ikey.ts ? ikey : key; + } + } else { // no data in imem + return key; + } + } else { + // no data in mem & imem, return the initial value + // only imem has data, return ikey + return ikey; + } } static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum) { @@ -2782,18 +2848,6 @@ static void extractOrderedTableUidList(SUidOrderCheckInfo* pOrderCheckInfo, SRea taosSort(pOrderCheckInfo->tableUidList, total, sizeof(uint64_t), uidComparFunc); } -// reset the last del file index -static void resetScanBlockLastBlockDelIndex(SReaderStatus* pStatus, int32_t order) { - void* p = taosHashIterate(pStatus->pTableMap, NULL); - while (p != NULL) { - STableBlockScanInfo* pScanInfo = *(STableBlockScanInfo**)p; - - // reset the last del file index - pScanInfo->lastBlockDelIndex = getInitialDelIndex(pScanInfo->delSkyline, order); - p = taosHashIterate(pStatus->pTableMap, p); - } -} - static int32_t initOrderCheckInfo(SUidOrderCheckInfo* pOrderCheckInfo, STsdbReader* pReader) { SReaderStatus* pStatus = &pReader->status; @@ -2921,59 +2975,19 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { ASSERT(pBlockInfo != NULL); - if (pBlockInfo != NULL) { - pScanInfo = - *(STableBlockScanInfo**)taosHashGet(pReader->status.pTableMap, &pBlockInfo->uid, sizeof(pBlockInfo->uid)); - } else { - pScanInfo = *pReader->status.pTableIter; - } - + pScanInfo = *(STableBlockScanInfo**)taosHashGet(pReader->status.pTableMap, &pBlockInfo->uid, sizeof(pBlockInfo->uid)); if (pScanInfo == NULL) { tsdbError("failed to get table scan-info, %s", pReader->idStr); code = TSDB_CODE_INVALID_PARA; return code; } - if (pBlockInfo != NULL) { - pBlock = getCurrentBlock(pBlockIter); - } + pBlock = getCurrentBlock(pBlockIter); initLastBlockReader(pLastBlockReader, pScanInfo, pReader); TSDBKEY keyInBuf = getCurrentKeyInBuf(pScanInfo, pReader); - /*if (pBlockInfo == NULL) { // build data block from last data file - SBlockData* pBData = &pReader->status.fileBlockData; - tBlockDataReset(pBData); - - SSDataBlock* pResBlock = pReader->pResBlock; - tsdbDebug("load data in last block firstly, due to desc scan data, %s", pReader->idStr); - - int64_t st = taosGetTimestampUs(); - - while (1) { - bool hasBlockLData = hasDataInLastBlock(pLastBlockReader); - - // no data in last block and block, no need to proceed. - if (hasBlockLData == false) { - break; - } - - buildComposedDataBlockImpl(pReader, pScanInfo, &pReader->status.fileBlockData, pLastBlockReader); - if (pResBlock->info.rows >= pReader->capacity) { - break; - } - } - - double el = (taosGetTimestampUs() - st) / 1000.0; - updateComposedBlockInfo(pReader, el, pScanInfo); - - if (pResBlock->info.rows > 0) { - tsdbDebug("%p uid:%" PRIu64 ", composed data block created, brange:%" PRIu64 "-%" PRIu64 - " rows:%d, elapsed time:%.2f ms %s", - pReader, pResBlock->info.id.uid, pResBlock->info.window.skey, pResBlock->info.window.ekey, - pResBlock->info.rows, el, pReader->idStr); - } - } else*/ if (fileBlockShouldLoad(pReader, pBlockInfo, pBlock, pScanInfo, keyInBuf, pLastBlockReader)) { + if (fileBlockShouldLoad(pReader, pBlockInfo, pBlock, pScanInfo, keyInBuf, pLastBlockReader)) { code = doLoadFileBlockData(pReader, pBlockIter, &pStatus->fileBlockData, pScanInfo->uid); if (code != TSDB_CODE_SUCCESS) { return code; @@ -3027,12 +3041,18 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { SDataBlockInfo* pInfo = &pReader->pResBlock->info; pInfo->rows = pBlock->nRow; pInfo->id.uid = pScanInfo->uid; + pInfo->dataLoad = 0; pInfo->window = (STimeWindow){.skey = pBlock->minKey.ts, .ekey = pBlock->maxKey.ts}; setComposedBlockFlag(pReader, false); setBlockAllDumped(&pStatus->fBlockDumpInfo, pBlock->maxKey.ts, pReader->order); // update the last key for the corresponding table pScanInfo->lastKey = ASCENDING_TRAVERSE(pReader->order) ? pInfo->window.ekey : pInfo->window.skey; + tsdbDebug("%p uid:%" PRIu64 + " clean file block retrieved from file, global index:%d, " + "table index:%d, rows:%d, brange:%" PRId64 "-%" PRId64 ", %s", + pReader, pScanInfo->uid, pBlockIter->index, pBlockInfo->tbBlockIdx, pBlock->nRow, pBlock->minKey.ts, + pBlock->maxKey.ts, pReader->idStr); } } @@ -3152,7 +3172,6 @@ static int32_t buildBlockFromFiles(STsdbReader* pReader) { // this file does not have data files, let's start check the last block file if exists if (pBlockIter->numOfBlocks == 0) { - resetScanBlockLastBlockDelIndex(&pReader->status, pReader->order); goto _begin; } } @@ -3189,7 +3208,6 @@ static int32_t buildBlockFromFiles(STsdbReader* pReader) { tBlockDataReset(pBlockData); resetDataBlockIterator(pBlockIter, pReader->order); - resetScanBlockLastBlockDelIndex(&pReader->status, pReader->order); goto _begin; } else { code = initForFirstBlockInFile(pReader, pBlockIter); @@ -3201,7 +3219,6 @@ static int32_t buildBlockFromFiles(STsdbReader* pReader) { // this file does not have blocks, let's start check the last block file if (pBlockIter->numOfBlocks == 0) { - resetScanBlockLastBlockDelIndex(&pReader->status, pReader->order); goto _begin; } } @@ -4124,19 +4141,21 @@ void tsdbReaderClose(STsdbReader* pReader) { taosMemoryFree(pLReader); } - tsdbDebug("%p :io-cost summary: head-file:%" PRIu64 ", head-file time:%.2f ms, SMA:%" PRId64 - " SMA-time:%.2f ms, fileBlocks:%" PRId64 - ", fileBlocks-load-time:%.2f ms, " - "build in-memory-block-time:%.2f ms, lastBlocks:%" PRId64 - ", lastBlocks-time:%.2f ms, composed-blocks:%" PRId64 - ", composed-blocks-time:%.2fms, STableBlockScanInfo size:%.2f Kb, creatTime:%.2f ms, %s", - pReader, pCost->headFileLoad, pCost->headFileLoadTime, pCost->smaDataLoad, pCost->smaLoadTime, - pCost->numOfBlocks, pCost->blockLoadTime, pCost->buildmemBlock, pCost->lastBlockLoad, - pCost->lastBlockLoadTime, pCost->composedBlocks, pCost->buildComposedBlockTime, - numOfTables * sizeof(STableBlockScanInfo) / 1000.0, pCost->createScanInfoList, pReader->idStr); + tsdbDebug( + "%p :io-cost summary: head-file:%" PRIu64 ", head-file time:%.2f ms, SMA:%" PRId64 + " SMA-time:%.2f ms, fileBlocks:%" PRId64 + ", fileBlocks-load-time:%.2f ms, " + "build in-memory-block-time:%.2f ms, lastBlocks:%" PRId64 ", lastBlocks-time:%.2f ms, composed-blocks:%" PRId64 + ", composed-blocks-time:%.2fms, STableBlockScanInfo size:%.2f Kb, createTime:%.2f ms,initDelSkylineIterTime:%.2f " + "ms, %s", + pReader, pCost->headFileLoad, pCost->headFileLoadTime, pCost->smaDataLoad, pCost->smaLoadTime, pCost->numOfBlocks, + pCost->blockLoadTime, pCost->buildmemBlock, pCost->lastBlockLoad, pCost->lastBlockLoadTime, pCost->composedBlocks, + pCost->buildComposedBlockTime, numOfTables * sizeof(STableBlockScanInfo) / 1000.0, pCost->createScanInfoList, + pCost->initDelSkylineIterTime, pReader->idStr); taosMemoryFree(pReader->idStr); taosMemoryFree(pReader->pSchema); + if (pReader->pMemSchema != pReader->pSchema) { taosMemoryFree(pReader->pMemSchema); } @@ -4435,26 +4454,6 @@ bool tsdbNextDataBlock(STsdbReader* pReader) { return false; } -static void setBlockInfo(const STsdbReader* pReader, int32_t* rows, uint64_t* uid, STimeWindow* pWindow) { - *rows = pReader->pResBlock->info.rows; - *uid = pReader->pResBlock->info.id.uid; - *pWindow = pReader->pResBlock->info.window; -} - -void tsdbRetrieveDataBlockInfo(const STsdbReader* pReader, int32_t* rows, uint64_t* uid, STimeWindow* pWindow) { - if (pReader->type == TIMEWINDOW_RANGE_EXTERNAL) { - if (pReader->step == EXTERNAL_ROWS_MAIN) { - setBlockInfo(pReader, rows, uid, pWindow); - } else if (pReader->step == EXTERNAL_ROWS_PREV) { - setBlockInfo(pReader->innerReader[0], rows, uid, pWindow); - } else { - setBlockInfo(pReader->innerReader[1], rows, uid, pWindow); - } - } else { - setBlockInfo(pReader, rows, uid, pWindow); - } -} - static void doFillNullColSMA(SBlockLoadSuppInfo* pSup, int32_t numOfRows, int32_t numOfCols, SColumnDataAgg* pTsAgg) { // do fill all null column value SMA info int32_t i = 0, j = 0; @@ -4585,7 +4584,7 @@ static SSDataBlock* doRetrieveDataBlock(STsdbReader* pReader) { return NULL; } - copyBlockDataToSDataBlock(pReader, pBlockScanInfo); + copyBlockDataToSDataBlock(pReader); return pReader->pResBlock; } diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c index 0e804bc65e..9f57887d48 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c @@ -15,457 +15,10 @@ #include "tsdb.h" -extern int32_t tsdbReadDataBlockEx(SDataFReader* pReader, SDataBlk* pDataBlk, SBlockData* pBlockData); extern int32_t tsdbUpdateTableSchema(SMeta* pMeta, int64_t suid, int64_t uid, SSkmInfo* pSkmInfo); extern int32_t tsdbWriteDataBlock(SDataFWriter* pWriter, SBlockData* pBlockData, SMapData* mDataBlk, int8_t cmprAlg); extern int32_t tsdbWriteSttBlock(SDataFWriter* pWriter, SBlockData* pBlockData, SArray* aSttBlk, int8_t cmprAlg); -// STsdbDataIter2 ======================================== -#define TSDB_MEM_TABLE_DATA_ITER 0 -#define TSDB_DATA_FILE_DATA_ITER 1 -#define TSDB_STT_FILE_DATA_ITER 2 -#define TSDB_TOMB_FILE_DATA_ITER 3 - -typedef struct STsdbDataIter2 STsdbDataIter2; -typedef struct STsdbFilterInfo STsdbFilterInfo; - -typedef struct { - int64_t suid; - int64_t uid; - SDelData delData; -} SDelInfo; - -struct STsdbDataIter2 { - STsdbDataIter2* next; - SRBTreeNode rbtn; - - int32_t type; - SRowInfo rowInfo; - SDelInfo delInfo; - union { - // TSDB_MEM_TABLE_DATA_ITER - struct { - SMemTable* pMemTable; - } mIter; - - // TSDB_DATA_FILE_DATA_ITER - struct { - SDataFReader* pReader; - SArray* aBlockIdx; // SArray - SMapData mDataBlk; - SBlockData bData; - int32_t iBlockIdx; - int32_t iDataBlk; - int32_t iRow; - } dIter; - - // TSDB_STT_FILE_DATA_ITER - struct { - SDataFReader* pReader; - int32_t iStt; - SArray* aSttBlk; - SBlockData bData; - int32_t iSttBlk; - int32_t iRow; - } sIter; - // TSDB_TOMB_FILE_DATA_ITER - struct { - SDelFReader* pReader; - SArray* aDelIdx; - SArray* aDelData; - int32_t iDelIdx; - int32_t iDelData; - } tIter; - }; -}; - -#define TSDB_FILTER_FLAG_BY_VERSION 0x1 -struct STsdbFilterInfo { - int32_t flag; - int64_t sver; - int64_t ever; -}; - -#define TSDB_RBTN_TO_DATA_ITER(pNode) ((STsdbDataIter2*)(((char*)pNode) - offsetof(STsdbDataIter2, rbtn))) - -/* open */ -static int32_t tsdbOpenDataFileDataIter(SDataFReader* pReader, STsdbDataIter2** ppIter) { - int32_t code = 0; - int32_t lino = 0; - - // create handle - STsdbDataIter2* pIter = (STsdbDataIter2*)taosMemoryCalloc(1, sizeof(*pIter)); - if (pIter == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - pIter->type = TSDB_DATA_FILE_DATA_ITER; - pIter->dIter.pReader = pReader; - if ((pIter->dIter.aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - code = tBlockDataCreate(&pIter->dIter.bData); - TSDB_CHECK_CODE(code, lino, _exit); - - pIter->dIter.iBlockIdx = 0; - pIter->dIter.iDataBlk = 0; - pIter->dIter.iRow = 0; - - // read data - code = tsdbReadBlockIdx(pReader, pIter->dIter.aBlockIdx); - TSDB_CHECK_CODE(code, lino, _exit); - - if (taosArrayGetSize(pIter->dIter.aBlockIdx) == 0) goto _clear; - -_exit: - if (code) { - if (pIter) { - _clear: - tBlockDataDestroy(&pIter->dIter.bData); - taosArrayDestroy(pIter->dIter.aBlockIdx); - taosMemoryFree(pIter); - pIter = NULL; - } - } - *ppIter = pIter; - return code; -} - -static int32_t tsdbOpenSttFileDataIter(SDataFReader* pReader, int32_t iStt, STsdbDataIter2** ppIter) { - int32_t code = 0; - int32_t lino = 0; - - // create handle - STsdbDataIter2* pIter = (STsdbDataIter2*)taosMemoryCalloc(1, sizeof(*pIter)); - if (pIter == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - pIter->type = TSDB_STT_FILE_DATA_ITER; - pIter->sIter.pReader = pReader; - pIter->sIter.iStt = iStt; - pIter->sIter.aSttBlk = taosArrayInit(0, sizeof(SSttBlk)); - if (pIter->sIter.aSttBlk == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - code = tBlockDataCreate(&pIter->sIter.bData); - TSDB_CHECK_CODE(code, lino, _exit); - - pIter->sIter.iSttBlk = 0; - pIter->sIter.iRow = 0; - - // read data - code = tsdbReadSttBlk(pReader, iStt, pIter->sIter.aSttBlk); - TSDB_CHECK_CODE(code, lino, _exit); - - if (taosArrayGetSize(pIter->sIter.aSttBlk) == 0) goto _clear; - -_exit: - if (code) { - if (pIter) { - _clear: - taosArrayDestroy(pIter->sIter.aSttBlk); - tBlockDataDestroy(&pIter->sIter.bData); - taosMemoryFree(pIter); - pIter = NULL; - } - } - *ppIter = pIter; - return code; -} - -static int32_t tsdbOpenTombFileDataIter(SDelFReader* pReader, STsdbDataIter2** ppIter) { - int32_t code = 0; - int32_t lino = 0; - - STsdbDataIter2* pIter = (STsdbDataIter2*)taosMemoryCalloc(1, sizeof(*pIter)); - if (pIter == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - pIter->type = TSDB_TOMB_FILE_DATA_ITER; - - pIter->tIter.pReader = pReader; - if ((pIter->tIter.aDelIdx = taosArrayInit(0, sizeof(SDelIdx))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - if ((pIter->tIter.aDelData = taosArrayInit(0, sizeof(SDelData))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - code = tsdbReadDelIdx(pReader, pIter->tIter.aDelIdx); - TSDB_CHECK_CODE(code, lino, _exit); - - if (taosArrayGetSize(pIter->tIter.aDelIdx) == 0) goto _clear; - - pIter->tIter.iDelIdx = 0; - pIter->tIter.iDelData = 0; - -_exit: - if (code) { - if (pIter) { - _clear: - taosArrayDestroy(pIter->tIter.aDelIdx); - taosArrayDestroy(pIter->tIter.aDelData); - taosMemoryFree(pIter); - pIter = NULL; - } - } - *ppIter = pIter; - return code; -} - -/* close */ -static void tsdbCloseDataFileDataIter(STsdbDataIter2* pIter) { - tBlockDataDestroy(&pIter->dIter.bData); - tMapDataClear(&pIter->dIter.mDataBlk); - taosArrayDestroy(pIter->dIter.aBlockIdx); - taosMemoryFree(pIter); -} - -static void tsdbCloseSttFileDataIter(STsdbDataIter2* pIter) { - tBlockDataDestroy(&pIter->sIter.bData); - taosArrayDestroy(pIter->sIter.aSttBlk); - taosMemoryFree(pIter); -} - -static void tsdbCloseTombFileDataIter(STsdbDataIter2* pIter) { - taosArrayDestroy(pIter->tIter.aDelData); - taosArrayDestroy(pIter->tIter.aDelIdx); - taosMemoryFree(pIter); -} - -static void tsdbCloseDataIter2(STsdbDataIter2* pIter) { - if (pIter->type == TSDB_MEM_TABLE_DATA_ITER) { - ASSERT(0); - } else if (pIter->type == TSDB_DATA_FILE_DATA_ITER) { - tsdbCloseDataFileDataIter(pIter); - } else if (pIter->type == TSDB_STT_FILE_DATA_ITER) { - tsdbCloseSttFileDataIter(pIter); - } else if (pIter->type == TSDB_TOMB_FILE_DATA_ITER) { - tsdbCloseTombFileDataIter(pIter); - } else { - ASSERT(0); - } -} - -/* cmpr */ -static int32_t tsdbDataIterCmprFn(const SRBTreeNode* pNode1, const SRBTreeNode* pNode2) { - STsdbDataIter2* pIter1 = TSDB_RBTN_TO_DATA_ITER(pNode1); - STsdbDataIter2* pIter2 = TSDB_RBTN_TO_DATA_ITER(pNode2); - return tRowInfoCmprFn(&pIter1->rowInfo, &pIter2->rowInfo); -} - -/* seek */ - -/* iter next */ -static int32_t tsdbDataFileDataIterNext(STsdbDataIter2* pIter, STsdbFilterInfo* pFilterInfo) { - int32_t code = 0; - int32_t lino = 0; - - for (;;) { - while (pIter->dIter.iRow < pIter->dIter.bData.nRow) { - if (pFilterInfo) { - if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) { - if (pIter->dIter.bData.aVersion[pIter->dIter.iRow] < pFilterInfo->sver || - pIter->dIter.bData.aVersion[pIter->dIter.iRow] > pFilterInfo->ever) { - pIter->dIter.iRow++; - continue; - } - } - } - - pIter->rowInfo.suid = pIter->dIter.bData.suid; - pIter->rowInfo.uid = pIter->dIter.bData.uid; - pIter->rowInfo.row = tsdbRowFromBlockData(&pIter->dIter.bData, pIter->dIter.iRow); - pIter->dIter.iRow++; - goto _exit; - } - - for (;;) { - while (pIter->dIter.iDataBlk < pIter->dIter.mDataBlk.nItem) { - SDataBlk dataBlk; - tMapDataGetItemByIdx(&pIter->dIter.mDataBlk, pIter->dIter.iDataBlk, &dataBlk, tGetDataBlk); - - // filter - if (pFilterInfo) { - if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) { - if (pFilterInfo->sver > dataBlk.maxVer || pFilterInfo->ever < dataBlk.minVer) { - pIter->dIter.iDataBlk++; - continue; - } - } - } - - code = tsdbReadDataBlockEx(pIter->dIter.pReader, &dataBlk, &pIter->dIter.bData); - TSDB_CHECK_CODE(code, lino, _exit); - - pIter->dIter.iDataBlk++; - pIter->dIter.iRow = 0; - - break; - } - - if (pIter->dIter.iRow < pIter->dIter.bData.nRow) break; - - for (;;) { - if (pIter->dIter.iBlockIdx < taosArrayGetSize(pIter->dIter.aBlockIdx)) { - SBlockIdx* pBlockIdx = taosArrayGet(pIter->dIter.aBlockIdx, pIter->dIter.iBlockIdx); - - code = tsdbReadDataBlk(pIter->dIter.pReader, pBlockIdx, &pIter->dIter.mDataBlk); - TSDB_CHECK_CODE(code, lino, _exit); - - pIter->dIter.iBlockIdx++; - pIter->dIter.iDataBlk = 0; - - break; - } else { - pIter->rowInfo = (SRowInfo){0}; - goto _exit; - } - } - } - } - -_exit: - if (code) { - tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); - } - return code; -} - -static int32_t tsdbSttFileDataIterNext(STsdbDataIter2* pIter, STsdbFilterInfo* pFilterInfo) { - int32_t code = 0; - int32_t lino = 0; - - for (;;) { - while (pIter->sIter.iRow < pIter->sIter.bData.nRow) { - if (pFilterInfo) { - if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) { - if (pFilterInfo->sver > pIter->sIter.bData.aVersion[pIter->sIter.iRow] || - pFilterInfo->ever < pIter->sIter.bData.aVersion[pIter->sIter.iRow]) { - pIter->sIter.iRow++; - continue; - } - } - } - - pIter->rowInfo.suid = pIter->sIter.bData.suid; - pIter->rowInfo.uid = pIter->sIter.bData.uid ? pIter->sIter.bData.uid : pIter->sIter.bData.aUid[pIter->sIter.iRow]; - pIter->rowInfo.row = tsdbRowFromBlockData(&pIter->sIter.bData, pIter->sIter.iRow); - pIter->sIter.iRow++; - goto _exit; - } - - for (;;) { - if (pIter->sIter.iSttBlk < taosArrayGetSize(pIter->sIter.aSttBlk)) { - SSttBlk* pSttBlk = taosArrayGet(pIter->sIter.aSttBlk, pIter->sIter.iSttBlk); - - if (pFilterInfo) { - if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) { - if (pFilterInfo->sver > pSttBlk->maxVer || pFilterInfo->ever < pSttBlk->minVer) { - pIter->sIter.iSttBlk++; - continue; - } - } - } - - code = tsdbReadSttBlockEx(pIter->sIter.pReader, pIter->sIter.iStt, pSttBlk, &pIter->sIter.bData); - TSDB_CHECK_CODE(code, lino, _exit); - - pIter->sIter.iRow = 0; - pIter->sIter.iSttBlk++; - break; - } else { - pIter->rowInfo = (SRowInfo){0}; - goto _exit; - } - } - } - -_exit: - if (code) { - tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); - } - return code; -} - -static int32_t tsdbTombFileDataIterNext(STsdbDataIter2* pIter, STsdbFilterInfo* pFilterInfo) { - int32_t code = 0; - int32_t lino = 0; - - for (;;) { - while (pIter->tIter.iDelData < taosArrayGetSize(pIter->tIter.aDelData)) { - SDelData* pDelData = taosArrayGet(pIter->tIter.aDelData, pIter->tIter.iDelData); - - if (pFilterInfo) { - if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) { - if (pFilterInfo->sver > pDelData->version || pFilterInfo->ever < pDelData->version) { - pIter->tIter.iDelData++; - continue; - } - } - } - - pIter->delInfo.delData = *pDelData; - pIter->tIter.iDelData++; - goto _exit; - } - - for (;;) { - if (pIter->tIter.iDelIdx < taosArrayGetSize(pIter->tIter.aDelIdx)) { - SDelIdx* pDelIdx = taosArrayGet(pIter->tIter.aDelIdx, pIter->tIter.iDelIdx); - - code = tsdbReadDelData(pIter->tIter.pReader, pDelIdx, pIter->tIter.aDelData); - TSDB_CHECK_CODE(code, lino, _exit); - - pIter->delInfo.suid = pDelIdx->suid; - pIter->delInfo.uid = pDelIdx->uid; - pIter->tIter.iDelData = 0; - pIter->tIter.iDelIdx++; - break; - } else { - pIter->delInfo = (SDelInfo){0}; - goto _exit; - } - } - } - -_exit: - if (code) { - tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); - } - return code; -} - -static int32_t tsdbDataIterNext2(STsdbDataIter2* pIter, STsdbFilterInfo* pFilterInfo) { - int32_t code = 0; - - if (pIter->type == TSDB_MEM_TABLE_DATA_ITER) { - ASSERT(0); - return code; - } else if (pIter->type == TSDB_DATA_FILE_DATA_ITER) { - return tsdbDataFileDataIterNext(pIter, pFilterInfo); - } else if (pIter->type == TSDB_STT_FILE_DATA_ITER) { - return tsdbSttFileDataIterNext(pIter, pFilterInfo); - } else if (pIter->type == TSDB_TOMB_FILE_DATA_ITER) { - return tsdbTombFileDataIterNext(pIter, pFilterInfo); - } else { - ASSERT(0); - return code; - } -} - -/* get */ - // STsdbSnapReader ======================================== struct STsdbSnapReader { STsdb* pTsdb; @@ -656,7 +209,7 @@ static int32_t tsdbSnapCmprData(STsdbSnapReader* pReader, uint8_t** ppData) { } SSnapDataHdr* pHdr = (SSnapDataHdr*)*ppData; - pHdr->type = SNAP_DATA_TSDB; + pHdr->type = pReader->type; pHdr->size = size; memcpy(pHdr->data, pReader->aBuf[3], aBufN[3]); @@ -1318,7 +871,7 @@ static int32_t tsdbSnapWriteFileDataStart(STsdbSnapWriter* pWriter, int32_t fid) TSDB_CHECK_CODE(code, lino, _exit); if (pWriter->pSIter) { - code = tsdbSttFileDataIterNext(pWriter->pSIter, NULL); + code = tsdbDataIterNext2(pWriter->pSIter, NULL); TSDB_CHECK_CODE(code, lino, _exit); // add to tree diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index 4e051b8b30..24dcae91d9 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c @@ -926,8 +926,9 @@ int32_t tsdbRowMergerGetRow(SRowMerger *pMerger, SRow **ppRow) { return tRowBuild(pMerger->pArray, pMerger->pTSchema, ppRow); } +/* // delete skyline ====================================================== -static int32_t tsdbMergeSkyline(SArray *aSkyline1, SArray *aSkyline2, SArray *aSkyline) { +static int32_t tsdbMergeSkyline2(SArray *aSkyline1, SArray *aSkyline2, SArray *aSkyline) { int32_t code = 0; int32_t i1 = 0; int32_t n1 = taosArrayGetSize(aSkyline1); @@ -993,7 +994,139 @@ static int32_t tsdbMergeSkyline(SArray *aSkyline1, SArray *aSkyline2, SArray *aS _exit: return code; } +*/ + +// delete skyline ====================================================== +static int32_t tsdbMergeSkyline(SArray *pSkyline1, SArray *pSkyline2, SArray *pSkyline) { + int32_t code = 0; + int32_t i1 = 0; + int32_t n1 = taosArrayGetSize(pSkyline1); + int32_t i2 = 0; + int32_t n2 = taosArrayGetSize(pSkyline2); + TSDBKEY *pKey1; + TSDBKEY *pKey2; + int64_t version1 = 0; + int64_t version2 = 0; + + ASSERT(n1 > 0 && n2 > 0); + + taosArrayClear(pSkyline); + TSDBKEY **pItem = TARRAY_GET_ELEM(pSkyline, 0); + + while (i1 < n1 && i2 < n2) { + pKey1 = (TSDBKEY *)taosArrayGetP(pSkyline1, i1); + pKey2 = (TSDBKEY *)taosArrayGetP(pSkyline2, i2); + + if (pKey1->ts < pKey2->ts) { + version1 = pKey1->version; + *pItem = pKey1; + i1++; + } else if (pKey1->ts > pKey2->ts) { + version2 = pKey2->version; + *pItem = pKey2; + i2++; + } else { + version1 = pKey1->version; + version2 = pKey2->version; + *pItem = pKey1; + i1++; + i2++; + } + + (*pItem)->version = TMAX(version1, version2); + pItem++; + } + + while (i1 < n1) { + pKey1 = (TSDBKEY *)taosArrayGetP(pSkyline1, i1); + *pItem = pKey1; + pItem++; + i1++; + } + + while (i2 < n2) { + pKey2 = (TSDBKEY *)taosArrayGetP(pSkyline2, i2); + *pItem = pKey2; + pItem++; + i2++; + } + + taosArraySetSize(pSkyline, TARRAY_ELEM_IDX(pSkyline, pItem)); + +_exit: + return code; +} + +int32_t tsdbBuildDeleteSkylineImpl(SArray *aSkyline, int32_t sidx, int32_t eidx, SArray *pSkyline) { + int32_t code = 0; + SDelData *pDelData; + int32_t midx; + + taosArrayClear(pSkyline); + if (sidx == eidx) { + TSDBKEY *pItem1 = taosArrayGet(aSkyline, sidx * 2); + TSDBKEY *pItem2 = taosArrayGet(aSkyline, sidx * 2 + 1); + taosArrayPush(pSkyline, &pItem1); + taosArrayPush(pSkyline, &pItem2); + } else { + SArray *pSkyline1 = NULL; + SArray *pSkyline2 = NULL; + midx = (sidx + eidx) / 2; + + pSkyline1 = taosArrayInit((midx - sidx + 1) * 2, POINTER_BYTES); + pSkyline2 = taosArrayInit((eidx - midx) * 2, POINTER_BYTES); + if (pSkyline1 == NULL || pSkyline1 == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _clear; + } + + code = tsdbBuildDeleteSkylineImpl(aSkyline, sidx, midx, pSkyline1); + if (code) goto _clear; + + code = tsdbBuildDeleteSkylineImpl(aSkyline, midx + 1, eidx, pSkyline2); + if (code) goto _clear; + + code = tsdbMergeSkyline(pSkyline1, pSkyline2, pSkyline); + + _clear: + taosArrayDestroy(pSkyline1); + taosArrayDestroy(pSkyline2); + } + + return code; +} + int32_t tsdbBuildDeleteSkyline(SArray *aDelData, int32_t sidx, int32_t eidx, SArray *aSkyline) { + SDelData *pDelData; + int32_t code = 0; + int32_t dataNum = eidx - sidx + 1; + SArray *aTmpSkyline = taosArrayInit(dataNum * 2, sizeof(TSDBKEY)); + SArray *pSkyline = taosArrayInit(dataNum * 2, POINTER_BYTES); + + for (int32_t i = sidx; i <= eidx; ++i) { + pDelData = (SDelData *)taosArrayGet(aDelData, i); + taosArrayPush(aTmpSkyline, &(TSDBKEY){.ts = pDelData->sKey, .version = pDelData->version}); + taosArrayPush(aTmpSkyline, &(TSDBKEY){.ts = pDelData->eKey, .version = 0}); + } + + code = tsdbBuildDeleteSkylineImpl(aTmpSkyline, sidx, eidx, pSkyline); + if (code) goto _clear; + + int32_t skylineNum = taosArrayGetSize(pSkyline); + for (int32_t i = 0; i < skylineNum; ++i) { + TSDBKEY *p = taosArrayGetP(pSkyline, i); + taosArrayPush(aSkyline, p); + } + +_clear: + taosArrayDestroy(aTmpSkyline); + taosArrayDestroy(pSkyline); + + return code; +} + +/* +int32_t tsdbBuildDeleteSkyline2(SArray *aDelData, int32_t sidx, int32_t eidx, SArray *aSkyline) { int32_t code = 0; SDelData *pDelData; int32_t midx; @@ -1030,6 +1163,7 @@ int32_t tsdbBuildDeleteSkyline(SArray *aDelData, int32_t sidx, int32_t eidx, SAr return code; } +*/ // SBlockData ====================================================== int32_t tBlockDataCreate(SBlockData *pBlockData) { @@ -1145,7 +1279,12 @@ void tBlockDataClear(SBlockData *pBlockData) { } } -static int32_t tBlockDataAppendBlockRow(SBlockData *pBlockData, SBlockData *pBlockDataFrom, int32_t iRow) { +/* flag > 0: forward update + * flag == 0: insert + * flag < 0: backward update + */ +static int32_t tBlockDataUpsertBlockRow(SBlockData *pBlockData, SBlockData *pBlockDataFrom, int32_t iRow, + int32_t flag) { int32_t code = 0; SColVal cv = {0}; @@ -1160,12 +1299,16 @@ static int32_t tBlockDataAppendBlockRow(SBlockData *pBlockData, SBlockData *pBlo } if (pColDataFrom == NULL || pColDataFrom->cid > pColDataTo->cid) { - code = tColDataAppendValue(pColDataTo, &COL_VAL_NONE(pColDataTo->cid, pColDataTo->type)); - if (code) goto _exit; + cv = COL_VAL_NONE(pColDataTo->cid, pColDataTo->type); + if (flag == 0 && (code = tColDataAppendValue(pColDataTo, &cv))) goto _exit; } else { tColDataGetValue(pColDataFrom, iRow, &cv); - code = tColDataAppendValue(pColDataTo, &cv); + if (flag) { + code = tColDataUpdateValue(pColDataTo, &cv, flag > 0); + } else { + code = tColDataAppendValue(pColDataTo, &cv); + } if (code) goto _exit; pColDataFrom = (++iColDataFrom < pBlockDataFrom->nColData) ? &pBlockDataFrom->aColData[iColDataFrom] : NULL; @@ -1185,36 +1328,77 @@ int32_t tBlockDataAppendRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTS if (pBlockData->uid == 0) { ASSERT(uid); code = tRealloc((uint8_t **)&pBlockData->aUid, sizeof(int64_t) * (pBlockData->nRow + 1)); - if (code) goto _err; + if (code) goto _exit; pBlockData->aUid[pBlockData->nRow] = uid; } // version code = tRealloc((uint8_t **)&pBlockData->aVersion, sizeof(int64_t) * (pBlockData->nRow + 1)); - if (code) goto _err; + if (code) goto _exit; pBlockData->aVersion[pBlockData->nRow] = TSDBROW_VERSION(pRow); // timestamp code = tRealloc((uint8_t **)&pBlockData->aTSKEY, sizeof(TSKEY) * (pBlockData->nRow + 1)); - if (code) goto _err; + if (code) goto _exit; pBlockData->aTSKEY[pBlockData->nRow] = TSDBROW_TS(pRow); - SColVal cv = {0}; if (pRow->type == TSDBROW_ROW_FMT) { - code = tRowAppendToColData(pRow->pTSRow, pTSchema, pBlockData->aColData, pBlockData->nColData); - if (code) goto _err; + code = tRowUpsertColData(pRow->pTSRow, pTSchema, pBlockData->aColData, pBlockData->nColData, 0 /* append */); + if (code) goto _exit; } else if (pRow->type == TSDBROW_COL_FMT) { - code = tBlockDataAppendBlockRow(pBlockData, pRow->pBlockData, pRow->iRow); - if (code) goto _err; + code = tBlockDataUpsertBlockRow(pBlockData, pRow->pBlockData, pRow->iRow, 0 /* append */); + if (code) goto _exit; } else { ASSERT(0); } pBlockData->nRow++; +_exit: return code; +} +static int32_t tBlockDataUpdateRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTSchema) { + int32_t code = 0; -_err: + // version + int64_t lversion = pBlockData->aVersion[pBlockData->nRow - 1]; + int64_t rversion = TSDBROW_VERSION(pRow); + ASSERT(lversion != rversion); + if (rversion > lversion) { + pBlockData->aVersion[pBlockData->nRow - 1] = rversion; + } + + // update other rows + if (pRow->type == TSDBROW_ROW_FMT) { + code = tRowUpsertColData(pRow->pTSRow, pTSchema, pBlockData->aColData, pBlockData->nColData, + (rversion > lversion) ? 1 : -1 /* update */); + if (code) goto _exit; + } else if (pRow->type == TSDBROW_COL_FMT) { + code = tBlockDataUpsertBlockRow(pBlockData, pRow->pBlockData, pRow->iRow, (rversion > lversion) ? 1 : -1); + if (code) goto _exit; + } else { + ASSERT(0); + } + +_exit: return code; } +int32_t tBlockDataTryUpsertRow(SBlockData *pBlockData, TSDBROW *pRow, int64_t uid) { + if (pBlockData->nRow == 0) { + return 1; + } else if (pBlockData->aTSKEY[pBlockData->nRow - 1] == TSDBROW_TS(pRow)) { + return pBlockData->nRow; + } else { + return pBlockData->nRow + 1; + } +} + +int32_t tBlockDataUpsertRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTSchema, int64_t uid) { + if (pBlockData->nRow > 0 && pBlockData->aTSKEY[pBlockData->nRow - 1] == TSDBROW_TS(pRow)) { + return tBlockDataUpdateRow(pBlockData, pRow, pTSchema); + } else { + return tBlockDataAppendRow(pBlockData, pRow, pTSchema, uid); + } +} + void tBlockDataGetColData(SBlockData *pBlockData, int16_t cid, SColData **ppColData) { ASSERT(cid != PRIMARYKEY_TIMESTAMP_COL_ID); int32_t lidx = 0; diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index a3401926e6..b075c3d835 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -113,8 +113,6 @@ int vnodeBegin(SVnode *pVnode) { int32_t code = 0; int32_t lino = 0; - pVnode->state.commitID++; - // alloc buffer pool code = vnodeGetBufPoolToUse(pVnode); TSDB_CHECK_CODE(code, lino, _exit); @@ -221,7 +219,7 @@ _err: return -1; } -int vnodeCommitInfo(const char *dir, const SVnodeInfo *pInfo) { +int vnodeCommitInfo(const char *dir) { char fname[TSDB_FILENAME_LEN]; char tfname[TSDB_FILENAME_LEN]; @@ -233,8 +231,7 @@ int vnodeCommitInfo(const char *dir, const SVnodeInfo *pInfo) { return -1; } - vInfo("vgId:%d, vnode info is committed", pInfo->config.vgId); - + vInfo("vnode info is committed, dir:%s", dir); return 0; } @@ -296,18 +293,12 @@ static int32_t vnodePrepareCommit(SVnode *pVnode, SCommitInfo *pInfo) { tsem_wait(&pVnode->canCommit); - taosThreadMutexLock(&pVnode->mutex); - ASSERT(pVnode->onCommit == NULL); - pVnode->onCommit = pVnode->inUse; - pVnode->inUse = NULL; - taosThreadMutexUnlock(&pVnode->mutex); - pVnode->state.commitTerm = pVnode->state.applyTerm; pInfo->info.config = pVnode->config; pInfo->info.state.committed = pVnode->state.applied; pInfo->info.state.commitTerm = pVnode->state.applyTerm; - pInfo->info.state.commitID = pVnode->state.commitID; + pInfo->info.state.commitID = ++pVnode->state.commitID; pInfo->pVnode = pVnode; pInfo->txn = metaGetTxn(pVnode->pMeta); @@ -331,12 +322,18 @@ static int32_t vnodePrepareCommit(SVnode *pVnode, SCommitInfo *pInfo) { code = smaPrepareAsyncCommit(pVnode->pSma); if (code) goto _exit; + taosThreadMutexLock(&pVnode->mutex); + ASSERT(pVnode->onCommit == NULL); + pVnode->onCommit = pVnode->inUse; + pVnode->inUse = NULL; + taosThreadMutexUnlock(&pVnode->mutex); + _exit: if (code) { vError("vgId:%d, %s failed at line %d since %s, commit id:%" PRId64, TD_VID(pVnode), __func__, lino, tstrerror(code), pVnode->state.commitID); } else { - vDebug("vgId:%d, %s done", TD_VID(pVnode), __func__); + vDebug("vgId:%d, %s done, commit id:%" PRId64, TD_VID(pVnode), __func__, pInfo->info.state.commitID); } return code; @@ -468,7 +465,7 @@ static int vnodeCommitImpl(SCommitInfo *pInfo) { } // commit info - if (vnodeCommitInfo(dir, &pInfo->info) < 0) { + if (vnodeCommitInfo(dir) < 0) { code = terrno; TSDB_CHECK_CODE(code, lino, _exit); } diff --git a/source/dnode/vnode/src/vnd/vnodeCompact.c b/source/dnode/vnode/src/vnd/vnodeCompact.c new file mode 100644 index 0000000000..14d893042d --- /dev/null +++ b/source/dnode/vnode/src/vnd/vnodeCompact.c @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "vnd.h" + +static int32_t vnodeCompactTask(void *param) { + int32_t code = 0; + int32_t lino = 0; + + SCompactInfo *pInfo = (SCompactInfo *)param; + SVnode *pVnode = pInfo->pVnode; + + // do compact + code = tsdbCompact(pInfo->pVnode->pTsdb, pInfo); + TSDB_CHECK_CODE(code, lino, _exit); + + // end compact + char dir[TSDB_FILENAME_LEN] = {0}; + if (pVnode->pTfs) { + snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path); + } else { + snprintf(dir, TSDB_FILENAME_LEN, "%s", pVnode->path); + } + vnodeCommitInfo(dir); + +_exit: + taosMemoryFree(pInfo); + tsem_post(&pInfo->pVnode->canCommit); + return code; +} +static int32_t vnodePrepareCompact(SVnode *pVnode, SCompactInfo *pInfo) { + int32_t code = 0; + int32_t lino = 0; + + tsem_wait(&pVnode->canCommit); + + pInfo->pVnode = pVnode; + pInfo->flag = 0; + pInfo->commitID = ++pVnode->state.commitID; + + char dir[TSDB_FILENAME_LEN] = {0}; + SVnodeInfo info = {0}; + + if (pVnode->pTfs) { + snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path); + } else { + snprintf(dir, TSDB_FILENAME_LEN, "%s", pVnode->path); + } + + vnodeLoadInfo(dir, &info); + info.state.commitID = pInfo->commitID; + vnodeSaveInfo(dir, &info); + +_exit: + if (code) { + vError("vgId:%d %s failed at line %d since %s, commit ID:%" PRId64, TD_VID(pVnode), __func__, lino, tstrerror(code), + pVnode->state.commitID); + } else { + vDebug("vgId:%d %s done, commit ID:%" PRId64, TD_VID(pVnode), __func__, pVnode->state.commitID); + } + return code; +} +int32_t vnodeAsyncCompact(SVnode *pVnode) { + int32_t code = 0; + int32_t lino = 0; + + SCompactInfo *pInfo = taosMemoryCalloc(1, sizeof(*pInfo)); + if (pInfo == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + + vnodeAsyncCommit(pVnode); + + code = vnodePrepareCompact(pVnode, pInfo); + TSDB_CHECK_CODE(code, lino, _exit); + + vnodeScheduleTask(vnodeCompactTask, pInfo); + +_exit: + if (code) { + vError("vgId:%d %s failed at line %d since %s", TD_VID(pVnode), __func__, lino, tstrerror(code)); + if (pInfo) taosMemoryFree(pInfo); + } else { + vInfo("vgId:%d %s done", TD_VID(pVnode), __func__); + } + return code; +} + +int32_t vnodeSyncCompact(SVnode *pVnode) { + vnodeAsyncCompact(pVnode); + tsem_wait(&pVnode->canCommit); + tsem_post(&pVnode->canCommit); + return 0; +} \ No newline at end of file diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c index da27b5e4d3..11d8583ff8 100644 --- a/source/dnode/vnode/src/vnd/vnodeOpen.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -49,7 +49,7 @@ int32_t vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) { info.state.commitID = 0; vInfo("vgId:%d, save config while create", pCfg->vgId); - if (vnodeSaveInfo(dir, &info) < 0 || vnodeCommitInfo(dir, &info) < 0) { + if (vnodeSaveInfo(dir, &info) < 0 || vnodeCommitInfo(dir) < 0) { vError("vgId:%d, failed to save vnode config since %s", pCfg ? pCfg->vgId : 0, tstrerror(terrno)); return -1; } @@ -97,7 +97,7 @@ int32_t vnodeAlterReplica(const char *path, SAlterVnodeReplicaReq *pReq, STfs *p return -1; } - ret = vnodeCommitInfo(dir, &info); + ret = vnodeCommitInfo(dir); if (ret < 0) { vError("vgId:%d, failed to commit vnode config since %s", pReq->vgId, tstrerror(terrno)); return -1; @@ -171,8 +171,8 @@ int32_t vnodeAlterHashRange(const char *srcPath, const char *dstPath, SAlterVnod return -1; } - vInfo("vgId:%d, start to alter hashrange from [%u, %u) to [%u, %u)", pReq->srcVgId, info.config.hashBegin, - info.config.hashEnd, pReq->hashBegin, pReq->hashEnd); + vInfo("vgId:%d, alter hashrange from [%u, %u] to [%u, %u]", pReq->srcVgId, info.config.hashBegin, info.config.hashEnd, + pReq->hashBegin, pReq->hashEnd); info.config.vgId = pReq->dstVgId; info.config.hashBegin = pReq->hashBegin; info.config.hashEnd = pReq->hashEnd; @@ -198,13 +198,13 @@ int32_t vnodeAlterHashRange(const char *srcPath, const char *dstPath, SAlterVnod return -1; } - ret = vnodeCommitInfo(dir, &info); + ret = vnodeCommitInfo(dir); if (ret < 0) { vError("vgId:%d, failed to commit vnode config since %s", pReq->dstVgId, tstrerror(terrno)); return -1; } - vInfo("vgId:%d, start to rename %s to %s", pReq->dstVgId, srcPath, dstPath); + vInfo("vgId:%d, rename %s to %s", pReq->dstVgId, srcPath, dstPath); ret = vnodeRenameVgroupId(srcPath, dstPath, pReq->srcVgId, pReq->dstVgId, pTfs); if (ret < 0) { vError("vgId:%d, failed to rename vnode from %s to %s since %s", pReq->dstVgId, srcPath, dstPath, @@ -257,7 +257,7 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) { if (updated) { vInfo("vgId:%d, save vnode info since dnode info changed", info.config.vgId); (void)vnodeSaveInfo(dir, &info); - (void)vnodeCommitInfo(dir, &info); + (void)vnodeCommitInfo(dir); } // create handle diff --git a/source/dnode/vnode/src/vnd/vnodeSnapshot.c b/source/dnode/vnode/src/vnd/vnodeSnapshot.c index 43f903dc48..71458acce2 100644 --- a/source/dnode/vnode/src/vnd/vnodeSnapshot.c +++ b/source/dnode/vnode/src/vnd/vnodeSnapshot.c @@ -349,7 +349,7 @@ int32_t vnodeSnapWriterClose(SVSnapWriter *pWriter, int8_t rollback, SSnapshot * snprintf(dir, TSDB_FILENAME_LEN, "%s", pWriter->pVnode->path); } - vnodeCommitInfo(dir, &pWriter->info); + vnodeCommitInfo(dir); } else { vnodeRollback(pWriter->pVnode); } @@ -426,7 +426,13 @@ int32_t vnodeSnapWrite(SVSnapWriter *pWriter, uint8_t *pData, uint32_t nData) { SVnode *pVnode = pWriter->pVnode; ASSERT(pHdr->size + sizeof(SSnapDataHdr) == nData); - ASSERT(pHdr->index == pWriter->index + 1); + + if (pHdr->index != pWriter->index + 1) { + vError("vgId:%d, unexpected vnode snapshot msg. index:%" PRId64 ", expected index:%" PRId64, TD_VID(pVnode), + pHdr->index, pWriter->index + 1); + return -1; + } + pWriter->index = pHdr->index; vDebug("vgId:%d, vnode snapshot write data, index:%" PRId64 " type:%d blockLen:%d", TD_VID(pVnode), pHdr->index, diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 313b9da9a5..05d29656ef 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -29,6 +29,7 @@ static int32_t vnodeProcessDropTtlTbReq(SVnode *pVnode, int64_t version, void *p static int32_t vnodeProcessTrimReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp); static int32_t vnodeProcessDeleteReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp); static int32_t vnodeProcessBatchDeleteReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp); +static int32_t vnodeProcessCompactVnodeReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp); int32_t vnodePreProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg) { int32_t code = 0; @@ -318,6 +319,9 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp case TDMT_VND_COMMIT: needCommit = true; break; + case TDMT_VND_COMPACT: + vnodeProcessCompactVnodeReq(pVnode, version, pReq, len, pRsp); + goto _exit; default: vError("vgId:%d, unprocessed msg, %d", TD_VID(pVnode), pMsg->msgType); return -1; @@ -1335,7 +1339,7 @@ static int32_t vnodeProcessBatchDeleteReq(SVnode *pVnode, int64_t version, void tDecodeSBatchDeleteReq(&decoder, &deleteReq); SMetaReader mr = {0}; - metaReaderInit(&mr, pVnode->pMeta, 0); + metaReaderInit(&mr, pVnode->pMeta, META_READER_NOLOCK); int32_t sz = taosArrayGetSize(deleteReq.deleteReqs); for (int32_t i = 0; i < sz; i++) { @@ -1404,3 +1408,18 @@ static int32_t vnodeProcessDeleteReq(SVnode *pVnode, int64_t version, void *pReq _err: return code; } + +static int32_t vnodeProcessCompactVnodeReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) { + SCompactVnodeReq req = {0}; + if (tDeserializeSCompactVnodeReq(pReq, len, &req) != 0) { + terrno = TSDB_CODE_INVALID_MSG; + return TSDB_CODE_INVALID_MSG; + } + vInfo("vgId:%d, compact msg will be processed, db:%s dbUid:%" PRId64 " compactStartTime:%" PRId64, TD_VID(pVnode), + req.db, req.dbUid, req.compactStartTime); + + vnodeAsyncCompact(pVnode); + vnodeBegin(pVnode); + + return 0; +} \ No newline at end of file diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index 6f3788616a..1e96a76170 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -219,7 +219,7 @@ void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) isWeak, isBlock, msg, numOfMsgs, arrayPos, pMsg->info.handle); if (!pVnode->restored) { - vGError("vgId:%d, msg:%p failed to process since restore not finished", vgId, pMsg); + vGError("vgId:%d, msg:%p failed to process since restore not finished, type:%s", vgId, pMsg, TMSG_INFO(pMsg->msgType)); terrno = TSDB_CODE_SYN_RESTORING; vnodeHandleProposeError(pVnode, pMsg, TSDB_CODE_SYN_RESTORING); rpcFreeCont(pMsg->pCont); @@ -228,7 +228,7 @@ void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) } if (pMsgArr == NULL || pIsWeakArr == NULL) { - vGError("vgId:%d, msg:%p failed to process since out of memory", vgId, pMsg); + vGError("vgId:%d, msg:%p failed to process since out of memory, type:%s", vgId, pMsg, TMSG_INFO(pMsg->msgType)); terrno = TSDB_CODE_OUT_OF_MEMORY; vnodeHandleProposeError(pVnode, pMsg, terrno); rpcFreeCont(pMsg->pCont); @@ -281,7 +281,7 @@ void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) vnodeIsMsgBlock(pMsg->msgType), msg, numOfMsgs, pMsg->info.handle); if (!pVnode->restored) { - vGError("vgId:%d, msg:%p failed to process since restore not finished", vgId, pMsg); + vGError("vgId:%d, msg:%p failed to process since restore not finished, type:%s", vgId, pMsg, TMSG_INFO(pMsg->msgType)); vnodeHandleProposeError(pVnode, pMsg, TSDB_CODE_SYN_RESTORING); rpcFreeCont(pMsg->pCont); taosFreeQitem(pMsg); @@ -635,7 +635,7 @@ int32_t vnodeSyncStart(SVnode *pVnode) { } void vnodeSyncPreClose(SVnode *pVnode) { - vInfo("vgId:%d, pre close sync", pVnode->config.vgId); + vInfo("vgId:%d, sync pre close", pVnode->config.vgId); syncLeaderTransfer(pVnode->sync); syncPreStop(pVnode->sync); @@ -649,7 +649,7 @@ void vnodeSyncPreClose(SVnode *pVnode) { } void vnodeSyncPostClose(SVnode *pVnode) { - vInfo("vgId:%d, post close sync", pVnode->config.vgId); + vInfo("vgId:%d, sync post close", pVnode->config.vgId); syncPostStop(pVnode->sync); } diff --git a/source/libs/CMakeLists.txt b/source/libs/CMakeLists.txt index 72459f4d35..e18be94ace 100644 --- a/source/libs/CMakeLists.txt +++ b/source/libs/CMakeLists.txt @@ -1,5 +1,4 @@ add_subdirectory(tdb) -add_subdirectory(cache) add_subdirectory(transport) add_subdirectory(wal) add_subdirectory(monitor) diff --git a/source/libs/cache/CMakeLists.txt b/source/libs/cache/CMakeLists.txt deleted file mode 100644 index dc631e5bfd..0000000000 --- a/source/libs/cache/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -aux_source_directory(src CACHE_SRC) -add_library(cache STATIC ${CACHE_SRC}) -target_include_directories( - cache - PUBLIC "${TD_SOURCE_DIR}/include/libs/cache" - PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" -) \ No newline at end of file diff --git a/source/libs/cache/inc/cacheDef.h b/source/libs/cache/inc/cacheDef.h deleted file mode 100644 index 2e0dbfcdb6..0000000000 --- a/source/libs/cache/inc/cacheDef.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * This program is free software: you can use, redistribute, and/or modify - * it under the terms of the GNU Affero General Public License, version 3 - * or later ("AGPL"), as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -#ifndef _TD_CACHE_DEF_H_ -#define _TD_CACHE_DEF_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif /*_TD_CACHE_DEF_H_*/ \ No newline at end of file diff --git a/source/libs/cache/src/cache.c b/source/libs/cache/src/cache.c deleted file mode 100644 index 6dea4a4e57..0000000000 --- a/source/libs/cache/src/cache.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * This program is free software: you can use, redistribute, and/or modify - * it under the terms of the GNU Affero General Public License, version 3 - * or later ("AGPL"), as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ \ No newline at end of file diff --git a/source/libs/cache/test/cacheTests.cpp b/source/libs/cache/test/cacheTests.cpp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index d939f7ea77..549ce6ae79 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -479,6 +479,8 @@ typedef struct SStreamScanInfo { SSDataBlock* pRecoverRes; SSDataBlock* pCreateTbRes; + int8_t igCheckUpdate; + int8_t igExpired; } SStreamScanInfo; typedef struct { @@ -869,8 +871,8 @@ int32_t releaseOutputBuf(SStreamState* pState, SWinKey* pKey, SResultRow* pResul int32_t saveOutputBuf(SStreamState* pState, SWinKey* pKey, SResultRow* pResult, int32_t resSize); void getNextIntervalWindow(SInterval* pInterval, STimeWindow* tw, int32_t order); int32_t qAppendTaskStopInfo(SExecTaskInfo* pTaskInfo, SExchangeOpStopInfo* pInfo); -int32_t getForwardStepsInBlock(int32_t numOfRows, __block_search_fn_t searchFn, TSKEY ekey, int32_t pos, - int32_t order, int64_t* pData); +int32_t getForwardStepsInBlock(int32_t numOfRows, __block_search_fn_t searchFn, TSKEY ekey, int32_t pos, int32_t order, + int64_t* pData); void appendCreateTableRow(SStreamState* pState, SExprSupp* pTableSup, SExprSupp* pTagSup, int64_t groupId, SSDataBlock* pSrcBlock, int32_t rowId, SSDataBlock* pDestBlock); @@ -878,8 +880,8 @@ SSDataBlock* buildCreateTableBlock(SExprSupp* tbName, SExprSupp* tag); SExprInfo* createExpr(SNodeList* pNodeList, int32_t* numOfExprs); void copyResultrowToDataBlock(SExprInfo* pExprInfo, int32_t numOfExprs, SResultRow* pRow, SqlFunctionCtx* pCtx, - SSDataBlock* pBlock, const int32_t* rowEntryOffset, SExecTaskInfo* pTaskInfo); -void doUpdateNumOfRows(SqlFunctionCtx* pCtx, SResultRow* pRow, int32_t numOfExprs, const int32_t* rowEntryOffset) ; + SSDataBlock* pBlock, const int32_t* rowEntryOffset, SExecTaskInfo* pTaskInfo); +void doUpdateNumOfRows(SqlFunctionCtx* pCtx, SResultRow* pRow, int32_t numOfExprs, const int32_t* rowEntryOffset); #ifdef __cplusplus } diff --git a/source/libs/executor/src/dataDeleter.c b/source/libs/executor/src/dataDeleter.c index a8051ea7c3..184b9e0148 100644 --- a/source/libs/executor/src/dataDeleter.c +++ b/source/libs/executor/src/dataDeleter.c @@ -62,8 +62,8 @@ static void toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* pInp pEntry->numOfCols = taosArrayGetSize(pInput->pData->pDataBlock); pEntry->dataLen = sizeof(SDeleterRes); -// ASSERT(1 == pEntry->numOfRows); -// ASSERT(3 == pEntry->numOfCols); + // ASSERT(1 == pEntry->numOfRows); + // ASSERT(3 == pEntry->numOfCols); pBuf->useSize = sizeof(SDataCacheEntry); @@ -142,7 +142,7 @@ static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput, taosFreeQitem(pBuf); return TSDB_CODE_OUT_OF_MEMORY; } - + toDataCacheEntry(pDeleter, pInput, pBuf); taosWriteQitem(pDeleter->pDataBlocks, pBuf); *pContinue = (DS_BUF_LOW == updateStatus(pDeleter) ? true : false); @@ -167,8 +167,10 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, bool* pQueryE SDataDeleterBuf* pBuf = NULL; taosReadQitem(pDeleter->pDataBlocks, (void**)&pBuf); - memcpy(&pDeleter->nextOutput, pBuf, sizeof(SDataDeleterBuf)); - taosFreeQitem(pBuf); + if (pBuf != NULL) { + memcpy(&pDeleter->nextOutput, pBuf, sizeof(SDataDeleterBuf)); + taosFreeQitem(pBuf); + } SDataCacheEntry* pEntry = (SDataCacheEntry*)pDeleter->nextOutput.pData; *pLen = pEntry->dataLen; @@ -256,7 +258,7 @@ int32_t createDataDeleter(SDataSinkManager* pManager, const SDataSinkNode* pData deleter->pDeleter = pDeleterNode; deleter->pSchema = pDataSink->pInputDataBlockDesc; - if(pParam == NULL) { + if (pParam == NULL) { code = TSDB_CODE_QRY_INVALID_INPUT; qError("invalid input param in creating data deleter, code%s", tstrerror(code)); goto _end; @@ -275,7 +277,7 @@ int32_t createDataDeleter(SDataSinkManager* pManager, const SDataSinkNode* pData *pHandle = deleter; return code; - _end: +_end: if (deleter != NULL) { destroyDataSinker((SDataSinkHandle*)deleter); taosMemoryFree(deleter); diff --git a/source/libs/executor/src/dataInserter.c b/source/libs/executor/src/dataInserter.c index f78e3c22e1..a823baa2ae 100644 --- a/source/libs/executor/src/dataInserter.c +++ b/source/libs/executor/src/dataInserter.c @@ -46,6 +46,7 @@ typedef struct SDataInserterHandle { uint64_t cachedSize; TdThreadMutex mutex; tsem_t ready; + bool explain; } SDataInserterHandle; typedef struct SSubmitRspParam { @@ -333,26 +334,28 @@ int32_t dataBlocksToSubmitReq(SDataInserterHandle* pInserter, void** pMsg, int32 static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput, bool* pContinue) { SDataInserterHandle* pInserter = (SDataInserterHandle*)pHandle; - taosArrayPush(pInserter->pDataBlocks, &pInput->pData); - void* pMsg = NULL; - int32_t msgLen = 0; - int32_t code = dataBlocksToSubmitReq(pInserter, &pMsg, &msgLen); - if (code) { - return code; - } + if (!pInserter->explain) { + taosArrayPush(pInserter->pDataBlocks, &pInput->pData); + void* pMsg = NULL; + int32_t msgLen = 0; + int32_t code = dataBlocksToSubmitReq(pInserter, &pMsg, &msgLen); + if (code) { + return code; + } - taosArrayClear(pInserter->pDataBlocks); + taosArrayClear(pInserter->pDataBlocks); - code = sendSubmitRequest(pInserter, pMsg, msgLen, pInserter->pParam->readHandle->pMsgCb->clientRpc, - &pInserter->pNode->epSet); - if (code) { - return code; - } + code = sendSubmitRequest(pInserter, pMsg, msgLen, pInserter->pParam->readHandle->pMsgCb->clientRpc, + &pInserter->pNode->epSet); + if (code) { + return code; + } - tsem_wait(&pInserter->ready); + tsem_wait(&pInserter->ready); - if (pInserter->submitRes.code) { - return pInserter->submitRes.code; + if (pInserter->submitRes.code) { + return pInserter->submitRes.code; + } } *pContinue = true; @@ -412,6 +415,7 @@ int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDat inserter->pParam = pParam; inserter->status = DS_BUF_EMPTY; inserter->queryEnd = false; + inserter->explain = pInserterNode->explain; int64_t suid = 0; int32_t code = diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 540b5e90f8..1add82bdc4 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -1670,12 +1670,18 @@ int32_t convertFillType(int32_t mode) { case FILL_MODE_NULL: type = TSDB_FILL_NULL; break; + case FILL_MODE_NULL_F: + type = TSDB_FILL_NULL_F; + break; case FILL_MODE_NEXT: type = TSDB_FILL_NEXT; break; case FILL_MODE_VALUE: type = TSDB_FILL_SET_VALUE; break; + case FILL_MODE_VALUE_F: + type = TSDB_FILL_SET_VALUE_F; + break; case FILL_MODE_LINEAR: type = TSDB_FILL_LINEAR; break; @@ -1824,28 +1830,30 @@ int32_t tableListAddTableInfo(STableListInfo* pTableList, uint64_t uid, uint64_t int32_t tableListGetGroupList(const STableListInfo* pTableList, int32_t ordinalGroupIndex, STableKeyInfo** pKeyInfo, int32_t* size) { - int32_t total = tableListGetOutputGroups(pTableList); - if (ordinalGroupIndex < 0 || ordinalGroupIndex >= total) { + int32_t totalGroups = tableListGetOutputGroups(pTableList); + int32_t numOfTables = tableListGetSize(pTableList); + + if (ordinalGroupIndex < 0 || ordinalGroupIndex >= totalGroups) { return TSDB_CODE_INVALID_PARA; } // here handle two special cases: // 1. only one group exists, and 2. one table exists for each group. - if (total == 1) { - *size = tableListGetSize(pTableList); + if (totalGroups == 1) { + *size = numOfTables; *pKeyInfo = (*size == 0) ? NULL : taosArrayGet(pTableList->pTableList, 0); return TSDB_CODE_SUCCESS; - } else if (total == tableListGetSize(pTableList)) { + } else if (totalGroups == numOfTables) { *size = 1; *pKeyInfo = taosArrayGet(pTableList->pTableList, ordinalGroupIndex); return TSDB_CODE_SUCCESS; } int32_t offset = pTableList->groupOffset[ordinalGroupIndex]; - if (ordinalGroupIndex < total - 1) { - *size = pTableList->groupOffset[offset + 1] - pTableList->groupOffset[offset]; + if (ordinalGroupIndex < totalGroups - 1) { + *size = pTableList->groupOffset[ordinalGroupIndex + 1] - offset; } else { - *size = total - pTableList->groupOffset[offset] - 1; + *size = numOfTables - offset; } *pKeyInfo = taosArrayGet(pTableList->pTableList, offset); diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c index 187c8f582a..41e4c990f8 100644 --- a/source/libs/executor/src/filloperator.c +++ b/source/libs/executor/src/filloperator.c @@ -140,7 +140,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) { while (1) { SSDataBlock* pBlock = pDownstream->fpSet.getNextFn(pDownstream); if (pBlock == NULL) { - if (pInfo->totalInputRows == 0) { + if (pInfo->totalInputRows == 0 && (pInfo->pFillInfo->type != TSDB_FILL_NULL_F && pInfo->pFillInfo->type != TSDB_FILL_SET_VALUE_F)) { setOperatorCompleted(pOperator); return NULL; } @@ -456,7 +456,8 @@ void* destroyStreamFillLinearInfo(SStreamFillLinearInfo* pFillLinear) { return NULL; } void* destroyStreamFillInfo(SStreamFillInfo* pFillInfo) { - if (pFillInfo->type == TSDB_FILL_SET_VALUE || pFillInfo->type == TSDB_FILL_NULL) { + if (pFillInfo->type == TSDB_FILL_SET_VALUE || pFillInfo->type == TSDB_FILL_SET_VALUE_F || + pFillInfo->type == TSDB_FILL_NULL || pFillInfo->type == TSDB_FILL_NULL_F) { taosMemoryFreeClear(pFillInfo->pResRow->pRowVal); taosMemoryFreeClear(pFillInfo->pResRow); } @@ -661,7 +662,9 @@ void setDeleteFillValueInfo(TSKEY start, TSKEY end, SStreamFillSupporter* pFillS pFillInfo->pos = FILL_POS_INVALID; switch (pFillInfo->type) { case TSDB_FILL_NULL: + case TSDB_FILL_NULL_F: case TSDB_FILL_SET_VALUE: + case TSDB_FILL_SET_VALUE_F: break; case TSDB_FILL_PREV: pFillInfo->pResRow = &pFillSup->prev; @@ -720,7 +723,9 @@ void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillS pFillInfo->pos = FILL_POS_INVALID; switch (pFillInfo->type) { case TSDB_FILL_NULL: - case TSDB_FILL_SET_VALUE: { + case TSDB_FILL_NULL_F: + case TSDB_FILL_SET_VALUE: + case TSDB_FILL_SET_VALUE_F: { if (pFillSup->prev.key == pFillInfo->preRowKey) { resetFillWindow(&pFillSup->prev); } @@ -1360,7 +1365,8 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* pFillInfo->pLinearInfo->winIndex = 0; pFillInfo->pResRow = NULL; - if (pFillSup->type == TSDB_FILL_SET_VALUE || pFillSup->type == TSDB_FILL_NULL) { + if (pFillSup->type == TSDB_FILL_SET_VALUE || pFillSup->type == TSDB_FILL_SET_VALUE_F + || pFillSup->type == TSDB_FILL_NULL || pFillSup->type == TSDB_FILL_NULL_F) { pFillInfo->pResRow = taosMemoryCalloc(1, sizeof(SResultRowData)); pFillInfo->pResRow->key = INT64_MIN; pFillInfo->pResRow->pRowVal = taosMemoryCalloc(1, pFillSup->rowSize); @@ -1405,7 +1411,7 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi goto _error; } - if (pInfo->pFillInfo->type == TSDB_FILL_SET_VALUE) { + if (pInfo->pFillInfo->type == TSDB_FILL_SET_VALUE || pInfo->pFillInfo->type == TSDB_FILL_SET_VALUE_F) { for (int32_t i = 0; i < pInfo->pFillSup->numOfAllCols; ++i) { SFillColInfo* pFillCol = pInfo->pFillSup->pAllColInfo + i; int32_t slotId = GET_DEST_SLOT_ID(pFillCol); @@ -1427,7 +1433,7 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi pCell->isNull = true; } } - } else if (pInfo->pFillInfo->type == TSDB_FILL_NULL) { + } else if (pInfo->pFillInfo->type == TSDB_FILL_NULL || pInfo->pFillInfo->type == TSDB_FILL_NULL_F) { for (int32_t i = 0; i < pInfo->pFillSup->numOfAllCols; ++i) { SFillColInfo* pFillCol = pInfo->pFillSup->pAllColInfo + i; int32_t slotId = GET_DEST_SLOT_ID(pFillCol); diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 9c8137db34..45f38a43e6 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -492,8 +492,8 @@ _error: static void doHashPartition(SOperatorInfo* pOperator, SSDataBlock* pBlock) { SPartitionOperatorInfo* pInfo = pOperator->info; - SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; - + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + for (int32_t j = 0; j < pBlock->info.rows; ++j) { recordNewGroupKeys(pInfo->pGroupCols, pInfo->pGroupColVals, pBlock, j); int32_t len = buildGroupKeys(pInfo->keyBuf, pInfo->pGroupColVals); @@ -690,8 +690,8 @@ static int compareDataGroupInfo(const void* group1, const void* group2) { static SSDataBlock* buildPartitionResult(SOperatorInfo* pOperator) { SPartitionOperatorInfo* pInfo = pOperator->info; - SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; - + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SDataGroupInfo* pGroupInfo = (pInfo->groupIndex != -1) ? taosArrayGet(pInfo->sortedGroupArray, pInfo->groupIndex) : NULL; if (pInfo->groupIndex == -1 || pInfo->pageIndex >= taosArrayGetSize(pGroupInfo->pPageList)) { @@ -713,7 +713,7 @@ static SSDataBlock* buildPartitionResult(SOperatorInfo* pOperator) { qError("failed to get buffer, code:%s, %s", tstrerror(terrno), GET_TASKID(pTaskInfo)); T_LONG_JMP(pTaskInfo->env, terrno); } - + blockDataEnsureCapacity(pInfo->binfo.pRes, pInfo->rowCapacity); blockDataFromBuf1(pInfo->binfo.pRes, page, pInfo->rowCapacity); @@ -829,6 +829,8 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition SPartitionOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SPartitionOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + pTaskInfo->code = terrno; goto _error; } @@ -841,6 +843,8 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition SExprInfo* pExprInfo1 = createExprInfo(pPartNode->pExprs, NULL, &num); int32_t code = initExprSupp(&pInfo->scalarSup, pExprInfo1, num); if (code != TSDB_CODE_SUCCESS) { + terrno = code; + pTaskInfo->code = terrno; goto _error; } } @@ -848,6 +852,8 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); pInfo->pGroupSet = taosHashInit(100, hashFn, false, HASH_NO_LOCK); if (pInfo->pGroupSet == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + pTaskInfo->code = terrno; goto _error; } @@ -866,6 +872,8 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition int32_t code = createDiskbasedBuf(&pInfo->pBuf, defaultPgsz, defaultBufsz, pTaskInfo->id.str, tsTempDir); if (code != TSDB_CODE_SUCCESS) { + terrno = code; + pTaskInfo->code = code; goto _error; } @@ -873,6 +881,8 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition pInfo->columnOffset = setupColumnOffset(pInfo->binfo.pRes, pInfo->rowCapacity); code = initGroupOptrInfo(&pInfo->pGroupColVals, &pInfo->groupKeyLen, &pInfo->keyBuf, pInfo->pGroupCols); if (code != TSDB_CODE_SUCCESS) { + terrno = code; + pTaskInfo->code = code; goto _error; } @@ -885,10 +895,15 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition createOperatorFpSet(optrDummyOpenFn, hashPartition, NULL, destroyPartitionOperatorInfo, optrDefaultBufFn, NULL); code = appendDownstream(pOperator, &downstream, 1); + if (code != TSDB_CODE_SUCCESS) { + terrno = code; + pTaskInfo->code = code; + goto _error; + } + return pOperator; _error: - pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY; if (pInfo != NULL) { destroyPartitionOperatorInfo(pInfo); } @@ -1138,7 +1153,7 @@ void initParDownStream(SOperatorInfo* downstream, SPartitionBySupporter* pParSup SStreamScanInfo* pScanInfo = downstream->info; pScanInfo->partitionSup = *pParSup; pScanInfo->pPartScalarSup = pExpr; - if (!pScanInfo->pUpdateInfo) { + if (!pScanInfo->igCheckUpdate && !pScanInfo->pUpdateInfo) { pScanInfo->pUpdateInfo = updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, 0); } } diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index f84871ea92..5a221a0fbd 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -190,6 +190,7 @@ static int32_t setInfoForNewGroup(SSDataBlock* pBlock, SLimitInfo* pLimitInfo, S return PROJECT_RETRIEVE_DONE; } +// todo refactor static int32_t doIngroupLimitOffset(SLimitInfo* pLimitInfo, uint64_t groupId, SSDataBlock* pBlock, SOperatorInfo* pOperator) { // set current group id diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 121d47692c..7d05b9c66d 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -312,8 +312,8 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanBase* pTableSca tsdbReleaseDataBlock(pTableScanInfo->dataReader); return TSDB_CODE_SUCCESS; } else if (*status == FUNC_DATA_REQUIRED_NOT_LOAD) { - qDebug("%s data block skipped, brange:%" PRId64 "-%" PRId64 ", rows:%d", GET_TASKID(pTaskInfo), - pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows); + qDebug("%s data block skipped, brange:%" PRId64 "-%" PRId64 ", rows:%d, uid:%" PRIu64, GET_TASKID(pTaskInfo), + pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows, pBlockInfo->id.uid); doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo, 1); pCost->skipBlocks += 1; tsdbReleaseDataBlock(pTableScanInfo->dataReader); @@ -399,7 +399,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanBase* pTableSca } bool limitReached = applyLimitOffset(&pTableScanInfo->limitInfo, pBlock, pTaskInfo); - if (limitReached) { // set operator flag is done + if (limitReached) { // set operator flag is done setOperatorCompleted(pOperator); } @@ -450,6 +450,15 @@ static STableCachedVal* createTableCacheVal(const SMetaReader* pMetaReader) { // const void *key, size_t keyLen, void *value static void freeCachedMetaItem(const void* key, size_t keyLen, void* value) { freeTableCachedVal(value); } +static void doSetNullValue(SSDataBlock* pBlock, const SExprInfo* pExpr, int32_t numOfExpr) { + for (int32_t j = 0; j < numOfExpr; ++j) { + int32_t dstSlotId = pExpr[j].base.resSchema.slotId; + + SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, dstSlotId); + colDataAppendNNULL(pColInfoData, 0, pBlock->info.rows); + } +} + int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int32_t numOfExpr, SSDataBlock* pBlock, int32_t rows, const char* idStr, STableMetaCacheInfo* pCache) { // currently only the tbname pseudo column @@ -469,14 +478,21 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int SMetaReader mr = {0}; LRUHandle* h = NULL; + // todo refactor: extract method + // the handling of the null data should be packed in the extracted method + // 1. check if it is existed in meta cache if (pCache == NULL) { metaReaderInit(&mr, pHandle->meta, 0); code = metaGetTableEntryByUidCache(&mr, pBlock->info.id.uid); if (code != TSDB_CODE_SUCCESS) { + // when encounter the TSDB_CODE_PAR_TABLE_NOT_EXIST error, we proceed. if (terrno == TSDB_CODE_PAR_TABLE_NOT_EXIST) { qWarn("failed to get table meta, table may have been dropped, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.id.uid, tstrerror(terrno), idStr); + + // append null value before return to caller, since the caller will ignore this error code and proceed + doSetNullValue(pBlock, pExpr, numOfExpr); } else { qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.id.uid, tstrerror(terrno), idStr); @@ -502,6 +518,8 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int if (terrno == TSDB_CODE_PAR_TABLE_NOT_EXIST) { qWarn("failed to get table meta, table may have been dropped, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.id.uid, tstrerror(terrno), idStr); + // append null value before return to caller, since the caller will ignore this error code and proceed + doSetNullValue(pBlock, pExpr, numOfExpr); } else { qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.id.uid, tstrerror(terrno), idStr); @@ -618,9 +636,15 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) { while (tsdbNextDataBlock(pTableScanInfo->base.dataReader)) { if (isTaskKilled(pTaskInfo)) { + tsdbReleaseDataBlock(pTableScanInfo->base.dataReader); T_LONG_JMP(pTaskInfo->env, pTaskInfo->code); } + if (pOperator->status == OP_EXEC_DONE) { + tsdbReleaseDataBlock(pTableScanInfo->base.dataReader); + break; + } + // process this data block based on the probabilities bool processThisBlock = processBlockWithProbability(&pTableScanInfo->sample); if (!processThisBlock) { @@ -632,9 +656,8 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) { uint32_t status = 0; int32_t code = loadDataBlock(pOperator, &pTableScanInfo->base, pBlock, &status); - // int32_t code = loadDataBlockOnDemand(pOperator->pRuntimeEnv, pTableScanInfo, pBlock, &status); if (code != TSDB_CODE_SUCCESS) { - T_LONG_JMP(pOperator->pTaskInfo->env, code); + T_LONG_JMP(pTaskInfo->env, code); } // current block is filter out according to filter condition, continue load the next block @@ -1410,7 +1433,12 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock dumyInfo.cur.pageId = -1; bool isClosed = false; STimeWindow win = {.skey = INT64_MIN, .ekey = INT64_MAX}; - if (tableInserted && isOverdue(tsCol[rowId], &pInfo->twAggSup)) { + bool overDue = isOverdue(tsCol[rowId], &pInfo->twAggSup); + if (pInfo->igExpired && overDue) { + continue; + } + + if (tableInserted && overDue) { win = getActiveTimeWindow(NULL, &dumyInfo, tsCol[rowId], &pInfo->interval, TSDB_ORDER_ASC); isClosed = isCloseWindow(&win, &pInfo->twAggSup); } @@ -2022,6 +2050,7 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) { if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__SNAPSHOT_DATA) { if (pInfo->dataReader && tsdbNextDataBlock(pInfo->dataReader)) { if (isTaskKilled(pTaskInfo)) { + tsdbReleaseDataBlock(pInfo->dataReader); longjmp(pTaskInfo->env, pTaskInfo->code); } @@ -2343,6 +2372,9 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys pInfo->pUpdateDataRes = createSpecialDataBlock(STREAM_CLEAR); pInfo->assignBlockUid = pTableScanNode->assignBlockUid; pInfo->partitionSup.needCalc = false; + pInfo->igCheckUpdate = pTableScanNode->igCheckUpdate; + pInfo->igExpired = pTableScanNode->igExpired; + pInfo->twAggSup.maxTs = INT64_MIN; setOperatorInfo(pOperator, "StreamScanOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN, false, OP_NOT_OPENED, pInfo, pTaskInfo); @@ -2523,6 +2555,7 @@ static SSDataBlock* getTableDataBlockImpl(void* param) { qTrace("tsdb/read-table-data: %p, enter next reader", reader); while (tsdbNextDataBlock(reader)) { if (isTaskKilled(pTaskInfo)) { + tsdbReleaseDataBlock(reader); T_LONG_JMP(pTaskInfo->env, pTaskInfo->code); } @@ -2539,7 +2572,7 @@ static SSDataBlock* getTableDataBlockImpl(void* param) { } uint32_t status = 0; - loadDataBlock(pOperator, &pInfo->base, pBlock, &status); + code = loadDataBlock(pOperator, &pInfo->base, pBlock, &status); // code = loadDataBlockFromOneTable(pOperator, pTableScanInfo, pBlock, &status); if (code != TSDB_CODE_SUCCESS) { T_LONG_JMP(pTaskInfo->env, code); @@ -2714,10 +2747,13 @@ SSDataBlock* getSortedTableMergeScanBlockData(SSortHandle* pHandle, SSDataBlock* } } - applyLimitOffset(&pInfo->limitInfo, pResBlock, pTaskInfo); - qDebug("%s get sorted row block, rows:%d, limit:%"PRId64, GET_TASKID(pTaskInfo), pResBlock->info.rows, - pInfo->limitInfo.numOfOutputRows); + bool limitReached = applyLimitOffset(&pInfo->limitInfo, pResBlock, pTaskInfo); + qDebug("%s get sorted row block, rows:%d, limit:%" PRId64, GET_TASKID(pTaskInfo), pResBlock->info.rows, + pInfo->limitInfo.numOfOutputRows); + if (limitReached) { + resetLimitInfoForNextGroup(&pInfo->limitInfo); + } return (pResBlock->info.rows > 0) ? pResBlock : NULL; } diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c index 2b78f265fb..7b226a0391 100644 --- a/source/libs/executor/src/sysscanoperator.c +++ b/source/libs/executor/src/sysscanoperator.c @@ -65,8 +65,8 @@ typedef struct SSysTableScanInfo { SSDataBlock* pRes; int64_t numOfBlocks; // extract basic running information. SLoadRemoteDataInfo loadInfo; - - int32_t tbnameSlotId; + SLimitInfo limitInfo; + int32_t tbnameSlotId; } SSysTableScanInfo; typedef struct { @@ -355,9 +355,11 @@ static int32_t optSysMergeRslt(SArray* mRslt, SArray* rslt); static SSDataBlock* sysTableScanFromMNode(SOperatorInfo* pOperator, SSysTableScanInfo* pInfo, const char* name, SExecTaskInfo* pTaskInfo); void extractTbnameSlotId(SSysTableScanInfo* pInfo, const SScanPhysiNode* pScanNode); -static SSDataBlock* sysTableScanFillTbName(SOperatorInfo* pOperator, const SSysTableScanInfo* pInfo, const char* name, - SSDataBlock* pBlock); -__optSysFilter optSysGetFilterFunc(int32_t ctype, bool* reverse) { + +static void sysTableScanFillTbName(SOperatorInfo* pOperator, const SSysTableScanInfo* pInfo, const char* name, + SSDataBlock* pBlock); + +__optSysFilter optSysGetFilterFunc(int32_t ctype, bool* reverse) { if (ctype == OP_TYPE_LOWER_EQUAL || ctype == OP_TYPE_LOWER_THAN) { *reverse = true; } @@ -731,7 +733,7 @@ void relocateAndFilterSysTagsScanResult(SSysTableScanInfo* pInfo, int32_t numOfR pInfo->pRes->info.rows = numOfRows; relocateColumnData(pInfo->pRes, pInfo->matchInfo.pList, dataBlock->pDataBlock, false); - doFilterResult(pInfo->pRes, pFilterInfo); + doFilter(pInfo->pRes, pFilterInfo, NULL); blockDataCleanup(dataBlock); } @@ -1210,7 +1212,7 @@ static SSDataBlock* sysTableBuildUserTablesByUids(SOperatorInfo* pOperator) { pInfo->pRes->info.rows = numOfRows; relocateColumnData(pInfo->pRes, pInfo->matchInfo.pList, p->pDataBlock, false); - doFilterResult(pInfo->pRes, pOperator->exprSupp.pFilterInfo); + doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL); blockDataCleanup(p); numOfRows = 0; @@ -1226,7 +1228,7 @@ static SSDataBlock* sysTableBuildUserTablesByUids(SOperatorInfo* pOperator) { pInfo->pRes->info.rows = numOfRows; relocateColumnData(pInfo->pRes, pInfo->matchInfo.pList, p->pDataBlock, false); - doFilterResult(pInfo->pRes, pOperator->exprSupp.pFilterInfo); + doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL); blockDataCleanup(p); numOfRows = 0; @@ -1387,7 +1389,7 @@ static SSDataBlock* sysTableBuildUserTables(SOperatorInfo* pOperator) { pInfo->pRes->info.rows = numOfRows; relocateColumnData(pInfo->pRes, pInfo->matchInfo.pList, p->pDataBlock, false); - doFilterResult(pInfo->pRes, pOperator->exprSupp.pFilterInfo); + doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL); blockDataCleanup(p); numOfRows = 0; @@ -1403,7 +1405,7 @@ static SSDataBlock* sysTableBuildUserTables(SOperatorInfo* pOperator) { pInfo->pRes->info.rows = numOfRows; relocateColumnData(pInfo->pRes, pInfo->matchInfo.pList, p->pDataBlock, false); - doFilterResult(pInfo->pRes, pOperator->exprSupp.pFilterInfo); + doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL); blockDataCleanup(p); numOfRows = 0; @@ -1434,7 +1436,7 @@ static SSDataBlock* sysTableScanUserTables(SOperatorInfo* pOperator) { // the retrieve is executed on the mnode, so return tables that belongs to the information schema database. if (pInfo->readHandle.mnd != NULL) { buildSysDbTableInfo(pInfo, pOperator->resultInfo.capacity); - doFilterResult(pInfo->pRes, pOperator->exprSupp.pFilterInfo); + doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL); pInfo->loadInfo.totalRows += pInfo->pRes->info.rows; setOperatorCompleted(pOperator); @@ -1578,30 +1580,37 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) { pBlock = sysTableScanFromMNode(pOperator, pInfo, name, pTaskInfo); } - return sysTableScanFillTbName(pOperator, pInfo, name, pBlock); -} - -static SSDataBlock* sysTableScanFillTbName(SOperatorInfo* pOperator, const SSysTableScanInfo* pInfo, const char* name, - SSDataBlock* pBlock) { + sysTableScanFillTbName(pOperator, pInfo, name, pBlock); if (pBlock != NULL) { - if (pInfo->tbnameSlotId != -1) { - SColumnInfoData* pColumnInfoData = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, pInfo->tbnameSlotId); - char varTbName[TSDB_TABLE_FNAME_LEN - 1 + VARSTR_HEADER_SIZE] = {0}; - memcpy(varDataVal(varTbName), name, strlen(name)); - varDataSetLen(varTbName, strlen(name)); - for (int i = 0; i < pBlock->info.rows; ++i) { - colDataAppend(pColumnInfoData, i, varTbName, NULL); - } - doFilterResult(pBlock, pOperator->exprSupp.pFilterInfo); + bool limitReached = applyLimitOffset(&pInfo->limitInfo, pBlock, pTaskInfo); + if (limitReached) { + setOperatorCompleted(pOperator); } - } - if (pBlock && pBlock->info.rows != 0) { - return pBlock; + + return pBlock->info.rows > 0 ? pBlock : NULL; } else { return NULL; } } +static void sysTableScanFillTbName(SOperatorInfo* pOperator, const SSysTableScanInfo* pInfo, const char* name, + SSDataBlock* pBlock) { + if (pBlock == NULL) { + return; + } + + if (pInfo->tbnameSlotId != -1) { + SColumnInfoData* pColumnInfoData = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, pInfo->tbnameSlotId); + char varTbName[TSDB_TABLE_FNAME_LEN - 1 + VARSTR_HEADER_SIZE] = {0}; + memcpy(varDataVal(varTbName), name, strlen(name)); + varDataSetLen(varTbName, strlen(name)); + + colDataAppendNItems(pColumnInfoData, 0, varTbName, pBlock->info.rows); + } + + doFilter(pBlock, pOperator->exprSupp.pFilterInfo, NULL); +} + static SSDataBlock* sysTableScanFromMNode(SOperatorInfo* pOperator, SSysTableScanInfo* pInfo, const char* name, SExecTaskInfo* pTaskInfo) { if (pOperator->status == OP_EXEC_DONE) { @@ -1665,7 +1674,7 @@ static SSDataBlock* sysTableScanFromMNode(SOperatorInfo* pOperator, SSysTableSca updateLoadRemoteInfo(&pInfo->loadInfo, pRsp->numOfRows, pRsp->compLen, startTs, pOperator); // todo log the filter info - doFilterResult(pInfo->pRes, pOperator->exprSupp.pFilterInfo); + doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL); taosMemoryFree(pRsp); if (pInfo->pRes->info.rows > 0) { return pInfo->pRes; @@ -1700,13 +1709,13 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* readHandle, SSystemTableScan pInfo->sysInfo = pScanPhyNode->sysInfo; pInfo->showRewrite = pScanPhyNode->showRewrite; pInfo->pRes = createDataBlockFromDescNode(pDescNode); - pInfo->pCondition = pScanNode->node.pConditions; code = filterInitFromNode(pScanNode->node.pConditions, &pOperator->exprSupp.pFilterInfo, 0); if (code != TSDB_CODE_SUCCESS) { goto _error; } + initLimitInfo(pScanPhyNode->scan.node.pLimit, pScanPhyNode->scan.node.pSlimit, &pInfo->limitInfo); initResultSizeInfo(&pOperator->resultInfo, 4096); blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity); @@ -1801,15 +1810,6 @@ int32_t loadSysTableCallback(void* param, SDataBuf* pMsg, int32_t code) { return TSDB_CODE_SUCCESS; } -SSDataBlock* doFilterResult(SSDataBlock* pDataBlock, SFilterInfo* pFilterInfo) { - if (pFilterInfo == NULL) { - return pDataBlock->info.rows == 0 ? NULL : pDataBlock; - } - - doFilter(pDataBlock, pFilterInfo, NULL); - return pDataBlock->info.rows == 0 ? NULL : pDataBlock; -} - static int32_t sysChkFilter__Comm(SNode* pNode) { // impl SOperatorNode* pOper = (SOperatorNode*)pNode; diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index 2d921d43d3..778281f9b4 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -186,7 +186,7 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* } } } - } else if (pFillInfo->type == TSDB_FILL_NULL) { // fill with NULL + } else if (pFillInfo->type == TSDB_FILL_NULL || pFillInfo->type == TSDB_FILL_NULL_F) { // fill with NULL setNullRow(pBlock, pFillInfo, index); } else { // fill with user specified value for each column for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) { @@ -349,7 +349,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t bool isNull = colDataIsNull_s(pSrc, pFillInfo->index); colDataAppend(pDst, index, src, isNull); saveColData(pFillInfo->prev.pRowVal, i, src, isNull); // todo: - } else if (pFillInfo->type == TSDB_FILL_NULL) { + } else if (pFillInfo->type == TSDB_FILL_NULL || pFillInfo->type == TSDB_FILL_NULL_F) { colDataAppendNULL(pDst, index); } else if (pFillInfo->type == TSDB_FILL_NEXT) { SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->next.pRowVal : pFillInfo->prev.pRowVal; @@ -447,32 +447,6 @@ struct SFillInfo* taosCreateFillInfo(TSKEY skey, int32_t numOfFillCols, int32_t taosResetFillInfo(pFillInfo, skey); - switch (fillType) { - case FILL_MODE_NONE: - pFillInfo->type = TSDB_FILL_NONE; - break; - case FILL_MODE_PREV: - pFillInfo->type = TSDB_FILL_PREV; - break; - case FILL_MODE_NULL: - pFillInfo->type = TSDB_FILL_NULL; - break; - case FILL_MODE_LINEAR: - pFillInfo->type = TSDB_FILL_LINEAR; - break; - case FILL_MODE_NEXT: - pFillInfo->type = TSDB_FILL_NEXT; - break; - case FILL_MODE_VALUE: - pFillInfo->type = TSDB_FILL_SET_VALUE; - break; - default: { - taosMemoryFree(pFillInfo); - terrno = TSDB_CODE_INVALID_PARA; - return NULL; - } - } - pFillInfo->type = fillType; pFillInfo->pFillCol = pCol; pFillInfo->numOfCols = numOfFillCols + numOfNotFillCols; @@ -572,15 +546,14 @@ bool taosFillHasMoreResults(SFillInfo* pFillInfo) { } int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, TSKEY ekey, int32_t maxNumOfRows) { - SColumnInfoData* pCol = taosArrayGet(pFillInfo->pSrcBlock->pDataBlock, pFillInfo->srcTsSlotId); - - int64_t* tsList = (int64_t*)pCol->pData; int32_t numOfRows = taosNumOfRemainRows(pFillInfo); TSKEY ekey1 = ekey; int64_t numOfRes = -1; if (numOfRows > 0) { // still fill gap within current data block, not generating data after the result set. + SColumnInfoData* pCol = taosArrayGet(pFillInfo->pSrcBlock->pDataBlock, pFillInfo->srcTsSlotId); + int64_t* tsList = (int64_t*)pCol->pData; TSKEY lastKey = tsList[pFillInfo->numOfRows - 1]; numOfRes = taosTimeCountInterval(lastKey, pFillInfo->currentKey, pFillInfo->interval.sliding, pFillInfo->interval.slidingUnit, pFillInfo->interval.precision); diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index 7cb49c8f54..bce8443353 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -185,12 +185,14 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp int32_t srcSlot = pExprInfo->base.pParam[0].pCol->slotId; switch (pSliceInfo->fillType) { - case TSDB_FILL_NULL: { + case TSDB_FILL_NULL: + case TSDB_FILL_NULL_F: { colDataAppendNULL(pDst, rows); break; } - case TSDB_FILL_SET_VALUE: { + case TSDB_FILL_SET_VALUE: + case TSDB_FILL_SET_VALUE_F: { SVariant* pVar = &pSliceInfo->pFillColInfo[j].fillVal; if (pDst->info.type == TSDB_DATA_TYPE_FLOAT) { diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 38108dcff6..1b9767f193 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1692,7 +1692,7 @@ void initIntervalDownStream(SOperatorInfo* downstream, uint16_t type, SAggSuppor SStreamScanInfo* pScanInfo = downstream->info; pScanInfo->windowSup.parentType = type; pScanInfo->windowSup.pIntervalAggSup = pSup; - if (!pScanInfo->pUpdateInfo) { + if (!pScanInfo->igCheckUpdate && !pScanInfo->pUpdateInfo) { pScanInfo->pUpdateInfo = updateInfoInitP(pInterval, pTwSup->waterMark); } pScanInfo->interval = *pInterval; @@ -2869,7 +2869,7 @@ void initDownStream(SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, uin } SStreamScanInfo* pScanInfo = downstream->info; pScanInfo->windowSup = (SWindowSupporter){.pStreamAggSup = pAggSup, .gap = pAggSup->gap, .parentType = type}; - if (!pScanInfo->pUpdateInfo) { + if (!pScanInfo->igCheckUpdate && !pScanInfo->pUpdateInfo) { pScanInfo->pUpdateInfo = updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, pTwSup->waterMark); } pScanInfo->twAggSup = *pTwSup; diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c index 661e9f97b7..90f20f40b8 100644 --- a/source/libs/executor/src/tsort.c +++ b/source/libs/executor/src/tsort.c @@ -190,8 +190,9 @@ static int32_t doAddToBuf(SSDataBlock* pDataBlock, SSortHandle* pHandle) { qError("Add to buf failed since %s", terrstr(terrno)); return terrno; } + int32_t code = createDiskbasedBuf(&pHandle->pBuf, pHandle->pageSize, pHandle->numOfPages * pHandle->pageSize, - "doAddToBuf", tsTempDir); + "sortExternalBuf", tsTempDir); dBufSetPrintInfo(pHandle->pBuf); if (code != TSDB_CODE_SUCCESS) { return code; @@ -635,6 +636,7 @@ int32_t getProperSortPageSize(size_t rowSize, uint32_t numOfCols) { static int32_t createInitialSources(SSortHandle* pHandle) { size_t sortBufSize = pHandle->numOfPages * pHandle->pageSize; + int32_t code = 0; if (pHandle->type == SORT_SINGLESOURCE_SORT) { SSortSource** pSource = taosArrayGet(pHandle->pOrderedSource, 0); @@ -663,8 +665,8 @@ static int32_t createInitialSources(SSortHandle* pHandle) { pHandle->beforeFp(pBlock, pHandle->param); } - int32_t code = blockDataMerge(pHandle->pDataBlock, pBlock); - if (code != 0) { + code = blockDataMerge(pHandle->pDataBlock, pBlock); + if (code != TSDB_CODE_SUCCESS) { if (source->param && !source->onlyRef) { taosMemoryFree(source->param); } @@ -689,6 +691,7 @@ static int32_t createInitialSources(SSortHandle* pHandle) { blockDataDestroy(source->src.pBlock); source->src.pBlock = NULL; } + taosMemoryFree(source); return code; } @@ -696,13 +699,17 @@ static int32_t createInitialSources(SSortHandle* pHandle) { int64_t el = taosGetTimestampUs() - p; pHandle->sortElapsed += el; - doAddToBuf(pHandle->pDataBlock, pHandle); + code = doAddToBuf(pHandle->pDataBlock, pHandle); + if (code != TSDB_CODE_SUCCESS) { + return code; + } } } if (source->param && !source->onlyRef) { taosMemoryFree(source->param); } + taosMemoryFree(source); if (pHandle->pDataBlock != NULL && pHandle->pDataBlock->info.rows > 0) { @@ -711,7 +718,7 @@ static int32_t createInitialSources(SSortHandle* pHandle) { // Perform the in-memory sort and then flush data in the buffer into disk. int64_t p = taosGetTimestampUs(); - int32_t code = blockDataSort(pHandle->pDataBlock, pHandle->pSortInfo); + code = blockDataSort(pHandle->pDataBlock, pHandle->pSortInfo); if (code != 0) { return code; } @@ -729,12 +736,12 @@ static int32_t createInitialSources(SSortHandle* pHandle) { pHandle->tupleHandle.pBlock = pHandle->pDataBlock; return 0; } else { - doAddToBuf(pHandle->pDataBlock, pHandle); + code = doAddToBuf(pHandle->pDataBlock, pHandle); } } } - return TSDB_CODE_SUCCESS; + return code; } int32_t tsortOpen(SSortHandle* pHandle) { diff --git a/source/libs/function/src/detail/tminmax.c b/source/libs/function/src/detail/tminmax.c index 847c738655..a511ca97f1 100644 --- a/source/libs/function/src/detail/tminmax.c +++ b/source/libs/function/src/detail/tminmax.c @@ -714,26 +714,18 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems) pBuf->type = type; if (IS_NULL_TYPE(type)) { - numOfElems = 0; goto _over; } // data in current data block are qualified to the query if (pInput->colDataSMAIsSet) { numOfElems = pInput->numOfRows - pAgg->numOfNull; - if (numOfElems == 0) { goto _over; } - void* tval = NULL; int16_t index = 0; - - if (isMinFunc) { - tval = &pInput->pColumnDataAgg[0]->min; - } else { - tval = &pInput->pColumnDataAgg[0]->max; - } + void* tval = (isMinFunc) ? &pInput->pColumnDataAgg[0]->min : &pInput->pColumnDataAgg[0]->max; if (!pBuf->assign) { if (type == TSDB_DATA_TYPE_FLOAT) { @@ -824,8 +816,9 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems) } } + numOfElems = 1; pBuf->assign = true; - return TSDB_CODE_SUCCESS; + goto _over; } int32_t start = pInput->startRowIndex; diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index 6ab91a4483..e3127fcd7b 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -262,6 +262,13 @@ bool fmIsGroupKeyFunc(int32_t funcId) { return FUNCTION_TYPE_GROUP_KEY == funcMgtBuiltins[funcId].type; } +bool fmIsBlockDistFunc(int32_t funcId) { + if (funcId < 0 || funcId >= funcMgtBuiltinsNum) { + return false; + } + return FUNCTION_TYPE_BLOCK_DIST == funcMgtBuiltins[funcId].type; +} + void fmFuncMgtDestroy() { void* m = gFunMgtService.pFuncNameHashTable; if (m != NULL && atomic_val_compare_exchange_ptr((void**)&gFunMgtService.pFuncNameHashTable, m, 0) == m) { diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 12041bd2ae..185f4428f2 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -387,6 +387,7 @@ static int32_t logicScanCopy(const SScanLogicNode* pSrc, SScanLogicNode* pDst) { COPY_SCALAR_FIELD(watermark); COPY_SCALAR_FIELD(deleteMark); COPY_SCALAR_FIELD(igExpired); + COPY_SCALAR_FIELD(igCheckUpdate); CLONE_NODE_LIST_FIELD(pGroupTags); COPY_SCALAR_FIELD(groupSort); CLONE_NODE_LIST_FIELD(pTags); @@ -476,6 +477,7 @@ static int32_t logicWindowCopy(const SWindowLogicNode* pSrc, SWindowLogicNode* p COPY_SCALAR_FIELD(watermark); COPY_SCALAR_FIELD(deleteMark); COPY_SCALAR_FIELD(igExpired); + COPY_SCALAR_FIELD(igCheckUpdate); COPY_SCALAR_FIELD(windowAlgo); COPY_SCALAR_FIELD(inputTsOrder); COPY_SCALAR_FIELD(outputTsOrder); diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index d9b3237993..099cd0d3b3 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -165,6 +165,8 @@ const char* nodesNodeName(ENodeType type) { return "ExplainStmt"; case QUERY_NODE_DESCRIBE_STMT: return "DescribeStmt"; + case QUERY_NODE_COMPACT_DATABASE_STMT: + return "CompactDatabaseStmt"; case QUERY_NODE_CREATE_STREAM_STMT: return "CreateStreamStmt"; case QUERY_NODE_DROP_STREAM_STMT: @@ -176,7 +178,7 @@ const char* nodesNodeName(ENodeType type) { case QUERY_NODE_SHOW_DB_ALIVE_STMT: return "ShowDbAliveStmt"; case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT: - return "ShowClusterAliveStmt"; + return "ShowClusterAliveStmt"; case QUERY_NODE_REDISTRIBUTE_VGROUP_STMT: return "RedistributeVgroupStmt"; case QUERY_NODE_SPLIT_VGROUP_STMT: @@ -1642,6 +1644,7 @@ static const char* jkTableScanPhysiPlanGroupSort = "GroupSort"; static const char* jkTableScanPhysiPlanTags = "Tags"; static const char* jkTableScanPhysiPlanSubtable = "Subtable"; static const char* jkTableScanPhysiPlanAssignBlockUid = "AssignBlockUid"; +static const char* jkTableScanPhysiPlanIgnoreUpdate = "IgnoreUpdate"; static int32_t physiTableScanNodeToJson(const void* pObj, SJson* pJson) { const STableScanPhysiNode* pNode = (const STableScanPhysiNode*)pObj; @@ -1707,6 +1710,9 @@ static int32_t physiTableScanNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddBoolToObject(pJson, jkTableScanPhysiPlanAssignBlockUid, pNode->assignBlockUid); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkTableScanPhysiPlanIgnoreUpdate, pNode->igCheckUpdate); + } return code; } @@ -1775,6 +1781,9 @@ static int32_t jsonToPhysiTableScanNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBoolValue(pJson, jkTableScanPhysiPlanAssignBlockUid, &pNode->assignBlockUid); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanIgnoreUpdate, &pNode->igCheckUpdate); + } return code; } @@ -2595,6 +2604,7 @@ static const char* jkQueryInsertPhysiPlanTableType = "TableType"; static const char* jkQueryInsertPhysiPlanTableFName = "TableFName"; static const char* jkQueryInsertPhysiPlanVgId = "VgId"; static const char* jkQueryInsertPhysiPlanEpSet = "EpSet"; +static const char* jkQueryInsertPhysiPlanExplain = "Explain"; static int32_t physiQueryInsertNodeToJson(const void* pObj, SJson* pJson) { const SQueryInserterNode* pNode = (const SQueryInserterNode*)pObj; @@ -2621,6 +2631,9 @@ static int32_t physiQueryInsertNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddObject(pJson, jkQueryInsertPhysiPlanEpSet, epSetToJson, &pNode->epSet); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddBoolToObject(pJson, jkQueryInsertPhysiPlanExplain, pNode->explain); + } return code; } @@ -2650,6 +2663,9 @@ static int32_t jsonToPhysiQueryInsertNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonToObject(pJson, jkQueryInsertPhysiPlanEpSet, jsonToEpSet, &pNode->epSet); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetBoolValue(pJson, jkQueryInsertPhysiPlanExplain, &pNode->explain); + } return code; } @@ -5686,6 +5702,18 @@ static int32_t jsonToDescribeStmt(const SJson* pJson, void* pObj) { return code; } +static const char* jkCompactDatabaseStmtDbName = "DbName"; + +static int32_t compactDatabaseStmtToJson(const void* pObj, SJson* pJson) { + const SCompactDatabaseStmt* pNode = (const SCompactDatabaseStmt*)pObj; + return tjsonAddStringToObject(pJson, jkCompactDatabaseStmtDbName, pNode->dbName); +} + +static int32_t jsonToCompactDatabaseStmt(const SJson* pJson, void* pObj) { + SCompactDatabaseStmt* pNode = (SCompactDatabaseStmt*)pObj; + return tjsonGetStringValue(pJson, jkCompactDatabaseStmtDbName, pNode->dbName); +} + static const char* jkCreateStreamStmtStreamName = "StreamName"; static const char* jkCreateStreamStmtTargetDbName = "TargetDbName"; static const char* jkCreateStreamStmtTargetTabName = "TargetTabName"; @@ -6397,6 +6425,8 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) { return explainStmtToJson(pObj, pJson); case QUERY_NODE_DESCRIBE_STMT: return describeStmtToJson(pObj, pJson); + case QUERY_NODE_COMPACT_DATABASE_STMT: + return compactDatabaseStmtToJson(pObj, pJson); case QUERY_NODE_CREATE_STREAM_STMT: return createStreamStmtToJson(pObj, pJson); case QUERY_NODE_DROP_STREAM_STMT: @@ -6703,6 +6733,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) { return jsonToExplainStmt(pJson, pObj); case QUERY_NODE_DESCRIBE_STMT: return jsonToDescribeStmt(pJson, pObj); + case QUERY_NODE_COMPACT_DATABASE_STMT: + return jsonToCompactDatabaseStmt(pJson, pObj); case QUERY_NODE_CREATE_STREAM_STMT: return jsonToCreateStreamStmt(pJson, pObj); case QUERY_NODE_DROP_STREAM_STMT: diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c index a4b77fad69..e94b2bba6c 100644 --- a/source/libs/nodes/src/nodesMsgFuncs.c +++ b/source/libs/nodes/src/nodesMsgFuncs.c @@ -2078,6 +2078,9 @@ static int32_t physiTableScanNodeInlineToMsg(const void* pObj, STlvEncoder* pEnc if (TSDB_CODE_SUCCESS == code) { code = tlvEncodeValueBool(pEncoder, pNode->assignBlockUid); } + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeValueI8(pEncoder, pNode->igCheckUpdate); + } return code; } @@ -2154,6 +2157,9 @@ static int32_t msgToPhysiTableScanNodeInline(STlvDecoder* pDecoder, void* pObj) if (TSDB_CODE_SUCCESS == code) { code = tlvDecodeValueBool(pDecoder, &pNode->assignBlockUid); } + if (TSDB_CODE_SUCCESS == code) { + code = tlvDecodeValueI8(pDecoder, &pNode->igCheckUpdate); + } return code; } @@ -3244,7 +3250,8 @@ enum { PHY_QUERY_INSERT_CODE_TABLE_TYPE, PHY_QUERY_INSERT_CODE_TABLE_NAME, PHY_QUERY_INSERT_CODE_VG_ID, - PHY_QUERY_INSERT_CODE_EP_SET + PHY_QUERY_INSERT_CODE_EP_SET, + PHY_QUERY_INSERT_CODE_EXPLAIN }; static int32_t physiQueryInsertNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { @@ -3272,6 +3279,9 @@ static int32_t physiQueryInsertNodeToMsg(const void* pObj, STlvEncoder* pEncoder if (TSDB_CODE_SUCCESS == code) { code = tlvEncodeObj(pEncoder, PHY_QUERY_INSERT_CODE_EP_SET, epSetToMsg, &pNode->epSet); } + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeBool(pEncoder, PHY_QUERY_INSERT_CODE_EXPLAIN, pNode->explain); + } return code; } @@ -3307,6 +3317,9 @@ static int32_t msgToPhysiQueryInsertNode(STlvDecoder* pDecoder, void* pObj) { case PHY_QUERY_INSERT_CODE_EP_SET: code = tlvDecodeObjFromTlv(pTlv, msgToEpSet, &pNode->epSet); break; + case PHY_QUERY_INSERT_CODE_EXPLAIN: + code = tlvDecodeBool(pTlv, &pNode->explain); + break; default: break; } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 723d6d9eee..0419c883e6 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -374,8 +374,8 @@ SNode* nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SDescribeStmt)); case QUERY_NODE_RESET_QUERY_CACHE_STMT: return makeNode(type, sizeof(SNode)); - case QUERY_NODE_COMPACT_STMT: - break; + case QUERY_NODE_COMPACT_DATABASE_STMT: + return makeNode(type, sizeof(SCompactDatabaseStmt)); case QUERY_NODE_CREATE_FUNCTION_STMT: return makeNode(type, sizeof(SCreateFunctionStmt)); case QUERY_NODE_DROP_FUNCTION_STMT: @@ -923,7 +923,7 @@ void nodesDestroyNode(SNode* pNode) { taosMemoryFree(((SDescribeStmt*)pNode)->pMeta); break; case QUERY_NODE_RESET_QUERY_CACHE_STMT: // no pointer field - case QUERY_NODE_COMPACT_STMT: // no pointer field + case QUERY_NODE_COMPACT_DATABASE_STMT: // no pointer field case QUERY_NODE_CREATE_FUNCTION_STMT: // no pointer field case QUERY_NODE_DROP_FUNCTION_STMT: // no pointer field break; @@ -2019,10 +2019,14 @@ char* nodesGetFillModeString(EFillMode mode) { return "none"; case FILL_MODE_VALUE: return "value"; + case FILL_MODE_VALUE_F: + return "value_f"; case FILL_MODE_PREV: return "prev"; case FILL_MODE_NULL: return "null"; + case FILL_MODE_NULL_F: + return "null_f"; case FILL_MODE_LINEAR: return "linear"; case FILL_MODE_NEXT: diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index d202e60a45..3b309db1db 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -151,6 +151,7 @@ SNode* createDropDatabaseStmt(SAstCreateContext* pCxt, bool ignoreNotExists, STo SNode* createAlterDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pOptions); SNode* createFlushDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName); SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, int32_t maxSpeed); +SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName); SNode* createDefaultTableOptions(SAstCreateContext* pCxt); SNode* createAlterTableOptions(SAstCreateContext* pCxt); SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType type, void* pVal); @@ -210,7 +211,6 @@ SNode* setExplainRatio(SAstCreateContext* pCxt, SNode* pOptions, const SToken* p SNode* createExplainStmt(SAstCreateContext* pCxt, bool analyze, SNode* pOptions, SNode* pQuery); SNode* createDescribeStmt(SAstCreateContext* pCxt, SNode* pRealTable); SNode* createResetQueryCacheStmt(SAstCreateContext* pCxt); -SNode* createCompactStmt(SAstCreateContext* pCxt, SNodeList* pVgroups); SNode* createCreateFunctionStmt(SAstCreateContext* pCxt, bool ignoreExists, bool aggFunc, const SToken* pFuncName, const SToken* pLibPath, SDataType dataType, int32_t bufSize); SNode* createDropFunctionStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pFuncName); diff --git a/source/libs/parser/inc/parInsertUtil.h b/source/libs/parser/inc/parInsertUtil.h index 7b816359f9..303d349b34 100644 --- a/source/libs/parser/inc/parInsertUtil.h +++ b/source/libs/parser/inc/parInsertUtil.h @@ -20,11 +20,11 @@ struct SToken; -#define NEXT_TOKEN(pSql, sToken) \ - do { \ - int32_t index = 0; \ - sToken = tStrGetToken(pSql, &index, false); \ - pSql += index; \ +#define NEXT_TOKEN(pSql, sToken) \ + do { \ + int32_t index = 0; \ + sToken = tStrGetToken(pSql, &index, false, NULL); \ + pSql += index; \ } while (0) #define CHECK_CODE(expr) \ diff --git a/source/libs/parser/inc/parToken.h b/source/libs/parser/inc/parToken.h index 642979c471..86bcc18fd5 100644 --- a/source/libs/parser/inc/parToken.h +++ b/source/libs/parser/inc/parToken.h @@ -55,7 +55,7 @@ uint32_t tGetToken(const char *z, uint32_t *tokenType); * @param isPrevOptr * @return */ -SToken tStrGetToken(const char *str, int32_t *i, bool isPrevOptr); +SToken tStrGetToken(const char *str, int32_t *i, bool isPrevOptr, bool *pIgnoreComma); /** * check if it is a keyword or not diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index eaaa101701..19992498a0 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -167,6 +167,7 @@ cmd ::= USE db_name(A). cmd ::= ALTER DATABASE db_name(A) alter_db_options(B). { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &A, B); } cmd ::= FLUSH DATABASE db_name(A). { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &A); } cmd ::= TRIM DATABASE db_name(A) speed_opt(B). { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &A, B); } +cmd ::= COMPACT DATABASE db_name(A). { pCxt->pRootNode = createCompactStmt(pCxt, &A); } %type not_exists_opt { bool } %destructor not_exists_opt { } @@ -528,9 +529,6 @@ explain_options(A) ::= . explain_options(A) ::= explain_options(B) VERBOSE NK_BOOL(C). { A = setExplainVerbose(pCxt, B, &C); } explain_options(A) ::= explain_options(B) RATIO NK_FLOAT(C). { A = setExplainRatio(pCxt, B, &C); } -/************************************************ compact *************************************************************/ -//cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP. { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - /************************************************ create/drop function ************************************************/ cmd ::= CREATE agg_func_opt(A) FUNCTION not_exists_opt(F) function_name(B) AS NK_STRING(C) OUTPUTTYPE type_name(D) bufsize_opt(E). { pCxt->pRootNode = createCreateFunctionStmt(pCxt, F, A, &B, &C, D, E); } @@ -570,6 +568,7 @@ stream_options(A) ::= stream_options(B) TRIGGER MAX_DELAY duration_literal(C). stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { ((SStreamOptions*)B)->pWatermark = releaseRawExprNode(pCxt, C); A = B; } stream_options(A) ::= stream_options(B) IGNORE EXPIRED NK_INTEGER(C). { ((SStreamOptions*)B)->ignoreExpired = taosStr2Int8(C.z, NULL, 10); A = B; } stream_options(A) ::= stream_options(B) FILL_HISTORY NK_INTEGER(C). { ((SStreamOptions*)B)->fillHistory = taosStr2Int8(C.z, NULL, 10); A = B; } +stream_options(A) ::= stream_options(B) IGNORE UPDATE NK_INTEGER(C). { ((SStreamOptions*)B)->ignoreUpdate = taosStr2Int8(C.z, NULL, 10); A = B; } subtable_opt(A) ::= . { A = NULL; } subtable_opt(A) ::= SUBTABLE NK_LP expression(B) NK_RP. { A = releaseRawExprNode(pCxt, B); } @@ -1009,12 +1008,14 @@ sliding_opt(A) ::= SLIDING NK_LP duration_literal(B) NK_RP. fill_opt(A) ::= . { A = NULL; } fill_opt(A) ::= FILL NK_LP fill_mode(B) NK_RP. { A = createFillNode(pCxt, B, NULL); } fill_opt(A) ::= FILL NK_LP VALUE NK_COMMA literal_list(B) NK_RP. { A = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, B)); } +fill_opt(A) ::= FILL NK_LP VALUE_F NK_COMMA literal_list(B) NK_RP. { A = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, B)); } %type fill_mode { EFillMode } %destructor fill_mode { } fill_mode(A) ::= NONE. { A = FILL_MODE_NONE; } fill_mode(A) ::= PREV. { A = FILL_MODE_PREV; } fill_mode(A) ::= NULL. { A = FILL_MODE_NULL; } +fill_mode(A) ::= NULL_F. { A = FILL_MODE_NULL_F; } fill_mode(A) ::= LINEAR. { A = FILL_MODE_LINEAR; } fill_mode(A) ::= NEXT. { A = FILL_MODE_NEXT; } @@ -1104,6 +1105,6 @@ null_ordering_opt(A) ::= . null_ordering_opt(A) ::= NULLS FIRST. { A = NULL_ORDER_FIRST; } null_ordering_opt(A) ::= NULLS LAST. { A = NULL_ORDER_LAST; } -%fallback ABORT AFTER ATTACH BEFORE BEGIN BITAND BITNOT BITOR BLOCKS CHANGE COMMA COMPACT CONCAT CONFLICT COPY DEFERRED DELIMITERS DETACH DIVIDE DOT EACH END FAIL +%fallback ABORT AFTER ATTACH BEFORE BEGIN BITAND BITNOT BITOR BLOCKS CHANGE COMMA CONCAT CONFLICT COPY DEFERRED DELIMITERS DETACH DIVIDE DOT EACH END FAIL FILE FOR GLOB ID IMMEDIATE IMPORT INITIALLY INSTEAD ISNULL KEY MODULES NK_BITNOT NK_SEMI NOTNULL OF PLUS PRIVILEGE RAISE REPLACE RESTRICT ROW SEMI STAR STATEMENT - STRICT STRING TIMES UPDATE VALUES VARIABLE VIEW WAL. + STRICT STRING TIMES VALUES VARIABLE VIEW WAL. diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index f582adb0c6..15a796e086 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1105,6 +1105,17 @@ SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, int32_t return (SNode*)pStmt; } +SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName) { + CHECK_PARSER_STATUS(pCxt); + if (!checkDbName(pCxt, pDbName, false)) { + return NULL; + } + SCompactDatabaseStmt* pStmt = (SCompactDatabaseStmt*)nodesMakeNode(QUERY_NODE_COMPACT_DATABASE_STMT); + CHECK_OUT_OF_MEM(pStmt); + COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName); + return (SNode*)pStmt; +} + SNode* createDefaultTableOptions(SAstCreateContext* pCxt) { CHECK_PARSER_STATUS(pCxt); STableOptions* pOptions = (STableOptions*)nodesMakeNode(QUERY_NODE_TABLE_OPTIONS); @@ -1768,13 +1779,6 @@ SNode* createResetQueryCacheStmt(SAstCreateContext* pCxt) { return pStmt; } -SNode* createCompactStmt(SAstCreateContext* pCxt, SNodeList* pVgroups) { - CHECK_PARSER_STATUS(pCxt); - SNode* pStmt = nodesMakeNode(QUERY_NODE_COMPACT_STMT); - CHECK_OUT_OF_MEM(pStmt); - return pStmt; -} - SNode* createCreateFunctionStmt(SAstCreateContext* pCxt, bool ignoreExists, bool aggFunc, const SToken* pFuncName, const SToken* pLibPath, SDataType dataType, int32_t bufSize) { CHECK_PARSER_STATUS(pCxt); @@ -1809,6 +1813,7 @@ SNode* createStreamOptions(SAstCreateContext* pCxt) { pOptions->triggerType = STREAM_TRIGGER_AT_ONCE; pOptions->fillHistory = STREAM_DEFAULT_FILL_HISTORY; pOptions->ignoreExpired = STREAM_DEFAULT_IGNORE_EXPIRED; + pOptions->ignoreUpdate = STREAM_DEFAULT_IGNORE_UPDATE; return (SNode*)pOptions; } diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 630b61bd4b..e82b1edee1 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -18,16 +18,23 @@ #include "tglobal.h" #include "ttime.h" -#define NEXT_TOKEN_WITH_PREV(pSql, token) \ - do { \ - int32_t index = 0; \ - token = tStrGetToken(pSql, &index, true); \ - pSql += index; \ +#define NEXT_TOKEN_WITH_PREV(pSql, token) \ + do { \ + int32_t index = 0; \ + token = tStrGetToken(pSql, &index, true, NULL); \ + pSql += index; \ } while (0) -#define NEXT_TOKEN_KEEP_SQL(pSql, token, index) \ - do { \ - token = tStrGetToken(pSql, &index, false); \ +#define NEXT_TOKEN_WITH_PREV_EXT(pSql, token, pIgnoreComma) \ + do { \ + int32_t index = 0; \ + token = tStrGetToken(pSql, &index, true, pIgnoreComma); \ + pSql += index; \ + } while (0) + +#define NEXT_TOKEN_KEEP_SQL(pSql, token, index) \ + do { \ + token = tStrGetToken(pSql, &index, false, NULL); \ } while (0) #define NEXT_VALID_TOKEN(pSql, token) \ @@ -266,12 +273,12 @@ static int parseTime(const char** end, SToken* pToken, int16_t timePrec, int64_t * e.g., now+12a, now-5h */ index = 0; - SToken token = tStrGetToken(pTokenEnd, &index, false); + SToken token = tStrGetToken(pTokenEnd, &index, false, NULL); pTokenEnd += index; if (token.type == TK_NK_MINUS || token.type == TK_NK_PLUS) { index = 0; - SToken valueToken = tStrGetToken(pTokenEnd, &index, false); + SToken valueToken = tStrGetToken(pTokenEnd, &index, false, NULL); pTokenEnd += index; if (valueToken.n < 2) { @@ -1240,7 +1247,14 @@ static int parseOneRow(SInsertParseContext* pCxt, const char** pSql, STableDataC int32_t code = TSDB_CODE_SUCCESS; // 1. set the parsed value from sql string for (int i = 0; i < pCols->numOfBound && TSDB_CODE_SUCCESS == code; ++i) { - NEXT_TOKEN_WITH_PREV(*pSql, *pToken); + const char* pOrigSql = *pSql; + bool ignoreComma = false; + NEXT_TOKEN_WITH_PREV_EXT(*pSql, *pToken, &ignoreComma); + if (ignoreComma) { + code = buildSyntaxErrMsg(&pCxt->msg, "invalid data or symbol", pOrigSql); + break; + } + SSchema* pSchema = &pSchemas[pCols->pColIndex[i]]; SColVal* pVal = taosArrayGet(pTableCxt->pValues, pCols->pColIndex[i]); @@ -1248,20 +1262,22 @@ static int parseOneRow(SInsertParseContext* pCxt, const char** pSql, STableDataC isParseBindParam = true; if (NULL == pCxt->pComCxt->pStmtCb) { code = buildSyntaxErrMsg(&pCxt->msg, "? only used in stmt", pToken->z); + break; + } + } else { + if (TK_NK_RP == pToken->type) { + code = generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_INVALID_COLUMNS_NUM); + break; } - continue; - } - if (TSDB_CODE_SUCCESS == code && TK_NK_RP == pToken->type) { - code = generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_INVALID_COLUMNS_NUM); - } + if (isParseBindParam) { + code = buildInvalidOperationMsg(&pCxt->msg, "no mix usage for ? and values"); + break; + } - if (TSDB_CODE_SUCCESS == code && isParseBindParam) { - code = buildInvalidOperationMsg(&pCxt->msg, "no mix usage for ? and values"); - } - - if (TSDB_CODE_SUCCESS == code) { - code = parseValueToken(pCxt, pSql, pToken, pSchema, getTableInfo(pTableCxt->pMeta).precision, pVal); + if (TSDB_CODE_SUCCESS == code) { + code = parseValueToken(pCxt, pSql, pToken, pSchema, getTableInfo(pTableCxt->pMeta).precision, pVal); + } } if (TSDB_CODE_SUCCESS == code && i < pCols->numOfBound - 1) { diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 93bfe179f4..678dcf34d3 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -61,6 +61,7 @@ static SKeyword keywordTable[] = { {"COLUMN", TK_COLUMN}, {"COMMENT", TK_COMMENT}, {"COMP", TK_COMP}, + {"COMPACT", TK_COMPACT}, {"CONNECTION", TK_CONNECTION}, {"CONNECTIONS", TK_CONNECTIONS}, {"CONNS", TK_CONNS}, @@ -149,6 +150,7 @@ static SKeyword keywordTable[] = { {"NOT", TK_NOT}, {"NOW", TK_NOW}, {"NULL", TK_NULL}, + {"NULL_F", TK_NULL_F}, {"NULLS", TK_NULLS}, {"OFFSET", TK_OFFSET}, {"ON", TK_ON}, @@ -234,11 +236,13 @@ static SKeyword keywordTable[] = { {"TTL", TK_TTL}, {"UNION", TK_UNION}, {"UNSIGNED", TK_UNSIGNED}, + {"UPDATE", TK_UPDATE}, {"USE", TK_USE}, {"USER", TK_USER}, {"USERS", TK_USERS}, {"USING", TK_USING}, {"VALUE", TK_VALUE}, + {"VALUE_F", TK_VALUE_F}, {"VALUES", TK_VALUES}, {"VARCHAR", TK_VARCHAR}, {"VARIABLES", TK_VARIABLES}, @@ -624,7 +628,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) { return 0; } -SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr) { +SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr, bool* pIgnoreComma) { SToken t0 = {0}; // here we reach the end of sql string, null-terminated string @@ -645,6 +649,10 @@ SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr) { return t0; } + if (NULL != pIgnoreComma && t == ',') { + *pIgnoreComma = true; + } + t = str[++(*i)]; } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index ae3f5226f5..1347193d99 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1561,6 +1561,27 @@ static int32_t translateRepeatScanFunc(STranslateContext* pCxt, SFunctionNode* p return TSDB_CODE_SUCCESS; } +static int32_t translateBlockDistFunc(STranslateContext* pCtx, SFunctionNode* pFunc) { + if (!fmIsBlockDistFunc(pFunc->funcId)) { + return TSDB_CODE_SUCCESS; + } + if (!isSelectStmt(pCtx->pCurrStmt)) { + return generateSyntaxErrMsgExt(&pCtx->msgBuf, TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE, + "%s is only supported in single table query", pFunc->functionName); + } + SSelectStmt* pSelect = (SSelectStmt*)pCtx->pCurrStmt; + SNode* pTable = pSelect->pFromTable; + if (NULL != pTable && (QUERY_NODE_REAL_TABLE != nodeType(pTable) || + (TSDB_SUPER_TABLE != ((SRealTableNode*)pTable)->pMeta->tableType && + TSDB_CHILD_TABLE != ((SRealTableNode*)pTable)->pMeta->tableType && + TSDB_NORMAL_TABLE != ((SRealTableNode*)pTable)->pMeta->tableType))) { + return generateSyntaxErrMsgExt(&pCtx->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC, + "%s is only supported on super table, child table or normal table", + pFunc->functionName); + } + return TSDB_CODE_SUCCESS; +} + static bool isStar(SNode* pNode) { return (QUERY_NODE_COLUMN == nodeType(pNode)) && ('\0' == ((SColumnNode*)pNode)->tableAlias[0]) && (0 == strcmp(((SColumnNode*)pNode)->colName, "*")); @@ -1584,6 +1605,7 @@ static int32_t translateMultiResFunc(STranslateContext* pCxt, SFunctionNode* pFu } if (tsKeepColumnName && 1 == LIST_LENGTH(pFunc->pParameterList) && !pFunc->node.asAlias) { strcpy(pFunc->node.userAlias, ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->userAlias); + strcpy(pFunc->node.aliasName, pFunc->node.userAlias); } return TSDB_CODE_SUCCESS; } @@ -1720,7 +1742,7 @@ static int32_t rewriteSystemInfoFunc(STranslateContext* pCxt, SNode** pNode) { return TSDB_CODE_PAR_INTERNAL_ERROR; } -static int32_t translateNoramlFunction(STranslateContext* pCxt, SFunctionNode* pFunc) { +static int32_t translateNormalFunction(STranslateContext* pCxt, SFunctionNode* pFunc) { int32_t code = translateAggFunc(pCxt, pFunc); if (TSDB_CODE_SUCCESS == code) { code = translateScanPseudoColumnFunc(pCxt, pFunc); @@ -1752,6 +1774,9 @@ static int32_t translateNoramlFunction(STranslateContext* pCxt, SFunctionNode* p if (TSDB_CODE_SUCCESS == code) { code = translateTimelineFunc(pCxt, pFunc); } + if (TSDB_CODE_SUCCESS == code) { + code = translateBlockDistFunc(pCxt, pFunc); + } if (TSDB_CODE_SUCCESS == code) { setFuncClassification(pCxt->pCurrStmt, pFunc); } @@ -1812,7 +1837,7 @@ static int32_t translateFunctionImpl(STranslateContext* pCxt, SFunctionNode** pF if (fmIsClientPseudoColumnFunc((*pFunc)->funcId)) { return rewriteClientPseudoColumnFunc(pCxt, (SNode**)pFunc); } - return translateNoramlFunction(pCxt, *pFunc); + return translateNormalFunction(pCxt, *pFunc); } static EDealRes translateFunction(STranslateContext* pCxt, SFunctionNode** pFunc) { @@ -2527,11 +2552,12 @@ static SNode* createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr) { int32_t len = 0; if (QUERY_NODE_COLUMN == nodeType(pExpr)) { SColumnNode* pCol = (SColumnNode*)pExpr; - len = snprintf(buf, sizeof(buf), "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName); - strncpy(pFunc->node.aliasName, buf, TMIN(len, sizeof(pFunc->node.aliasName) - 1)); if (tsKeepColumnName) { strcpy(pFunc->node.userAlias, pCol->colName); + strcpy(pFunc->node.aliasName, pCol->colName); } else { + len = snprintf(buf, sizeof(buf), "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName); + strncpy(pFunc->node.aliasName, buf, TMIN(len, sizeof(pFunc->node.aliasName) - 1)); len = snprintf(buf, sizeof(buf), "%s(%s)", pSrcFunc->functionName, pCol->colName); strncpy(pFunc->node.userAlias, buf, TMIN(len, sizeof(pFunc->node.userAlias) - 1)); } @@ -2798,7 +2824,7 @@ static int32_t convertFillValue(STranslateContext* pCxt, SDataType dt, SNodeList } static int32_t checkFillValues(STranslateContext* pCxt, SFillNode* pFill, SNodeList* pProjectionList) { - if (FILL_MODE_VALUE != pFill->mode) { + if (FILL_MODE_VALUE != pFill->mode && FILL_MODE_VALUE_F != pFill->mode) { return TSDB_CODE_SUCCESS; } @@ -3517,7 +3543,7 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS if (comp > 0) { SNode* pRightFunc = NULL; int32_t code = createCastFunc(pCxt, pRight, pLeftExpr->resType, &pRightFunc); - if (TSDB_CODE_SUCCESS != code || NULL == pRightFunc) { // deal scan coverity + if (TSDB_CODE_SUCCESS != code || NULL == pRightFunc) { // deal scan coverity return code; } REPLACE_LIST2_NODE(pRightFunc); @@ -3525,7 +3551,7 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS } else if (comp < 0) { SNode* pLeftFunc = NULL; int32_t code = createCastFunc(pCxt, pLeft, pRightExpr->resType, &pLeftFunc); - if (TSDB_CODE_SUCCESS != code || NULL == pLeftFunc) { // deal scan coverity + if (TSDB_CODE_SUCCESS != code || NULL == pLeftFunc) { // deal scan coverity return code; } REPLACE_LIST1_NODE(pLeftFunc); @@ -5507,7 +5533,7 @@ static int32_t translateDropCGroup(STranslateContext* pCxt, SDropCGroupStmt* pSt } static int32_t translateAlterLocal(STranslateContext* pCxt, SAlterLocalStmt* pStmt) { - // todo + // The statement is executed directly on the client without constructing a message. return TSDB_CODE_SUCCESS; } @@ -5522,6 +5548,14 @@ static int32_t translateDescribe(STranslateContext* pCxt, SDescribeStmt* pStmt) return refreshGetTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pStmt->pMeta); } +static int32_t translateCompact(STranslateContext* pCxt, SCompactDatabaseStmt* pStmt) { + SCompactDbReq compactReq = {0}; + SName name; + tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); + tNameGetFullDbName(&name, compactReq.db); + return buildCmdMsg(pCxt, TDMT_MND_COMPACT_DB, (FSerializeFunc)tSerializeSCompactDbReq, &compactReq); +} + static int32_t translateKillConnection(STranslateContext* pCxt, SKillStmt* pStmt) { SKillConnReq killReq = {0}; killReq.connId = pStmt->targetId; @@ -5809,7 +5843,7 @@ static int32_t projColPosCompar(const void* l, const void* r) { return ((SProjColPos*)l)->colId > ((SProjColPos*)r)->colId; } -static void projColPosDelete(void* p) { taosMemoryFree(((SProjColPos*)p)->pProj); } +static void projColPosDelete(void* p) { nodesDestroyNode(((SProjColPos*)p)->pProj); } static int32_t addProjToProjColPos(STranslateContext* pCxt, const SSchema* pSchema, SNode* pProj, SArray* pProjColPos) { SNode* pNewProj = nodesCloneNode(pProj); @@ -6152,6 +6186,7 @@ static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt* columnDefNodeToField(pStmt->pTags, &pReq->pTags); pReq->numOfTags = LIST_LENGTH(pStmt->pTags); } + pReq->igUpdate = pStmt->pOptions->ignoreUpdate; } return code; @@ -6455,6 +6490,9 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { case QUERY_NODE_DESCRIBE_STMT: code = translateDescribe(pCxt, (SDescribeStmt*)pNode); break; + case QUERY_NODE_COMPACT_DATABASE_STMT: + code = translateCompact(pCxt, (SCompactDatabaseStmt*)pNode); + break; case QUERY_NODE_KILL_CONNECTION_STMT: code = translateKillConnection(pCxt, (SKillStmt*)pNode); break; diff --git a/source/libs/parser/src/parser.c b/source/libs/parser/src/parser.c index cf338d63ff..47482db740 100644 --- a/source/libs/parser/src/parser.c +++ b/source/libs/parser/src/parser.c @@ -27,7 +27,7 @@ bool qIsInsertValuesSql(const char* pStr, size_t length) { const char* pSql = pStr; int32_t index = 0; - SToken t = tStrGetToken((char*)pStr, &index, false); + SToken t = tStrGetToken((char*)pStr, &index, false, NULL); if (TK_INSERT != t.type && TK_IMPORT != t.type) { return false; } @@ -35,7 +35,7 @@ bool qIsInsertValuesSql(const char* pStr, size_t length) { do { pStr += index; index = 0; - t = tStrGetToken((char*)pStr, &index, false); + t = tStrGetToken((char*)pStr, &index, false, NULL); if (TK_USING == t.type || TK_VALUES == t.type || TK_FILE == t.type) { return true; } else if (TK_SELECT == t.type) { diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 6086858043..836d1c5de9 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -104,26 +104,26 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 467 +#define YYNOCODE 469 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - EFillMode yy22; - ENullOrder yy23; - SNode* yy44; - int64_t yy91; - SAlterOption yy153; - bool yy163; - int8_t yy169; - SDataType yy260; - SToken yy455; - EOrder yy490; - SNodeList* yy684; - EOperatorType yy704; - EJoinType yy724; - int32_t yy832; + EOperatorType yy2; + SNode* yy42; + bool yy103; + EOrder yy106; + SNodeList* yy110; + SToken yy225; + EFillMode yy410; + SDataType yy448; + SAlterOption yy459; + int32_t yy508; + ENullOrder yy599; + EJoinType yy638; + int64_t yy641; + int8_t yy705; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -139,17 +139,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 734 -#define YYNRULE 558 -#define YYNTOKEN 326 -#define YY_MAX_SHIFT 733 -#define YY_MIN_SHIFTREDUCE 1089 -#define YY_MAX_SHIFTREDUCE 1646 -#define YY_ERROR_ACTION 1647 -#define YY_ACCEPT_ACTION 1648 -#define YY_NO_ACTION 1649 -#define YY_MIN_REDUCE 1650 -#define YY_MAX_REDUCE 2207 +#define YYNSTATE 741 +#define YYNRULE 562 +#define YYNTOKEN 328 +#define YY_MAX_SHIFT 740 +#define YY_MIN_SHIFTREDUCE 1099 +#define YY_MAX_SHIFTREDUCE 1660 +#define YY_ERROR_ACTION 1661 +#define YY_ACCEPT_ACTION 1662 +#define YY_NO_ACTION 1663 +#define YY_MIN_REDUCE 1664 +#define YY_MAX_REDUCE 2225 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,819 +216,753 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (3082) +#define YY_ACTTAB_COUNT (2749) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 474, 1673, 475, 1686, 1886, 586, 1792, 604, 2007, 2178, - /* 10 */ 1788, 1856, 45, 43, 1576, 480, 1922, 175, 342, 2003, - /* 20 */ 374, 476, 1425, 1794, 585, 181, 419, 1854, 365, 2179, - /* 30 */ 587, 1919, 610, 1506, 2003, 1423, 2021, 2183, 344, 1905, - /* 40 */ 2007, 2178, 38, 37, 1922, 1989, 44, 42, 41, 40, - /* 50 */ 39, 2003, 562, 1999, 2005, 356, 2178, 2182, 1501, 1920, - /* 60 */ 610, 2179, 2181, 18, 633, 177, 327, 2039, 1999, 2005, - /* 70 */ 1431, 2184, 181, 366, 598, 637, 2179, 587, 1843, 633, - /* 80 */ 1989, 163, 639, 45, 43, 1999, 2005, 369, 586, 1959, - /* 90 */ 1805, 374, 2178, 1425, 163, 14, 633, 337, 44, 42, - /* 100 */ 41, 40, 39, 1806, 1506, 139, 1423, 585, 181, 35, - /* 110 */ 285, 2020, 2179, 587, 165, 2056, 1662, 730, 321, 2022, - /* 120 */ 643, 2024, 2025, 638, 636, 633, 624, 2074, 267, 1501, - /* 130 */ 1450, 2008, 1508, 1509, 18, 235, 379, 1982, 1535, 1849, - /* 140 */ 1851, 1431, 2003, 590, 1248, 665, 664, 663, 1252, 662, - /* 150 */ 1254, 1255, 661, 1257, 658, 437, 1263, 655, 1265, 1266, - /* 160 */ 652, 649, 1481, 1491, 436, 60, 14, 91, 1507, 1510, - /* 170 */ 264, 2117, 597, 1781, 132, 596, 1999, 2005, 2178, 41, - /* 180 */ 40, 39, 562, 1426, 1856, 1424, 2178, 633, 730, 348, - /* 190 */ 1122, 353, 1451, 585, 181, 1536, 1850, 1851, 2179, 587, - /* 200 */ 1854, 2184, 181, 1508, 1509, 166, 2179, 587, 1429, 1430, - /* 210 */ 1757, 1480, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, - /* 220 */ 635, 631, 1499, 1500, 1502, 1503, 1504, 1505, 2, 1124, - /* 230 */ 1975, 1127, 1128, 1481, 1491, 492, 622, 85, 121, 1507, - /* 240 */ 1510, 120, 119, 118, 117, 116, 115, 114, 113, 112, - /* 250 */ 349, 135, 347, 346, 1426, 515, 1424, 38, 37, 517, - /* 260 */ 1798, 44, 42, 41, 40, 39, 593, 34, 372, 1530, - /* 270 */ 1531, 1532, 1533, 1534, 1538, 1539, 1540, 1541, 394, 1429, - /* 280 */ 1430, 516, 1480, 1483, 1484, 1485, 1486, 1487, 1488, 1489, - /* 290 */ 1490, 635, 631, 1499, 1500, 1502, 1503, 1504, 1505, 2, - /* 300 */ 377, 11, 45, 43, 1291, 1292, 622, 219, 160, 622, - /* 310 */ 374, 48, 1425, 1651, 609, 354, 184, 1805, 1672, 1141, - /* 320 */ 598, 1140, 170, 1506, 1854, 1423, 2021, 1603, 509, 505, - /* 330 */ 501, 497, 216, 623, 121, 233, 60, 120, 119, 118, - /* 340 */ 117, 116, 115, 114, 113, 112, 1450, 131, 1501, 1580, - /* 350 */ 1142, 139, 1573, 18, 513, 1450, 483, 2039, 475, 1686, - /* 360 */ 1431, 490, 1989, 1915, 1803, 640, 591, 675, 86, 2124, - /* 370 */ 1989, 214, 639, 45, 43, 1511, 573, 1601, 1602, 1604, - /* 380 */ 1605, 374, 1671, 1425, 48, 14, 153, 152, 672, 671, - /* 390 */ 670, 150, 105, 1779, 1506, 2121, 1423, 2021, 88, 332, - /* 400 */ 608, 2020, 546, 2124, 544, 2056, 140, 730, 167, 2022, - /* 410 */ 643, 2024, 2025, 638, 1795, 633, 180, 2117, 2118, 1501, - /* 420 */ 137, 2122, 1508, 1509, 1643, 1450, 1989, 1452, 2039, 2120, - /* 430 */ 64, 1431, 175, 1141, 473, 1140, 640, 478, 1692, 213, - /* 440 */ 207, 1989, 482, 639, 212, 478, 1692, 488, 218, 563, - /* 450 */ 2146, 1670, 1481, 1491, 1906, 677, 46, 1208, 1507, 1510, - /* 460 */ 492, 38, 37, 205, 1142, 44, 42, 41, 40, 39, - /* 470 */ 581, 49, 2020, 1426, 1719, 1424, 2056, 677, 730, 168, - /* 480 */ 2022, 643, 2024, 2025, 638, 8, 633, 184, 1346, 1347, - /* 490 */ 1648, 594, 1210, 1508, 1509, 1989, 598, 1482, 1429, 1430, - /* 500 */ 60, 1480, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, - /* 510 */ 635, 631, 1499, 1500, 1502, 1503, 1504, 1505, 2, 1642, - /* 520 */ 623, 60, 1901, 1481, 1491, 524, 523, 139, 623, 1507, - /* 530 */ 1510, 588, 2199, 189, 186, 184, 623, 1451, 1449, 528, - /* 540 */ 527, 526, 54, 406, 1426, 1537, 1424, 136, 522, 1613, - /* 550 */ 417, 1803, 521, 2039, 1983, 60, 387, 520, 525, 1803, - /* 560 */ 386, 580, 551, 519, 408, 404, 11, 1803, 9, 1429, - /* 570 */ 1430, 266, 1480, 1483, 1484, 1485, 1486, 1487, 1488, 1489, - /* 580 */ 1490, 635, 631, 1499, 1500, 1502, 1503, 1504, 1505, 2, - /* 590 */ 45, 43, 182, 2117, 2118, 1572, 137, 2122, 374, 562, - /* 600 */ 1425, 562, 733, 2178, 2124, 2178, 579, 457, 2183, 13, - /* 610 */ 12, 1506, 2178, 1423, 2021, 623, 292, 32, 2184, 181, - /* 620 */ 2184, 181, 184, 2179, 587, 2179, 587, 1542, 2182, 418, - /* 630 */ 2119, 174, 2179, 2180, 609, 1450, 1501, 723, 719, 715, - /* 640 */ 711, 290, 411, 623, 410, 2039, 1803, 1856, 1431, 1363, - /* 650 */ 1364, 184, 1856, 640, 362, 701, 699, 427, 1989, 367, - /* 660 */ 639, 45, 43, 1854, 85, 197, 196, 409, 1854, 374, - /* 670 */ 1453, 1425, 184, 46, 1803, 2183, 141, 106, 598, 2080, - /* 680 */ 283, 607, 1506, 1915, 1423, 1362, 1365, 1799, 456, 2020, - /* 690 */ 413, 1569, 1452, 2056, 412, 730, 167, 2022, 643, 2024, - /* 700 */ 2025, 638, 1650, 633, 1549, 1453, 184, 1501, 1516, 139, - /* 710 */ 1508, 1509, 420, 619, 1450, 609, 38, 37, 234, 1431, - /* 720 */ 44, 42, 41, 40, 39, 421, 130, 129, 128, 127, - /* 730 */ 126, 125, 124, 123, 122, 562, 623, 11, 2147, 2178, - /* 740 */ 1481, 1491, 1856, 690, 14, 1773, 1507, 1510, 270, 378, - /* 750 */ 131, 668, 27, 269, 2184, 181, 576, 518, 1854, 2179, - /* 760 */ 587, 1426, 618, 1424, 1915, 1669, 730, 1803, 1636, 625, - /* 770 */ 1390, 2081, 238, 600, 179, 2117, 2118, 1482, 137, 2122, - /* 780 */ 1668, 1508, 1509, 1431, 1401, 1402, 1429, 1430, 99, 1480, - /* 790 */ 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 635, 631, - /* 800 */ 1499, 1500, 1502, 1503, 1504, 1505, 2, 623, 689, 1989, - /* 810 */ 1796, 1481, 1491, 330, 190, 1448, 623, 1507, 1510, 623, - /* 820 */ 1901, 442, 450, 224, 1989, 464, 222, 377, 463, 380, - /* 830 */ 443, 191, 1426, 491, 1424, 163, 266, 163, 1803, 542, - /* 840 */ 582, 577, 571, 433, 1805, 465, 1805, 1803, 435, 243, - /* 850 */ 1803, 1667, 540, 1666, 538, 2182, 1482, 1429, 1430, 1790, - /* 860 */ 1480, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 635, - /* 870 */ 631, 1499, 1500, 1502, 1503, 1504, 1505, 2, 1665, 1664, - /* 880 */ 623, 276, 277, 164, 1661, 627, 275, 2081, 305, 345, - /* 890 */ 1716, 528, 527, 526, 1800, 1989, 1786, 1989, 623, 136, - /* 900 */ 522, 423, 303, 71, 521, 1901, 70, 1127, 1128, 520, - /* 910 */ 525, 1803, 236, 38, 37, 519, 195, 44, 42, 41, - /* 920 */ 40, 39, 1989, 1989, 201, 470, 468, 669, 1989, 1803, - /* 930 */ 1847, 461, 2129, 1569, 455, 454, 453, 452, 449, 448, - /* 940 */ 447, 446, 445, 441, 440, 439, 438, 329, 430, 429, - /* 950 */ 428, 1660, 425, 424, 343, 707, 706, 705, 704, 384, - /* 960 */ 60, 703, 702, 143, 697, 696, 695, 694, 693, 692, - /* 970 */ 691, 155, 687, 686, 685, 383, 382, 682, 681, 680, - /* 980 */ 679, 678, 38, 37, 623, 533, 44, 42, 41, 40, - /* 990 */ 39, 623, 667, 1659, 1453, 1989, 104, 31, 558, 107, - /* 1000 */ 543, 1592, 1780, 38, 37, 602, 101, 44, 42, 41, - /* 1010 */ 40, 39, 2021, 33, 232, 1803, 549, 1434, 623, 38, - /* 1020 */ 37, 623, 1803, 44, 42, 41, 40, 39, 1856, 536, - /* 1030 */ 239, 517, 606, 623, 530, 280, 623, 1989, 634, 231, - /* 1040 */ 79, 78, 416, 2039, 1855, 188, 1658, 620, 623, 1803, - /* 1050 */ 621, 601, 1803, 516, 299, 1706, 1989, 1833, 639, 1657, - /* 1060 */ 1656, 562, 286, 328, 1803, 2178, 402, 1803, 400, 396, - /* 1070 */ 392, 389, 409, 1778, 623, 68, 2021, 529, 67, 1803, - /* 1080 */ 2184, 181, 193, 1655, 557, 2179, 587, 2020, 381, 1425, - /* 1090 */ 1989, 2056, 1654, 1433, 108, 2022, 643, 2024, 2025, 638, - /* 1100 */ 1653, 633, 1423, 1989, 1989, 1803, 178, 2039, 2109, 675, - /* 1110 */ 630, 184, 368, 2105, 72, 640, 226, 589, 82, 225, - /* 1120 */ 1989, 81, 639, 51, 1663, 3, 183, 1989, 153, 152, - /* 1130 */ 672, 671, 670, 150, 2135, 2021, 1989, 1431, 244, 1758, - /* 1140 */ 673, 38, 37, 1847, 1989, 44, 42, 41, 40, 39, - /* 1150 */ 674, 2020, 2149, 1847, 151, 2056, 1699, 261, 108, 2022, - /* 1160 */ 643, 2024, 2025, 638, 80, 633, 2039, 1437, 142, 574, - /* 1170 */ 148, 2080, 2109, 145, 601, 133, 368, 2105, 531, 1989, - /* 1180 */ 675, 639, 1645, 1646, 730, 38, 37, 1697, 151, 44, - /* 1190 */ 42, 41, 40, 39, 228, 2021, 151, 227, 217, 153, - /* 1200 */ 152, 672, 671, 670, 150, 230, 53, 242, 229, 534, - /* 1210 */ 2020, 62, 47, 248, 2056, 151, 47, 108, 2022, 643, - /* 1220 */ 2024, 2025, 638, 52, 633, 2010, 2039, 1170, 2040, 178, - /* 1230 */ 561, 2109, 13, 12, 640, 368, 2105, 1693, 273, 1989, - /* 1240 */ 1396, 639, 69, 1436, 255, 385, 89, 149, 1399, 151, - /* 1250 */ 1426, 62, 1424, 47, 2021, 1527, 647, 2136, 149, 151, - /* 1260 */ 134, 149, 1171, 1600, 1492, 250, 1910, 605, 1360, 1687, - /* 1270 */ 2020, 1844, 2139, 2012, 2056, 1429, 1430, 108, 2022, 643, - /* 1280 */ 2024, 2025, 638, 599, 633, 2039, 725, 683, 2021, 2198, - /* 1290 */ 278, 2109, 684, 640, 615, 368, 2105, 162, 1989, 282, - /* 1300 */ 639, 1241, 260, 1543, 263, 298, 2143, 393, 1269, 1189, - /* 1310 */ 1273, 1280, 1278, 154, 1187, 1, 4, 388, 341, 2039, - /* 1320 */ 1383, 293, 194, 422, 1453, 1911, 426, 640, 431, 2020, - /* 1330 */ 1448, 459, 1989, 2056, 639, 444, 108, 2022, 643, 2024, - /* 1340 */ 2025, 638, 1903, 633, 451, 458, 460, 466, 2198, 467, - /* 1350 */ 2109, 198, 469, 471, 368, 2105, 1454, 472, 481, 1456, - /* 1360 */ 484, 204, 1451, 2020, 485, 2156, 206, 2056, 1455, 486, - /* 1370 */ 108, 2022, 643, 2024, 2025, 638, 1457, 633, 487, 209, - /* 1380 */ 489, 2021, 2198, 211, 2109, 493, 83, 84, 368, 2105, - /* 1390 */ 1144, 510, 215, 511, 512, 371, 370, 514, 1793, 569, - /* 1400 */ 550, 2021, 111, 1965, 87, 1439, 221, 331, 1964, 552, - /* 1410 */ 548, 147, 2039, 575, 1789, 237, 1506, 223, 1432, 294, - /* 1420 */ 640, 156, 157, 553, 1791, 1989, 1787, 639, 240, 158, - /* 1430 */ 159, 556, 2039, 559, 2155, 613, 7, 2154, 2131, 584, - /* 1440 */ 640, 1501, 254, 2140, 565, 1989, 171, 639, 566, 567, - /* 1450 */ 572, 357, 578, 1431, 2150, 256, 2020, 257, 2201, 564, - /* 1460 */ 2056, 358, 592, 108, 2022, 643, 2024, 2025, 638, 595, - /* 1470 */ 633, 246, 249, 258, 1569, 2198, 2020, 2109, 1452, 2177, - /* 1480 */ 2056, 368, 2105, 108, 2022, 643, 2024, 2025, 638, 138, - /* 1490 */ 633, 259, 2172, 262, 268, 2198, 2125, 2109, 603, 94, - /* 1500 */ 629, 368, 2105, 361, 1458, 1916, 295, 611, 612, 1930, - /* 1510 */ 1929, 1928, 2128, 296, 364, 616, 96, 617, 297, 1804, - /* 1520 */ 98, 59, 2090, 100, 645, 300, 1774, 1848, 726, 727, - /* 1530 */ 289, 729, 333, 302, 334, 50, 309, 323, 313, 1981, - /* 1540 */ 2021, 1980, 324, 1979, 76, 304, 1976, 390, 391, 1416, - /* 1550 */ 1417, 187, 395, 1974, 397, 398, 399, 1973, 1972, 401, - /* 1560 */ 403, 1971, 405, 1970, 407, 77, 1440, 1386, 1435, 1385, - /* 1570 */ 1942, 2039, 1941, 1940, 414, 415, 1939, 1938, 1337, 640, - /* 1580 */ 1894, 1893, 1891, 1890, 1989, 192, 639, 144, 1889, 1892, - /* 1590 */ 1888, 1443, 1445, 1887, 1885, 1884, 1883, 432, 1882, 434, - /* 1600 */ 2021, 146, 1866, 1865, 631, 1499, 1500, 1502, 1503, 1504, - /* 1610 */ 1505, 1896, 1881, 1880, 1879, 2020, 1878, 1877, 1876, 2056, - /* 1620 */ 1875, 1874, 108, 2022, 643, 2024, 2025, 638, 2021, 633, - /* 1630 */ 1873, 2039, 1872, 1871, 2084, 1870, 2109, 1869, 1868, 640, - /* 1640 */ 368, 2105, 1867, 1864, 1989, 1895, 639, 1863, 1862, 1339, - /* 1650 */ 1861, 1860, 1859, 462, 1858, 1857, 1721, 1216, 199, 2039, - /* 1660 */ 1720, 1718, 200, 1682, 74, 202, 2009, 640, 176, 1681, - /* 1670 */ 1955, 1130, 1989, 477, 639, 2020, 1129, 1949, 479, 2056, - /* 1680 */ 203, 1937, 108, 2022, 643, 2024, 2025, 638, 75, 633, - /* 1690 */ 1936, 210, 208, 1914, 2082, 2021, 2109, 1782, 1163, 1717, - /* 1700 */ 368, 2105, 1715, 2020, 496, 1713, 494, 2056, 1711, 498, - /* 1710 */ 108, 2022, 643, 2024, 2025, 638, 495, 633, 2021, 500, - /* 1720 */ 499, 502, 626, 503, 2109, 1709, 2039, 504, 368, 2105, - /* 1730 */ 507, 506, 1696, 508, 640, 1695, 1678, 1784, 1285, 1989, - /* 1740 */ 61, 639, 1284, 220, 1783, 1207, 1206, 1205, 1204, 2039, - /* 1750 */ 698, 700, 1201, 1200, 1198, 1199, 1707, 640, 1700, 532, - /* 1760 */ 350, 351, 1989, 352, 639, 1698, 535, 1677, 1676, 537, - /* 1770 */ 2020, 1675, 541, 110, 2056, 539, 1954, 109, 2022, 643, - /* 1780 */ 2024, 2025, 638, 1406, 633, 1408, 2021, 1405, 1948, 1392, - /* 1790 */ 1935, 2109, 545, 2020, 161, 2108, 2105, 2056, 1933, 26, - /* 1800 */ 109, 2022, 643, 2024, 2025, 638, 2021, 633, 55, 65, - /* 1810 */ 555, 554, 2183, 19, 2109, 16, 28, 2039, 628, 2105, - /* 1820 */ 1615, 245, 570, 355, 241, 640, 247, 253, 568, 58, - /* 1830 */ 1989, 252, 639, 2010, 20, 30, 560, 2039, 5, 1599, - /* 1840 */ 169, 251, 29, 63, 90, 640, 21, 6, 1630, 1629, - /* 1850 */ 1989, 1591, 639, 1635, 359, 1636, 17, 1634, 1633, 360, - /* 1860 */ 1566, 641, 1565, 265, 57, 2056, 1934, 1932, 109, 2022, - /* 1870 */ 643, 2024, 2025, 638, 172, 633, 1931, 1913, 93, 92, - /* 1880 */ 271, 2020, 2109, 56, 1912, 2056, 336, 2105, 109, 2022, - /* 1890 */ 643, 2024, 2025, 638, 22, 633, 2021, 272, 95, 1597, - /* 1900 */ 274, 279, 2109, 66, 284, 97, 23, 2106, 1518, 614, - /* 1910 */ 12, 1441, 101, 2059, 2021, 10, 281, 1496, 1473, 173, - /* 1920 */ 1517, 632, 185, 1528, 1494, 36, 15, 2039, 1493, 24, - /* 1930 */ 2021, 1465, 642, 25, 646, 640, 376, 1270, 648, 650, - /* 1940 */ 1989, 1267, 639, 644, 651, 2039, 1264, 653, 654, 656, - /* 1950 */ 1258, 657, 659, 640, 1256, 660, 1247, 287, 1989, 666, - /* 1960 */ 639, 2039, 1279, 1262, 102, 1261, 363, 1260, 103, 640, - /* 1970 */ 1275, 2020, 676, 73, 1989, 2056, 639, 1195, 315, 2022, - /* 1980 */ 643, 2024, 2025, 638, 1259, 633, 1161, 1194, 1193, 2020, - /* 1990 */ 1192, 1191, 1190, 2056, 1188, 1186, 168, 2022, 643, 2024, - /* 2000 */ 2025, 638, 2021, 633, 1185, 2020, 1184, 1214, 688, 2056, - /* 2010 */ 288, 1182, 322, 2022, 643, 2024, 2025, 638, 1181, 633, - /* 2020 */ 1180, 1179, 583, 1178, 2021, 1167, 1177, 1176, 1211, 1209, - /* 2030 */ 1173, 1172, 1169, 2039, 1714, 1168, 1166, 708, 1712, 1710, - /* 2040 */ 1708, 637, 712, 1694, 710, 716, 1989, 714, 639, 2200, - /* 2050 */ 718, 720, 709, 722, 713, 2039, 724, 717, 1119, 1674, - /* 2060 */ 373, 721, 728, 640, 291, 1649, 1427, 301, 1989, 731, - /* 2070 */ 639, 732, 1649, 1649, 1649, 1649, 1649, 2020, 1649, 1649, - /* 2080 */ 1649, 2056, 1649, 1649, 321, 2022, 643, 2024, 2025, 638, - /* 2090 */ 1649, 633, 2021, 2075, 1649, 1649, 1649, 1649, 1649, 2020, - /* 2100 */ 1649, 1649, 1649, 2056, 1649, 1649, 322, 2022, 643, 2024, - /* 2110 */ 2025, 638, 2021, 633, 1649, 1649, 1649, 1649, 1649, 1649, - /* 2120 */ 1649, 1649, 1649, 2039, 1649, 1649, 1649, 1649, 375, 1649, - /* 2130 */ 1649, 640, 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649, - /* 2140 */ 1649, 1649, 1649, 2039, 1649, 1649, 1649, 1649, 1649, 1649, - /* 2150 */ 1649, 640, 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649, - /* 2160 */ 1649, 1649, 1649, 1649, 1649, 1649, 1649, 2020, 1649, 1649, - /* 2170 */ 1649, 2056, 1649, 1649, 322, 2022, 643, 2024, 2025, 638, - /* 2180 */ 2021, 633, 1649, 1649, 1649, 1649, 1649, 547, 1649, 1649, - /* 2190 */ 1649, 2056, 1649, 1649, 317, 2022, 643, 2024, 2025, 638, - /* 2200 */ 2021, 633, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, - /* 2210 */ 1649, 2039, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 640, - /* 2220 */ 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649, 1649, 1649, - /* 2230 */ 1649, 2039, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 640, - /* 2240 */ 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649, 1649, 1649, - /* 2250 */ 1649, 1649, 1649, 1649, 1649, 2020, 1649, 2021, 1649, 2056, - /* 2260 */ 1649, 1649, 306, 2022, 643, 2024, 2025, 638, 1649, 633, - /* 2270 */ 1649, 1649, 1649, 1649, 1649, 2020, 1649, 1649, 1649, 2056, - /* 2280 */ 1649, 1649, 307, 2022, 643, 2024, 2025, 638, 2039, 633, - /* 2290 */ 1649, 2021, 1649, 1649, 1649, 1649, 640, 1649, 1649, 1649, - /* 2300 */ 1649, 1989, 1649, 639, 1649, 1649, 1649, 1649, 1649, 1649, - /* 2310 */ 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 2021, - /* 2320 */ 1649, 1649, 2039, 1649, 1649, 1649, 1649, 1649, 1649, 1649, - /* 2330 */ 640, 1649, 2020, 1649, 1649, 1989, 2056, 639, 1649, 308, - /* 2340 */ 2022, 643, 2024, 2025, 638, 1649, 633, 1649, 1649, 1649, - /* 2350 */ 2039, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 640, 1649, - /* 2360 */ 1649, 1649, 1649, 1989, 1649, 639, 2020, 1649, 1649, 1649, - /* 2370 */ 2056, 1649, 1649, 314, 2022, 643, 2024, 2025, 638, 2021, - /* 2380 */ 633, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, - /* 2390 */ 1649, 1649, 1649, 1649, 2020, 1649, 1649, 1649, 2056, 1649, - /* 2400 */ 2021, 318, 2022, 643, 2024, 2025, 638, 1649, 633, 1649, - /* 2410 */ 2039, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 640, 1649, - /* 2420 */ 1649, 1649, 1649, 1989, 1649, 639, 1649, 1649, 1649, 1649, - /* 2430 */ 1649, 2039, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 640, - /* 2440 */ 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649, 1649, 1649, - /* 2450 */ 1649, 1649, 1649, 1649, 2020, 1649, 1649, 1649, 2056, 1649, - /* 2460 */ 1649, 310, 2022, 643, 2024, 2025, 638, 1649, 633, 1649, - /* 2470 */ 1649, 1649, 1649, 2021, 1649, 2020, 1649, 1649, 1649, 2056, - /* 2480 */ 1649, 1649, 319, 2022, 643, 2024, 2025, 638, 1649, 633, - /* 2490 */ 1649, 1649, 1649, 1649, 1649, 1649, 1649, 2021, 1649, 1649, - /* 2500 */ 1649, 1649, 1649, 1649, 2039, 1649, 1649, 1649, 1649, 1649, - /* 2510 */ 1649, 1649, 640, 1649, 1649, 1649, 1649, 1989, 1649, 639, - /* 2520 */ 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 2039, 1649, - /* 2530 */ 1649, 1649, 1649, 1649, 1649, 1649, 640, 1649, 1649, 1649, - /* 2540 */ 1649, 1989, 1649, 639, 1649, 1649, 1649, 1649, 2020, 1649, - /* 2550 */ 1649, 1649, 2056, 1649, 2021, 311, 2022, 643, 2024, 2025, - /* 2560 */ 638, 1649, 633, 1649, 1649, 1649, 1649, 1649, 1649, 1649, - /* 2570 */ 1649, 1649, 2020, 1649, 2021, 1649, 2056, 1649, 1649, 320, - /* 2580 */ 2022, 643, 2024, 2025, 638, 2039, 633, 1649, 1649, 1649, - /* 2590 */ 1649, 1649, 1649, 640, 1649, 1649, 1649, 1649, 1989, 1649, - /* 2600 */ 639, 1649, 1649, 1649, 1649, 2039, 1649, 1649, 1649, 1649, - /* 2610 */ 1649, 1649, 1649, 640, 1649, 1649, 1649, 1649, 1989, 1649, - /* 2620 */ 639, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 2020, - /* 2630 */ 1649, 2021, 1649, 2056, 1649, 1649, 312, 2022, 643, 2024, - /* 2640 */ 2025, 638, 1649, 633, 1649, 1649, 1649, 1649, 1649, 2020, - /* 2650 */ 1649, 1649, 2021, 2056, 1649, 1649, 325, 2022, 643, 2024, - /* 2660 */ 2025, 638, 2039, 633, 1649, 1649, 1649, 1649, 1649, 1649, - /* 2670 */ 640, 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649, 1649, - /* 2680 */ 2021, 1649, 1649, 2039, 1649, 1649, 1649, 1649, 1649, 1649, - /* 2690 */ 1649, 640, 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649, - /* 2700 */ 1649, 1649, 1649, 1649, 1649, 1649, 2020, 1649, 1649, 1649, - /* 2710 */ 2056, 2039, 1649, 326, 2022, 643, 2024, 2025, 638, 640, - /* 2720 */ 633, 1649, 1649, 1649, 1989, 1649, 639, 2020, 1649, 1649, - /* 2730 */ 1649, 2056, 1649, 1649, 2033, 2022, 643, 2024, 2025, 638, - /* 2740 */ 2021, 633, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, - /* 2750 */ 1649, 1649, 1649, 1649, 1649, 2020, 1649, 1649, 1649, 2056, - /* 2760 */ 1649, 2021, 2032, 2022, 643, 2024, 2025, 638, 1649, 633, - /* 2770 */ 1649, 2039, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 640, - /* 2780 */ 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649, 1649, 1649, - /* 2790 */ 1649, 1649, 2039, 1649, 1649, 1649, 1649, 1649, 1649, 1649, - /* 2800 */ 640, 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649, 1649, - /* 2810 */ 1649, 1649, 1649, 1649, 1649, 2020, 1649, 1649, 1649, 2056, - /* 2820 */ 1649, 1649, 2031, 2022, 643, 2024, 2025, 638, 1649, 633, - /* 2830 */ 1649, 1649, 1649, 1649, 2021, 1649, 2020, 1649, 1649, 1649, - /* 2840 */ 2056, 1649, 1649, 338, 2022, 643, 2024, 2025, 638, 1649, - /* 2850 */ 633, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 2021, 1649, - /* 2860 */ 1649, 1649, 1649, 1649, 1649, 2039, 1649, 1649, 1649, 1649, - /* 2870 */ 1649, 1649, 1649, 640, 1649, 1649, 1649, 1649, 1989, 1649, - /* 2880 */ 639, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 2039, - /* 2890 */ 1649, 1649, 1649, 1649, 1649, 1649, 1649, 640, 1649, 1649, - /* 2900 */ 1649, 1649, 1989, 1649, 639, 1649, 1649, 1649, 1649, 2020, - /* 2910 */ 1649, 1649, 1649, 2056, 1649, 2021, 339, 2022, 643, 2024, - /* 2920 */ 2025, 638, 1649, 633, 1649, 1649, 1649, 1649, 1649, 1649, - /* 2930 */ 1649, 1649, 1649, 2020, 1649, 2021, 1649, 2056, 1649, 1649, - /* 2940 */ 335, 2022, 643, 2024, 2025, 638, 2039, 633, 1649, 1649, - /* 2950 */ 1649, 1649, 1649, 1649, 640, 1649, 1649, 1649, 1649, 1989, - /* 2960 */ 1649, 639, 1649, 1649, 1649, 1649, 2039, 1649, 1649, 1649, - /* 2970 */ 1649, 1649, 1649, 1649, 640, 1649, 1649, 1649, 1649, 1989, - /* 2980 */ 1649, 639, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, - /* 2990 */ 2020, 1649, 2021, 1649, 2056, 1649, 1649, 340, 2022, 643, - /* 3000 */ 2024, 2025, 638, 1649, 633, 1649, 1649, 1649, 1649, 1649, - /* 3010 */ 641, 1649, 1649, 1649, 2056, 1649, 1649, 317, 2022, 643, - /* 3020 */ 2024, 2025, 638, 2039, 633, 1649, 1649, 1649, 1649, 1649, - /* 3030 */ 1649, 640, 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649, - /* 3040 */ 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, - /* 3050 */ 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, - /* 3060 */ 1649, 1649, 1649, 1649, 1649, 1649, 1649, 2020, 1649, 1649, - /* 3070 */ 1649, 2056, 1649, 1649, 316, 2022, 643, 2024, 2025, 638, - /* 3080 */ 1649, 633, + /* 0 */ 1937, 2201, 1796, 605, 480, 2196, 481, 1700, 489, 1807, + /* 10 */ 481, 1700, 45, 43, 1588, 1935, 617, 31, 176, 178, + /* 20 */ 378, 2200, 1437, 38, 37, 2197, 2199, 44, 42, 41, + /* 30 */ 40, 39, 1858, 1518, 140, 1435, 1462, 2037, 1871, 346, + /* 40 */ 1920, 2023, 38, 37, 611, 356, 44, 42, 41, 40, + /* 50 */ 39, 423, 2019, 2201, 1869, 38, 37, 2196, 1513, 44, + /* 60 */ 42, 41, 40, 39, 18, 498, 383, 1465, 2055, 1864, + /* 70 */ 1866, 1443, 1662, 2200, 167, 605, 644, 2197, 2198, 1772, + /* 80 */ 1151, 2005, 1150, 646, 45, 43, 2015, 2021, 359, 568, + /* 90 */ 1132, 329, 378, 2196, 1437, 220, 14, 640, 339, 181, + /* 100 */ 2133, 2134, 548, 138, 2138, 1518, 140, 1435, 2202, 182, + /* 110 */ 600, 1152, 2036, 2197, 594, 546, 2072, 544, 737, 323, + /* 120 */ 2038, 650, 2040, 2041, 645, 643, 640, 631, 2090, 1134, + /* 130 */ 1513, 1137, 1138, 1520, 1521, 629, 18, 479, 391, 1547, + /* 140 */ 484, 1706, 390, 1443, 1687, 1259, 672, 671, 670, 1263, + /* 150 */ 669, 1265, 1266, 668, 1268, 665, 176, 1274, 662, 1276, + /* 160 */ 1277, 659, 656, 1493, 1503, 1937, 605, 615, 14, 1519, + /* 170 */ 1522, 266, 2133, 604, 381, 133, 603, 369, 1921, 2196, + /* 180 */ 1934, 617, 161, 568, 1438, 616, 1436, 2196, 2005, 357, + /* 190 */ 737, 1820, 629, 269, 592, 182, 1548, 140, 1869, 2197, + /* 200 */ 594, 498, 2202, 182, 629, 1520, 1521, 2197, 594, 588, + /* 210 */ 1441, 1442, 246, 1492, 1495, 1496, 1497, 1498, 1499, 1500, + /* 220 */ 1501, 1502, 642, 638, 1511, 1512, 1514, 1515, 1516, 1517, + /* 230 */ 2, 61, 496, 92, 1930, 1493, 1503, 583, 106, 684, + /* 240 */ 122, 1519, 1522, 121, 120, 119, 118, 117, 116, 115, + /* 250 */ 114, 113, 141, 1592, 350, 166, 1438, 1676, 1436, 1462, + /* 260 */ 1810, 607, 180, 2133, 2134, 1461, 138, 2138, 48, 34, + /* 270 */ 376, 1542, 1543, 1544, 1545, 1546, 1550, 1551, 1552, 1553, + /* 280 */ 48, 61, 1441, 1442, 1219, 1492, 1495, 1496, 1497, 1498, + /* 290 */ 1499, 1500, 1501, 1502, 642, 638, 1511, 1512, 1514, 1515, + /* 300 */ 1516, 1517, 2, 2023, 11, 45, 43, 44, 42, 41, + /* 310 */ 40, 39, 1462, 378, 2019, 1437, 351, 740, 349, 348, + /* 320 */ 1221, 521, 589, 584, 577, 523, 1518, 1462, 1435, 488, + /* 330 */ 2037, 294, 484, 1706, 605, 35, 287, 38, 37, 601, + /* 340 */ 410, 44, 42, 41, 40, 39, 175, 522, 2015, 2021, + /* 350 */ 360, 1513, 730, 726, 722, 718, 292, 18, 86, 640, + /* 360 */ 486, 2055, 412, 408, 1443, 140, 482, 557, 415, 647, + /* 370 */ 414, 2140, 136, 1151, 2005, 1150, 646, 45, 43, 1523, + /* 380 */ 1463, 1813, 2201, 185, 11, 378, 9, 1437, 61, 14, + /* 390 */ 278, 279, 65, 107, 413, 277, 285, 2137, 1518, 1464, + /* 400 */ 1435, 632, 1494, 2097, 1152, 2036, 1733, 630, 1686, 2072, + /* 410 */ 630, 737, 168, 2038, 650, 2040, 2041, 645, 1665, 640, + /* 420 */ 185, 132, 676, 1513, 187, 1862, 1520, 1521, 519, 626, + /* 430 */ 183, 2133, 2134, 185, 138, 2138, 1443, 630, 1818, 122, + /* 440 */ 11, 1818, 121, 120, 119, 118, 117, 116, 115, 114, + /* 450 */ 113, 132, 2005, 569, 2162, 194, 1493, 1503, 524, 1871, + /* 460 */ 100, 46, 1519, 1522, 272, 634, 366, 2097, 1818, 271, + /* 470 */ 1357, 1358, 534, 533, 532, 1869, 1650, 1438, 2026, 1436, + /* 480 */ 137, 528, 1811, 737, 61, 527, 1401, 461, 240, 1901, + /* 490 */ 526, 531, 83, 1302, 1303, 82, 525, 236, 1520, 1521, + /* 500 */ 1865, 1866, 1463, 1441, 1442, 1657, 1492, 1495, 1496, 1497, + /* 510 */ 1498, 1499, 1500, 1501, 1502, 642, 638, 1511, 1512, 1514, + /* 520 */ 1515, 1516, 1517, 2, 534, 533, 532, 2028, 1493, 1503, + /* 530 */ 1664, 1871, 137, 528, 1519, 1522, 630, 527, 344, 630, + /* 540 */ 185, 1464, 526, 531, 268, 198, 197, 1869, 525, 1438, + /* 550 */ 54, 1436, 616, 421, 131, 130, 129, 128, 127, 126, + /* 560 */ 125, 124, 123, 1412, 1413, 417, 1181, 1818, 460, 416, + /* 570 */ 1818, 41, 40, 39, 2037, 1441, 1442, 616, 1492, 1495, + /* 580 */ 1496, 1497, 1498, 1499, 1500, 1501, 1502, 642, 638, 1511, + /* 590 */ 1512, 1514, 1515, 1516, 1517, 2, 45, 43, 1446, 614, + /* 600 */ 1916, 1930, 1182, 1656, 378, 2055, 1437, 630, 593, 630, + /* 610 */ 568, 190, 2196, 647, 2196, 1374, 1375, 1518, 2005, 1435, + /* 620 */ 646, 422, 221, 431, 625, 61, 1930, 592, 182, 2202, + /* 630 */ 182, 49, 2197, 594, 2197, 594, 185, 171, 1818, 1685, + /* 640 */ 1818, 441, 1513, 515, 511, 507, 503, 218, 630, 2036, + /* 650 */ 440, 1373, 1376, 2072, 1616, 1443, 110, 2038, 650, 2040, + /* 660 */ 2041, 645, 446, 640, 424, 370, 1528, 1684, 45, 43, + /* 670 */ 2125, 1465, 1462, 164, 2124, 2121, 378, 425, 1437, 1818, + /* 680 */ 46, 539, 1820, 2005, 87, 1683, 268, 216, 1443, 1518, + /* 690 */ 1682, 1435, 142, 38, 37, 2096, 549, 44, 42, 41, + /* 700 */ 40, 39, 737, 580, 579, 1614, 1615, 1617, 1618, 1619, + /* 710 */ 234, 2005, 1871, 1809, 1513, 38, 37, 1520, 1521, 44, + /* 720 */ 42, 41, 40, 39, 2019, 542, 33, 1443, 1870, 2005, + /* 730 */ 536, 1795, 38, 37, 2005, 233, 44, 42, 41, 40, + /* 740 */ 39, 1681, 593, 1680, 1679, 1549, 2196, 1493, 1503, 1449, + /* 750 */ 630, 27, 14, 1519, 1522, 215, 209, 675, 2015, 2021, + /* 760 */ 214, 592, 182, 494, 447, 1803, 2197, 594, 1438, 640, + /* 770 */ 1436, 164, 69, 1678, 737, 68, 2055, 185, 1675, 207, + /* 780 */ 1821, 1818, 1627, 185, 587, 2005, 1974, 2005, 2005, 1520, + /* 790 */ 1521, 1674, 13, 12, 1441, 1442, 696, 1492, 1495, 1496, + /* 800 */ 1497, 1498, 1499, 1500, 1501, 1502, 642, 638, 1511, 1512, + /* 810 */ 1514, 1515, 1516, 1517, 2, 1494, 191, 2005, 32, 1493, + /* 820 */ 1503, 332, 2005, 1460, 682, 1519, 1522, 235, 1554, 586, + /* 830 */ 454, 86, 237, 468, 1871, 2005, 467, 1137, 1138, 682, + /* 840 */ 1438, 371, 1436, 154, 153, 679, 678, 677, 151, 1673, + /* 850 */ 1869, 437, 1465, 469, 1814, 1794, 439, 1916, 154, 153, + /* 860 */ 679, 678, 677, 151, 530, 529, 1441, 1442, 192, 1492, + /* 870 */ 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 642, 638, + /* 880 */ 1511, 1512, 1514, 1515, 1516, 1517, 2, 381, 1561, 563, + /* 890 */ 89, 334, 165, 2005, 355, 164, 550, 307, 347, 1730, + /* 900 */ 630, 38, 37, 1793, 1820, 44, 42, 41, 40, 39, + /* 910 */ 427, 305, 72, 1805, 497, 71, 1672, 8, 684, 38, + /* 920 */ 37, 1871, 384, 44, 42, 41, 40, 39, 382, 301, + /* 930 */ 164, 1818, 1848, 203, 476, 474, 471, 1869, 2140, 1820, + /* 940 */ 465, 708, 706, 459, 458, 457, 456, 453, 452, 451, + /* 950 */ 450, 449, 445, 444, 443, 442, 331, 434, 433, 432, + /* 960 */ 2005, 429, 428, 345, 2136, 714, 713, 712, 711, 388, + /* 970 */ 61, 710, 709, 144, 704, 703, 702, 701, 700, 699, + /* 980 */ 698, 156, 694, 693, 692, 387, 386, 689, 688, 687, + /* 990 */ 686, 685, 630, 630, 1671, 38, 37, 245, 1998, 44, + /* 1000 */ 42, 41, 40, 39, 1437, 630, 1815, 238, 1604, 108, + /* 1010 */ 2037, 682, 2200, 630, 630, 630, 1585, 1435, 697, 627, + /* 1020 */ 1788, 1670, 1669, 1818, 1818, 1668, 1667, 628, 564, 609, + /* 1030 */ 154, 153, 679, 678, 677, 151, 1818, 1916, 2005, 523, + /* 1040 */ 51, 2055, 3, 568, 1818, 1818, 1818, 2196, 196, 608, + /* 1050 */ 80, 79, 420, 1443, 2005, 189, 646, 630, 163, 2037, + /* 1060 */ 2140, 522, 2202, 182, 152, 2005, 2005, 2197, 594, 2005, + /* 1070 */ 2005, 613, 680, 2023, 330, 1862, 1462, 406, 73, 404, + /* 1080 */ 400, 396, 393, 413, 2019, 2036, 2135, 244, 1818, 2072, + /* 1090 */ 2055, 2024, 109, 2038, 650, 2040, 2041, 645, 647, 640, + /* 1100 */ 737, 597, 2019, 2005, 179, 646, 2125, 2145, 1581, 630, + /* 1110 */ 372, 2121, 681, 1991, 146, 1862, 134, 53, 2015, 2021, + /* 1120 */ 373, 630, 185, 282, 184, 1581, 2037, 90, 81, 640, + /* 1130 */ 1999, 1801, 2151, 152, 2036, 288, 2015, 2021, 2072, 674, + /* 1140 */ 1818, 109, 2038, 650, 2040, 2041, 645, 640, 640, 630, + /* 1150 */ 152, 143, 1818, 149, 2096, 2125, 241, 2055, 2037, 372, + /* 1160 */ 2121, 398, 1720, 385, 226, 608, 1438, 224, 1436, 1713, + /* 1170 */ 2005, 228, 646, 230, 227, 568, 229, 63, 232, 2196, + /* 1180 */ 1818, 231, 63, 250, 535, 552, 1407, 551, 637, 2055, + /* 1190 */ 1677, 537, 1441, 1442, 2202, 182, 1711, 647, 641, 2197, + /* 1200 */ 594, 2036, 2005, 1410, 646, 2072, 1445, 2037, 109, 2038, + /* 1210 */ 650, 2040, 2041, 645, 52, 640, 1659, 1660, 540, 1494, + /* 1220 */ 179, 567, 2125, 152, 47, 1707, 372, 2121, 275, 2165, + /* 1230 */ 1613, 70, 150, 2036, 152, 1612, 252, 2072, 2055, 1773, + /* 1240 */ 109, 2038, 650, 2040, 2041, 645, 647, 640, 2152, 13, + /* 1250 */ 12, 2005, 2216, 646, 2125, 105, 63, 555, 372, 2121, + /* 1260 */ 47, 1584, 47, 654, 150, 102, 2037, 263, 581, 2159, + /* 1270 */ 219, 152, 135, 690, 732, 257, 612, 1371, 596, 150, + /* 1280 */ 2056, 280, 2036, 389, 622, 284, 2072, 1252, 1701, 109, + /* 1290 */ 2038, 650, 2040, 2041, 645, 1200, 640, 2055, 691, 1925, + /* 1300 */ 2037, 2216, 568, 2125, 1859, 647, 2196, 372, 2121, 1555, + /* 1310 */ 2005, 2155, 646, 1504, 606, 300, 1280, 1284, 2172, 265, + /* 1320 */ 1198, 2202, 182, 262, 1291, 1289, 2197, 594, 598, 1, + /* 1330 */ 4, 2055, 155, 392, 1539, 397, 1394, 295, 195, 647, + /* 1340 */ 343, 2036, 426, 1465, 2005, 2072, 646, 1926, 109, 2038, + /* 1350 */ 650, 2040, 2041, 645, 430, 640, 463, 1448, 435, 1460, + /* 1360 */ 2216, 448, 2125, 1918, 462, 455, 372, 2121, 464, 470, + /* 1370 */ 472, 200, 473, 2037, 475, 2036, 477, 575, 1466, 2072, + /* 1380 */ 478, 487, 109, 2038, 650, 2040, 2041, 645, 1468, 640, + /* 1390 */ 206, 490, 375, 374, 2216, 1463, 2125, 208, 491, 1467, + /* 1400 */ 372, 2121, 1451, 492, 2055, 1469, 493, 211, 495, 499, + /* 1410 */ 213, 2190, 647, 1518, 84, 1444, 1154, 2005, 518, 646, + /* 1420 */ 85, 217, 2037, 516, 517, 112, 333, 88, 520, 1808, + /* 1430 */ 1980, 554, 556, 1979, 148, 296, 223, 239, 1513, 1804, + /* 1440 */ 558, 225, 242, 559, 565, 2156, 157, 582, 2036, 158, + /* 1450 */ 1806, 1443, 2072, 2055, 1802, 109, 2038, 650, 2040, 2041, + /* 1460 */ 645, 647, 640, 159, 160, 2171, 2005, 2216, 646, 2125, + /* 1470 */ 620, 572, 562, 372, 2121, 2166, 7, 2170, 578, 361, + /* 1480 */ 591, 571, 585, 573, 2144, 2147, 2037, 248, 251, 256, + /* 1490 */ 172, 570, 258, 259, 2219, 139, 260, 2036, 636, 362, + /* 1500 */ 264, 2072, 602, 599, 109, 2038, 650, 2040, 2041, 645, + /* 1510 */ 1581, 640, 1464, 2195, 610, 270, 2100, 2055, 2125, 261, + /* 1520 */ 2141, 365, 372, 2121, 1470, 647, 95, 297, 1931, 623, + /* 1530 */ 2005, 618, 646, 619, 298, 1945, 1944, 624, 1943, 368, + /* 1540 */ 97, 99, 60, 299, 1819, 2106, 101, 1789, 652, 291, + /* 1550 */ 302, 1863, 733, 326, 2037, 734, 311, 335, 336, 736, + /* 1560 */ 325, 2036, 50, 315, 1452, 2072, 1447, 306, 109, 2038, + /* 1570 */ 650, 2040, 2041, 645, 1997, 640, 1996, 1995, 304, 77, + /* 1580 */ 2098, 1992, 2125, 394, 2037, 2055, 372, 2121, 395, 1428, + /* 1590 */ 1455, 1457, 1429, 647, 188, 399, 1990, 401, 2005, 402, + /* 1600 */ 646, 403, 1989, 638, 1511, 1512, 1514, 1515, 1516, 1517, + /* 1610 */ 405, 1988, 1987, 407, 2037, 2055, 409, 1986, 78, 411, + /* 1620 */ 1397, 1396, 1957, 647, 1956, 1955, 1954, 418, 2005, 2036, + /* 1630 */ 646, 419, 1953, 2072, 1348, 1909, 109, 2038, 650, 2040, + /* 1640 */ 2041, 645, 1908, 640, 2037, 2055, 1906, 145, 633, 1905, + /* 1650 */ 2125, 1904, 1907, 647, 372, 2121, 1903, 1902, 2005, 2036, + /* 1660 */ 646, 1900, 1899, 2072, 193, 436, 110, 2038, 650, 2040, + /* 1670 */ 2041, 645, 1898, 640, 1897, 2055, 438, 1911, 2037, 1896, + /* 1680 */ 2125, 1895, 1894, 647, 635, 2121, 1893, 1892, 2005, 648, + /* 1690 */ 646, 1891, 1890, 2072, 1889, 1888, 110, 2038, 650, 2040, + /* 1700 */ 2041, 645, 1887, 640, 1886, 2037, 1885, 1884, 1883, 2055, + /* 1710 */ 2125, 1882, 147, 1881, 338, 2121, 1880, 647, 1879, 2036, + /* 1720 */ 1910, 1878, 2005, 2072, 646, 1877, 169, 2038, 650, 2040, + /* 1730 */ 2041, 645, 1350, 640, 1876, 1875, 2055, 1874, 1873, 466, + /* 1740 */ 1872, 1736, 199, 1735, 647, 1734, 201, 1227, 202, 2005, + /* 1750 */ 1732, 646, 2025, 2036, 2037, 1696, 204, 2072, 75, 177, + /* 1760 */ 168, 2038, 650, 2040, 2041, 645, 1695, 640, 1140, 483, + /* 1770 */ 1139, 485, 205, 1970, 1964, 76, 1952, 1951, 595, 2217, + /* 1780 */ 2036, 210, 212, 1929, 2072, 2055, 1797, 110, 2038, 650, + /* 1790 */ 2040, 2041, 645, 647, 640, 1174, 1731, 1729, 2005, 500, + /* 1800 */ 646, 2125, 2163, 1727, 502, 501, 2122, 504, 505, 506, + /* 1810 */ 1725, 509, 1723, 508, 510, 512, 2037, 513, 1710, 1709, + /* 1820 */ 514, 1692, 1799, 1296, 1295, 1798, 1218, 1217, 62, 2036, + /* 1830 */ 222, 705, 1721, 2072, 1216, 1215, 317, 2038, 650, 2040, + /* 1840 */ 2041, 645, 707, 640, 1212, 1210, 1211, 2055, 2037, 1209, + /* 1850 */ 352, 1714, 353, 1712, 538, 647, 354, 1691, 1690, 541, + /* 1860 */ 2005, 543, 646, 1689, 545, 547, 111, 26, 1417, 1969, + /* 1870 */ 1418, 1416, 1403, 1963, 55, 1950, 560, 1948, 66, 2055, + /* 1880 */ 590, 1420, 561, 162, 367, 2201, 19, 647, 16, 28, + /* 1890 */ 247, 2036, 2005, 243, 646, 2072, 358, 2037, 169, 2038, + /* 1900 */ 650, 2040, 2041, 645, 1629, 640, 566, 574, 58, 576, + /* 1910 */ 249, 5, 59, 1611, 2037, 254, 6, 1603, 20, 255, + /* 1920 */ 30, 2026, 64, 2036, 1649, 17, 1644, 2072, 2055, 21, + /* 1930 */ 324, 2038, 650, 2040, 2041, 645, 644, 640, 1650, 1643, + /* 1940 */ 170, 2005, 363, 646, 253, 2055, 2037, 1648, 29, 1647, + /* 1950 */ 377, 2218, 91, 647, 57, 364, 1578, 1577, 2005, 1949, + /* 1960 */ 646, 1947, 1946, 267, 173, 1928, 93, 94, 273, 1927, + /* 1970 */ 96, 2037, 2036, 621, 56, 22, 2072, 2055, 23, 323, + /* 1980 */ 2038, 650, 2040, 2041, 645, 647, 640, 274, 2091, 2036, + /* 1990 */ 2005, 1609, 646, 2072, 102, 2037, 324, 2038, 650, 2040, + /* 2000 */ 2041, 645, 2055, 640, 276, 281, 283, 379, 12, 67, + /* 2010 */ 647, 286, 1453, 174, 98, 2005, 1530, 646, 1540, 2075, + /* 2020 */ 2037, 553, 10, 1508, 1506, 2072, 2055, 1505, 319, 2038, + /* 2030 */ 650, 2040, 2041, 645, 647, 640, 639, 1529, 36, 2005, + /* 2040 */ 15, 646, 24, 649, 186, 1477, 2036, 1485, 25, 653, + /* 2050 */ 2072, 2055, 651, 324, 2038, 650, 2040, 2041, 645, 647, + /* 2060 */ 640, 380, 657, 655, 2005, 1281, 646, 1278, 1275, 658, + /* 2070 */ 2036, 660, 661, 663, 2072, 1269, 664, 308, 2038, 650, + /* 2080 */ 2040, 2041, 645, 2037, 640, 1267, 666, 667, 1258, 103, + /* 2090 */ 673, 289, 1290, 1286, 1273, 2036, 104, 1272, 74, 2072, + /* 2100 */ 1172, 1271, 309, 2038, 650, 2040, 2041, 645, 683, 640, + /* 2110 */ 2037, 1206, 1270, 1205, 2055, 1204, 1203, 1202, 1201, 1225, + /* 2120 */ 1199, 1197, 647, 1196, 1195, 695, 1193, 2005, 1192, 646, + /* 2130 */ 1191, 290, 2037, 1189, 1190, 1188, 1187, 1220, 1222, 1184, + /* 2140 */ 1183, 2055, 1180, 1179, 1178, 1177, 1728, 716, 715, 647, + /* 2150 */ 1726, 719, 1724, 717, 2005, 1722, 646, 720, 2036, 721, + /* 2160 */ 723, 1708, 2072, 2055, 727, 310, 2038, 650, 2040, 2041, + /* 2170 */ 645, 647, 640, 725, 724, 728, 2005, 729, 646, 731, + /* 2180 */ 1129, 1688, 293, 735, 738, 2036, 1439, 303, 739, 2072, + /* 2190 */ 1663, 1663, 316, 2038, 650, 2040, 2041, 645, 1663, 640, + /* 2200 */ 1663, 1663, 1663, 1663, 1663, 1663, 1663, 2036, 1663, 1663, + /* 2210 */ 1663, 2072, 2037, 1663, 320, 2038, 650, 2040, 2041, 645, + /* 2220 */ 1663, 640, 1663, 1663, 1663, 1663, 1663, 1663, 1663, 2037, + /* 2230 */ 1663, 1663, 1663, 1663, 1663, 1663, 1663, 1663, 1663, 1663, + /* 2240 */ 1663, 1663, 1663, 2055, 1663, 1663, 2037, 1663, 1663, 1663, + /* 2250 */ 1663, 647, 1663, 1663, 1663, 1663, 2005, 1663, 646, 1663, + /* 2260 */ 2055, 1663, 1663, 1663, 1663, 1663, 1663, 1663, 647, 1663, + /* 2270 */ 1663, 1663, 1663, 2005, 1663, 646, 1663, 2055, 2037, 1663, + /* 2280 */ 1663, 1663, 1663, 1663, 1663, 647, 1663, 2036, 1663, 1663, + /* 2290 */ 2005, 2072, 646, 1663, 312, 2038, 650, 2040, 2041, 645, + /* 2300 */ 1663, 640, 1663, 2037, 2036, 1663, 1663, 1663, 2072, 2055, + /* 2310 */ 1663, 321, 2038, 650, 2040, 2041, 645, 647, 640, 1663, + /* 2320 */ 1663, 2036, 2005, 1663, 646, 2072, 1663, 2037, 313, 2038, + /* 2330 */ 650, 2040, 2041, 645, 2055, 640, 1663, 1663, 1663, 1663, + /* 2340 */ 1663, 1663, 647, 1663, 1663, 1663, 1663, 2005, 1663, 646, + /* 2350 */ 1663, 1663, 2037, 2036, 1663, 1663, 1663, 2072, 2055, 1663, + /* 2360 */ 322, 2038, 650, 2040, 2041, 645, 647, 640, 1663, 1663, + /* 2370 */ 1663, 2005, 1663, 646, 1663, 1663, 1663, 1663, 2036, 1663, + /* 2380 */ 1663, 1663, 2072, 2055, 1663, 314, 2038, 650, 2040, 2041, + /* 2390 */ 645, 647, 640, 1663, 1663, 1663, 2005, 1663, 646, 1663, + /* 2400 */ 1663, 1663, 2036, 1663, 1663, 1663, 2072, 1663, 1663, 327, + /* 2410 */ 2038, 650, 2040, 2041, 645, 2037, 640, 1663, 1663, 1663, + /* 2420 */ 1663, 1663, 1663, 1663, 1663, 1663, 1663, 2036, 1663, 1663, + /* 2430 */ 1663, 2072, 1663, 1663, 328, 2038, 650, 2040, 2041, 645, + /* 2440 */ 1663, 640, 2037, 1663, 1663, 1663, 2055, 1663, 1663, 1663, + /* 2450 */ 1663, 1663, 1663, 1663, 647, 1663, 1663, 1663, 1663, 2005, + /* 2460 */ 1663, 646, 1663, 1663, 2037, 1663, 1663, 1663, 1663, 1663, + /* 2470 */ 1663, 1663, 1663, 2055, 1663, 1663, 1663, 1663, 1663, 1663, + /* 2480 */ 1663, 647, 1663, 1663, 1663, 1663, 2005, 1663, 646, 1663, + /* 2490 */ 2036, 1663, 1663, 1663, 2072, 2055, 1663, 2049, 2038, 650, + /* 2500 */ 2040, 2041, 645, 647, 640, 1663, 1663, 1663, 2005, 1663, + /* 2510 */ 646, 1663, 1663, 1663, 1663, 1663, 1663, 2036, 1663, 1663, + /* 2520 */ 1663, 2072, 1663, 1663, 2048, 2038, 650, 2040, 2041, 645, + /* 2530 */ 1663, 640, 1663, 1663, 1663, 1663, 1663, 1663, 1663, 2036, + /* 2540 */ 1663, 1663, 1663, 2072, 2037, 1663, 2047, 2038, 650, 2040, + /* 2550 */ 2041, 645, 1663, 640, 1663, 1663, 1663, 1663, 1663, 1663, + /* 2560 */ 1663, 2037, 1663, 1663, 1663, 1663, 1663, 1663, 1663, 1663, + /* 2570 */ 1663, 1663, 1663, 1663, 1663, 2055, 1663, 1663, 2037, 1663, + /* 2580 */ 1663, 1663, 1663, 647, 1663, 1663, 1663, 1663, 2005, 1663, + /* 2590 */ 646, 1663, 2055, 1663, 1663, 1663, 1663, 1663, 1663, 1663, + /* 2600 */ 647, 1663, 1663, 1663, 1663, 2005, 1663, 646, 1663, 2055, + /* 2610 */ 2037, 1663, 1663, 1663, 1663, 1663, 1663, 647, 1663, 2036, + /* 2620 */ 1663, 1663, 2005, 2072, 646, 1663, 340, 2038, 650, 2040, + /* 2630 */ 2041, 645, 1663, 640, 1663, 2037, 2036, 1663, 1663, 1663, + /* 2640 */ 2072, 2055, 1663, 341, 2038, 650, 2040, 2041, 645, 647, + /* 2650 */ 640, 1663, 1663, 2036, 2005, 1663, 646, 2072, 1663, 2037, + /* 2660 */ 337, 2038, 650, 2040, 2041, 645, 2055, 640, 1663, 1663, + /* 2670 */ 1663, 1663, 1663, 1663, 647, 1663, 1663, 1663, 1663, 2005, + /* 2680 */ 1663, 646, 1663, 1663, 1663, 2036, 1663, 1663, 1663, 2072, + /* 2690 */ 2055, 1663, 342, 2038, 650, 2040, 2041, 645, 647, 640, + /* 2700 */ 1663, 1663, 1663, 2005, 1663, 646, 1663, 1663, 1663, 1663, + /* 2710 */ 648, 1663, 1663, 1663, 2072, 1663, 1663, 319, 2038, 650, + /* 2720 */ 2040, 2041, 645, 1663, 640, 1663, 1663, 1663, 1663, 1663, + /* 2730 */ 1663, 1663, 1663, 1663, 2036, 1663, 1663, 1663, 2072, 1663, + /* 2740 */ 1663, 318, 2038, 650, 2040, 2041, 645, 1663, 640, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 333, 329, 335, 336, 0, 437, 361, 392, 362, 441, - /* 10 */ 361, 360, 12, 13, 14, 14, 375, 360, 367, 373, - /* 20 */ 20, 20, 22, 362, 456, 457, 337, 376, 387, 461, - /* 30 */ 462, 390, 391, 33, 373, 35, 329, 437, 381, 382, - /* 40 */ 362, 441, 8, 9, 375, 373, 12, 13, 14, 15, - /* 50 */ 16, 373, 437, 407, 408, 409, 441, 457, 58, 390, - /* 60 */ 391, 461, 462, 63, 418, 359, 377, 360, 407, 408, - /* 70 */ 70, 456, 457, 352, 337, 368, 461, 462, 372, 418, - /* 80 */ 373, 360, 375, 12, 13, 407, 408, 409, 437, 356, - /* 90 */ 369, 20, 441, 22, 360, 95, 418, 63, 12, 13, - /* 100 */ 14, 15, 16, 369, 33, 368, 35, 456, 457, 426, - /* 110 */ 427, 404, 461, 462, 328, 408, 330, 117, 411, 412, - /* 120 */ 413, 414, 415, 416, 417, 418, 419, 420, 58, 58, - /* 130 */ 20, 362, 132, 133, 63, 402, 371, 392, 104, 374, - /* 140 */ 375, 70, 373, 44, 108, 109, 110, 111, 112, 113, - /* 150 */ 114, 115, 116, 117, 118, 151, 120, 121, 122, 123, - /* 160 */ 124, 125, 162, 163, 160, 95, 95, 97, 168, 169, - /* 170 */ 433, 434, 435, 0, 437, 438, 407, 408, 441, 14, - /* 180 */ 15, 16, 437, 183, 360, 185, 441, 418, 117, 37, - /* 190 */ 4, 367, 20, 456, 457, 161, 374, 375, 461, 462, - /* 200 */ 376, 456, 457, 132, 133, 344, 461, 462, 208, 209, - /* 210 */ 349, 211, 212, 213, 214, 215, 216, 217, 218, 219, - /* 220 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 43, - /* 230 */ 0, 45, 46, 162, 163, 62, 20, 343, 21, 168, - /* 240 */ 169, 24, 25, 26, 27, 28, 29, 30, 31, 32, - /* 250 */ 98, 357, 100, 101, 183, 103, 185, 8, 9, 107, - /* 260 */ 366, 12, 13, 14, 15, 16, 44, 233, 234, 235, - /* 270 */ 236, 237, 238, 239, 240, 241, 242, 243, 48, 208, - /* 280 */ 209, 129, 211, 212, 213, 214, 215, 216, 217, 218, - /* 290 */ 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - /* 300 */ 352, 230, 12, 13, 132, 133, 20, 33, 360, 20, - /* 310 */ 20, 95, 22, 0, 337, 367, 246, 369, 329, 20, - /* 320 */ 337, 22, 48, 33, 376, 35, 329, 208, 54, 55, - /* 330 */ 56, 57, 58, 337, 21, 127, 95, 24, 25, 26, - /* 340 */ 27, 28, 29, 30, 31, 32, 20, 351, 58, 14, - /* 350 */ 51, 368, 4, 63, 358, 20, 333, 360, 335, 336, - /* 360 */ 70, 384, 373, 386, 368, 368, 267, 107, 94, 410, - /* 370 */ 373, 97, 375, 12, 13, 14, 257, 258, 259, 260, - /* 380 */ 261, 20, 329, 22, 95, 95, 126, 127, 128, 129, - /* 390 */ 130, 131, 341, 0, 33, 436, 35, 329, 190, 191, - /* 400 */ 20, 404, 194, 410, 196, 408, 355, 117, 411, 412, - /* 410 */ 413, 414, 415, 416, 363, 418, 433, 434, 435, 58, - /* 420 */ 437, 438, 132, 133, 175, 20, 373, 20, 360, 436, - /* 430 */ 4, 70, 360, 20, 334, 22, 368, 337, 338, 165, - /* 440 */ 166, 373, 334, 375, 170, 337, 338, 173, 35, 452, - /* 450 */ 453, 329, 162, 163, 382, 62, 95, 35, 168, 169, - /* 460 */ 62, 8, 9, 189, 51, 12, 13, 14, 15, 16, - /* 470 */ 20, 95, 404, 183, 0, 185, 408, 62, 117, 411, - /* 480 */ 412, 413, 414, 415, 416, 39, 418, 246, 162, 163, - /* 490 */ 326, 269, 70, 132, 133, 373, 337, 162, 208, 209, - /* 500 */ 95, 211, 212, 213, 214, 215, 216, 217, 218, 219, - /* 510 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 270, - /* 520 */ 337, 95, 368, 162, 163, 346, 347, 368, 337, 168, - /* 530 */ 169, 463, 464, 379, 351, 246, 337, 20, 20, 65, - /* 540 */ 66, 67, 351, 178, 183, 161, 185, 73, 74, 96, - /* 550 */ 351, 368, 78, 360, 392, 95, 392, 83, 84, 368, - /* 560 */ 396, 368, 106, 89, 199, 200, 230, 368, 232, 208, - /* 570 */ 209, 164, 211, 212, 213, 214, 215, 216, 217, 218, - /* 580 */ 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - /* 590 */ 12, 13, 433, 434, 435, 247, 437, 438, 20, 437, - /* 600 */ 22, 437, 19, 441, 410, 441, 413, 79, 437, 1, - /* 610 */ 2, 33, 441, 35, 329, 337, 33, 233, 456, 457, - /* 620 */ 456, 457, 246, 461, 462, 461, 462, 243, 457, 351, - /* 630 */ 436, 48, 461, 462, 337, 20, 58, 54, 55, 56, - /* 640 */ 57, 58, 182, 337, 184, 360, 368, 360, 70, 132, - /* 650 */ 133, 246, 360, 368, 367, 346, 347, 351, 373, 367, - /* 660 */ 375, 12, 13, 376, 343, 137, 138, 207, 376, 20, - /* 670 */ 20, 22, 246, 95, 368, 3, 421, 94, 337, 424, - /* 680 */ 97, 384, 33, 386, 35, 168, 169, 366, 160, 404, - /* 690 */ 392, 245, 20, 408, 396, 117, 411, 412, 413, 414, - /* 700 */ 415, 416, 0, 418, 96, 20, 246, 58, 14, 368, - /* 710 */ 132, 133, 22, 130, 20, 337, 8, 9, 126, 70, - /* 720 */ 12, 13, 14, 15, 16, 35, 24, 25, 26, 27, - /* 730 */ 28, 29, 30, 31, 32, 437, 337, 230, 453, 441, - /* 740 */ 162, 163, 360, 348, 95, 350, 168, 169, 165, 367, - /* 750 */ 351, 106, 44, 170, 456, 457, 167, 358, 376, 461, - /* 760 */ 462, 183, 384, 185, 386, 329, 117, 368, 96, 422, - /* 770 */ 187, 424, 189, 432, 433, 434, 435, 162, 437, 438, - /* 780 */ 329, 132, 133, 70, 192, 193, 208, 209, 341, 211, - /* 790 */ 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, - /* 800 */ 222, 223, 224, 225, 226, 227, 228, 337, 70, 373, - /* 810 */ 363, 162, 163, 18, 164, 20, 337, 168, 169, 337, - /* 820 */ 368, 351, 27, 99, 373, 30, 102, 352, 33, 352, - /* 830 */ 351, 379, 183, 351, 185, 360, 164, 360, 368, 21, - /* 840 */ 251, 252, 253, 48, 369, 50, 369, 368, 53, 164, - /* 850 */ 368, 329, 34, 329, 36, 3, 162, 208, 209, 361, - /* 860 */ 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, - /* 870 */ 221, 222, 223, 224, 225, 226, 227, 228, 329, 329, - /* 880 */ 337, 126, 127, 18, 329, 422, 131, 424, 23, 94, - /* 890 */ 0, 65, 66, 67, 351, 373, 361, 373, 337, 73, - /* 900 */ 74, 106, 37, 38, 78, 368, 41, 45, 46, 83, - /* 910 */ 84, 368, 351, 8, 9, 89, 379, 12, 13, 14, - /* 920 */ 15, 16, 373, 373, 59, 60, 61, 370, 373, 368, - /* 930 */ 373, 136, 244, 245, 139, 140, 141, 142, 143, 144, - /* 940 */ 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - /* 950 */ 155, 329, 157, 158, 159, 65, 66, 67, 68, 69, - /* 960 */ 95, 71, 72, 73, 74, 75, 76, 77, 78, 79, - /* 970 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - /* 980 */ 90, 91, 8, 9, 337, 4, 12, 13, 14, 15, - /* 990 */ 16, 337, 361, 329, 20, 373, 95, 2, 351, 134, - /* 1000 */ 19, 96, 0, 8, 9, 351, 105, 12, 13, 14, - /* 1010 */ 15, 16, 329, 2, 33, 368, 392, 35, 337, 8, - /* 1020 */ 9, 337, 368, 12, 13, 14, 15, 16, 360, 48, - /* 1030 */ 361, 107, 351, 337, 53, 351, 337, 373, 361, 58, - /* 1040 */ 175, 176, 177, 360, 376, 180, 329, 351, 337, 368, - /* 1050 */ 351, 368, 368, 129, 353, 0, 373, 356, 375, 329, - /* 1060 */ 329, 437, 351, 198, 368, 441, 201, 368, 203, 204, - /* 1070 */ 205, 206, 207, 0, 337, 94, 329, 22, 97, 368, - /* 1080 */ 456, 457, 58, 329, 397, 461, 462, 404, 351, 22, - /* 1090 */ 373, 408, 329, 35, 411, 412, 413, 414, 415, 416, - /* 1100 */ 329, 418, 35, 373, 373, 368, 423, 360, 425, 107, - /* 1110 */ 63, 246, 429, 430, 106, 368, 99, 265, 94, 102, - /* 1120 */ 373, 97, 375, 42, 330, 44, 443, 373, 126, 127, - /* 1130 */ 128, 129, 130, 131, 451, 329, 373, 70, 164, 349, - /* 1140 */ 370, 8, 9, 373, 373, 12, 13, 14, 15, 16, - /* 1150 */ 370, 404, 383, 373, 44, 408, 0, 465, 411, 412, - /* 1160 */ 413, 414, 415, 416, 156, 418, 360, 185, 421, 454, - /* 1170 */ 423, 424, 425, 42, 368, 44, 429, 430, 22, 373, - /* 1180 */ 107, 375, 132, 133, 117, 8, 9, 0, 44, 12, - /* 1190 */ 13, 14, 15, 16, 99, 329, 44, 102, 339, 126, - /* 1200 */ 127, 128, 129, 130, 131, 99, 96, 58, 102, 22, - /* 1210 */ 404, 44, 44, 44, 408, 44, 44, 411, 412, 413, - /* 1220 */ 414, 415, 416, 164, 418, 47, 360, 35, 360, 423, - /* 1230 */ 171, 425, 1, 2, 368, 429, 430, 0, 44, 373, - /* 1240 */ 96, 375, 44, 185, 448, 339, 97, 44, 96, 44, - /* 1250 */ 183, 44, 185, 44, 329, 208, 44, 451, 44, 44, - /* 1260 */ 44, 44, 70, 96, 96, 96, 383, 96, 96, 336, - /* 1270 */ 404, 372, 383, 95, 408, 208, 209, 411, 412, 413, - /* 1280 */ 414, 415, 416, 439, 418, 360, 49, 13, 329, 423, - /* 1290 */ 96, 425, 13, 368, 96, 429, 430, 164, 373, 96, - /* 1300 */ 375, 96, 431, 96, 458, 96, 440, 48, 96, 35, - /* 1310 */ 96, 96, 96, 96, 35, 442, 248, 406, 405, 360, - /* 1320 */ 181, 394, 42, 380, 20, 383, 380, 368, 378, 404, - /* 1330 */ 20, 161, 373, 408, 375, 337, 411, 412, 413, 414, - /* 1340 */ 415, 416, 337, 418, 380, 378, 378, 93, 423, 345, - /* 1350 */ 425, 337, 337, 337, 429, 430, 20, 331, 331, 20, - /* 1360 */ 399, 343, 20, 404, 375, 440, 343, 408, 20, 338, - /* 1370 */ 411, 412, 413, 414, 415, 416, 20, 418, 393, 343, - /* 1380 */ 338, 329, 423, 343, 425, 337, 343, 343, 429, 430, - /* 1390 */ 52, 340, 343, 340, 331, 12, 13, 360, 360, 440, - /* 1400 */ 403, 329, 337, 373, 95, 22, 360, 331, 373, 188, - /* 1410 */ 197, 401, 360, 256, 360, 341, 33, 360, 35, 399, - /* 1420 */ 368, 360, 360, 398, 360, 373, 360, 375, 341, 360, - /* 1430 */ 360, 375, 360, 337, 447, 255, 262, 447, 450, 174, - /* 1440 */ 368, 58, 449, 383, 263, 373, 447, 375, 373, 264, - /* 1450 */ 373, 373, 373, 70, 383, 446, 404, 445, 466, 249, - /* 1460 */ 408, 271, 266, 411, 412, 413, 414, 415, 416, 268, - /* 1470 */ 418, 388, 388, 444, 245, 423, 404, 425, 20, 460, - /* 1480 */ 408, 429, 430, 411, 412, 413, 414, 415, 416, 368, - /* 1490 */ 418, 406, 440, 459, 341, 423, 410, 425, 337, 341, - /* 1500 */ 117, 429, 430, 338, 20, 386, 388, 373, 373, 373, - /* 1510 */ 373, 373, 440, 388, 373, 166, 341, 385, 356, 368, - /* 1520 */ 341, 95, 428, 95, 364, 337, 350, 373, 36, 332, - /* 1530 */ 341, 331, 389, 342, 389, 395, 354, 354, 354, 0, - /* 1540 */ 329, 0, 400, 0, 42, 327, 0, 35, 202, 35, - /* 1550 */ 35, 35, 202, 0, 35, 35, 202, 0, 0, 202, - /* 1560 */ 35, 0, 22, 0, 35, 190, 183, 185, 185, 183, - /* 1570 */ 0, 360, 0, 0, 179, 178, 0, 0, 47, 368, - /* 1580 */ 0, 0, 0, 0, 373, 151, 375, 42, 0, 0, - /* 1590 */ 0, 208, 209, 0, 0, 0, 0, 35, 0, 151, - /* 1600 */ 329, 42, 0, 0, 221, 222, 223, 224, 225, 226, - /* 1610 */ 227, 0, 0, 0, 0, 404, 0, 0, 0, 408, - /* 1620 */ 0, 0, 411, 412, 413, 414, 415, 416, 329, 418, - /* 1630 */ 0, 360, 0, 0, 423, 0, 425, 0, 0, 368, - /* 1640 */ 429, 430, 0, 0, 373, 0, 375, 0, 0, 22, - /* 1650 */ 0, 0, 0, 135, 0, 0, 0, 35, 58, 360, - /* 1660 */ 0, 0, 58, 0, 39, 42, 47, 368, 44, 0, - /* 1670 */ 0, 14, 373, 47, 375, 404, 14, 0, 47, 408, - /* 1680 */ 40, 0, 411, 412, 413, 414, 415, 416, 39, 418, - /* 1690 */ 0, 174, 39, 0, 423, 329, 425, 0, 64, 0, - /* 1700 */ 429, 430, 0, 404, 39, 0, 35, 408, 0, 35, - /* 1710 */ 411, 412, 413, 414, 415, 416, 48, 418, 329, 39, - /* 1720 */ 48, 35, 423, 48, 425, 0, 360, 39, 429, 430, - /* 1730 */ 48, 35, 0, 39, 368, 0, 0, 0, 35, 373, - /* 1740 */ 104, 375, 22, 102, 0, 35, 35, 35, 35, 360, - /* 1750 */ 44, 44, 35, 35, 35, 22, 0, 368, 0, 50, - /* 1760 */ 22, 22, 373, 22, 375, 0, 35, 0, 0, 35, - /* 1770 */ 404, 0, 22, 20, 408, 35, 0, 411, 412, 413, - /* 1780 */ 414, 415, 416, 35, 418, 96, 329, 35, 0, 35, - /* 1790 */ 0, 425, 195, 404, 186, 429, 430, 408, 0, 95, - /* 1800 */ 411, 412, 413, 414, 415, 416, 329, 418, 164, 95, - /* 1810 */ 164, 22, 3, 44, 425, 250, 95, 360, 429, 430, - /* 1820 */ 96, 95, 254, 164, 166, 368, 96, 47, 229, 44, - /* 1830 */ 373, 44, 375, 47, 250, 44, 172, 360, 171, 96, - /* 1840 */ 95, 95, 95, 3, 95, 368, 44, 171, 35, 35, - /* 1850 */ 373, 96, 375, 96, 35, 96, 250, 35, 35, 35, - /* 1860 */ 96, 404, 96, 47, 44, 408, 0, 0, 411, 412, - /* 1870 */ 413, 414, 415, 416, 47, 418, 0, 0, 39, 95, - /* 1880 */ 47, 404, 425, 244, 0, 408, 429, 430, 411, 412, - /* 1890 */ 413, 414, 415, 416, 95, 418, 329, 96, 39, 96, - /* 1900 */ 95, 95, 425, 95, 47, 95, 44, 430, 229, 167, - /* 1910 */ 2, 22, 105, 95, 329, 231, 165, 96, 22, 47, - /* 1920 */ 229, 95, 47, 208, 96, 95, 95, 360, 96, 95, - /* 1930 */ 329, 96, 210, 95, 35, 368, 35, 96, 95, 35, - /* 1940 */ 373, 96, 375, 106, 95, 360, 96, 35, 95, 35, - /* 1950 */ 96, 95, 35, 368, 96, 95, 22, 44, 373, 107, - /* 1960 */ 375, 360, 35, 119, 95, 119, 365, 119, 95, 368, - /* 1970 */ 22, 404, 63, 95, 373, 408, 375, 35, 411, 412, - /* 1980 */ 413, 414, 415, 416, 119, 418, 64, 35, 35, 404, - /* 1990 */ 35, 35, 35, 408, 35, 35, 411, 412, 413, 414, - /* 2000 */ 415, 416, 329, 418, 35, 404, 35, 70, 92, 408, - /* 2010 */ 44, 35, 411, 412, 413, 414, 415, 416, 35, 418, - /* 2020 */ 35, 22, 455, 35, 329, 22, 35, 35, 70, 35, - /* 2030 */ 35, 35, 35, 360, 0, 35, 35, 35, 0, 0, - /* 2040 */ 0, 368, 35, 0, 39, 35, 373, 39, 375, 464, - /* 2050 */ 39, 35, 48, 39, 48, 360, 35, 48, 35, 0, - /* 2060 */ 365, 48, 21, 368, 22, 467, 22, 22, 373, 21, - /* 2070 */ 375, 20, 467, 467, 467, 467, 467, 404, 467, 467, - /* 2080 */ 467, 408, 467, 467, 411, 412, 413, 414, 415, 416, - /* 2090 */ 467, 418, 329, 420, 467, 467, 467, 467, 467, 404, - /* 2100 */ 467, 467, 467, 408, 467, 467, 411, 412, 413, 414, - /* 2110 */ 415, 416, 329, 418, 467, 467, 467, 467, 467, 467, - /* 2120 */ 467, 467, 467, 360, 467, 467, 467, 467, 365, 467, - /* 2130 */ 467, 368, 467, 467, 467, 467, 373, 467, 375, 467, - /* 2140 */ 467, 467, 467, 360, 467, 467, 467, 467, 467, 467, - /* 2150 */ 467, 368, 467, 467, 467, 467, 373, 467, 375, 467, - /* 2160 */ 467, 467, 467, 467, 467, 467, 467, 404, 467, 467, - /* 2170 */ 467, 408, 467, 467, 411, 412, 413, 414, 415, 416, - /* 2180 */ 329, 418, 467, 467, 467, 467, 467, 404, 467, 467, - /* 2190 */ 467, 408, 467, 467, 411, 412, 413, 414, 415, 416, - /* 2200 */ 329, 418, 467, 467, 467, 467, 467, 467, 467, 467, - /* 2210 */ 467, 360, 467, 467, 467, 467, 467, 467, 467, 368, - /* 2220 */ 467, 467, 467, 467, 373, 467, 375, 467, 467, 467, - /* 2230 */ 467, 360, 467, 467, 467, 467, 467, 467, 467, 368, - /* 2240 */ 467, 467, 467, 467, 373, 467, 375, 467, 467, 467, - /* 2250 */ 467, 467, 467, 467, 467, 404, 467, 329, 467, 408, - /* 2260 */ 467, 467, 411, 412, 413, 414, 415, 416, 467, 418, - /* 2270 */ 467, 467, 467, 467, 467, 404, 467, 467, 467, 408, - /* 2280 */ 467, 467, 411, 412, 413, 414, 415, 416, 360, 418, - /* 2290 */ 467, 329, 467, 467, 467, 467, 368, 467, 467, 467, - /* 2300 */ 467, 373, 467, 375, 467, 467, 467, 467, 467, 467, - /* 2310 */ 467, 467, 467, 467, 467, 467, 467, 467, 467, 329, - /* 2320 */ 467, 467, 360, 467, 467, 467, 467, 467, 467, 467, - /* 2330 */ 368, 467, 404, 467, 467, 373, 408, 375, 467, 411, - /* 2340 */ 412, 413, 414, 415, 416, 467, 418, 467, 467, 467, - /* 2350 */ 360, 467, 467, 467, 467, 467, 467, 467, 368, 467, - /* 2360 */ 467, 467, 467, 373, 467, 375, 404, 467, 467, 467, - /* 2370 */ 408, 467, 467, 411, 412, 413, 414, 415, 416, 329, - /* 2380 */ 418, 467, 467, 467, 467, 467, 467, 467, 467, 467, - /* 2390 */ 467, 467, 467, 467, 404, 467, 467, 467, 408, 467, - /* 2400 */ 329, 411, 412, 413, 414, 415, 416, 467, 418, 467, - /* 2410 */ 360, 467, 467, 467, 467, 467, 467, 467, 368, 467, - /* 2420 */ 467, 467, 467, 373, 467, 375, 467, 467, 467, 467, - /* 2430 */ 467, 360, 467, 467, 467, 467, 467, 467, 467, 368, - /* 2440 */ 467, 467, 467, 467, 373, 467, 375, 467, 467, 467, - /* 2450 */ 467, 467, 467, 467, 404, 467, 467, 467, 408, 467, - /* 2460 */ 467, 411, 412, 413, 414, 415, 416, 467, 418, 467, - /* 2470 */ 467, 467, 467, 329, 467, 404, 467, 467, 467, 408, - /* 2480 */ 467, 467, 411, 412, 413, 414, 415, 416, 467, 418, - /* 2490 */ 467, 467, 467, 467, 467, 467, 467, 329, 467, 467, - /* 2500 */ 467, 467, 467, 467, 360, 467, 467, 467, 467, 467, - /* 2510 */ 467, 467, 368, 467, 467, 467, 467, 373, 467, 375, - /* 2520 */ 467, 467, 467, 467, 467, 467, 467, 467, 360, 467, - /* 2530 */ 467, 467, 467, 467, 467, 467, 368, 467, 467, 467, - /* 2540 */ 467, 373, 467, 375, 467, 467, 467, 467, 404, 467, - /* 2550 */ 467, 467, 408, 467, 329, 411, 412, 413, 414, 415, - /* 2560 */ 416, 467, 418, 467, 467, 467, 467, 467, 467, 467, - /* 2570 */ 467, 467, 404, 467, 329, 467, 408, 467, 467, 411, - /* 2580 */ 412, 413, 414, 415, 416, 360, 418, 467, 467, 467, - /* 2590 */ 467, 467, 467, 368, 467, 467, 467, 467, 373, 467, - /* 2600 */ 375, 467, 467, 467, 467, 360, 467, 467, 467, 467, - /* 2610 */ 467, 467, 467, 368, 467, 467, 467, 467, 373, 467, - /* 2620 */ 375, 467, 467, 467, 467, 467, 467, 467, 467, 404, - /* 2630 */ 467, 329, 467, 408, 467, 467, 411, 412, 413, 414, - /* 2640 */ 415, 416, 467, 418, 467, 467, 467, 467, 467, 404, - /* 2650 */ 467, 467, 329, 408, 467, 467, 411, 412, 413, 414, - /* 2660 */ 415, 416, 360, 418, 467, 467, 467, 467, 467, 467, - /* 2670 */ 368, 467, 467, 467, 467, 373, 467, 375, 467, 467, - /* 2680 */ 329, 467, 467, 360, 467, 467, 467, 467, 467, 467, - /* 2690 */ 467, 368, 467, 467, 467, 467, 373, 467, 375, 467, - /* 2700 */ 467, 467, 467, 467, 467, 467, 404, 467, 467, 467, - /* 2710 */ 408, 360, 467, 411, 412, 413, 414, 415, 416, 368, - /* 2720 */ 418, 467, 467, 467, 373, 467, 375, 404, 467, 467, - /* 2730 */ 467, 408, 467, 467, 411, 412, 413, 414, 415, 416, - /* 2740 */ 329, 418, 467, 467, 467, 467, 467, 467, 467, 467, - /* 2750 */ 467, 467, 467, 467, 467, 404, 467, 467, 467, 408, - /* 2760 */ 467, 329, 411, 412, 413, 414, 415, 416, 467, 418, - /* 2770 */ 467, 360, 467, 467, 467, 467, 467, 467, 467, 368, - /* 2780 */ 467, 467, 467, 467, 373, 467, 375, 467, 467, 467, - /* 2790 */ 467, 467, 360, 467, 467, 467, 467, 467, 467, 467, - /* 2800 */ 368, 467, 467, 467, 467, 373, 467, 375, 467, 467, - /* 2810 */ 467, 467, 467, 467, 467, 404, 467, 467, 467, 408, - /* 2820 */ 467, 467, 411, 412, 413, 414, 415, 416, 467, 418, - /* 2830 */ 467, 467, 467, 467, 329, 467, 404, 467, 467, 467, - /* 2840 */ 408, 467, 467, 411, 412, 413, 414, 415, 416, 467, - /* 2850 */ 418, 467, 467, 467, 467, 467, 467, 467, 329, 467, - /* 2860 */ 467, 467, 467, 467, 467, 360, 467, 467, 467, 467, - /* 2870 */ 467, 467, 467, 368, 467, 467, 467, 467, 373, 467, - /* 2880 */ 375, 467, 467, 467, 467, 467, 467, 467, 467, 360, - /* 2890 */ 467, 467, 467, 467, 467, 467, 467, 368, 467, 467, - /* 2900 */ 467, 467, 373, 467, 375, 467, 467, 467, 467, 404, - /* 2910 */ 467, 467, 467, 408, 467, 329, 411, 412, 413, 414, - /* 2920 */ 415, 416, 467, 418, 467, 467, 467, 467, 467, 467, - /* 2930 */ 467, 467, 467, 404, 467, 329, 467, 408, 467, 467, - /* 2940 */ 411, 412, 413, 414, 415, 416, 360, 418, 467, 467, - /* 2950 */ 467, 467, 467, 467, 368, 467, 467, 467, 467, 373, - /* 2960 */ 467, 375, 467, 467, 467, 467, 360, 467, 467, 467, - /* 2970 */ 467, 467, 467, 467, 368, 467, 467, 467, 467, 373, - /* 2980 */ 467, 375, 467, 467, 467, 467, 467, 467, 467, 467, - /* 2990 */ 404, 467, 329, 467, 408, 467, 467, 411, 412, 413, - /* 3000 */ 414, 415, 416, 467, 418, 467, 467, 467, 467, 467, - /* 3010 */ 404, 467, 467, 467, 408, 467, 467, 411, 412, 413, - /* 3020 */ 414, 415, 416, 360, 418, 467, 467, 467, 467, 467, - /* 3030 */ 467, 368, 467, 467, 467, 467, 373, 467, 375, 467, - /* 3040 */ 467, 467, 467, 467, 467, 467, 467, 467, 467, 467, - /* 3050 */ 467, 467, 467, 467, 467, 467, 467, 467, 467, 467, - /* 3060 */ 467, 467, 467, 467, 467, 467, 467, 404, 467, 467, - /* 3070 */ 467, 408, 467, 467, 411, 412, 413, 414, 415, 416, - /* 3080 */ 467, 418, + /* 0 */ 377, 439, 0, 339, 335, 443, 337, 338, 335, 363, + /* 10 */ 337, 338, 12, 13, 14, 392, 393, 2, 362, 361, + /* 20 */ 20, 459, 22, 8, 9, 463, 464, 12, 13, 14, + /* 30 */ 15, 16, 374, 33, 370, 35, 20, 331, 362, 383, + /* 40 */ 384, 364, 8, 9, 394, 369, 12, 13, 14, 15, + /* 50 */ 16, 339, 375, 439, 378, 8, 9, 443, 58, 12, + /* 60 */ 13, 14, 15, 16, 64, 63, 373, 20, 362, 376, + /* 70 */ 377, 71, 328, 459, 346, 339, 370, 463, 464, 351, + /* 80 */ 20, 375, 22, 377, 12, 13, 409, 410, 411, 439, + /* 90 */ 4, 379, 20, 443, 22, 35, 96, 420, 64, 435, + /* 100 */ 436, 437, 21, 439, 440, 33, 370, 35, 458, 459, + /* 110 */ 44, 51, 406, 463, 464, 34, 410, 36, 118, 413, + /* 120 */ 414, 415, 416, 417, 418, 419, 420, 421, 422, 43, + /* 130 */ 58, 45, 46, 133, 134, 20, 64, 336, 394, 105, + /* 140 */ 339, 340, 398, 71, 331, 109, 110, 111, 112, 113, + /* 150 */ 114, 115, 116, 117, 118, 119, 362, 121, 122, 123, + /* 160 */ 124, 125, 126, 163, 164, 377, 339, 20, 96, 169, + /* 170 */ 170, 435, 436, 437, 354, 439, 440, 389, 384, 443, + /* 180 */ 392, 393, 362, 439, 184, 339, 186, 443, 375, 369, + /* 190 */ 118, 371, 20, 58, 458, 459, 162, 370, 378, 463, + /* 200 */ 464, 63, 458, 459, 20, 133, 134, 463, 464, 20, + /* 210 */ 210, 211, 165, 213, 214, 215, 216, 217, 218, 219, + /* 220 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + /* 230 */ 230, 96, 386, 98, 388, 163, 164, 168, 343, 63, + /* 240 */ 21, 169, 170, 24, 25, 26, 27, 28, 29, 30, + /* 250 */ 31, 32, 357, 14, 37, 330, 184, 332, 186, 20, + /* 260 */ 365, 434, 435, 436, 437, 20, 439, 440, 96, 235, + /* 270 */ 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + /* 280 */ 96, 96, 210, 211, 35, 213, 214, 215, 216, 217, + /* 290 */ 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + /* 300 */ 228, 229, 230, 364, 232, 12, 13, 12, 13, 14, + /* 310 */ 15, 16, 20, 20, 375, 22, 99, 19, 101, 102, + /* 320 */ 71, 104, 253, 254, 255, 108, 33, 20, 35, 336, + /* 330 */ 331, 33, 339, 340, 339, 428, 429, 8, 9, 273, + /* 340 */ 179, 12, 13, 14, 15, 16, 48, 130, 409, 410, + /* 350 */ 411, 58, 54, 55, 56, 57, 58, 64, 345, 420, + /* 360 */ 14, 362, 201, 202, 71, 370, 20, 107, 183, 370, + /* 370 */ 185, 412, 359, 20, 375, 22, 377, 12, 13, 14, + /* 380 */ 20, 368, 3, 248, 232, 20, 234, 22, 96, 96, + /* 390 */ 127, 128, 4, 95, 209, 132, 98, 438, 33, 20, + /* 400 */ 35, 424, 163, 426, 51, 406, 0, 339, 331, 410, + /* 410 */ 339, 118, 413, 414, 415, 416, 417, 418, 0, 420, + /* 420 */ 248, 353, 372, 58, 353, 375, 133, 134, 360, 131, + /* 430 */ 435, 436, 437, 248, 439, 440, 71, 339, 370, 21, + /* 440 */ 232, 370, 24, 25, 26, 27, 28, 29, 30, 31, + /* 450 */ 32, 353, 375, 454, 455, 58, 163, 164, 360, 362, + /* 460 */ 343, 96, 169, 170, 166, 424, 369, 426, 370, 171, + /* 470 */ 163, 164, 66, 67, 68, 378, 97, 184, 47, 186, + /* 480 */ 74, 75, 365, 118, 96, 79, 188, 80, 190, 0, + /* 490 */ 84, 85, 95, 133, 134, 98, 90, 127, 133, 134, + /* 500 */ 376, 377, 20, 210, 211, 176, 213, 214, 215, 216, + /* 510 */ 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + /* 520 */ 227, 228, 229, 230, 66, 67, 68, 96, 163, 164, + /* 530 */ 0, 362, 74, 75, 169, 170, 339, 79, 369, 339, + /* 540 */ 248, 20, 84, 85, 165, 138, 139, 378, 90, 184, + /* 550 */ 353, 186, 339, 353, 24, 25, 26, 27, 28, 29, + /* 560 */ 30, 31, 32, 193, 194, 394, 35, 370, 161, 398, + /* 570 */ 370, 14, 15, 16, 331, 210, 211, 339, 213, 214, + /* 580 */ 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, + /* 590 */ 225, 226, 227, 228, 229, 230, 12, 13, 35, 386, + /* 600 */ 370, 388, 71, 274, 20, 362, 22, 339, 439, 339, + /* 610 */ 439, 381, 443, 370, 443, 133, 134, 33, 375, 35, + /* 620 */ 377, 353, 33, 353, 386, 96, 388, 458, 459, 458, + /* 630 */ 459, 96, 463, 464, 463, 464, 248, 48, 370, 331, + /* 640 */ 370, 152, 58, 54, 55, 56, 57, 58, 339, 406, + /* 650 */ 161, 169, 170, 410, 210, 71, 413, 414, 415, 416, + /* 660 */ 417, 418, 353, 420, 22, 354, 14, 331, 12, 13, + /* 670 */ 427, 20, 20, 362, 431, 432, 20, 35, 22, 370, + /* 680 */ 96, 4, 371, 375, 95, 331, 165, 98, 71, 33, + /* 690 */ 331, 35, 423, 8, 9, 426, 19, 12, 13, 14, + /* 700 */ 15, 16, 118, 259, 260, 261, 262, 263, 264, 265, + /* 710 */ 33, 375, 362, 364, 58, 8, 9, 133, 134, 12, + /* 720 */ 13, 14, 15, 16, 375, 48, 2, 71, 378, 375, + /* 730 */ 53, 0, 8, 9, 375, 58, 12, 13, 14, 15, + /* 740 */ 16, 331, 439, 331, 331, 162, 443, 163, 164, 186, + /* 750 */ 339, 44, 96, 169, 170, 166, 167, 107, 409, 410, + /* 760 */ 171, 458, 459, 174, 353, 363, 463, 464, 184, 420, + /* 770 */ 186, 362, 95, 331, 118, 98, 362, 248, 331, 190, + /* 780 */ 371, 370, 97, 248, 370, 375, 358, 375, 375, 133, + /* 790 */ 134, 331, 1, 2, 210, 211, 71, 213, 214, 215, + /* 800 */ 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + /* 810 */ 226, 227, 228, 229, 230, 163, 165, 375, 235, 163, + /* 820 */ 164, 18, 375, 20, 108, 169, 170, 128, 245, 415, + /* 830 */ 27, 345, 404, 30, 362, 375, 33, 45, 46, 108, + /* 840 */ 184, 369, 186, 127, 128, 129, 130, 131, 132, 331, + /* 850 */ 378, 48, 20, 50, 368, 0, 53, 370, 127, 128, + /* 860 */ 129, 130, 131, 132, 348, 349, 210, 211, 381, 213, + /* 870 */ 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + /* 880 */ 224, 225, 226, 227, 228, 229, 230, 354, 97, 399, + /* 890 */ 191, 192, 18, 375, 195, 362, 197, 23, 95, 0, + /* 900 */ 339, 8, 9, 0, 371, 12, 13, 14, 15, 16, + /* 910 */ 107, 37, 38, 363, 353, 41, 331, 39, 63, 8, + /* 920 */ 9, 362, 354, 12, 13, 14, 15, 16, 369, 355, + /* 930 */ 362, 370, 358, 59, 60, 61, 62, 378, 412, 371, + /* 940 */ 137, 348, 349, 140, 141, 142, 143, 144, 145, 146, + /* 950 */ 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + /* 960 */ 375, 158, 159, 160, 438, 66, 67, 68, 69, 70, + /* 970 */ 96, 72, 73, 74, 75, 76, 77, 78, 79, 80, + /* 980 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + /* 990 */ 91, 92, 339, 339, 331, 8, 9, 165, 394, 12, + /* 1000 */ 13, 14, 15, 16, 22, 339, 353, 353, 97, 135, + /* 1010 */ 331, 108, 3, 339, 339, 339, 4, 35, 350, 353, + /* 1020 */ 352, 331, 331, 370, 370, 331, 331, 353, 353, 353, + /* 1030 */ 127, 128, 129, 130, 131, 132, 370, 370, 375, 108, + /* 1040 */ 42, 362, 44, 439, 370, 370, 370, 443, 381, 370, + /* 1050 */ 176, 177, 178, 71, 375, 181, 377, 339, 165, 331, + /* 1060 */ 412, 130, 458, 459, 44, 375, 375, 463, 464, 375, + /* 1070 */ 375, 353, 372, 364, 200, 375, 20, 203, 107, 205, + /* 1080 */ 206, 207, 208, 209, 375, 406, 438, 58, 370, 410, + /* 1090 */ 362, 364, 413, 414, 415, 416, 417, 418, 370, 420, + /* 1100 */ 118, 44, 375, 375, 425, 377, 427, 246, 247, 339, + /* 1110 */ 431, 432, 372, 0, 42, 375, 44, 97, 409, 410, + /* 1120 */ 411, 339, 248, 353, 445, 247, 331, 98, 157, 420, + /* 1130 */ 394, 363, 453, 44, 406, 353, 409, 410, 410, 363, + /* 1140 */ 370, 413, 414, 415, 416, 417, 418, 420, 420, 339, + /* 1150 */ 44, 423, 370, 425, 426, 427, 363, 362, 331, 431, + /* 1160 */ 432, 48, 0, 353, 100, 370, 184, 103, 186, 0, + /* 1170 */ 375, 100, 377, 100, 103, 439, 103, 44, 100, 443, + /* 1180 */ 370, 103, 44, 44, 22, 196, 97, 198, 64, 362, + /* 1190 */ 332, 22, 210, 211, 458, 459, 0, 370, 363, 463, + /* 1200 */ 464, 406, 375, 97, 377, 410, 35, 331, 413, 414, + /* 1210 */ 415, 416, 417, 418, 165, 420, 133, 134, 22, 163, + /* 1220 */ 425, 172, 427, 44, 44, 0, 431, 432, 44, 385, + /* 1230 */ 97, 44, 44, 406, 44, 97, 97, 410, 362, 351, + /* 1240 */ 413, 414, 415, 416, 417, 418, 370, 420, 453, 1, + /* 1250 */ 2, 375, 425, 377, 427, 96, 44, 394, 431, 432, + /* 1260 */ 44, 249, 44, 44, 44, 106, 331, 467, 456, 442, + /* 1270 */ 341, 44, 44, 13, 49, 450, 97, 97, 269, 44, + /* 1280 */ 362, 97, 406, 341, 97, 97, 410, 97, 338, 413, + /* 1290 */ 414, 415, 416, 417, 418, 35, 420, 362, 13, 385, + /* 1300 */ 331, 425, 439, 427, 374, 370, 443, 431, 432, 97, + /* 1310 */ 375, 385, 377, 97, 441, 97, 97, 97, 442, 460, + /* 1320 */ 35, 458, 459, 433, 97, 97, 463, 464, 271, 444, + /* 1330 */ 250, 362, 97, 408, 210, 48, 182, 396, 42, 370, + /* 1340 */ 407, 406, 382, 20, 375, 410, 377, 385, 413, 414, + /* 1350 */ 415, 416, 417, 418, 382, 420, 162, 186, 380, 20, + /* 1360 */ 425, 339, 427, 339, 380, 382, 431, 432, 380, 339, + /* 1370 */ 94, 339, 347, 331, 339, 406, 339, 442, 20, 410, + /* 1380 */ 333, 333, 413, 414, 415, 416, 417, 418, 20, 420, + /* 1390 */ 345, 401, 12, 13, 425, 20, 427, 345, 377, 20, + /* 1400 */ 431, 432, 22, 340, 362, 20, 395, 345, 340, 339, + /* 1410 */ 345, 442, 370, 33, 345, 35, 52, 375, 333, 377, + /* 1420 */ 345, 345, 331, 342, 342, 339, 333, 96, 362, 362, + /* 1430 */ 375, 199, 405, 375, 403, 401, 362, 343, 58, 362, + /* 1440 */ 189, 362, 343, 400, 339, 385, 362, 258, 406, 362, + /* 1450 */ 362, 71, 410, 362, 362, 413, 414, 415, 416, 417, + /* 1460 */ 418, 370, 420, 362, 362, 449, 375, 425, 377, 427, + /* 1470 */ 257, 375, 377, 431, 432, 385, 266, 449, 375, 375, + /* 1480 */ 175, 267, 375, 268, 442, 452, 331, 390, 390, 451, + /* 1490 */ 449, 251, 448, 447, 468, 370, 446, 406, 118, 275, + /* 1500 */ 461, 410, 272, 270, 413, 414, 415, 416, 417, 418, + /* 1510 */ 247, 420, 20, 462, 339, 343, 425, 362, 427, 408, + /* 1520 */ 412, 340, 431, 432, 20, 370, 343, 390, 388, 167, + /* 1530 */ 375, 375, 377, 375, 390, 375, 375, 387, 375, 375, + /* 1540 */ 343, 343, 96, 358, 370, 430, 96, 352, 366, 343, + /* 1550 */ 339, 375, 36, 402, 331, 334, 356, 391, 391, 333, + /* 1560 */ 356, 406, 397, 356, 184, 410, 186, 329, 413, 414, + /* 1570 */ 415, 416, 417, 418, 0, 420, 0, 0, 344, 42, + /* 1580 */ 425, 0, 427, 35, 331, 362, 431, 432, 204, 35, + /* 1590 */ 210, 211, 35, 370, 35, 204, 0, 35, 375, 35, + /* 1600 */ 377, 204, 0, 223, 224, 225, 226, 227, 228, 229, + /* 1610 */ 204, 0, 0, 35, 331, 362, 22, 0, 191, 35, + /* 1620 */ 186, 184, 0, 370, 0, 0, 0, 180, 375, 406, + /* 1630 */ 377, 179, 0, 410, 47, 0, 413, 414, 415, 416, + /* 1640 */ 417, 418, 0, 420, 331, 362, 0, 42, 425, 0, + /* 1650 */ 427, 0, 0, 370, 431, 432, 0, 0, 375, 406, + /* 1660 */ 377, 0, 0, 410, 152, 35, 413, 414, 415, 416, + /* 1670 */ 417, 418, 0, 420, 0, 362, 152, 0, 331, 0, + /* 1680 */ 427, 0, 0, 370, 431, 432, 0, 0, 375, 406, + /* 1690 */ 377, 0, 0, 410, 0, 0, 413, 414, 415, 416, + /* 1700 */ 417, 418, 0, 420, 0, 331, 0, 0, 0, 362, + /* 1710 */ 427, 0, 42, 0, 431, 432, 0, 370, 0, 406, + /* 1720 */ 0, 0, 375, 410, 377, 0, 413, 414, 415, 416, + /* 1730 */ 417, 418, 22, 420, 0, 0, 362, 0, 0, 136, + /* 1740 */ 0, 0, 58, 0, 370, 0, 58, 35, 58, 375, + /* 1750 */ 0, 377, 47, 406, 331, 0, 42, 410, 39, 44, + /* 1760 */ 413, 414, 415, 416, 417, 418, 0, 420, 14, 47, + /* 1770 */ 14, 47, 40, 0, 0, 39, 0, 0, 465, 466, + /* 1780 */ 406, 39, 175, 0, 410, 362, 0, 413, 414, 415, + /* 1790 */ 416, 417, 418, 370, 420, 65, 0, 0, 375, 35, + /* 1800 */ 377, 427, 455, 0, 39, 48, 432, 35, 48, 39, + /* 1810 */ 0, 48, 0, 35, 39, 35, 331, 48, 0, 0, + /* 1820 */ 39, 0, 0, 35, 22, 0, 35, 35, 105, 406, + /* 1830 */ 103, 44, 0, 410, 35, 35, 413, 414, 415, 416, + /* 1840 */ 417, 418, 44, 420, 35, 22, 35, 362, 331, 35, + /* 1850 */ 22, 0, 22, 0, 50, 370, 22, 0, 0, 35, + /* 1860 */ 375, 35, 377, 0, 35, 22, 20, 96, 35, 0, + /* 1870 */ 35, 35, 35, 0, 165, 0, 22, 0, 96, 362, + /* 1880 */ 457, 97, 165, 187, 367, 3, 44, 370, 252, 96, + /* 1890 */ 96, 406, 375, 167, 377, 410, 165, 331, 413, 414, + /* 1900 */ 415, 416, 417, 418, 97, 420, 173, 231, 44, 256, + /* 1910 */ 97, 172, 44, 97, 331, 44, 172, 97, 252, 47, + /* 1920 */ 44, 47, 3, 406, 97, 252, 35, 410, 362, 44, + /* 1930 */ 413, 414, 415, 416, 417, 418, 370, 420, 97, 35, + /* 1940 */ 96, 375, 35, 377, 96, 362, 331, 35, 96, 35, + /* 1950 */ 367, 466, 96, 370, 44, 35, 97, 97, 375, 0, + /* 1960 */ 377, 0, 0, 47, 47, 0, 96, 39, 47, 0, + /* 1970 */ 39, 331, 406, 168, 246, 96, 410, 362, 44, 413, + /* 1980 */ 414, 415, 416, 417, 418, 370, 420, 97, 422, 406, + /* 1990 */ 375, 97, 377, 410, 106, 331, 413, 414, 415, 416, + /* 2000 */ 417, 418, 362, 420, 96, 96, 166, 367, 2, 96, + /* 2010 */ 370, 47, 22, 47, 96, 375, 231, 377, 210, 96, + /* 2020 */ 331, 406, 233, 97, 97, 410, 362, 97, 413, 414, + /* 2030 */ 415, 416, 417, 418, 370, 420, 96, 231, 96, 375, + /* 2040 */ 96, 377, 96, 212, 47, 97, 406, 22, 96, 35, + /* 2050 */ 410, 362, 107, 413, 414, 415, 416, 417, 418, 370, + /* 2060 */ 420, 35, 35, 96, 375, 97, 377, 97, 97, 96, + /* 2070 */ 406, 35, 96, 35, 410, 97, 96, 413, 414, 415, + /* 2080 */ 416, 417, 418, 331, 420, 97, 35, 96, 22, 96, + /* 2090 */ 108, 44, 35, 22, 120, 406, 96, 120, 96, 410, + /* 2100 */ 65, 120, 413, 414, 415, 416, 417, 418, 64, 420, + /* 2110 */ 331, 35, 120, 35, 362, 35, 35, 35, 35, 71, + /* 2120 */ 35, 35, 370, 35, 35, 93, 35, 375, 35, 377, + /* 2130 */ 35, 44, 331, 35, 22, 35, 35, 35, 71, 35, + /* 2140 */ 35, 362, 35, 35, 22, 35, 0, 48, 35, 370, + /* 2150 */ 0, 35, 0, 39, 375, 0, 377, 48, 406, 39, + /* 2160 */ 35, 0, 410, 362, 35, 413, 414, 415, 416, 417, + /* 2170 */ 418, 370, 420, 39, 48, 48, 375, 39, 377, 35, + /* 2180 */ 35, 0, 22, 21, 21, 406, 22, 22, 20, 410, + /* 2190 */ 469, 469, 413, 414, 415, 416, 417, 418, 469, 420, + /* 2200 */ 469, 469, 469, 469, 469, 469, 469, 406, 469, 469, + /* 2210 */ 469, 410, 331, 469, 413, 414, 415, 416, 417, 418, + /* 2220 */ 469, 420, 469, 469, 469, 469, 469, 469, 469, 331, + /* 2230 */ 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, + /* 2240 */ 469, 469, 469, 362, 469, 469, 331, 469, 469, 469, + /* 2250 */ 469, 370, 469, 469, 469, 469, 375, 469, 377, 469, + /* 2260 */ 362, 469, 469, 469, 469, 469, 469, 469, 370, 469, + /* 2270 */ 469, 469, 469, 375, 469, 377, 469, 362, 331, 469, + /* 2280 */ 469, 469, 469, 469, 469, 370, 469, 406, 469, 469, + /* 2290 */ 375, 410, 377, 469, 413, 414, 415, 416, 417, 418, + /* 2300 */ 469, 420, 469, 331, 406, 469, 469, 469, 410, 362, + /* 2310 */ 469, 413, 414, 415, 416, 417, 418, 370, 420, 469, + /* 2320 */ 469, 406, 375, 469, 377, 410, 469, 331, 413, 414, + /* 2330 */ 415, 416, 417, 418, 362, 420, 469, 469, 469, 469, + /* 2340 */ 469, 469, 370, 469, 469, 469, 469, 375, 469, 377, + /* 2350 */ 469, 469, 331, 406, 469, 469, 469, 410, 362, 469, + /* 2360 */ 413, 414, 415, 416, 417, 418, 370, 420, 469, 469, + /* 2370 */ 469, 375, 469, 377, 469, 469, 469, 469, 406, 469, + /* 2380 */ 469, 469, 410, 362, 469, 413, 414, 415, 416, 417, + /* 2390 */ 418, 370, 420, 469, 469, 469, 375, 469, 377, 469, + /* 2400 */ 469, 469, 406, 469, 469, 469, 410, 469, 469, 413, + /* 2410 */ 414, 415, 416, 417, 418, 331, 420, 469, 469, 469, + /* 2420 */ 469, 469, 469, 469, 469, 469, 469, 406, 469, 469, + /* 2430 */ 469, 410, 469, 469, 413, 414, 415, 416, 417, 418, + /* 2440 */ 469, 420, 331, 469, 469, 469, 362, 469, 469, 469, + /* 2450 */ 469, 469, 469, 469, 370, 469, 469, 469, 469, 375, + /* 2460 */ 469, 377, 469, 469, 331, 469, 469, 469, 469, 469, + /* 2470 */ 469, 469, 469, 362, 469, 469, 469, 469, 469, 469, + /* 2480 */ 469, 370, 469, 469, 469, 469, 375, 469, 377, 469, + /* 2490 */ 406, 469, 469, 469, 410, 362, 469, 413, 414, 415, + /* 2500 */ 416, 417, 418, 370, 420, 469, 469, 469, 375, 469, + /* 2510 */ 377, 469, 469, 469, 469, 469, 469, 406, 469, 469, + /* 2520 */ 469, 410, 469, 469, 413, 414, 415, 416, 417, 418, + /* 2530 */ 469, 420, 469, 469, 469, 469, 469, 469, 469, 406, + /* 2540 */ 469, 469, 469, 410, 331, 469, 413, 414, 415, 416, + /* 2550 */ 417, 418, 469, 420, 469, 469, 469, 469, 469, 469, + /* 2560 */ 469, 331, 469, 469, 469, 469, 469, 469, 469, 469, + /* 2570 */ 469, 469, 469, 469, 469, 362, 469, 469, 331, 469, + /* 2580 */ 469, 469, 469, 370, 469, 469, 469, 469, 375, 469, + /* 2590 */ 377, 469, 362, 469, 469, 469, 469, 469, 469, 469, + /* 2600 */ 370, 469, 469, 469, 469, 375, 469, 377, 469, 362, + /* 2610 */ 331, 469, 469, 469, 469, 469, 469, 370, 469, 406, + /* 2620 */ 469, 469, 375, 410, 377, 469, 413, 414, 415, 416, + /* 2630 */ 417, 418, 469, 420, 469, 331, 406, 469, 469, 469, + /* 2640 */ 410, 362, 469, 413, 414, 415, 416, 417, 418, 370, + /* 2650 */ 420, 469, 469, 406, 375, 469, 377, 410, 469, 331, + /* 2660 */ 413, 414, 415, 416, 417, 418, 362, 420, 469, 469, + /* 2670 */ 469, 469, 469, 469, 370, 469, 469, 469, 469, 375, + /* 2680 */ 469, 377, 469, 469, 469, 406, 469, 469, 469, 410, + /* 2690 */ 362, 469, 413, 414, 415, 416, 417, 418, 370, 420, + /* 2700 */ 469, 469, 469, 375, 469, 377, 469, 469, 469, 469, + /* 2710 */ 406, 469, 469, 469, 410, 469, 469, 413, 414, 415, + /* 2720 */ 416, 417, 418, 469, 420, 469, 469, 469, 469, 469, + /* 2730 */ 469, 469, 469, 469, 406, 469, 469, 469, 410, 469, + /* 2740 */ 469, 413, 414, 415, 416, 417, 418, 469, 420, }; -#define YY_SHIFT_COUNT (733) +#define YY_SHIFT_COUNT (740) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2059) +#define YY_SHIFT_MAX (2181) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 865, 0, 71, 0, 290, 290, 290, 290, 290, 290, - /* 10 */ 290, 290, 290, 290, 290, 361, 578, 578, 649, 578, - /* 20 */ 578, 578, 578, 578, 578, 578, 578, 578, 578, 578, - /* 30 */ 578, 578, 578, 578, 578, 578, 578, 578, 578, 578, - /* 40 */ 578, 578, 578, 578, 578, 578, 578, 578, 289, 405, - /* 50 */ 460, 216, 70, 241, 376, 241, 216, 216, 1383, 1383, - /* 60 */ 241, 1383, 1383, 426, 241, 110, 517, 286, 286, 517, - /* 70 */ 186, 186, 326, 172, 1, 1, 286, 286, 286, 286, - /* 80 */ 286, 286, 286, 380, 286, 286, 398, 110, 286, 286, - /* 90 */ 450, 286, 110, 286, 380, 286, 380, 110, 286, 286, - /* 100 */ 110, 286, 110, 110, 110, 286, 415, 795, 34, 34, - /* 110 */ 217, 826, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, - /* 120 */ 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, - /* 130 */ 1067, 152, 672, 326, 172, 173, 422, 407, 407, 407, - /* 140 */ 393, 336, 336, 422, 518, 518, 518, 456, 507, 110, - /* 150 */ 713, 110, 713, 713, 645, 738, 36, 36, 36, 36, - /* 160 */ 36, 36, 36, 36, 583, 313, 474, 974, 249, 119, - /* 170 */ 413, 589, 335, 694, 299, 650, 862, 924, 685, 688, - /* 180 */ 446, 852, 688, 1081, 348, 615, 1068, 1259, 1139, 1280, - /* 190 */ 1304, 1280, 1170, 1310, 1310, 1280, 1170, 1170, 1254, 1310, - /* 200 */ 1310, 1310, 1336, 1336, 1339, 398, 1342, 398, 1348, 1356, - /* 210 */ 398, 1348, 398, 398, 398, 1310, 398, 1338, 1338, 1336, - /* 220 */ 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, - /* 230 */ 110, 1310, 1336, 713, 713, 1213, 1309, 1339, 415, 1221, - /* 240 */ 1342, 415, 1310, 1304, 1304, 713, 1157, 1180, 713, 1157, - /* 250 */ 1180, 713, 713, 110, 1174, 1265, 1157, 1185, 1181, 1210, - /* 260 */ 1068, 1190, 1201, 1196, 1229, 518, 1458, 1310, 1348, 415, - /* 270 */ 415, 1484, 1180, 713, 713, 713, 713, 713, 1180, 713, - /* 280 */ 1349, 415, 645, 415, 518, 1426, 1428, 713, 738, 1310, - /* 290 */ 415, 1492, 1336, 3082, 3082, 3082, 3082, 3082, 3082, 3082, - /* 300 */ 3082, 3082, 890, 274, 702, 981, 453, 708, 905, 1002, - /* 310 */ 995, 1011, 1133, 1073, 1177, 1177, 1177, 1177, 1177, 1177, - /* 320 */ 1177, 1177, 1177, 260, 208, 86, 86, 528, 365, 4, - /* 330 */ 1024, 818, 592, 755, 755, 165, 608, 384, 165, 165, - /* 340 */ 165, 230, 1110, 690, 1131, 1008, 724, 1017, 1095, 1106, - /* 350 */ 1055, 1156, 1187, 1144, 1152, 1149, 1167, 1169, 1050, 99, - /* 360 */ 222, 1059, 1171, 1172, 1194, 1198, 1203, 1205, 1231, 1207, - /* 370 */ 982, 1058, 1047, 1168, 1178, 1209, 1212, 1214, 1215, 1216, - /* 380 */ 1217, 901, 1274, 1279, 1192, 1237, 1539, 1541, 1543, 1502, - /* 390 */ 1546, 1512, 1346, 1514, 1515, 1516, 1350, 1553, 1519, 1520, - /* 400 */ 1354, 1557, 1357, 1558, 1525, 1561, 1540, 1563, 1529, 1375, - /* 410 */ 1382, 1386, 1570, 1572, 1573, 1395, 1397, 1576, 1577, 1531, - /* 420 */ 1580, 1581, 1582, 1545, 1583, 1588, 1589, 1590, 1593, 1594, - /* 430 */ 1595, 1596, 1434, 1562, 1598, 1448, 1611, 1612, 1613, 1614, - /* 440 */ 1616, 1617, 1618, 1620, 1621, 1630, 1632, 1633, 1635, 1637, - /* 450 */ 1638, 1642, 1559, 1602, 1603, 1643, 1645, 1647, 1648, 1627, - /* 460 */ 1650, 1651, 1652, 1518, 1654, 1655, 1622, 1656, 1600, 1660, - /* 470 */ 1604, 1661, 1663, 1623, 1625, 1624, 1619, 1657, 1626, 1662, - /* 480 */ 1631, 1669, 1640, 1649, 1670, 1677, 1681, 1653, 1517, 1690, - /* 490 */ 1693, 1697, 1634, 1699, 1702, 1671, 1668, 1665, 1705, 1674, - /* 500 */ 1672, 1680, 1708, 1686, 1675, 1688, 1725, 1696, 1682, 1694, - /* 510 */ 1732, 1735, 1736, 1737, 1636, 1641, 1703, 1720, 1744, 1710, - /* 520 */ 1711, 1712, 1713, 1706, 1707, 1717, 1718, 1733, 1719, 1756, - /* 530 */ 1738, 1758, 1739, 1709, 1765, 1741, 1731, 1767, 1734, 1768, - /* 540 */ 1740, 1771, 1750, 1753, 1748, 1752, 1597, 1689, 1704, 1776, - /* 550 */ 1644, 1714, 1754, 1788, 1608, 1789, 1646, 1658, 1790, 1798, - /* 560 */ 1659, 1664, 1809, 1769, 1565, 1721, 1724, 1726, 1667, 1599, - /* 570 */ 1676, 1568, 1730, 1785, 1743, 1745, 1746, 1747, 1755, 1787, - /* 580 */ 1780, 1786, 1749, 1791, 1584, 1757, 1759, 1840, 1802, 1606, - /* 590 */ 1813, 1814, 1819, 1822, 1823, 1824, 1764, 1766, 1816, 1639, - /* 600 */ 1820, 1827, 1866, 1867, 1876, 1877, 1784, 1839, 1619, 1833, - /* 610 */ 1799, 1801, 1803, 1805, 1806, 1742, 1808, 1884, 1859, 1751, - /* 620 */ 1810, 1807, 1619, 1857, 1862, 1679, 1684, 1691, 1908, 1889, - /* 630 */ 1715, 1818, 1821, 1826, 1828, 1830, 1832, 1872, 1831, 1834, - /* 640 */ 1875, 1835, 1896, 1722, 1838, 1837, 1841, 1899, 1901, 1843, - /* 650 */ 1845, 1904, 1849, 1850, 1912, 1853, 1854, 1914, 1856, 1858, - /* 660 */ 1917, 1860, 1844, 1846, 1848, 1865, 1934, 1852, 1869, 1913, - /* 670 */ 1873, 1927, 1878, 1913, 1913, 1948, 1922, 1909, 1942, 1952, - /* 680 */ 1953, 1955, 1956, 1957, 1959, 1960, 1969, 1971, 1937, 1916, - /* 690 */ 1966, 1976, 1983, 1985, 1999, 1988, 1991, 1992, 1958, 1706, - /* 700 */ 1994, 1707, 1995, 1996, 1997, 2000, 2003, 2001, 2034, 2002, - /* 710 */ 2004, 2005, 2038, 2007, 2006, 2008, 2039, 2010, 2009, 2011, - /* 720 */ 2040, 2016, 2013, 2014, 2043, 2021, 2023, 2059, 2042, 2041, - /* 730 */ 2044, 2045, 2048, 2051, + /* 0 */ 874, 0, 72, 0, 293, 293, 293, 293, 293, 293, + /* 10 */ 293, 293, 293, 293, 293, 365, 584, 584, 656, 584, + /* 20 */ 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, + /* 30 */ 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, + /* 40 */ 584, 584, 584, 584, 584, 584, 584, 584, 172, 292, + /* 50 */ 185, 184, 135, 529, 535, 529, 184, 184, 1380, 1380, + /* 60 */ 1380, 529, 1380, 1380, 388, 529, 16, 482, 115, 115, + /* 70 */ 482, 86, 86, 307, 360, 346, 346, 115, 115, 115, + /* 80 */ 115, 115, 115, 115, 147, 115, 115, 138, 16, 115, + /* 90 */ 115, 189, 115, 16, 115, 147, 115, 147, 16, 115, + /* 100 */ 115, 16, 115, 16, 16, 16, 115, 176, 803, 34, + /* 110 */ 34, 219, 458, 982, 982, 982, 982, 982, 982, 982, + /* 120 */ 982, 982, 982, 982, 982, 982, 982, 982, 982, 982, + /* 130 */ 982, 982, 217, 379, 307, 360, 2, 249, 521, 521, + /* 140 */ 521, 855, 152, 152, 249, 245, 245, 245, 260, 208, + /* 150 */ 16, 617, 16, 617, 617, 650, 725, 36, 36, 36, + /* 160 */ 36, 36, 36, 36, 36, 298, 418, 406, 47, 329, + /* 170 */ 444, 60, 69, 239, 652, 353, 651, 792, 931, 832, + /* 180 */ 861, 878, 1009, 861, 998, 1012, 1056, 1080, 1287, 1154, + /* 190 */ 1296, 1323, 1296, 1194, 1339, 1339, 1296, 1194, 1194, 1339, + /* 200 */ 1276, 1339, 1339, 1339, 1358, 1358, 1368, 138, 1375, 138, + /* 210 */ 1379, 1385, 138, 1379, 138, 138, 138, 1339, 138, 1364, + /* 220 */ 1364, 1358, 16, 16, 16, 16, 16, 16, 16, 16, + /* 230 */ 16, 16, 16, 1339, 1358, 617, 617, 1232, 1331, 1368, + /* 240 */ 176, 1251, 1375, 176, 1339, 1323, 1323, 617, 1189, 1213, + /* 250 */ 617, 1189, 1213, 617, 617, 16, 1210, 1305, 1189, 1215, + /* 260 */ 1214, 1240, 1080, 1224, 1230, 1233, 1263, 245, 1492, 1339, + /* 270 */ 1379, 176, 176, 1504, 1213, 617, 617, 617, 617, 617, + /* 280 */ 1213, 617, 1362, 176, 650, 176, 245, 1446, 1450, 617, + /* 290 */ 725, 1339, 176, 1516, 1358, 2749, 2749, 2749, 2749, 2749, + /* 300 */ 2749, 2749, 2749, 2749, 899, 589, 530, 677, 685, 707, + /* 310 */ 911, 731, 15, 724, 893, 903, 987, 987, 987, 987, + /* 320 */ 987, 987, 987, 987, 987, 716, 699, 295, 295, 407, + /* 330 */ 161, 489, 397, 81, 370, 263, 263, 557, 791, 583, + /* 340 */ 557, 557, 557, 1113, 1020, 642, 1072, 971, 1064, 1071, + /* 350 */ 1073, 1078, 1162, 1169, 1196, 989, 1089, 1106, 1029, 1133, + /* 360 */ 1138, 1139, 1083, 1057, 66, 1049, 1179, 1180, 1184, 1187, + /* 370 */ 1188, 1190, 1248, 1212, 563, 1171, 1124, 1216, 431, 1218, + /* 380 */ 1219, 1220, 1227, 1228, 1235, 1159, 1260, 1285, 531, 1225, + /* 390 */ 1574, 1576, 1577, 1537, 1581, 1548, 1384, 1554, 1557, 1559, + /* 400 */ 1391, 1596, 1562, 1564, 1397, 1602, 1406, 1611, 1578, 1612, + /* 410 */ 1594, 1617, 1584, 1427, 1434, 1437, 1622, 1624, 1625, 1447, + /* 420 */ 1452, 1626, 1632, 1587, 1635, 1642, 1646, 1605, 1649, 1651, + /* 430 */ 1652, 1656, 1657, 1661, 1662, 1672, 1512, 1630, 1674, 1524, + /* 440 */ 1677, 1679, 1681, 1682, 1686, 1687, 1691, 1692, 1694, 1695, + /* 450 */ 1702, 1704, 1706, 1707, 1708, 1711, 1670, 1713, 1716, 1718, + /* 460 */ 1720, 1721, 1725, 1710, 1734, 1735, 1737, 1603, 1738, 1740, + /* 470 */ 1741, 1684, 1712, 1743, 1688, 1745, 1690, 1750, 1755, 1714, + /* 480 */ 1719, 1715, 1705, 1754, 1722, 1756, 1724, 1766, 1732, 1736, + /* 490 */ 1773, 1774, 1776, 1742, 1607, 1777, 1783, 1786, 1730, 1796, + /* 500 */ 1797, 1764, 1757, 1765, 1803, 1772, 1760, 1770, 1810, 1778, + /* 510 */ 1763, 1775, 1812, 1780, 1769, 1781, 1818, 1819, 1821, 1822, + /* 520 */ 1723, 1727, 1788, 1802, 1825, 1791, 1792, 1799, 1800, 1787, + /* 530 */ 1798, 1809, 1811, 1823, 1814, 1832, 1828, 1851, 1830, 1804, + /* 540 */ 1853, 1834, 1824, 1857, 1826, 1858, 1829, 1863, 1843, 1846, + /* 550 */ 1833, 1835, 1836, 1784, 1771, 1869, 1709, 1782, 1837, 1873, + /* 560 */ 1696, 1854, 1717, 1726, 1875, 1877, 1731, 1733, 1882, 1842, + /* 570 */ 1636, 1793, 1807, 1794, 1739, 1676, 1744, 1653, 1813, 1864, + /* 580 */ 1868, 1816, 1844, 1848, 1852, 1820, 1871, 1872, 1874, 1856, + /* 590 */ 1876, 1666, 1827, 1841, 1919, 1885, 1673, 1891, 1904, 1907, + /* 600 */ 1912, 1914, 1920, 1859, 1860, 1916, 1728, 1910, 1917, 1959, + /* 610 */ 1961, 1962, 1965, 1870, 1928, 1705, 1921, 1879, 1890, 1894, + /* 620 */ 1908, 1909, 1805, 1913, 1969, 1931, 1840, 1918, 1888, 1705, + /* 630 */ 1964, 1934, 1785, 1789, 1806, 2006, 1990, 1808, 1923, 1926, + /* 640 */ 1940, 1927, 1942, 1930, 1966, 1944, 1946, 1997, 1948, 2025, + /* 650 */ 1831, 1952, 1945, 1968, 2014, 2026, 1967, 1970, 2027, 1973, + /* 660 */ 1971, 2036, 1976, 1978, 2038, 1980, 1988, 2051, 1991, 1974, + /* 670 */ 1977, 1981, 1992, 2066, 1982, 1993, 2047, 2000, 2057, 2002, + /* 680 */ 2047, 2047, 2071, 2035, 2044, 2076, 2078, 2080, 2081, 2082, + /* 690 */ 2083, 2085, 2086, 2088, 2089, 2048, 2032, 2087, 2091, 2093, + /* 700 */ 2095, 2112, 2098, 2100, 2101, 2067, 1787, 2102, 1798, 2104, + /* 710 */ 2105, 2107, 2108, 2122, 2110, 2146, 2113, 2099, 2114, 2150, + /* 720 */ 2116, 2109, 2120, 2152, 2125, 2126, 2134, 2155, 2129, 2127, + /* 730 */ 2138, 2161, 2144, 2145, 2181, 2160, 2162, 2164, 2165, 2163, + /* 740 */ 2168, }; -#define YY_REDUCE_COUNT (301) -#define YY_REDUCE_MIN (-432) -#define YY_REDUCE_MAX (2663) +#define YY_REDUCE_COUNT (303) +#define YY_REDUCE_MIN (-438) +#define YY_REDUCE_MAX (2328) static const short yy_reduce_ofst[] = { - /* 0 */ 164, 683, 747, 806, 866, 925, 959, 1052, 1072, 1211, - /* 10 */ 1271, 1299, 1366, 1389, 1457, -293, -3, 68, 1477, 285, - /* 20 */ 1567, 1585, 1601, 1673, 1695, 1763, 1783, 1851, 1871, 1928, - /* 30 */ 1962, 1990, 2050, 2071, 2144, 2168, 2225, 2245, 2302, 2323, - /* 40 */ 2351, 2411, 2432, 2505, 2529, 2586, 2606, 2663, -263, -349, - /* 50 */ 298, 341, -385, -255, 162, 624, -17, 159, -354, -322, - /* 60 */ -432, -339, -231, -400, 171, -52, -359, -4, 399, -331, - /* 70 */ -333, 23, -343, -235, 100, 108, 183, 191, 199, 278, - /* 80 */ 306, 470, 479, -23, 482, 543, -106, -176, 561, 647, - /* 90 */ 193, 654, 287, 681, 297, 684, 378, -279, 696, 699, - /* 100 */ 292, 711, 475, 382, 477, 737, 51, -311, -317, -317, - /* 110 */ -214, -139, -328, -11, 53, 122, 436, 451, 522, 524, - /* 120 */ 549, 550, 555, 622, 664, 717, 730, 731, 754, 763, - /* 130 */ 771, -294, -41, 72, -178, 321, 179, -41, -7, 194, - /* 140 */ 447, 347, 463, 309, 154, 452, 537, -267, 255, -266, - /* 150 */ 557, 668, 770, 780, 701, 395, -355, -351, 498, 535, - /* 160 */ 631, 669, 677, 631, 687, 794, 790, 769, 692, 715, - /* 170 */ 859, 796, 868, 868, 906, 883, 933, 899, 889, 844, - /* 180 */ 844, 846, 844, 871, 873, 868, 911, 913, 927, 943, - /* 190 */ 942, 946, 950, 998, 1005, 964, 967, 968, 1004, 1014, - /* 200 */ 1015, 1016, 1026, 1027, 961, 1018, 989, 1023, 1031, 985, - /* 210 */ 1036, 1042, 1040, 1043, 1044, 1048, 1049, 1051, 1053, 1063, - /* 220 */ 1037, 1038, 1046, 1054, 1057, 1061, 1062, 1064, 1066, 1069, - /* 230 */ 1070, 1065, 1076, 1030, 1035, 997, 1010, 1020, 1074, 1025, - /* 240 */ 1056, 1087, 1096, 1060, 1071, 1075, 987, 1083, 1077, 990, - /* 250 */ 1084, 1078, 1079, 868, 988, 993, 999, 1009, 1012, 1029, - /* 260 */ 1085, 992, 1019, 1034, 844, 1121, 1086, 1161, 1165, 1153, - /* 270 */ 1158, 1119, 1118, 1134, 1135, 1136, 1137, 1138, 1125, 1141, - /* 280 */ 1132, 1175, 1162, 1179, 1151, 1094, 1160, 1154, 1176, 1188, - /* 290 */ 1189, 1197, 1200, 1140, 1142, 1143, 1145, 1182, 1183, 1184, - /* 300 */ 1191, 1218, + /* 0 */ -256, 679, 728, 795, 827, 876, 935, 969, 1042, 1091, + /* 10 */ 1155, 1223, 243, 1253, 1283, -294, -1, 1313, 1374, 1347, + /* 20 */ 1423, 1485, 1517, 1566, 1583, 1640, 1615, 1664, 1689, 1752, + /* 30 */ 1779, 1801, 1881, 1898, 1915, 1947, 1972, 1996, 2021, 2084, + /* 40 */ 2111, 2133, 2213, 2230, 2247, 2279, 2304, 2328, -264, 169, + /* 50 */ 171, -173, -350, 604, 736, 863, -336, -5, -323, -61, + /* 60 */ 709, 303, 349, 727, -438, -386, -180, -212, 68, 98, + /* 70 */ -377, -331, -327, -344, -307, -199, -7, 71, 197, 200, + /* 80 */ 268, 270, 309, 411, -154, 561, 653, 13, -324, 654, + /* 90 */ 675, 414, 676, 97, 718, 213, 770, 238, 311, 666, + /* 100 */ 674, 472, 782, 533, 559, 568, 810, -105, -288, -93, + /* 110 */ -93, -75, -272, -187, 77, 308, 336, 354, 359, 410, + /* 120 */ 412, 413, 442, 447, 460, 518, 585, 663, 690, 691, + /* 130 */ 694, 695, -342, -41, -206, 124, 486, 516, -41, 526, + /* 140 */ 648, 117, -23, 41, 593, 230, 487, 667, 428, 269, + /* 150 */ 409, 50, 350, 700, 740, 574, 668, -354, 402, 550, + /* 160 */ 768, 776, 793, 835, 776, 490, 858, 888, 844, 800, + /* 170 */ 812, 929, 825, 918, 918, 942, 914, 950, 930, 926, + /* 180 */ 873, 873, 859, 873, 890, 885, 918, 925, 933, 941, + /* 190 */ 960, 962, 972, 978, 1022, 1024, 983, 984, 988, 1030, + /* 200 */ 1025, 1032, 1035, 1037, 1047, 1048, 990, 1045, 1021, 1052, + /* 210 */ 1063, 1011, 1062, 1068, 1065, 1069, 1075, 1070, 1076, 1081, + /* 220 */ 1082, 1085, 1066, 1067, 1074, 1077, 1079, 1084, 1087, 1088, + /* 230 */ 1092, 1101, 1102, 1086, 1093, 1055, 1058, 1027, 1031, 1034, + /* 240 */ 1094, 1043, 1095, 1099, 1105, 1060, 1090, 1096, 1016, 1097, + /* 250 */ 1103, 1028, 1098, 1104, 1107, 918, 1033, 1038, 1041, 1044, + /* 260 */ 1046, 1050, 1111, 1026, 1051, 1039, 873, 1125, 1108, 1175, + /* 270 */ 1181, 1172, 1183, 1140, 1137, 1156, 1158, 1160, 1161, 1163, + /* 280 */ 1144, 1164, 1150, 1197, 1185, 1198, 1174, 1115, 1182, 1176, + /* 290 */ 1195, 1211, 1206, 1221, 1226, 1165, 1151, 1166, 1167, 1200, + /* 300 */ 1204, 1207, 1234, 1238, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 10 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 20 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 30 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 40 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 50 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 60 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 70 */ 1647, 1647, 1904, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 80 */ 1647, 1647, 1647, 1647, 1647, 1647, 1725, 1647, 1647, 1647, - /* 90 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 100 */ 1647, 1647, 1647, 1647, 1647, 1647, 1723, 1897, 2111, 1647, - /* 110 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 120 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 130 */ 1647, 1647, 2123, 1647, 1647, 1725, 1647, 2123, 2123, 2123, - /* 140 */ 1723, 2083, 2083, 1647, 1647, 1647, 1647, 1958, 1647, 1647, - /* 150 */ 1647, 1647, 1647, 1647, 1832, 1647, 1647, 1647, 1647, 1647, - /* 160 */ 1856, 1647, 1647, 1647, 1950, 1647, 1647, 2148, 2202, 1647, - /* 170 */ 1647, 2151, 1647, 1647, 1647, 1909, 1647, 1785, 2138, 2115, - /* 180 */ 2129, 2186, 2116, 2113, 2132, 1647, 2142, 1647, 1943, 1902, - /* 190 */ 1647, 1902, 1899, 1647, 1647, 1902, 1899, 1899, 1776, 1647, - /* 200 */ 1647, 1647, 1647, 1647, 1647, 1725, 1647, 1725, 1647, 1647, - /* 210 */ 1725, 1647, 1725, 1725, 1725, 1647, 1725, 1704, 1704, 1647, - /* 220 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 230 */ 1647, 1647, 1647, 1647, 1647, 1968, 1956, 1647, 1723, 1952, - /* 240 */ 1647, 1723, 1647, 1647, 1647, 1647, 2159, 2157, 1647, 2159, - /* 250 */ 2157, 1647, 1647, 1647, 2171, 2167, 2159, 2175, 2173, 2144, - /* 260 */ 2142, 2205, 2192, 2188, 2129, 1647, 1647, 1647, 1647, 1723, - /* 270 */ 1723, 1647, 2157, 1647, 1647, 1647, 1647, 1647, 2157, 1647, - /* 280 */ 1647, 1723, 1647, 1723, 1647, 1647, 1801, 1647, 1647, 1647, - /* 290 */ 1723, 1679, 1647, 1945, 1961, 1927, 1927, 1835, 1835, 1835, - /* 300 */ 1726, 1652, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 310 */ 1647, 1647, 1647, 1647, 2170, 2169, 2038, 1647, 2087, 2086, - /* 320 */ 2085, 2076, 2037, 1797, 1647, 2036, 2035, 1647, 1647, 1647, - /* 330 */ 1647, 1647, 1647, 1918, 1917, 2029, 1647, 1647, 2030, 2028, - /* 340 */ 2027, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 350 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 2189, - /* 360 */ 2193, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 2112, 1647, - /* 370 */ 1647, 1647, 1647, 1647, 2011, 1647, 1647, 1647, 1647, 1647, - /* 380 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 390 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 400 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 410 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 420 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 430 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 440 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 450 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 460 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 470 */ 1647, 1647, 1647, 1647, 1647, 1684, 2016, 1647, 1647, 1647, - /* 480 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 490 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 500 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 510 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 520 */ 1647, 1647, 1647, 1764, 1763, 1647, 1647, 1647, 1647, 1647, - /* 530 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 540 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 2020, 1647, 1647, - /* 550 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 560 */ 1647, 1647, 2185, 2145, 1647, 1647, 1647, 1647, 1647, 1647, - /* 570 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 580 */ 1647, 2011, 1647, 2168, 1647, 1647, 2183, 1647, 2187, 1647, - /* 590 */ 1647, 1647, 1647, 1647, 1647, 1647, 2122, 2118, 1647, 1647, - /* 600 */ 2114, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 2019, 1647, - /* 610 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 620 */ 1647, 1647, 2010, 1647, 2073, 1647, 1647, 1647, 2107, 1647, - /* 630 */ 1647, 2058, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 640 */ 1647, 2020, 1647, 2023, 1647, 1647, 1647, 1647, 1647, 1829, - /* 650 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 660 */ 1647, 1647, 1814, 1812, 1811, 1810, 1647, 1807, 1647, 1842, - /* 670 */ 1647, 1647, 1647, 1838, 1837, 1647, 1647, 1647, 1647, 1647, - /* 680 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 690 */ 1744, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1736, - /* 700 */ 1647, 1735, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 710 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 720 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - /* 730 */ 1647, 1647, 1647, 1647, + /* 0 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 10 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 20 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 30 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 40 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 50 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 60 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 70 */ 1661, 1661, 1661, 1919, 1661, 1661, 1661, 1661, 1661, 1661, + /* 80 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1740, 1661, 1661, + /* 90 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 100 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1738, 1912, 2127, + /* 110 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 120 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 130 */ 1661, 1661, 1661, 2139, 1661, 1661, 1740, 1661, 2139, 2139, + /* 140 */ 2139, 1738, 2099, 2099, 1661, 1661, 1661, 1661, 1973, 1661, + /* 150 */ 1661, 1661, 1661, 1661, 1661, 1847, 1661, 1661, 1661, 1661, + /* 160 */ 1661, 1871, 1661, 1661, 1661, 1965, 1661, 1661, 2164, 2220, + /* 170 */ 1661, 1661, 2167, 1661, 1661, 1661, 1924, 1661, 1800, 2154, + /* 180 */ 2131, 2145, 2204, 2132, 2129, 2148, 1661, 2158, 1661, 1958, + /* 190 */ 1917, 1661, 1917, 1914, 1661, 1661, 1917, 1914, 1914, 1661, + /* 200 */ 1791, 1661, 1661, 1661, 1661, 1661, 1661, 1740, 1661, 1740, + /* 210 */ 1661, 1661, 1740, 1661, 1740, 1740, 1740, 1661, 1740, 1718, + /* 220 */ 1718, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 230 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1984, 1971, 1661, + /* 240 */ 1738, 1967, 1661, 1738, 1661, 1661, 1661, 1661, 2175, 2173, + /* 250 */ 1661, 2175, 2173, 1661, 1661, 1661, 2189, 2185, 2175, 2193, + /* 260 */ 2191, 2160, 2158, 2223, 2210, 2206, 2145, 1661, 1661, 1661, + /* 270 */ 1661, 1738, 1738, 1661, 2173, 1661, 1661, 1661, 1661, 1661, + /* 280 */ 2173, 1661, 1661, 1738, 1661, 1738, 1661, 1661, 1816, 1661, + /* 290 */ 1661, 1661, 1738, 1693, 1661, 1960, 1976, 1942, 1942, 1850, + /* 300 */ 1850, 1850, 1741, 1666, 1661, 1661, 1661, 1661, 1661, 1661, + /* 310 */ 1661, 1661, 1661, 1661, 1661, 1661, 2188, 2187, 2054, 1661, + /* 320 */ 2103, 2102, 2101, 2092, 2053, 1812, 1661, 2052, 2051, 1661, + /* 330 */ 1661, 1661, 1661, 1661, 1661, 1933, 1932, 2045, 1661, 1661, + /* 340 */ 2046, 2044, 2043, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 350 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 360 */ 1661, 1661, 1661, 2207, 2211, 1661, 1661, 1661, 1661, 1661, + /* 370 */ 1661, 1661, 2128, 1661, 1661, 1661, 1661, 1661, 2027, 1661, + /* 380 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 390 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 400 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 410 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 420 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 430 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 440 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 450 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 460 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 470 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 480 */ 1661, 1698, 2032, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 490 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 500 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 510 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 520 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1779, + /* 530 */ 1778, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 540 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 550 */ 1661, 1661, 1661, 2036, 1661, 1661, 1661, 1661, 1661, 1661, + /* 560 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 2203, 2161, + /* 570 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 580 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 2027, 1661, + /* 590 */ 2186, 1661, 1661, 2201, 1661, 2205, 1661, 1661, 1661, 1661, + /* 600 */ 1661, 1661, 1661, 2138, 2134, 1661, 1661, 2130, 1661, 1661, + /* 610 */ 1661, 1661, 1661, 1661, 1661, 2035, 1661, 1661, 1661, 1661, + /* 620 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 2026, + /* 630 */ 1661, 2089, 1661, 1661, 1661, 2123, 1661, 1661, 2074, 1661, + /* 640 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 2036, 1661, + /* 650 */ 2039, 1661, 1661, 1661, 1661, 1661, 1844, 1661, 1661, 1661, + /* 660 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1829, + /* 670 */ 1827, 1826, 1825, 1661, 1822, 1661, 1857, 1661, 1661, 1661, + /* 680 */ 1853, 1852, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 690 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1759, 1661, 1661, + /* 700 */ 1661, 1661, 1661, 1661, 1661, 1661, 1751, 1661, 1750, 1661, + /* 710 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 720 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 730 */ 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, + /* 740 */ 1661, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1110,6 +1044,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* USE => nothing */ 0, /* FLUSH => nothing */ 0, /* TRIM => nothing */ + 0, /* COMPACT => nothing */ 0, /* IF => nothing */ 0, /* NOT => nothing */ 0, /* EXISTS => nothing */ @@ -1245,6 +1180,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* IGNORE => nothing */ 0, /* EXPIRED => nothing */ 0, /* FILL_HISTORY => nothing */ + 0, /* UPDATE => nothing */ 0, /* SUBTABLE => nothing */ 0, /* KILL => nothing */ 0, /* CONNECTION => nothing */ @@ -1277,7 +1213,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* SERVER_STATUS => nothing */ 0, /* CURRENT_USER => nothing */ 0, /* CASE => nothing */ - 272, /* END => ABORT */ + 276, /* END => ABORT */ 0, /* WHEN => nothing */ 0, /* THEN => nothing */ 0, /* ELSE => nothing */ @@ -1306,8 +1242,10 @@ static const YYCODETYPE yyFallback[] = { 0, /* SLIDING => nothing */ 0, /* FILL => nothing */ 0, /* VALUE => nothing */ + 0, /* VALUE_F => nothing */ 0, /* NONE => nothing */ 0, /* PREV => nothing */ + 0, /* NULL_F => nothing */ 0, /* LINEAR => nothing */ 0, /* NEXT => nothing */ 0, /* HAVING => nothing */ @@ -1321,59 +1259,57 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ABORT => nothing */ - 272, /* AFTER => ABORT */ - 272, /* ATTACH => ABORT */ - 272, /* BEFORE => ABORT */ - 272, /* BEGIN => ABORT */ - 272, /* BITAND => ABORT */ - 272, /* BITNOT => ABORT */ - 272, /* BITOR => ABORT */ - 272, /* BLOCKS => ABORT */ - 272, /* CHANGE => ABORT */ - 272, /* COMMA => ABORT */ - 272, /* COMPACT => ABORT */ - 272, /* CONCAT => ABORT */ - 272, /* CONFLICT => ABORT */ - 272, /* COPY => ABORT */ - 272, /* DEFERRED => ABORT */ - 272, /* DELIMITERS => ABORT */ - 272, /* DETACH => ABORT */ - 272, /* DIVIDE => ABORT */ - 272, /* DOT => ABORT */ - 272, /* EACH => ABORT */ - 272, /* FAIL => ABORT */ - 272, /* FILE => ABORT */ - 272, /* FOR => ABORT */ - 272, /* GLOB => ABORT */ - 272, /* ID => ABORT */ - 272, /* IMMEDIATE => ABORT */ - 272, /* IMPORT => ABORT */ - 272, /* INITIALLY => ABORT */ - 272, /* INSTEAD => ABORT */ - 272, /* ISNULL => ABORT */ - 272, /* KEY => ABORT */ - 272, /* MODULES => ABORT */ - 272, /* NK_BITNOT => ABORT */ - 272, /* NK_SEMI => ABORT */ - 272, /* NOTNULL => ABORT */ - 272, /* OF => ABORT */ - 272, /* PLUS => ABORT */ - 272, /* PRIVILEGE => ABORT */ - 272, /* RAISE => ABORT */ - 272, /* REPLACE => ABORT */ - 272, /* RESTRICT => ABORT */ - 272, /* ROW => ABORT */ - 272, /* SEMI => ABORT */ - 272, /* STAR => ABORT */ - 272, /* STATEMENT => ABORT */ - 272, /* STRICT => ABORT */ - 272, /* STRING => ABORT */ - 272, /* TIMES => ABORT */ - 272, /* UPDATE => ABORT */ - 272, /* VALUES => ABORT */ - 272, /* VARIABLE => ABORT */ - 272, /* VIEW => ABORT */ - 272, /* WAL => ABORT */ + 276, /* AFTER => ABORT */ + 276, /* ATTACH => ABORT */ + 276, /* BEFORE => ABORT */ + 276, /* BEGIN => ABORT */ + 276, /* BITAND => ABORT */ + 276, /* BITNOT => ABORT */ + 276, /* BITOR => ABORT */ + 276, /* BLOCKS => ABORT */ + 276, /* CHANGE => ABORT */ + 276, /* COMMA => ABORT */ + 276, /* CONCAT => ABORT */ + 276, /* CONFLICT => ABORT */ + 276, /* COPY => ABORT */ + 276, /* DEFERRED => ABORT */ + 276, /* DELIMITERS => ABORT */ + 276, /* DETACH => ABORT */ + 276, /* DIVIDE => ABORT */ + 276, /* DOT => ABORT */ + 276, /* EACH => ABORT */ + 276, /* FAIL => ABORT */ + 276, /* FILE => ABORT */ + 276, /* FOR => ABORT */ + 276, /* GLOB => ABORT */ + 276, /* ID => ABORT */ + 276, /* IMMEDIATE => ABORT */ + 276, /* IMPORT => ABORT */ + 276, /* INITIALLY => ABORT */ + 276, /* INSTEAD => ABORT */ + 276, /* ISNULL => ABORT */ + 276, /* KEY => ABORT */ + 276, /* MODULES => ABORT */ + 276, /* NK_BITNOT => ABORT */ + 276, /* NK_SEMI => ABORT */ + 276, /* NOTNULL => ABORT */ + 276, /* OF => ABORT */ + 276, /* PLUS => ABORT */ + 276, /* PRIVILEGE => ABORT */ + 276, /* RAISE => ABORT */ + 276, /* REPLACE => ABORT */ + 276, /* RESTRICT => ABORT */ + 276, /* ROW => ABORT */ + 276, /* SEMI => ABORT */ + 276, /* STAR => ABORT */ + 276, /* STATEMENT => ABORT */ + 276, /* STRICT => ABORT */ + 276, /* STRING => ABORT */ + 276, /* TIMES => ABORT */ + 276, /* VALUES => ABORT */ + 276, /* VARIABLE => ABORT */ + 276, /* VIEW => ABORT */ + 276, /* WAL => ABORT */ }; #endif /* YYFALLBACK */ @@ -1523,411 +1459,413 @@ static const char *const yyTokenName[] = { /* 59 */ "USE", /* 60 */ "FLUSH", /* 61 */ "TRIM", - /* 62 */ "IF", - /* 63 */ "NOT", - /* 64 */ "EXISTS", - /* 65 */ "BUFFER", - /* 66 */ "CACHEMODEL", - /* 67 */ "CACHESIZE", - /* 68 */ "COMP", - /* 69 */ "DURATION", - /* 70 */ "NK_VARIABLE", - /* 71 */ "MAXROWS", - /* 72 */ "MINROWS", - /* 73 */ "KEEP", - /* 74 */ "PAGES", - /* 75 */ "PAGESIZE", - /* 76 */ "TSDB_PAGESIZE", - /* 77 */ "PRECISION", - /* 78 */ "REPLICA", - /* 79 */ "VGROUPS", - /* 80 */ "SINGLE_STABLE", - /* 81 */ "RETENTIONS", - /* 82 */ "SCHEMALESS", - /* 83 */ "WAL_LEVEL", - /* 84 */ "WAL_FSYNC_PERIOD", - /* 85 */ "WAL_RETENTION_PERIOD", - /* 86 */ "WAL_RETENTION_SIZE", - /* 87 */ "WAL_ROLL_PERIOD", - /* 88 */ "WAL_SEGMENT_SIZE", - /* 89 */ "STT_TRIGGER", - /* 90 */ "TABLE_PREFIX", - /* 91 */ "TABLE_SUFFIX", - /* 92 */ "NK_COLON", - /* 93 */ "MAX_SPEED", - /* 94 */ "TABLE", - /* 95 */ "NK_LP", - /* 96 */ "NK_RP", - /* 97 */ "STABLE", - /* 98 */ "ADD", - /* 99 */ "COLUMN", - /* 100 */ "MODIFY", - /* 101 */ "RENAME", - /* 102 */ "TAG", - /* 103 */ "SET", - /* 104 */ "NK_EQ", - /* 105 */ "USING", - /* 106 */ "TAGS", - /* 107 */ "COMMENT", - /* 108 */ "BOOL", - /* 109 */ "TINYINT", - /* 110 */ "SMALLINT", - /* 111 */ "INT", - /* 112 */ "INTEGER", - /* 113 */ "BIGINT", - /* 114 */ "FLOAT", - /* 115 */ "DOUBLE", - /* 116 */ "BINARY", - /* 117 */ "TIMESTAMP", - /* 118 */ "NCHAR", - /* 119 */ "UNSIGNED", - /* 120 */ "JSON", - /* 121 */ "VARCHAR", - /* 122 */ "MEDIUMBLOB", - /* 123 */ "BLOB", - /* 124 */ "VARBINARY", - /* 125 */ "DECIMAL", - /* 126 */ "MAX_DELAY", - /* 127 */ "WATERMARK", - /* 128 */ "ROLLUP", - /* 129 */ "TTL", - /* 130 */ "SMA", - /* 131 */ "DELETE_MARK", - /* 132 */ "FIRST", - /* 133 */ "LAST", - /* 134 */ "SHOW", - /* 135 */ "PRIVILEGES", - /* 136 */ "DATABASES", - /* 137 */ "TABLES", - /* 138 */ "STABLES", - /* 139 */ "MNODES", - /* 140 */ "QNODES", - /* 141 */ "FUNCTIONS", - /* 142 */ "INDEXES", - /* 143 */ "ACCOUNTS", - /* 144 */ "APPS", - /* 145 */ "CONNECTIONS", - /* 146 */ "LICENCES", - /* 147 */ "GRANTS", - /* 148 */ "QUERIES", - /* 149 */ "SCORES", - /* 150 */ "TOPICS", - /* 151 */ "VARIABLES", - /* 152 */ "CLUSTER", - /* 153 */ "BNODES", - /* 154 */ "SNODES", - /* 155 */ "TRANSACTIONS", - /* 156 */ "DISTRIBUTED", - /* 157 */ "CONSUMERS", - /* 158 */ "SUBSCRIPTIONS", - /* 159 */ "VNODES", - /* 160 */ "ALIVE", - /* 161 */ "LIKE", - /* 162 */ "TBNAME", - /* 163 */ "QTAGS", - /* 164 */ "AS", - /* 165 */ "INDEX", - /* 166 */ "FUNCTION", - /* 167 */ "INTERVAL", - /* 168 */ "COUNT", - /* 169 */ "LAST_ROW", - /* 170 */ "TOPIC", - /* 171 */ "WITH", - /* 172 */ "META", - /* 173 */ "CONSUMER", - /* 174 */ "GROUP", - /* 175 */ "DESC", - /* 176 */ "DESCRIBE", - /* 177 */ "RESET", - /* 178 */ "QUERY", - /* 179 */ "CACHE", - /* 180 */ "EXPLAIN", - /* 181 */ "ANALYZE", - /* 182 */ "VERBOSE", - /* 183 */ "NK_BOOL", - /* 184 */ "RATIO", - /* 185 */ "NK_FLOAT", - /* 186 */ "OUTPUTTYPE", - /* 187 */ "AGGREGATE", - /* 188 */ "BUFSIZE", - /* 189 */ "STREAM", - /* 190 */ "INTO", - /* 191 */ "TRIGGER", - /* 192 */ "AT_ONCE", - /* 193 */ "WINDOW_CLOSE", - /* 194 */ "IGNORE", - /* 195 */ "EXPIRED", - /* 196 */ "FILL_HISTORY", - /* 197 */ "SUBTABLE", - /* 198 */ "KILL", - /* 199 */ "CONNECTION", - /* 200 */ "TRANSACTION", - /* 201 */ "BALANCE", - /* 202 */ "VGROUP", - /* 203 */ "MERGE", - /* 204 */ "REDISTRIBUTE", - /* 205 */ "SPLIT", - /* 206 */ "DELETE", - /* 207 */ "INSERT", - /* 208 */ "NULL", - /* 209 */ "NK_QUESTION", - /* 210 */ "NK_ARROW", - /* 211 */ "ROWTS", - /* 212 */ "QSTART", - /* 213 */ "QEND", - /* 214 */ "QDURATION", - /* 215 */ "WSTART", - /* 216 */ "WEND", - /* 217 */ "WDURATION", - /* 218 */ "IROWTS", - /* 219 */ "ISFILLED", - /* 220 */ "CAST", - /* 221 */ "NOW", - /* 222 */ "TODAY", - /* 223 */ "TIMEZONE", - /* 224 */ "CLIENT_VERSION", - /* 225 */ "SERVER_VERSION", - /* 226 */ "SERVER_STATUS", - /* 227 */ "CURRENT_USER", - /* 228 */ "CASE", - /* 229 */ "END", - /* 230 */ "WHEN", - /* 231 */ "THEN", - /* 232 */ "ELSE", - /* 233 */ "BETWEEN", - /* 234 */ "IS", - /* 235 */ "NK_LT", - /* 236 */ "NK_GT", - /* 237 */ "NK_LE", - /* 238 */ "NK_GE", - /* 239 */ "NK_NE", - /* 240 */ "MATCH", - /* 241 */ "NMATCH", - /* 242 */ "CONTAINS", - /* 243 */ "IN", - /* 244 */ "JOIN", - /* 245 */ "INNER", - /* 246 */ "SELECT", - /* 247 */ "DISTINCT", - /* 248 */ "WHERE", - /* 249 */ "PARTITION", - /* 250 */ "BY", - /* 251 */ "SESSION", - /* 252 */ "STATE_WINDOW", - /* 253 */ "EVENT_WINDOW", - /* 254 */ "START", - /* 255 */ "SLIDING", - /* 256 */ "FILL", - /* 257 */ "VALUE", - /* 258 */ "NONE", - /* 259 */ "PREV", - /* 260 */ "LINEAR", - /* 261 */ "NEXT", - /* 262 */ "HAVING", - /* 263 */ "RANGE", - /* 264 */ "EVERY", - /* 265 */ "ORDER", - /* 266 */ "SLIMIT", - /* 267 */ "SOFFSET", - /* 268 */ "LIMIT", - /* 269 */ "OFFSET", - /* 270 */ "ASC", - /* 271 */ "NULLS", - /* 272 */ "ABORT", - /* 273 */ "AFTER", - /* 274 */ "ATTACH", - /* 275 */ "BEFORE", - /* 276 */ "BEGIN", - /* 277 */ "BITAND", - /* 278 */ "BITNOT", - /* 279 */ "BITOR", - /* 280 */ "BLOCKS", - /* 281 */ "CHANGE", - /* 282 */ "COMMA", - /* 283 */ "COMPACT", - /* 284 */ "CONCAT", - /* 285 */ "CONFLICT", - /* 286 */ "COPY", - /* 287 */ "DEFERRED", - /* 288 */ "DELIMITERS", - /* 289 */ "DETACH", - /* 290 */ "DIVIDE", - /* 291 */ "DOT", - /* 292 */ "EACH", - /* 293 */ "FAIL", - /* 294 */ "FILE", - /* 295 */ "FOR", - /* 296 */ "GLOB", - /* 297 */ "ID", - /* 298 */ "IMMEDIATE", - /* 299 */ "IMPORT", - /* 300 */ "INITIALLY", - /* 301 */ "INSTEAD", - /* 302 */ "ISNULL", - /* 303 */ "KEY", - /* 304 */ "MODULES", - /* 305 */ "NK_BITNOT", - /* 306 */ "NK_SEMI", - /* 307 */ "NOTNULL", - /* 308 */ "OF", - /* 309 */ "PLUS", - /* 310 */ "PRIVILEGE", - /* 311 */ "RAISE", - /* 312 */ "REPLACE", - /* 313 */ "RESTRICT", - /* 314 */ "ROW", - /* 315 */ "SEMI", - /* 316 */ "STAR", - /* 317 */ "STATEMENT", - /* 318 */ "STRICT", - /* 319 */ "STRING", - /* 320 */ "TIMES", - /* 321 */ "UPDATE", - /* 322 */ "VALUES", - /* 323 */ "VARIABLE", - /* 324 */ "VIEW", - /* 325 */ "WAL", - /* 326 */ "cmd", - /* 327 */ "account_options", - /* 328 */ "alter_account_options", - /* 329 */ "literal", - /* 330 */ "alter_account_option", - /* 331 */ "user_name", - /* 332 */ "sysinfo_opt", - /* 333 */ "privileges", - /* 334 */ "priv_level", - /* 335 */ "priv_type_list", - /* 336 */ "priv_type", - /* 337 */ "db_name", - /* 338 */ "topic_name", - /* 339 */ "dnode_endpoint", - /* 340 */ "force_opt", - /* 341 */ "not_exists_opt", - /* 342 */ "db_options", - /* 343 */ "exists_opt", - /* 344 */ "alter_db_options", - /* 345 */ "speed_opt", - /* 346 */ "integer_list", - /* 347 */ "variable_list", - /* 348 */ "retention_list", - /* 349 */ "alter_db_option", - /* 350 */ "retention", - /* 351 */ "full_table_name", - /* 352 */ "column_def_list", - /* 353 */ "tags_def_opt", - /* 354 */ "table_options", - /* 355 */ "multi_create_clause", - /* 356 */ "tags_def", - /* 357 */ "multi_drop_clause", - /* 358 */ "alter_table_clause", - /* 359 */ "alter_table_options", - /* 360 */ "column_name", - /* 361 */ "type_name", - /* 362 */ "signed_literal", - /* 363 */ "create_subtable_clause", - /* 364 */ "specific_cols_opt", - /* 365 */ "expression_list", - /* 366 */ "drop_table_clause", - /* 367 */ "col_name_list", - /* 368 */ "table_name", - /* 369 */ "column_def", - /* 370 */ "duration_list", - /* 371 */ "rollup_func_list", - /* 372 */ "alter_table_option", - /* 373 */ "duration_literal", - /* 374 */ "rollup_func_name", - /* 375 */ "function_name", - /* 376 */ "col_name", - /* 377 */ "db_name_cond_opt", - /* 378 */ "like_pattern_opt", - /* 379 */ "table_name_cond", - /* 380 */ "from_db_opt", - /* 381 */ "tag_list_opt", - /* 382 */ "tag_item", - /* 383 */ "column_alias", - /* 384 */ "full_index_name", - /* 385 */ "index_options", - /* 386 */ "index_name", - /* 387 */ "func_list", - /* 388 */ "sliding_opt", - /* 389 */ "sma_stream_opt", - /* 390 */ "func", - /* 391 */ "sma_func_name", - /* 392 */ "query_or_subquery", - /* 393 */ "cgroup_name", - /* 394 */ "analyze_opt", - /* 395 */ "explain_options", - /* 396 */ "insert_query", - /* 397 */ "agg_func_opt", - /* 398 */ "bufsize_opt", - /* 399 */ "stream_name", - /* 400 */ "stream_options", - /* 401 */ "col_list_opt", - /* 402 */ "tag_def_or_ref_opt", - /* 403 */ "subtable_opt", - /* 404 */ "expression", - /* 405 */ "dnode_list", - /* 406 */ "where_clause_opt", - /* 407 */ "signed", - /* 408 */ "literal_func", - /* 409 */ "literal_list", - /* 410 */ "table_alias", - /* 411 */ "expr_or_subquery", - /* 412 */ "pseudo_column", - /* 413 */ "column_reference", - /* 414 */ "function_expression", - /* 415 */ "case_when_expression", - /* 416 */ "star_func", - /* 417 */ "star_func_para_list", - /* 418 */ "noarg_func", - /* 419 */ "other_para_list", - /* 420 */ "star_func_para", - /* 421 */ "when_then_list", - /* 422 */ "case_when_else_opt", - /* 423 */ "common_expression", - /* 424 */ "when_then_expr", - /* 425 */ "predicate", - /* 426 */ "compare_op", - /* 427 */ "in_op", - /* 428 */ "in_predicate_value", - /* 429 */ "boolean_value_expression", - /* 430 */ "boolean_primary", - /* 431 */ "from_clause_opt", - /* 432 */ "table_reference_list", - /* 433 */ "table_reference", - /* 434 */ "table_primary", - /* 435 */ "joined_table", - /* 436 */ "alias_opt", - /* 437 */ "subquery", - /* 438 */ "parenthesized_joined_table", - /* 439 */ "join_type", - /* 440 */ "search_condition", - /* 441 */ "query_specification", - /* 442 */ "set_quantifier_opt", - /* 443 */ "select_list", - /* 444 */ "partition_by_clause_opt", - /* 445 */ "range_opt", - /* 446 */ "every_opt", - /* 447 */ "fill_opt", - /* 448 */ "twindow_clause_opt", - /* 449 */ "group_by_clause_opt", - /* 450 */ "having_clause_opt", - /* 451 */ "select_item", - /* 452 */ "partition_list", - /* 453 */ "partition_item", - /* 454 */ "fill_mode", - /* 455 */ "group_by_list", - /* 456 */ "query_expression", - /* 457 */ "query_simple", - /* 458 */ "order_by_clause_opt", - /* 459 */ "slimit_clause_opt", - /* 460 */ "limit_clause_opt", - /* 461 */ "union_query_expression", - /* 462 */ "query_simple_or_subquery", - /* 463 */ "sort_specification_list", - /* 464 */ "sort_specification", - /* 465 */ "ordering_specification_opt", - /* 466 */ "null_ordering_opt", + /* 62 */ "COMPACT", + /* 63 */ "IF", + /* 64 */ "NOT", + /* 65 */ "EXISTS", + /* 66 */ "BUFFER", + /* 67 */ "CACHEMODEL", + /* 68 */ "CACHESIZE", + /* 69 */ "COMP", + /* 70 */ "DURATION", + /* 71 */ "NK_VARIABLE", + /* 72 */ "MAXROWS", + /* 73 */ "MINROWS", + /* 74 */ "KEEP", + /* 75 */ "PAGES", + /* 76 */ "PAGESIZE", + /* 77 */ "TSDB_PAGESIZE", + /* 78 */ "PRECISION", + /* 79 */ "REPLICA", + /* 80 */ "VGROUPS", + /* 81 */ "SINGLE_STABLE", + /* 82 */ "RETENTIONS", + /* 83 */ "SCHEMALESS", + /* 84 */ "WAL_LEVEL", + /* 85 */ "WAL_FSYNC_PERIOD", + /* 86 */ "WAL_RETENTION_PERIOD", + /* 87 */ "WAL_RETENTION_SIZE", + /* 88 */ "WAL_ROLL_PERIOD", + /* 89 */ "WAL_SEGMENT_SIZE", + /* 90 */ "STT_TRIGGER", + /* 91 */ "TABLE_PREFIX", + /* 92 */ "TABLE_SUFFIX", + /* 93 */ "NK_COLON", + /* 94 */ "MAX_SPEED", + /* 95 */ "TABLE", + /* 96 */ "NK_LP", + /* 97 */ "NK_RP", + /* 98 */ "STABLE", + /* 99 */ "ADD", + /* 100 */ "COLUMN", + /* 101 */ "MODIFY", + /* 102 */ "RENAME", + /* 103 */ "TAG", + /* 104 */ "SET", + /* 105 */ "NK_EQ", + /* 106 */ "USING", + /* 107 */ "TAGS", + /* 108 */ "COMMENT", + /* 109 */ "BOOL", + /* 110 */ "TINYINT", + /* 111 */ "SMALLINT", + /* 112 */ "INT", + /* 113 */ "INTEGER", + /* 114 */ "BIGINT", + /* 115 */ "FLOAT", + /* 116 */ "DOUBLE", + /* 117 */ "BINARY", + /* 118 */ "TIMESTAMP", + /* 119 */ "NCHAR", + /* 120 */ "UNSIGNED", + /* 121 */ "JSON", + /* 122 */ "VARCHAR", + /* 123 */ "MEDIUMBLOB", + /* 124 */ "BLOB", + /* 125 */ "VARBINARY", + /* 126 */ "DECIMAL", + /* 127 */ "MAX_DELAY", + /* 128 */ "WATERMARK", + /* 129 */ "ROLLUP", + /* 130 */ "TTL", + /* 131 */ "SMA", + /* 132 */ "DELETE_MARK", + /* 133 */ "FIRST", + /* 134 */ "LAST", + /* 135 */ "SHOW", + /* 136 */ "PRIVILEGES", + /* 137 */ "DATABASES", + /* 138 */ "TABLES", + /* 139 */ "STABLES", + /* 140 */ "MNODES", + /* 141 */ "QNODES", + /* 142 */ "FUNCTIONS", + /* 143 */ "INDEXES", + /* 144 */ "ACCOUNTS", + /* 145 */ "APPS", + /* 146 */ "CONNECTIONS", + /* 147 */ "LICENCES", + /* 148 */ "GRANTS", + /* 149 */ "QUERIES", + /* 150 */ "SCORES", + /* 151 */ "TOPICS", + /* 152 */ "VARIABLES", + /* 153 */ "CLUSTER", + /* 154 */ "BNODES", + /* 155 */ "SNODES", + /* 156 */ "TRANSACTIONS", + /* 157 */ "DISTRIBUTED", + /* 158 */ "CONSUMERS", + /* 159 */ "SUBSCRIPTIONS", + /* 160 */ "VNODES", + /* 161 */ "ALIVE", + /* 162 */ "LIKE", + /* 163 */ "TBNAME", + /* 164 */ "QTAGS", + /* 165 */ "AS", + /* 166 */ "INDEX", + /* 167 */ "FUNCTION", + /* 168 */ "INTERVAL", + /* 169 */ "COUNT", + /* 170 */ "LAST_ROW", + /* 171 */ "TOPIC", + /* 172 */ "WITH", + /* 173 */ "META", + /* 174 */ "CONSUMER", + /* 175 */ "GROUP", + /* 176 */ "DESC", + /* 177 */ "DESCRIBE", + /* 178 */ "RESET", + /* 179 */ "QUERY", + /* 180 */ "CACHE", + /* 181 */ "EXPLAIN", + /* 182 */ "ANALYZE", + /* 183 */ "VERBOSE", + /* 184 */ "NK_BOOL", + /* 185 */ "RATIO", + /* 186 */ "NK_FLOAT", + /* 187 */ "OUTPUTTYPE", + /* 188 */ "AGGREGATE", + /* 189 */ "BUFSIZE", + /* 190 */ "STREAM", + /* 191 */ "INTO", + /* 192 */ "TRIGGER", + /* 193 */ "AT_ONCE", + /* 194 */ "WINDOW_CLOSE", + /* 195 */ "IGNORE", + /* 196 */ "EXPIRED", + /* 197 */ "FILL_HISTORY", + /* 198 */ "UPDATE", + /* 199 */ "SUBTABLE", + /* 200 */ "KILL", + /* 201 */ "CONNECTION", + /* 202 */ "TRANSACTION", + /* 203 */ "BALANCE", + /* 204 */ "VGROUP", + /* 205 */ "MERGE", + /* 206 */ "REDISTRIBUTE", + /* 207 */ "SPLIT", + /* 208 */ "DELETE", + /* 209 */ "INSERT", + /* 210 */ "NULL", + /* 211 */ "NK_QUESTION", + /* 212 */ "NK_ARROW", + /* 213 */ "ROWTS", + /* 214 */ "QSTART", + /* 215 */ "QEND", + /* 216 */ "QDURATION", + /* 217 */ "WSTART", + /* 218 */ "WEND", + /* 219 */ "WDURATION", + /* 220 */ "IROWTS", + /* 221 */ "ISFILLED", + /* 222 */ "CAST", + /* 223 */ "NOW", + /* 224 */ "TODAY", + /* 225 */ "TIMEZONE", + /* 226 */ "CLIENT_VERSION", + /* 227 */ "SERVER_VERSION", + /* 228 */ "SERVER_STATUS", + /* 229 */ "CURRENT_USER", + /* 230 */ "CASE", + /* 231 */ "END", + /* 232 */ "WHEN", + /* 233 */ "THEN", + /* 234 */ "ELSE", + /* 235 */ "BETWEEN", + /* 236 */ "IS", + /* 237 */ "NK_LT", + /* 238 */ "NK_GT", + /* 239 */ "NK_LE", + /* 240 */ "NK_GE", + /* 241 */ "NK_NE", + /* 242 */ "MATCH", + /* 243 */ "NMATCH", + /* 244 */ "CONTAINS", + /* 245 */ "IN", + /* 246 */ "JOIN", + /* 247 */ "INNER", + /* 248 */ "SELECT", + /* 249 */ "DISTINCT", + /* 250 */ "WHERE", + /* 251 */ "PARTITION", + /* 252 */ "BY", + /* 253 */ "SESSION", + /* 254 */ "STATE_WINDOW", + /* 255 */ "EVENT_WINDOW", + /* 256 */ "START", + /* 257 */ "SLIDING", + /* 258 */ "FILL", + /* 259 */ "VALUE", + /* 260 */ "VALUE_F", + /* 261 */ "NONE", + /* 262 */ "PREV", + /* 263 */ "NULL_F", + /* 264 */ "LINEAR", + /* 265 */ "NEXT", + /* 266 */ "HAVING", + /* 267 */ "RANGE", + /* 268 */ "EVERY", + /* 269 */ "ORDER", + /* 270 */ "SLIMIT", + /* 271 */ "SOFFSET", + /* 272 */ "LIMIT", + /* 273 */ "OFFSET", + /* 274 */ "ASC", + /* 275 */ "NULLS", + /* 276 */ "ABORT", + /* 277 */ "AFTER", + /* 278 */ "ATTACH", + /* 279 */ "BEFORE", + /* 280 */ "BEGIN", + /* 281 */ "BITAND", + /* 282 */ "BITNOT", + /* 283 */ "BITOR", + /* 284 */ "BLOCKS", + /* 285 */ "CHANGE", + /* 286 */ "COMMA", + /* 287 */ "CONCAT", + /* 288 */ "CONFLICT", + /* 289 */ "COPY", + /* 290 */ "DEFERRED", + /* 291 */ "DELIMITERS", + /* 292 */ "DETACH", + /* 293 */ "DIVIDE", + /* 294 */ "DOT", + /* 295 */ "EACH", + /* 296 */ "FAIL", + /* 297 */ "FILE", + /* 298 */ "FOR", + /* 299 */ "GLOB", + /* 300 */ "ID", + /* 301 */ "IMMEDIATE", + /* 302 */ "IMPORT", + /* 303 */ "INITIALLY", + /* 304 */ "INSTEAD", + /* 305 */ "ISNULL", + /* 306 */ "KEY", + /* 307 */ "MODULES", + /* 308 */ "NK_BITNOT", + /* 309 */ "NK_SEMI", + /* 310 */ "NOTNULL", + /* 311 */ "OF", + /* 312 */ "PLUS", + /* 313 */ "PRIVILEGE", + /* 314 */ "RAISE", + /* 315 */ "REPLACE", + /* 316 */ "RESTRICT", + /* 317 */ "ROW", + /* 318 */ "SEMI", + /* 319 */ "STAR", + /* 320 */ "STATEMENT", + /* 321 */ "STRICT", + /* 322 */ "STRING", + /* 323 */ "TIMES", + /* 324 */ "VALUES", + /* 325 */ "VARIABLE", + /* 326 */ "VIEW", + /* 327 */ "WAL", + /* 328 */ "cmd", + /* 329 */ "account_options", + /* 330 */ "alter_account_options", + /* 331 */ "literal", + /* 332 */ "alter_account_option", + /* 333 */ "user_name", + /* 334 */ "sysinfo_opt", + /* 335 */ "privileges", + /* 336 */ "priv_level", + /* 337 */ "priv_type_list", + /* 338 */ "priv_type", + /* 339 */ "db_name", + /* 340 */ "topic_name", + /* 341 */ "dnode_endpoint", + /* 342 */ "force_opt", + /* 343 */ "not_exists_opt", + /* 344 */ "db_options", + /* 345 */ "exists_opt", + /* 346 */ "alter_db_options", + /* 347 */ "speed_opt", + /* 348 */ "integer_list", + /* 349 */ "variable_list", + /* 350 */ "retention_list", + /* 351 */ "alter_db_option", + /* 352 */ "retention", + /* 353 */ "full_table_name", + /* 354 */ "column_def_list", + /* 355 */ "tags_def_opt", + /* 356 */ "table_options", + /* 357 */ "multi_create_clause", + /* 358 */ "tags_def", + /* 359 */ "multi_drop_clause", + /* 360 */ "alter_table_clause", + /* 361 */ "alter_table_options", + /* 362 */ "column_name", + /* 363 */ "type_name", + /* 364 */ "signed_literal", + /* 365 */ "create_subtable_clause", + /* 366 */ "specific_cols_opt", + /* 367 */ "expression_list", + /* 368 */ "drop_table_clause", + /* 369 */ "col_name_list", + /* 370 */ "table_name", + /* 371 */ "column_def", + /* 372 */ "duration_list", + /* 373 */ "rollup_func_list", + /* 374 */ "alter_table_option", + /* 375 */ "duration_literal", + /* 376 */ "rollup_func_name", + /* 377 */ "function_name", + /* 378 */ "col_name", + /* 379 */ "db_name_cond_opt", + /* 380 */ "like_pattern_opt", + /* 381 */ "table_name_cond", + /* 382 */ "from_db_opt", + /* 383 */ "tag_list_opt", + /* 384 */ "tag_item", + /* 385 */ "column_alias", + /* 386 */ "full_index_name", + /* 387 */ "index_options", + /* 388 */ "index_name", + /* 389 */ "func_list", + /* 390 */ "sliding_opt", + /* 391 */ "sma_stream_opt", + /* 392 */ "func", + /* 393 */ "sma_func_name", + /* 394 */ "query_or_subquery", + /* 395 */ "cgroup_name", + /* 396 */ "analyze_opt", + /* 397 */ "explain_options", + /* 398 */ "insert_query", + /* 399 */ "agg_func_opt", + /* 400 */ "bufsize_opt", + /* 401 */ "stream_name", + /* 402 */ "stream_options", + /* 403 */ "col_list_opt", + /* 404 */ "tag_def_or_ref_opt", + /* 405 */ "subtable_opt", + /* 406 */ "expression", + /* 407 */ "dnode_list", + /* 408 */ "where_clause_opt", + /* 409 */ "signed", + /* 410 */ "literal_func", + /* 411 */ "literal_list", + /* 412 */ "table_alias", + /* 413 */ "expr_or_subquery", + /* 414 */ "pseudo_column", + /* 415 */ "column_reference", + /* 416 */ "function_expression", + /* 417 */ "case_when_expression", + /* 418 */ "star_func", + /* 419 */ "star_func_para_list", + /* 420 */ "noarg_func", + /* 421 */ "other_para_list", + /* 422 */ "star_func_para", + /* 423 */ "when_then_list", + /* 424 */ "case_when_else_opt", + /* 425 */ "common_expression", + /* 426 */ "when_then_expr", + /* 427 */ "predicate", + /* 428 */ "compare_op", + /* 429 */ "in_op", + /* 430 */ "in_predicate_value", + /* 431 */ "boolean_value_expression", + /* 432 */ "boolean_primary", + /* 433 */ "from_clause_opt", + /* 434 */ "table_reference_list", + /* 435 */ "table_reference", + /* 436 */ "table_primary", + /* 437 */ "joined_table", + /* 438 */ "alias_opt", + /* 439 */ "subquery", + /* 440 */ "parenthesized_joined_table", + /* 441 */ "join_type", + /* 442 */ "search_condition", + /* 443 */ "query_specification", + /* 444 */ "set_quantifier_opt", + /* 445 */ "select_list", + /* 446 */ "partition_by_clause_opt", + /* 447 */ "range_opt", + /* 448 */ "every_opt", + /* 449 */ "fill_opt", + /* 450 */ "twindow_clause_opt", + /* 451 */ "group_by_clause_opt", + /* 452 */ "having_clause_opt", + /* 453 */ "select_item", + /* 454 */ "partition_list", + /* 455 */ "partition_item", + /* 456 */ "fill_mode", + /* 457 */ "group_by_list", + /* 458 */ "query_expression", + /* 459 */ "query_simple", + /* 460 */ "order_by_clause_opt", + /* 461 */ "slimit_clause_opt", + /* 462 */ "limit_clause_opt", + /* 463 */ "union_query_expression", + /* 464 */ "query_simple_or_subquery", + /* 465 */ "sort_specification_list", + /* 466 */ "sort_specification", + /* 467 */ "ordering_specification_opt", + /* 468 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2007,492 +1945,496 @@ static const char *const yyRuleName[] = { /* 69 */ "cmd ::= ALTER DATABASE db_name alter_db_options", /* 70 */ "cmd ::= FLUSH DATABASE db_name", /* 71 */ "cmd ::= TRIM DATABASE db_name speed_opt", - /* 72 */ "not_exists_opt ::= IF NOT EXISTS", - /* 73 */ "not_exists_opt ::=", - /* 74 */ "exists_opt ::= IF EXISTS", - /* 75 */ "exists_opt ::=", - /* 76 */ "db_options ::=", - /* 77 */ "db_options ::= db_options BUFFER NK_INTEGER", - /* 78 */ "db_options ::= db_options CACHEMODEL NK_STRING", - /* 79 */ "db_options ::= db_options CACHESIZE NK_INTEGER", - /* 80 */ "db_options ::= db_options COMP NK_INTEGER", - /* 81 */ "db_options ::= db_options DURATION NK_INTEGER", - /* 82 */ "db_options ::= db_options DURATION NK_VARIABLE", - /* 83 */ "db_options ::= db_options MAXROWS NK_INTEGER", - /* 84 */ "db_options ::= db_options MINROWS NK_INTEGER", - /* 85 */ "db_options ::= db_options KEEP integer_list", - /* 86 */ "db_options ::= db_options KEEP variable_list", - /* 87 */ "db_options ::= db_options PAGES NK_INTEGER", - /* 88 */ "db_options ::= db_options PAGESIZE NK_INTEGER", - /* 89 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER", - /* 90 */ "db_options ::= db_options PRECISION NK_STRING", - /* 91 */ "db_options ::= db_options REPLICA NK_INTEGER", - /* 92 */ "db_options ::= db_options VGROUPS NK_INTEGER", - /* 93 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", - /* 94 */ "db_options ::= db_options RETENTIONS retention_list", - /* 95 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", - /* 96 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER", - /* 97 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER", - /* 98 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER", - /* 99 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", - /* 100 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER", - /* 101 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", - /* 102 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER", - /* 103 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER", - /* 104 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER", - /* 105 */ "db_options ::= db_options TABLE_PREFIX NK_INTEGER", - /* 106 */ "db_options ::= db_options TABLE_SUFFIX NK_INTEGER", - /* 107 */ "alter_db_options ::= alter_db_option", - /* 108 */ "alter_db_options ::= alter_db_options alter_db_option", - /* 109 */ "alter_db_option ::= BUFFER NK_INTEGER", - /* 110 */ "alter_db_option ::= CACHEMODEL NK_STRING", - /* 111 */ "alter_db_option ::= CACHESIZE NK_INTEGER", - /* 112 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER", - /* 113 */ "alter_db_option ::= KEEP integer_list", - /* 114 */ "alter_db_option ::= KEEP variable_list", - /* 115 */ "alter_db_option ::= PAGES NK_INTEGER", - /* 116 */ "alter_db_option ::= REPLICA NK_INTEGER", - /* 117 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", - /* 118 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER", - /* 119 */ "integer_list ::= NK_INTEGER", - /* 120 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", - /* 121 */ "variable_list ::= NK_VARIABLE", - /* 122 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", - /* 123 */ "retention_list ::= retention", - /* 124 */ "retention_list ::= retention_list NK_COMMA retention", - /* 125 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", - /* 126 */ "speed_opt ::=", - /* 127 */ "speed_opt ::= MAX_SPEED NK_INTEGER", - /* 128 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 129 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 130 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 131 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 132 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 133 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 134 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 135 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 136 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", - /* 137 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 138 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 139 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 140 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 141 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 142 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 143 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 144 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", - /* 145 */ "multi_create_clause ::= create_subtable_clause", - /* 146 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 147 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options", - /* 148 */ "multi_drop_clause ::= drop_table_clause", - /* 149 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", - /* 150 */ "drop_table_clause ::= exists_opt full_table_name", - /* 151 */ "specific_cols_opt ::=", - /* 152 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 153 */ "full_table_name ::= table_name", - /* 154 */ "full_table_name ::= db_name NK_DOT table_name", - /* 155 */ "column_def_list ::= column_def", - /* 156 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 157 */ "column_def ::= column_name type_name", - /* 158 */ "column_def ::= column_name type_name COMMENT NK_STRING", - /* 159 */ "type_name ::= BOOL", - /* 160 */ "type_name ::= TINYINT", - /* 161 */ "type_name ::= SMALLINT", - /* 162 */ "type_name ::= INT", - /* 163 */ "type_name ::= INTEGER", - /* 164 */ "type_name ::= BIGINT", - /* 165 */ "type_name ::= FLOAT", - /* 166 */ "type_name ::= DOUBLE", - /* 167 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 168 */ "type_name ::= TIMESTAMP", - /* 169 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 170 */ "type_name ::= TINYINT UNSIGNED", - /* 171 */ "type_name ::= SMALLINT UNSIGNED", - /* 172 */ "type_name ::= INT UNSIGNED", - /* 173 */ "type_name ::= BIGINT UNSIGNED", - /* 174 */ "type_name ::= JSON", - /* 175 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 176 */ "type_name ::= MEDIUMBLOB", - /* 177 */ "type_name ::= BLOB", - /* 178 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 179 */ "type_name ::= DECIMAL", - /* 180 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 181 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 182 */ "tags_def_opt ::=", - /* 183 */ "tags_def_opt ::= tags_def", - /* 184 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 185 */ "table_options ::=", - /* 186 */ "table_options ::= table_options COMMENT NK_STRING", - /* 187 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 188 */ "table_options ::= table_options WATERMARK duration_list", - /* 189 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 190 */ "table_options ::= table_options TTL NK_INTEGER", - /* 191 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 192 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 193 */ "alter_table_options ::= alter_table_option", - /* 194 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 195 */ "alter_table_option ::= COMMENT NK_STRING", - /* 196 */ "alter_table_option ::= TTL NK_INTEGER", - /* 197 */ "duration_list ::= duration_literal", - /* 198 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 199 */ "rollup_func_list ::= rollup_func_name", - /* 200 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 201 */ "rollup_func_name ::= function_name", - /* 202 */ "rollup_func_name ::= FIRST", - /* 203 */ "rollup_func_name ::= LAST", - /* 204 */ "col_name_list ::= col_name", - /* 205 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 206 */ "col_name ::= column_name", - /* 207 */ "cmd ::= SHOW DNODES", - /* 208 */ "cmd ::= SHOW USERS", - /* 209 */ "cmd ::= SHOW USER PRIVILEGES", - /* 210 */ "cmd ::= SHOW DATABASES", - /* 211 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 212 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 213 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 214 */ "cmd ::= SHOW MNODES", - /* 215 */ "cmd ::= SHOW QNODES", - /* 216 */ "cmd ::= SHOW FUNCTIONS", - /* 217 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 218 */ "cmd ::= SHOW STREAMS", - /* 219 */ "cmd ::= SHOW ACCOUNTS", - /* 220 */ "cmd ::= SHOW APPS", - /* 221 */ "cmd ::= SHOW CONNECTIONS", - /* 222 */ "cmd ::= SHOW LICENCES", - /* 223 */ "cmd ::= SHOW GRANTS", - /* 224 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 225 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 226 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 227 */ "cmd ::= SHOW QUERIES", - /* 228 */ "cmd ::= SHOW SCORES", - /* 229 */ "cmd ::= SHOW TOPICS", - /* 230 */ "cmd ::= SHOW VARIABLES", - /* 231 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 232 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 233 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 234 */ "cmd ::= SHOW BNODES", - /* 235 */ "cmd ::= SHOW SNODES", - /* 236 */ "cmd ::= SHOW CLUSTER", - /* 237 */ "cmd ::= SHOW TRANSACTIONS", - /* 238 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 239 */ "cmd ::= SHOW CONSUMERS", - /* 240 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 241 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 242 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 243 */ "cmd ::= SHOW VNODES NK_INTEGER", - /* 244 */ "cmd ::= SHOW VNODES NK_STRING", - /* 245 */ "cmd ::= SHOW db_name_cond_opt ALIVE", - /* 246 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 247 */ "db_name_cond_opt ::=", - /* 248 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 249 */ "like_pattern_opt ::=", - /* 250 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 251 */ "table_name_cond ::= table_name", - /* 252 */ "from_db_opt ::=", - /* 253 */ "from_db_opt ::= FROM db_name", - /* 254 */ "tag_list_opt ::=", - /* 255 */ "tag_list_opt ::= tag_item", - /* 256 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 257 */ "tag_item ::= TBNAME", - /* 258 */ "tag_item ::= QTAGS", - /* 259 */ "tag_item ::= column_name", - /* 260 */ "tag_item ::= column_name column_alias", - /* 261 */ "tag_item ::= column_name AS column_alias", - /* 262 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options", - /* 263 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP", - /* 264 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 265 */ "full_index_name ::= index_name", - /* 266 */ "full_index_name ::= db_name NK_DOT index_name", - /* 267 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 268 */ "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", - /* 269 */ "func_list ::= func", - /* 270 */ "func_list ::= func_list NK_COMMA func", - /* 271 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 272 */ "sma_func_name ::= function_name", - /* 273 */ "sma_func_name ::= COUNT", - /* 274 */ "sma_func_name ::= FIRST", - /* 275 */ "sma_func_name ::= LAST", - /* 276 */ "sma_func_name ::= LAST_ROW", - /* 277 */ "sma_stream_opt ::=", - /* 278 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 279 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 280 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 281 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 282 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", - /* 283 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", - /* 284 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", - /* 285 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", - /* 286 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 287 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 288 */ "cmd ::= DESC full_table_name", - /* 289 */ "cmd ::= DESCRIBE full_table_name", - /* 290 */ "cmd ::= RESET QUERY CACHE", - /* 291 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 292 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 293 */ "analyze_opt ::=", - /* 294 */ "analyze_opt ::= ANALYZE", - /* 295 */ "explain_options ::=", - /* 296 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 297 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 298 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 299 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 300 */ "agg_func_opt ::=", - /* 301 */ "agg_func_opt ::= AGGREGATE", - /* 302 */ "bufsize_opt ::=", - /* 303 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 304 */ "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", - /* 305 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 306 */ "col_list_opt ::=", - /* 307 */ "col_list_opt ::= NK_LP col_name_list NK_RP", - /* 308 */ "tag_def_or_ref_opt ::=", - /* 309 */ "tag_def_or_ref_opt ::= tags_def", - /* 310 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", - /* 311 */ "stream_options ::=", - /* 312 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 313 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 314 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 315 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 316 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 317 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 318 */ "subtable_opt ::=", - /* 319 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 320 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 321 */ "cmd ::= KILL QUERY NK_STRING", - /* 322 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 323 */ "cmd ::= BALANCE VGROUP", - /* 324 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 325 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 326 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 327 */ "dnode_list ::= DNODE NK_INTEGER", - /* 328 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 329 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 330 */ "cmd ::= query_or_subquery", - /* 331 */ "cmd ::= insert_query", - /* 332 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 333 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 334 */ "literal ::= NK_INTEGER", - /* 335 */ "literal ::= NK_FLOAT", - /* 336 */ "literal ::= NK_STRING", - /* 337 */ "literal ::= NK_BOOL", - /* 338 */ "literal ::= TIMESTAMP NK_STRING", - /* 339 */ "literal ::= duration_literal", - /* 340 */ "literal ::= NULL", - /* 341 */ "literal ::= NK_QUESTION", - /* 342 */ "duration_literal ::= NK_VARIABLE", - /* 343 */ "signed ::= NK_INTEGER", - /* 344 */ "signed ::= NK_PLUS NK_INTEGER", - /* 345 */ "signed ::= NK_MINUS NK_INTEGER", - /* 346 */ "signed ::= NK_FLOAT", - /* 347 */ "signed ::= NK_PLUS NK_FLOAT", - /* 348 */ "signed ::= NK_MINUS NK_FLOAT", - /* 349 */ "signed_literal ::= signed", - /* 350 */ "signed_literal ::= NK_STRING", - /* 351 */ "signed_literal ::= NK_BOOL", - /* 352 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 353 */ "signed_literal ::= duration_literal", - /* 354 */ "signed_literal ::= NULL", - /* 355 */ "signed_literal ::= literal_func", - /* 356 */ "signed_literal ::= NK_QUESTION", - /* 357 */ "literal_list ::= signed_literal", - /* 358 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 359 */ "db_name ::= NK_ID", - /* 360 */ "table_name ::= NK_ID", - /* 361 */ "column_name ::= NK_ID", - /* 362 */ "function_name ::= NK_ID", - /* 363 */ "table_alias ::= NK_ID", - /* 364 */ "column_alias ::= NK_ID", - /* 365 */ "user_name ::= NK_ID", - /* 366 */ "topic_name ::= NK_ID", - /* 367 */ "stream_name ::= NK_ID", - /* 368 */ "cgroup_name ::= NK_ID", - /* 369 */ "index_name ::= NK_ID", - /* 370 */ "expr_or_subquery ::= expression", - /* 371 */ "expression ::= literal", - /* 372 */ "expression ::= pseudo_column", - /* 373 */ "expression ::= column_reference", - /* 374 */ "expression ::= function_expression", - /* 375 */ "expression ::= case_when_expression", - /* 376 */ "expression ::= NK_LP expression NK_RP", - /* 377 */ "expression ::= NK_PLUS expr_or_subquery", - /* 378 */ "expression ::= NK_MINUS expr_or_subquery", - /* 379 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 380 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 381 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 382 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 383 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 384 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 385 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 386 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 387 */ "expression_list ::= expr_or_subquery", - /* 388 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 389 */ "column_reference ::= column_name", - /* 390 */ "column_reference ::= table_name NK_DOT column_name", - /* 391 */ "pseudo_column ::= ROWTS", - /* 392 */ "pseudo_column ::= TBNAME", - /* 393 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 394 */ "pseudo_column ::= QSTART", - /* 395 */ "pseudo_column ::= QEND", - /* 396 */ "pseudo_column ::= QDURATION", - /* 397 */ "pseudo_column ::= WSTART", - /* 398 */ "pseudo_column ::= WEND", - /* 399 */ "pseudo_column ::= WDURATION", - /* 400 */ "pseudo_column ::= IROWTS", - /* 401 */ "pseudo_column ::= ISFILLED", - /* 402 */ "pseudo_column ::= QTAGS", - /* 403 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 404 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 405 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 406 */ "function_expression ::= literal_func", - /* 407 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 408 */ "literal_func ::= NOW", - /* 409 */ "noarg_func ::= NOW", - /* 410 */ "noarg_func ::= TODAY", - /* 411 */ "noarg_func ::= TIMEZONE", - /* 412 */ "noarg_func ::= DATABASE", - /* 413 */ "noarg_func ::= CLIENT_VERSION", - /* 414 */ "noarg_func ::= SERVER_VERSION", - /* 415 */ "noarg_func ::= SERVER_STATUS", - /* 416 */ "noarg_func ::= CURRENT_USER", - /* 417 */ "noarg_func ::= USER", - /* 418 */ "star_func ::= COUNT", - /* 419 */ "star_func ::= FIRST", - /* 420 */ "star_func ::= LAST", - /* 421 */ "star_func ::= LAST_ROW", - /* 422 */ "star_func_para_list ::= NK_STAR", - /* 423 */ "star_func_para_list ::= other_para_list", - /* 424 */ "other_para_list ::= star_func_para", - /* 425 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 426 */ "star_func_para ::= expr_or_subquery", - /* 427 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 428 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 429 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 430 */ "when_then_list ::= when_then_expr", - /* 431 */ "when_then_list ::= when_then_list when_then_expr", - /* 432 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 433 */ "case_when_else_opt ::=", - /* 434 */ "case_when_else_opt ::= ELSE common_expression", - /* 435 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 436 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 437 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 438 */ "predicate ::= expr_or_subquery IS NULL", - /* 439 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 440 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 441 */ "compare_op ::= NK_LT", - /* 442 */ "compare_op ::= NK_GT", - /* 443 */ "compare_op ::= NK_LE", - /* 444 */ "compare_op ::= NK_GE", - /* 445 */ "compare_op ::= NK_NE", - /* 446 */ "compare_op ::= NK_EQ", - /* 447 */ "compare_op ::= LIKE", - /* 448 */ "compare_op ::= NOT LIKE", - /* 449 */ "compare_op ::= MATCH", - /* 450 */ "compare_op ::= NMATCH", - /* 451 */ "compare_op ::= CONTAINS", - /* 452 */ "in_op ::= IN", - /* 453 */ "in_op ::= NOT IN", - /* 454 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 455 */ "boolean_value_expression ::= boolean_primary", - /* 456 */ "boolean_value_expression ::= NOT boolean_primary", - /* 457 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 458 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 459 */ "boolean_primary ::= predicate", - /* 460 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 461 */ "common_expression ::= expr_or_subquery", - /* 462 */ "common_expression ::= boolean_value_expression", - /* 463 */ "from_clause_opt ::=", - /* 464 */ "from_clause_opt ::= FROM table_reference_list", - /* 465 */ "table_reference_list ::= table_reference", - /* 466 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 467 */ "table_reference ::= table_primary", - /* 468 */ "table_reference ::= joined_table", - /* 469 */ "table_primary ::= table_name alias_opt", - /* 470 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 471 */ "table_primary ::= subquery alias_opt", - /* 472 */ "table_primary ::= parenthesized_joined_table", - /* 473 */ "alias_opt ::=", - /* 474 */ "alias_opt ::= table_alias", - /* 475 */ "alias_opt ::= AS table_alias", - /* 476 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 477 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 478 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 479 */ "join_type ::=", - /* 480 */ "join_type ::= INNER", - /* 481 */ "query_specification ::= SELECT set_quantifier_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", - /* 482 */ "set_quantifier_opt ::=", - /* 483 */ "set_quantifier_opt ::= DISTINCT", - /* 484 */ "set_quantifier_opt ::= ALL", - /* 485 */ "select_list ::= select_item", - /* 486 */ "select_list ::= select_list NK_COMMA select_item", - /* 487 */ "select_item ::= NK_STAR", - /* 488 */ "select_item ::= common_expression", - /* 489 */ "select_item ::= common_expression column_alias", - /* 490 */ "select_item ::= common_expression AS column_alias", - /* 491 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 492 */ "where_clause_opt ::=", - /* 493 */ "where_clause_opt ::= WHERE search_condition", - /* 494 */ "partition_by_clause_opt ::=", - /* 495 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 496 */ "partition_list ::= partition_item", - /* 497 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 498 */ "partition_item ::= expr_or_subquery", - /* 499 */ "partition_item ::= expr_or_subquery column_alias", - /* 500 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 501 */ "twindow_clause_opt ::=", - /* 502 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 503 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 504 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 505 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 506 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 507 */ "sliding_opt ::=", - /* 508 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 509 */ "fill_opt ::=", - /* 510 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 511 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 512 */ "fill_mode ::= NONE", - /* 513 */ "fill_mode ::= PREV", - /* 514 */ "fill_mode ::= NULL", - /* 515 */ "fill_mode ::= LINEAR", - /* 516 */ "fill_mode ::= NEXT", - /* 517 */ "group_by_clause_opt ::=", - /* 518 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 519 */ "group_by_list ::= expr_or_subquery", - /* 520 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 521 */ "having_clause_opt ::=", - /* 522 */ "having_clause_opt ::= HAVING search_condition", - /* 523 */ "range_opt ::=", - /* 524 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 525 */ "every_opt ::=", - /* 526 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 527 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 528 */ "query_simple ::= query_specification", - /* 529 */ "query_simple ::= union_query_expression", - /* 530 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 531 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 532 */ "query_simple_or_subquery ::= query_simple", - /* 533 */ "query_simple_or_subquery ::= subquery", - /* 534 */ "query_or_subquery ::= query_expression", - /* 535 */ "query_or_subquery ::= subquery", - /* 536 */ "order_by_clause_opt ::=", - /* 537 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 538 */ "slimit_clause_opt ::=", - /* 539 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 540 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 541 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 542 */ "limit_clause_opt ::=", - /* 543 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 544 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 545 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 546 */ "subquery ::= NK_LP query_expression NK_RP", - /* 547 */ "subquery ::= NK_LP subquery NK_RP", - /* 548 */ "search_condition ::= common_expression", - /* 549 */ "sort_specification_list ::= sort_specification", - /* 550 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 551 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 552 */ "ordering_specification_opt ::=", - /* 553 */ "ordering_specification_opt ::= ASC", - /* 554 */ "ordering_specification_opt ::= DESC", - /* 555 */ "null_ordering_opt ::=", - /* 556 */ "null_ordering_opt ::= NULLS FIRST", - /* 557 */ "null_ordering_opt ::= NULLS LAST", + /* 72 */ "cmd ::= COMPACT DATABASE db_name", + /* 73 */ "not_exists_opt ::= IF NOT EXISTS", + /* 74 */ "not_exists_opt ::=", + /* 75 */ "exists_opt ::= IF EXISTS", + /* 76 */ "exists_opt ::=", + /* 77 */ "db_options ::=", + /* 78 */ "db_options ::= db_options BUFFER NK_INTEGER", + /* 79 */ "db_options ::= db_options CACHEMODEL NK_STRING", + /* 80 */ "db_options ::= db_options CACHESIZE NK_INTEGER", + /* 81 */ "db_options ::= db_options COMP NK_INTEGER", + /* 82 */ "db_options ::= db_options DURATION NK_INTEGER", + /* 83 */ "db_options ::= db_options DURATION NK_VARIABLE", + /* 84 */ "db_options ::= db_options MAXROWS NK_INTEGER", + /* 85 */ "db_options ::= db_options MINROWS NK_INTEGER", + /* 86 */ "db_options ::= db_options KEEP integer_list", + /* 87 */ "db_options ::= db_options KEEP variable_list", + /* 88 */ "db_options ::= db_options PAGES NK_INTEGER", + /* 89 */ "db_options ::= db_options PAGESIZE NK_INTEGER", + /* 90 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER", + /* 91 */ "db_options ::= db_options PRECISION NK_STRING", + /* 92 */ "db_options ::= db_options REPLICA NK_INTEGER", + /* 93 */ "db_options ::= db_options VGROUPS NK_INTEGER", + /* 94 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", + /* 95 */ "db_options ::= db_options RETENTIONS retention_list", + /* 96 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", + /* 97 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER", + /* 98 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER", + /* 99 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER", + /* 100 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", + /* 101 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER", + /* 102 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", + /* 103 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER", + /* 104 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER", + /* 105 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER", + /* 106 */ "db_options ::= db_options TABLE_PREFIX NK_INTEGER", + /* 107 */ "db_options ::= db_options TABLE_SUFFIX NK_INTEGER", + /* 108 */ "alter_db_options ::= alter_db_option", + /* 109 */ "alter_db_options ::= alter_db_options alter_db_option", + /* 110 */ "alter_db_option ::= BUFFER NK_INTEGER", + /* 111 */ "alter_db_option ::= CACHEMODEL NK_STRING", + /* 112 */ "alter_db_option ::= CACHESIZE NK_INTEGER", + /* 113 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER", + /* 114 */ "alter_db_option ::= KEEP integer_list", + /* 115 */ "alter_db_option ::= KEEP variable_list", + /* 116 */ "alter_db_option ::= PAGES NK_INTEGER", + /* 117 */ "alter_db_option ::= REPLICA NK_INTEGER", + /* 118 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", + /* 119 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER", + /* 120 */ "integer_list ::= NK_INTEGER", + /* 121 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", + /* 122 */ "variable_list ::= NK_VARIABLE", + /* 123 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", + /* 124 */ "retention_list ::= retention", + /* 125 */ "retention_list ::= retention_list NK_COMMA retention", + /* 126 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", + /* 127 */ "speed_opt ::=", + /* 128 */ "speed_opt ::= MAX_SPEED NK_INTEGER", + /* 129 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 130 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 131 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 132 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 133 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 134 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 135 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 136 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 137 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 138 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 139 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 140 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 141 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 142 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 143 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 144 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 145 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", + /* 146 */ "multi_create_clause ::= create_subtable_clause", + /* 147 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 148 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options", + /* 149 */ "multi_drop_clause ::= drop_table_clause", + /* 150 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", + /* 151 */ "drop_table_clause ::= exists_opt full_table_name", + /* 152 */ "specific_cols_opt ::=", + /* 153 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", + /* 154 */ "full_table_name ::= table_name", + /* 155 */ "full_table_name ::= db_name NK_DOT table_name", + /* 156 */ "column_def_list ::= column_def", + /* 157 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 158 */ "column_def ::= column_name type_name", + /* 159 */ "column_def ::= column_name type_name COMMENT NK_STRING", + /* 160 */ "type_name ::= BOOL", + /* 161 */ "type_name ::= TINYINT", + /* 162 */ "type_name ::= SMALLINT", + /* 163 */ "type_name ::= INT", + /* 164 */ "type_name ::= INTEGER", + /* 165 */ "type_name ::= BIGINT", + /* 166 */ "type_name ::= FLOAT", + /* 167 */ "type_name ::= DOUBLE", + /* 168 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 169 */ "type_name ::= TIMESTAMP", + /* 170 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 171 */ "type_name ::= TINYINT UNSIGNED", + /* 172 */ "type_name ::= SMALLINT UNSIGNED", + /* 173 */ "type_name ::= INT UNSIGNED", + /* 174 */ "type_name ::= BIGINT UNSIGNED", + /* 175 */ "type_name ::= JSON", + /* 176 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 177 */ "type_name ::= MEDIUMBLOB", + /* 178 */ "type_name ::= BLOB", + /* 179 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 180 */ "type_name ::= DECIMAL", + /* 181 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 182 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 183 */ "tags_def_opt ::=", + /* 184 */ "tags_def_opt ::= tags_def", + /* 185 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 186 */ "table_options ::=", + /* 187 */ "table_options ::= table_options COMMENT NK_STRING", + /* 188 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 189 */ "table_options ::= table_options WATERMARK duration_list", + /* 190 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 191 */ "table_options ::= table_options TTL NK_INTEGER", + /* 192 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 193 */ "table_options ::= table_options DELETE_MARK duration_list", + /* 194 */ "alter_table_options ::= alter_table_option", + /* 195 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 196 */ "alter_table_option ::= COMMENT NK_STRING", + /* 197 */ "alter_table_option ::= TTL NK_INTEGER", + /* 198 */ "duration_list ::= duration_literal", + /* 199 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 200 */ "rollup_func_list ::= rollup_func_name", + /* 201 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 202 */ "rollup_func_name ::= function_name", + /* 203 */ "rollup_func_name ::= FIRST", + /* 204 */ "rollup_func_name ::= LAST", + /* 205 */ "col_name_list ::= col_name", + /* 206 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 207 */ "col_name ::= column_name", + /* 208 */ "cmd ::= SHOW DNODES", + /* 209 */ "cmd ::= SHOW USERS", + /* 210 */ "cmd ::= SHOW USER PRIVILEGES", + /* 211 */ "cmd ::= SHOW DATABASES", + /* 212 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 213 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 214 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 215 */ "cmd ::= SHOW MNODES", + /* 216 */ "cmd ::= SHOW QNODES", + /* 217 */ "cmd ::= SHOW FUNCTIONS", + /* 218 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 219 */ "cmd ::= SHOW STREAMS", + /* 220 */ "cmd ::= SHOW ACCOUNTS", + /* 221 */ "cmd ::= SHOW APPS", + /* 222 */ "cmd ::= SHOW CONNECTIONS", + /* 223 */ "cmd ::= SHOW LICENCES", + /* 224 */ "cmd ::= SHOW GRANTS", + /* 225 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 226 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 227 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 228 */ "cmd ::= SHOW QUERIES", + /* 229 */ "cmd ::= SHOW SCORES", + /* 230 */ "cmd ::= SHOW TOPICS", + /* 231 */ "cmd ::= SHOW VARIABLES", + /* 232 */ "cmd ::= SHOW CLUSTER VARIABLES", + /* 233 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 234 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", + /* 235 */ "cmd ::= SHOW BNODES", + /* 236 */ "cmd ::= SHOW SNODES", + /* 237 */ "cmd ::= SHOW CLUSTER", + /* 238 */ "cmd ::= SHOW TRANSACTIONS", + /* 239 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 240 */ "cmd ::= SHOW CONSUMERS", + /* 241 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 242 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 243 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", + /* 244 */ "cmd ::= SHOW VNODES NK_INTEGER", + /* 245 */ "cmd ::= SHOW VNODES NK_STRING", + /* 246 */ "cmd ::= SHOW db_name_cond_opt ALIVE", + /* 247 */ "cmd ::= SHOW CLUSTER ALIVE", + /* 248 */ "db_name_cond_opt ::=", + /* 249 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 250 */ "like_pattern_opt ::=", + /* 251 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 252 */ "table_name_cond ::= table_name", + /* 253 */ "from_db_opt ::=", + /* 254 */ "from_db_opt ::= FROM db_name", + /* 255 */ "tag_list_opt ::=", + /* 256 */ "tag_list_opt ::= tag_item", + /* 257 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 258 */ "tag_item ::= TBNAME", + /* 259 */ "tag_item ::= QTAGS", + /* 260 */ "tag_item ::= column_name", + /* 261 */ "tag_item ::= column_name column_alias", + /* 262 */ "tag_item ::= column_name AS column_alias", + /* 263 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options", + /* 264 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP", + /* 265 */ "cmd ::= DROP INDEX exists_opt full_index_name", + /* 266 */ "full_index_name ::= index_name", + /* 267 */ "full_index_name ::= db_name NK_DOT index_name", + /* 268 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 269 */ "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", + /* 270 */ "func_list ::= func", + /* 271 */ "func_list ::= func_list NK_COMMA func", + /* 272 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 273 */ "sma_func_name ::= function_name", + /* 274 */ "sma_func_name ::= COUNT", + /* 275 */ "sma_func_name ::= FIRST", + /* 276 */ "sma_func_name ::= LAST", + /* 277 */ "sma_func_name ::= LAST_ROW", + /* 278 */ "sma_stream_opt ::=", + /* 279 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 280 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 281 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 282 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 283 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", + /* 284 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", + /* 285 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", + /* 286 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", + /* 287 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 288 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 289 */ "cmd ::= DESC full_table_name", + /* 290 */ "cmd ::= DESCRIBE full_table_name", + /* 291 */ "cmd ::= RESET QUERY CACHE", + /* 292 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 293 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", + /* 294 */ "analyze_opt ::=", + /* 295 */ "analyze_opt ::= ANALYZE", + /* 296 */ "explain_options ::=", + /* 297 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 298 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 299 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 300 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 301 */ "agg_func_opt ::=", + /* 302 */ "agg_func_opt ::= AGGREGATE", + /* 303 */ "bufsize_opt ::=", + /* 304 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 305 */ "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", + /* 306 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 307 */ "col_list_opt ::=", + /* 308 */ "col_list_opt ::= NK_LP col_name_list NK_RP", + /* 309 */ "tag_def_or_ref_opt ::=", + /* 310 */ "tag_def_or_ref_opt ::= tags_def", + /* 311 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", + /* 312 */ "stream_options ::=", + /* 313 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 314 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 315 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 316 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 317 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 318 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 319 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 320 */ "subtable_opt ::=", + /* 321 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 322 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 323 */ "cmd ::= KILL QUERY NK_STRING", + /* 324 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 325 */ "cmd ::= BALANCE VGROUP", + /* 326 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 327 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 328 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 329 */ "dnode_list ::= DNODE NK_INTEGER", + /* 330 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 331 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 332 */ "cmd ::= query_or_subquery", + /* 333 */ "cmd ::= insert_query", + /* 334 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 335 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 336 */ "literal ::= NK_INTEGER", + /* 337 */ "literal ::= NK_FLOAT", + /* 338 */ "literal ::= NK_STRING", + /* 339 */ "literal ::= NK_BOOL", + /* 340 */ "literal ::= TIMESTAMP NK_STRING", + /* 341 */ "literal ::= duration_literal", + /* 342 */ "literal ::= NULL", + /* 343 */ "literal ::= NK_QUESTION", + /* 344 */ "duration_literal ::= NK_VARIABLE", + /* 345 */ "signed ::= NK_INTEGER", + /* 346 */ "signed ::= NK_PLUS NK_INTEGER", + /* 347 */ "signed ::= NK_MINUS NK_INTEGER", + /* 348 */ "signed ::= NK_FLOAT", + /* 349 */ "signed ::= NK_PLUS NK_FLOAT", + /* 350 */ "signed ::= NK_MINUS NK_FLOAT", + /* 351 */ "signed_literal ::= signed", + /* 352 */ "signed_literal ::= NK_STRING", + /* 353 */ "signed_literal ::= NK_BOOL", + /* 354 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 355 */ "signed_literal ::= duration_literal", + /* 356 */ "signed_literal ::= NULL", + /* 357 */ "signed_literal ::= literal_func", + /* 358 */ "signed_literal ::= NK_QUESTION", + /* 359 */ "literal_list ::= signed_literal", + /* 360 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 361 */ "db_name ::= NK_ID", + /* 362 */ "table_name ::= NK_ID", + /* 363 */ "column_name ::= NK_ID", + /* 364 */ "function_name ::= NK_ID", + /* 365 */ "table_alias ::= NK_ID", + /* 366 */ "column_alias ::= NK_ID", + /* 367 */ "user_name ::= NK_ID", + /* 368 */ "topic_name ::= NK_ID", + /* 369 */ "stream_name ::= NK_ID", + /* 370 */ "cgroup_name ::= NK_ID", + /* 371 */ "index_name ::= NK_ID", + /* 372 */ "expr_or_subquery ::= expression", + /* 373 */ "expression ::= literal", + /* 374 */ "expression ::= pseudo_column", + /* 375 */ "expression ::= column_reference", + /* 376 */ "expression ::= function_expression", + /* 377 */ "expression ::= case_when_expression", + /* 378 */ "expression ::= NK_LP expression NK_RP", + /* 379 */ "expression ::= NK_PLUS expr_or_subquery", + /* 380 */ "expression ::= NK_MINUS expr_or_subquery", + /* 381 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 382 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 383 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 384 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 385 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 386 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 387 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 388 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 389 */ "expression_list ::= expr_or_subquery", + /* 390 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 391 */ "column_reference ::= column_name", + /* 392 */ "column_reference ::= table_name NK_DOT column_name", + /* 393 */ "pseudo_column ::= ROWTS", + /* 394 */ "pseudo_column ::= TBNAME", + /* 395 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 396 */ "pseudo_column ::= QSTART", + /* 397 */ "pseudo_column ::= QEND", + /* 398 */ "pseudo_column ::= QDURATION", + /* 399 */ "pseudo_column ::= WSTART", + /* 400 */ "pseudo_column ::= WEND", + /* 401 */ "pseudo_column ::= WDURATION", + /* 402 */ "pseudo_column ::= IROWTS", + /* 403 */ "pseudo_column ::= ISFILLED", + /* 404 */ "pseudo_column ::= QTAGS", + /* 405 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 406 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 407 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 408 */ "function_expression ::= literal_func", + /* 409 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 410 */ "literal_func ::= NOW", + /* 411 */ "noarg_func ::= NOW", + /* 412 */ "noarg_func ::= TODAY", + /* 413 */ "noarg_func ::= TIMEZONE", + /* 414 */ "noarg_func ::= DATABASE", + /* 415 */ "noarg_func ::= CLIENT_VERSION", + /* 416 */ "noarg_func ::= SERVER_VERSION", + /* 417 */ "noarg_func ::= SERVER_STATUS", + /* 418 */ "noarg_func ::= CURRENT_USER", + /* 419 */ "noarg_func ::= USER", + /* 420 */ "star_func ::= COUNT", + /* 421 */ "star_func ::= FIRST", + /* 422 */ "star_func ::= LAST", + /* 423 */ "star_func ::= LAST_ROW", + /* 424 */ "star_func_para_list ::= NK_STAR", + /* 425 */ "star_func_para_list ::= other_para_list", + /* 426 */ "other_para_list ::= star_func_para", + /* 427 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 428 */ "star_func_para ::= expr_or_subquery", + /* 429 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 430 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 431 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 432 */ "when_then_list ::= when_then_expr", + /* 433 */ "when_then_list ::= when_then_list when_then_expr", + /* 434 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 435 */ "case_when_else_opt ::=", + /* 436 */ "case_when_else_opt ::= ELSE common_expression", + /* 437 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 438 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 439 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 440 */ "predicate ::= expr_or_subquery IS NULL", + /* 441 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 442 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 443 */ "compare_op ::= NK_LT", + /* 444 */ "compare_op ::= NK_GT", + /* 445 */ "compare_op ::= NK_LE", + /* 446 */ "compare_op ::= NK_GE", + /* 447 */ "compare_op ::= NK_NE", + /* 448 */ "compare_op ::= NK_EQ", + /* 449 */ "compare_op ::= LIKE", + /* 450 */ "compare_op ::= NOT LIKE", + /* 451 */ "compare_op ::= MATCH", + /* 452 */ "compare_op ::= NMATCH", + /* 453 */ "compare_op ::= CONTAINS", + /* 454 */ "in_op ::= IN", + /* 455 */ "in_op ::= NOT IN", + /* 456 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 457 */ "boolean_value_expression ::= boolean_primary", + /* 458 */ "boolean_value_expression ::= NOT boolean_primary", + /* 459 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 460 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 461 */ "boolean_primary ::= predicate", + /* 462 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 463 */ "common_expression ::= expr_or_subquery", + /* 464 */ "common_expression ::= boolean_value_expression", + /* 465 */ "from_clause_opt ::=", + /* 466 */ "from_clause_opt ::= FROM table_reference_list", + /* 467 */ "table_reference_list ::= table_reference", + /* 468 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 469 */ "table_reference ::= table_primary", + /* 470 */ "table_reference ::= joined_table", + /* 471 */ "table_primary ::= table_name alias_opt", + /* 472 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 473 */ "table_primary ::= subquery alias_opt", + /* 474 */ "table_primary ::= parenthesized_joined_table", + /* 475 */ "alias_opt ::=", + /* 476 */ "alias_opt ::= table_alias", + /* 477 */ "alias_opt ::= AS table_alias", + /* 478 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 479 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 480 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 481 */ "join_type ::=", + /* 482 */ "join_type ::= INNER", + /* 483 */ "query_specification ::= SELECT set_quantifier_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", + /* 484 */ "set_quantifier_opt ::=", + /* 485 */ "set_quantifier_opt ::= DISTINCT", + /* 486 */ "set_quantifier_opt ::= ALL", + /* 487 */ "select_list ::= select_item", + /* 488 */ "select_list ::= select_list NK_COMMA select_item", + /* 489 */ "select_item ::= NK_STAR", + /* 490 */ "select_item ::= common_expression", + /* 491 */ "select_item ::= common_expression column_alias", + /* 492 */ "select_item ::= common_expression AS column_alias", + /* 493 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 494 */ "where_clause_opt ::=", + /* 495 */ "where_clause_opt ::= WHERE search_condition", + /* 496 */ "partition_by_clause_opt ::=", + /* 497 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 498 */ "partition_list ::= partition_item", + /* 499 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 500 */ "partition_item ::= expr_or_subquery", + /* 501 */ "partition_item ::= expr_or_subquery column_alias", + /* 502 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 503 */ "twindow_clause_opt ::=", + /* 504 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 505 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 506 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 507 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 508 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 509 */ "sliding_opt ::=", + /* 510 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 511 */ "fill_opt ::=", + /* 512 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 513 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 514 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP", + /* 515 */ "fill_mode ::= NONE", + /* 516 */ "fill_mode ::= PREV", + /* 517 */ "fill_mode ::= NULL", + /* 518 */ "fill_mode ::= NULL_F", + /* 519 */ "fill_mode ::= LINEAR", + /* 520 */ "fill_mode ::= NEXT", + /* 521 */ "group_by_clause_opt ::=", + /* 522 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 523 */ "group_by_list ::= expr_or_subquery", + /* 524 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 525 */ "having_clause_opt ::=", + /* 526 */ "having_clause_opt ::= HAVING search_condition", + /* 527 */ "range_opt ::=", + /* 528 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 529 */ "every_opt ::=", + /* 530 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 531 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 532 */ "query_simple ::= query_specification", + /* 533 */ "query_simple ::= union_query_expression", + /* 534 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 535 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 536 */ "query_simple_or_subquery ::= query_simple", + /* 537 */ "query_simple_or_subquery ::= subquery", + /* 538 */ "query_or_subquery ::= query_expression", + /* 539 */ "query_or_subquery ::= subquery", + /* 540 */ "order_by_clause_opt ::=", + /* 541 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 542 */ "slimit_clause_opt ::=", + /* 543 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 544 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 545 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 546 */ "limit_clause_opt ::=", + /* 547 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 548 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 549 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 550 */ "subquery ::= NK_LP query_expression NK_RP", + /* 551 */ "subquery ::= NK_LP subquery NK_RP", + /* 552 */ "search_condition ::= common_expression", + /* 553 */ "sort_specification_list ::= sort_specification", + /* 554 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 555 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 556 */ "ordering_specification_opt ::=", + /* 557 */ "ordering_specification_opt ::= ASC", + /* 558 */ "ordering_specification_opt ::= DESC", + /* 559 */ "null_ordering_opt ::=", + /* 560 */ "null_ordering_opt ::= NULLS FIRST", + /* 561 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2619,199 +2561,199 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 326: /* cmd */ - case 329: /* literal */ - case 342: /* db_options */ - case 344: /* alter_db_options */ - case 350: /* retention */ - case 351: /* full_table_name */ - case 354: /* table_options */ - case 358: /* alter_table_clause */ - case 359: /* alter_table_options */ - case 362: /* signed_literal */ - case 363: /* create_subtable_clause */ - case 366: /* drop_table_clause */ - case 369: /* column_def */ - case 373: /* duration_literal */ - case 374: /* rollup_func_name */ - case 376: /* col_name */ - case 377: /* db_name_cond_opt */ - case 378: /* like_pattern_opt */ - case 379: /* table_name_cond */ - case 380: /* from_db_opt */ - case 382: /* tag_item */ - case 384: /* full_index_name */ - case 385: /* index_options */ - case 388: /* sliding_opt */ - case 389: /* sma_stream_opt */ - case 390: /* func */ - case 392: /* query_or_subquery */ - case 395: /* explain_options */ - case 396: /* insert_query */ - case 400: /* stream_options */ - case 403: /* subtable_opt */ - case 404: /* expression */ - case 406: /* where_clause_opt */ - case 407: /* signed */ - case 408: /* literal_func */ - case 411: /* expr_or_subquery */ - case 412: /* pseudo_column */ - case 413: /* column_reference */ - case 414: /* function_expression */ - case 415: /* case_when_expression */ - case 420: /* star_func_para */ - case 422: /* case_when_else_opt */ - case 423: /* common_expression */ - case 424: /* when_then_expr */ - case 425: /* predicate */ - case 428: /* in_predicate_value */ - case 429: /* boolean_value_expression */ - case 430: /* boolean_primary */ - case 431: /* from_clause_opt */ - case 432: /* table_reference_list */ - case 433: /* table_reference */ - case 434: /* table_primary */ - case 435: /* joined_table */ - case 437: /* subquery */ - case 438: /* parenthesized_joined_table */ - case 440: /* search_condition */ - case 441: /* query_specification */ - case 445: /* range_opt */ - case 446: /* every_opt */ - case 447: /* fill_opt */ - case 448: /* twindow_clause_opt */ - case 450: /* having_clause_opt */ - case 451: /* select_item */ - case 453: /* partition_item */ - case 456: /* query_expression */ - case 457: /* query_simple */ - case 459: /* slimit_clause_opt */ - case 460: /* limit_clause_opt */ - case 461: /* union_query_expression */ - case 462: /* query_simple_or_subquery */ - case 464: /* sort_specification */ + case 328: /* cmd */ + case 331: /* literal */ + case 344: /* db_options */ + case 346: /* alter_db_options */ + case 352: /* retention */ + case 353: /* full_table_name */ + case 356: /* table_options */ + case 360: /* alter_table_clause */ + case 361: /* alter_table_options */ + case 364: /* signed_literal */ + case 365: /* create_subtable_clause */ + case 368: /* drop_table_clause */ + case 371: /* column_def */ + case 375: /* duration_literal */ + case 376: /* rollup_func_name */ + case 378: /* col_name */ + case 379: /* db_name_cond_opt */ + case 380: /* like_pattern_opt */ + case 381: /* table_name_cond */ + case 382: /* from_db_opt */ + case 384: /* tag_item */ + case 386: /* full_index_name */ + case 387: /* index_options */ + case 390: /* sliding_opt */ + case 391: /* sma_stream_opt */ + case 392: /* func */ + case 394: /* query_or_subquery */ + case 397: /* explain_options */ + case 398: /* insert_query */ + case 402: /* stream_options */ + case 405: /* subtable_opt */ + case 406: /* expression */ + case 408: /* where_clause_opt */ + case 409: /* signed */ + case 410: /* literal_func */ + case 413: /* expr_or_subquery */ + case 414: /* pseudo_column */ + case 415: /* column_reference */ + case 416: /* function_expression */ + case 417: /* case_when_expression */ + case 422: /* star_func_para */ + case 424: /* case_when_else_opt */ + case 425: /* common_expression */ + case 426: /* when_then_expr */ + case 427: /* predicate */ + case 430: /* in_predicate_value */ + case 431: /* boolean_value_expression */ + case 432: /* boolean_primary */ + case 433: /* from_clause_opt */ + case 434: /* table_reference_list */ + case 435: /* table_reference */ + case 436: /* table_primary */ + case 437: /* joined_table */ + case 439: /* subquery */ + case 440: /* parenthesized_joined_table */ + case 442: /* search_condition */ + case 443: /* query_specification */ + case 447: /* range_opt */ + case 448: /* every_opt */ + case 449: /* fill_opt */ + case 450: /* twindow_clause_opt */ + case 452: /* having_clause_opt */ + case 453: /* select_item */ + case 455: /* partition_item */ + case 458: /* query_expression */ + case 459: /* query_simple */ + case 461: /* slimit_clause_opt */ + case 462: /* limit_clause_opt */ + case 463: /* union_query_expression */ + case 464: /* query_simple_or_subquery */ + case 466: /* sort_specification */ { - nodesDestroyNode((yypminor->yy44)); + nodesDestroyNode((yypminor->yy42)); } break; - case 327: /* account_options */ - case 328: /* alter_account_options */ - case 330: /* alter_account_option */ - case 345: /* speed_opt */ - case 398: /* bufsize_opt */ + case 329: /* account_options */ + case 330: /* alter_account_options */ + case 332: /* alter_account_option */ + case 347: /* speed_opt */ + case 400: /* bufsize_opt */ { } break; - case 331: /* user_name */ - case 334: /* priv_level */ - case 337: /* db_name */ - case 338: /* topic_name */ - case 339: /* dnode_endpoint */ - case 360: /* column_name */ - case 368: /* table_name */ - case 375: /* function_name */ - case 383: /* column_alias */ - case 386: /* index_name */ - case 391: /* sma_func_name */ - case 393: /* cgroup_name */ - case 399: /* stream_name */ - case 410: /* table_alias */ - case 416: /* star_func */ - case 418: /* noarg_func */ - case 436: /* alias_opt */ + case 333: /* user_name */ + case 336: /* priv_level */ + case 339: /* db_name */ + case 340: /* topic_name */ + case 341: /* dnode_endpoint */ + case 362: /* column_name */ + case 370: /* table_name */ + case 377: /* function_name */ + case 385: /* column_alias */ + case 388: /* index_name */ + case 393: /* sma_func_name */ + case 395: /* cgroup_name */ + case 401: /* stream_name */ + case 412: /* table_alias */ + case 418: /* star_func */ + case 420: /* noarg_func */ + case 438: /* alias_opt */ { } break; - case 332: /* sysinfo_opt */ + case 334: /* sysinfo_opt */ { } break; - case 333: /* privileges */ - case 335: /* priv_type_list */ - case 336: /* priv_type */ + case 335: /* privileges */ + case 337: /* priv_type_list */ + case 338: /* priv_type */ { } break; - case 340: /* force_opt */ - case 341: /* not_exists_opt */ - case 343: /* exists_opt */ - case 394: /* analyze_opt */ - case 397: /* agg_func_opt */ - case 442: /* set_quantifier_opt */ + case 342: /* force_opt */ + case 343: /* not_exists_opt */ + case 345: /* exists_opt */ + case 396: /* analyze_opt */ + case 399: /* agg_func_opt */ + case 444: /* set_quantifier_opt */ { } break; - case 346: /* integer_list */ - case 347: /* variable_list */ - case 348: /* retention_list */ - case 352: /* column_def_list */ - case 353: /* tags_def_opt */ - case 355: /* multi_create_clause */ - case 356: /* tags_def */ - case 357: /* multi_drop_clause */ - case 364: /* specific_cols_opt */ - case 365: /* expression_list */ - case 367: /* col_name_list */ - case 370: /* duration_list */ - case 371: /* rollup_func_list */ - case 381: /* tag_list_opt */ - case 387: /* func_list */ - case 401: /* col_list_opt */ - case 402: /* tag_def_or_ref_opt */ - case 405: /* dnode_list */ - case 409: /* literal_list */ - case 417: /* star_func_para_list */ - case 419: /* other_para_list */ - case 421: /* when_then_list */ - case 443: /* select_list */ - case 444: /* partition_by_clause_opt */ - case 449: /* group_by_clause_opt */ - case 452: /* partition_list */ - case 455: /* group_by_list */ - case 458: /* order_by_clause_opt */ - case 463: /* sort_specification_list */ + case 348: /* integer_list */ + case 349: /* variable_list */ + case 350: /* retention_list */ + case 354: /* column_def_list */ + case 355: /* tags_def_opt */ + case 357: /* multi_create_clause */ + case 358: /* tags_def */ + case 359: /* multi_drop_clause */ + case 366: /* specific_cols_opt */ + case 367: /* expression_list */ + case 369: /* col_name_list */ + case 372: /* duration_list */ + case 373: /* rollup_func_list */ + case 383: /* tag_list_opt */ + case 389: /* func_list */ + case 403: /* col_list_opt */ + case 404: /* tag_def_or_ref_opt */ + case 407: /* dnode_list */ + case 411: /* literal_list */ + case 419: /* star_func_para_list */ + case 421: /* other_para_list */ + case 423: /* when_then_list */ + case 445: /* select_list */ + case 446: /* partition_by_clause_opt */ + case 451: /* group_by_clause_opt */ + case 454: /* partition_list */ + case 457: /* group_by_list */ + case 460: /* order_by_clause_opt */ + case 465: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy684)); + nodesDestroyList((yypminor->yy110)); } break; - case 349: /* alter_db_option */ - case 372: /* alter_table_option */ + case 351: /* alter_db_option */ + case 374: /* alter_table_option */ { } break; - case 361: /* type_name */ + case 363: /* type_name */ { } break; - case 426: /* compare_op */ - case 427: /* in_op */ + case 428: /* compare_op */ + case 429: /* in_op */ { } break; - case 439: /* join_type */ + case 441: /* join_type */ { } break; - case 454: /* fill_mode */ + case 456: /* fill_mode */ { } break; - case 465: /* ordering_specification_opt */ + case 467: /* ordering_specification_opt */ { } break; - case 466: /* null_ordering_opt */ + case 468: /* null_ordering_opt */ { } @@ -3110,564 +3052,568 @@ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { - { 326, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - { 326, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - { 327, 0 }, /* (2) account_options ::= */ - { 327, -3 }, /* (3) account_options ::= account_options PPS literal */ - { 327, -3 }, /* (4) account_options ::= account_options TSERIES literal */ - { 327, -3 }, /* (5) account_options ::= account_options STORAGE literal */ - { 327, -3 }, /* (6) account_options ::= account_options STREAMS literal */ - { 327, -3 }, /* (7) account_options ::= account_options QTIME literal */ - { 327, -3 }, /* (8) account_options ::= account_options DBS literal */ - { 327, -3 }, /* (9) account_options ::= account_options USERS literal */ - { 327, -3 }, /* (10) account_options ::= account_options CONNS literal */ - { 327, -3 }, /* (11) account_options ::= account_options STATE literal */ - { 328, -1 }, /* (12) alter_account_options ::= alter_account_option */ - { 328, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - { 330, -2 }, /* (14) alter_account_option ::= PASS literal */ - { 330, -2 }, /* (15) alter_account_option ::= PPS literal */ - { 330, -2 }, /* (16) alter_account_option ::= TSERIES literal */ - { 330, -2 }, /* (17) alter_account_option ::= STORAGE literal */ - { 330, -2 }, /* (18) alter_account_option ::= STREAMS literal */ - { 330, -2 }, /* (19) alter_account_option ::= QTIME literal */ - { 330, -2 }, /* (20) alter_account_option ::= DBS literal */ - { 330, -2 }, /* (21) alter_account_option ::= USERS literal */ - { 330, -2 }, /* (22) alter_account_option ::= CONNS literal */ - { 330, -2 }, /* (23) alter_account_option ::= STATE literal */ - { 326, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ - { 326, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - { 326, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - { 326, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - { 326, -3 }, /* (28) cmd ::= DROP USER user_name */ - { 332, 0 }, /* (29) sysinfo_opt ::= */ - { 332, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ - { 326, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ - { 326, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ - { 333, -1 }, /* (33) privileges ::= ALL */ - { 333, -1 }, /* (34) privileges ::= priv_type_list */ - { 333, -1 }, /* (35) privileges ::= SUBSCRIBE */ - { 335, -1 }, /* (36) priv_type_list ::= priv_type */ - { 335, -3 }, /* (37) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - { 336, -1 }, /* (38) priv_type ::= READ */ - { 336, -1 }, /* (39) priv_type ::= WRITE */ - { 334, -3 }, /* (40) priv_level ::= NK_STAR NK_DOT NK_STAR */ - { 334, -3 }, /* (41) priv_level ::= db_name NK_DOT NK_STAR */ - { 334, -1 }, /* (42) priv_level ::= topic_name */ - { 326, -3 }, /* (43) cmd ::= CREATE DNODE dnode_endpoint */ - { 326, -5 }, /* (44) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - { 326, -4 }, /* (45) cmd ::= DROP DNODE NK_INTEGER force_opt */ - { 326, -4 }, /* (46) cmd ::= DROP DNODE dnode_endpoint force_opt */ - { 326, -4 }, /* (47) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { 326, -5 }, /* (48) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { 326, -4 }, /* (49) cmd ::= ALTER ALL DNODES NK_STRING */ - { 326, -5 }, /* (50) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { 339, -1 }, /* (51) dnode_endpoint ::= NK_STRING */ - { 339, -1 }, /* (52) dnode_endpoint ::= NK_ID */ - { 339, -1 }, /* (53) dnode_endpoint ::= NK_IPTOKEN */ - { 340, 0 }, /* (54) force_opt ::= */ - { 340, -1 }, /* (55) force_opt ::= FORCE */ - { 326, -3 }, /* (56) cmd ::= ALTER LOCAL NK_STRING */ - { 326, -4 }, /* (57) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { 326, -5 }, /* (58) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { 326, -5 }, /* (59) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { 326, -5 }, /* (60) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - { 326, -5 }, /* (61) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - { 326, -5 }, /* (62) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - { 326, -5 }, /* (63) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - { 326, -5 }, /* (64) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - { 326, -5 }, /* (65) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - { 326, -5 }, /* (66) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { 326, -4 }, /* (67) cmd ::= DROP DATABASE exists_opt db_name */ - { 326, -2 }, /* (68) cmd ::= USE db_name */ - { 326, -4 }, /* (69) cmd ::= ALTER DATABASE db_name alter_db_options */ - { 326, -3 }, /* (70) cmd ::= FLUSH DATABASE db_name */ - { 326, -4 }, /* (71) cmd ::= TRIM DATABASE db_name speed_opt */ - { 341, -3 }, /* (72) not_exists_opt ::= IF NOT EXISTS */ - { 341, 0 }, /* (73) not_exists_opt ::= */ - { 343, -2 }, /* (74) exists_opt ::= IF EXISTS */ - { 343, 0 }, /* (75) exists_opt ::= */ - { 342, 0 }, /* (76) db_options ::= */ - { 342, -3 }, /* (77) db_options ::= db_options BUFFER NK_INTEGER */ - { 342, -3 }, /* (78) db_options ::= db_options CACHEMODEL NK_STRING */ - { 342, -3 }, /* (79) db_options ::= db_options CACHESIZE NK_INTEGER */ - { 342, -3 }, /* (80) db_options ::= db_options COMP NK_INTEGER */ - { 342, -3 }, /* (81) db_options ::= db_options DURATION NK_INTEGER */ - { 342, -3 }, /* (82) db_options ::= db_options DURATION NK_VARIABLE */ - { 342, -3 }, /* (83) db_options ::= db_options MAXROWS NK_INTEGER */ - { 342, -3 }, /* (84) db_options ::= db_options MINROWS NK_INTEGER */ - { 342, -3 }, /* (85) db_options ::= db_options KEEP integer_list */ - { 342, -3 }, /* (86) db_options ::= db_options KEEP variable_list */ - { 342, -3 }, /* (87) db_options ::= db_options PAGES NK_INTEGER */ - { 342, -3 }, /* (88) db_options ::= db_options PAGESIZE NK_INTEGER */ - { 342, -3 }, /* (89) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - { 342, -3 }, /* (90) db_options ::= db_options PRECISION NK_STRING */ - { 342, -3 }, /* (91) db_options ::= db_options REPLICA NK_INTEGER */ - { 342, -3 }, /* (92) db_options ::= db_options VGROUPS NK_INTEGER */ - { 342, -3 }, /* (93) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 342, -3 }, /* (94) db_options ::= db_options RETENTIONS retention_list */ - { 342, -3 }, /* (95) db_options ::= db_options SCHEMALESS NK_INTEGER */ - { 342, -3 }, /* (96) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - { 342, -3 }, /* (97) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - { 342, -3 }, /* (98) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - { 342, -4 }, /* (99) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - { 342, -3 }, /* (100) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - { 342, -4 }, /* (101) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - { 342, -3 }, /* (102) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - { 342, -3 }, /* (103) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - { 342, -3 }, /* (104) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - { 342, -3 }, /* (105) db_options ::= db_options TABLE_PREFIX NK_INTEGER */ - { 342, -3 }, /* (106) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ - { 344, -1 }, /* (107) alter_db_options ::= alter_db_option */ - { 344, -2 }, /* (108) alter_db_options ::= alter_db_options alter_db_option */ - { 349, -2 }, /* (109) alter_db_option ::= BUFFER NK_INTEGER */ - { 349, -2 }, /* (110) alter_db_option ::= CACHEMODEL NK_STRING */ - { 349, -2 }, /* (111) alter_db_option ::= CACHESIZE NK_INTEGER */ - { 349, -2 }, /* (112) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - { 349, -2 }, /* (113) alter_db_option ::= KEEP integer_list */ - { 349, -2 }, /* (114) alter_db_option ::= KEEP variable_list */ - { 349, -2 }, /* (115) alter_db_option ::= PAGES NK_INTEGER */ - { 349, -2 }, /* (116) alter_db_option ::= REPLICA NK_INTEGER */ - { 349, -2 }, /* (117) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - { 349, -2 }, /* (118) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - { 346, -1 }, /* (119) integer_list ::= NK_INTEGER */ - { 346, -3 }, /* (120) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 347, -1 }, /* (121) variable_list ::= NK_VARIABLE */ - { 347, -3 }, /* (122) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 348, -1 }, /* (123) retention_list ::= retention */ - { 348, -3 }, /* (124) retention_list ::= retention_list NK_COMMA retention */ - { 350, -3 }, /* (125) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - { 345, 0 }, /* (126) speed_opt ::= */ - { 345, -2 }, /* (127) speed_opt ::= MAX_SPEED NK_INTEGER */ - { 326, -9 }, /* (128) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 326, -3 }, /* (129) cmd ::= CREATE TABLE multi_create_clause */ - { 326, -9 }, /* (130) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 326, -3 }, /* (131) cmd ::= DROP TABLE multi_drop_clause */ - { 326, -4 }, /* (132) cmd ::= DROP STABLE exists_opt full_table_name */ - { 326, -3 }, /* (133) cmd ::= ALTER TABLE alter_table_clause */ - { 326, -3 }, /* (134) cmd ::= ALTER STABLE alter_table_clause */ - { 358, -2 }, /* (135) alter_table_clause ::= full_table_name alter_table_options */ - { 358, -5 }, /* (136) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 358, -4 }, /* (137) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 358, -5 }, /* (138) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 358, -5 }, /* (139) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 358, -5 }, /* (140) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 358, -4 }, /* (141) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 358, -5 }, /* (142) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 358, -5 }, /* (143) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 358, -6 }, /* (144) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - { 355, -1 }, /* (145) multi_create_clause ::= create_subtable_clause */ - { 355, -2 }, /* (146) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 363, -10 }, /* (147) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ - { 357, -1 }, /* (148) multi_drop_clause ::= drop_table_clause */ - { 357, -2 }, /* (149) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 366, -2 }, /* (150) drop_table_clause ::= exists_opt full_table_name */ - { 364, 0 }, /* (151) specific_cols_opt ::= */ - { 364, -3 }, /* (152) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - { 351, -1 }, /* (153) full_table_name ::= table_name */ - { 351, -3 }, /* (154) full_table_name ::= db_name NK_DOT table_name */ - { 352, -1 }, /* (155) column_def_list ::= column_def */ - { 352, -3 }, /* (156) column_def_list ::= column_def_list NK_COMMA column_def */ - { 369, -2 }, /* (157) column_def ::= column_name type_name */ - { 369, -4 }, /* (158) column_def ::= column_name type_name COMMENT NK_STRING */ - { 361, -1 }, /* (159) type_name ::= BOOL */ - { 361, -1 }, /* (160) type_name ::= TINYINT */ - { 361, -1 }, /* (161) type_name ::= SMALLINT */ - { 361, -1 }, /* (162) type_name ::= INT */ - { 361, -1 }, /* (163) type_name ::= INTEGER */ - { 361, -1 }, /* (164) type_name ::= BIGINT */ - { 361, -1 }, /* (165) type_name ::= FLOAT */ - { 361, -1 }, /* (166) type_name ::= DOUBLE */ - { 361, -4 }, /* (167) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 361, -1 }, /* (168) type_name ::= TIMESTAMP */ - { 361, -4 }, /* (169) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 361, -2 }, /* (170) type_name ::= TINYINT UNSIGNED */ - { 361, -2 }, /* (171) type_name ::= SMALLINT UNSIGNED */ - { 361, -2 }, /* (172) type_name ::= INT UNSIGNED */ - { 361, -2 }, /* (173) type_name ::= BIGINT UNSIGNED */ - { 361, -1 }, /* (174) type_name ::= JSON */ - { 361, -4 }, /* (175) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 361, -1 }, /* (176) type_name ::= MEDIUMBLOB */ - { 361, -1 }, /* (177) type_name ::= BLOB */ - { 361, -4 }, /* (178) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 361, -1 }, /* (179) type_name ::= DECIMAL */ - { 361, -4 }, /* (180) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 361, -6 }, /* (181) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 353, 0 }, /* (182) tags_def_opt ::= */ - { 353, -1 }, /* (183) tags_def_opt ::= tags_def */ - { 356, -4 }, /* (184) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 354, 0 }, /* (185) table_options ::= */ - { 354, -3 }, /* (186) table_options ::= table_options COMMENT NK_STRING */ - { 354, -3 }, /* (187) table_options ::= table_options MAX_DELAY duration_list */ - { 354, -3 }, /* (188) table_options ::= table_options WATERMARK duration_list */ - { 354, -5 }, /* (189) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - { 354, -3 }, /* (190) table_options ::= table_options TTL NK_INTEGER */ - { 354, -5 }, /* (191) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 354, -3 }, /* (192) table_options ::= table_options DELETE_MARK duration_list */ - { 359, -1 }, /* (193) alter_table_options ::= alter_table_option */ - { 359, -2 }, /* (194) alter_table_options ::= alter_table_options alter_table_option */ - { 372, -2 }, /* (195) alter_table_option ::= COMMENT NK_STRING */ - { 372, -2 }, /* (196) alter_table_option ::= TTL NK_INTEGER */ - { 370, -1 }, /* (197) duration_list ::= duration_literal */ - { 370, -3 }, /* (198) duration_list ::= duration_list NK_COMMA duration_literal */ - { 371, -1 }, /* (199) rollup_func_list ::= rollup_func_name */ - { 371, -3 }, /* (200) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - { 374, -1 }, /* (201) rollup_func_name ::= function_name */ - { 374, -1 }, /* (202) rollup_func_name ::= FIRST */ - { 374, -1 }, /* (203) rollup_func_name ::= LAST */ - { 367, -1 }, /* (204) col_name_list ::= col_name */ - { 367, -3 }, /* (205) col_name_list ::= col_name_list NK_COMMA col_name */ - { 376, -1 }, /* (206) col_name ::= column_name */ - { 326, -2 }, /* (207) cmd ::= SHOW DNODES */ - { 326, -2 }, /* (208) cmd ::= SHOW USERS */ - { 326, -3 }, /* (209) cmd ::= SHOW USER PRIVILEGES */ - { 326, -2 }, /* (210) cmd ::= SHOW DATABASES */ - { 326, -4 }, /* (211) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 326, -4 }, /* (212) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 326, -3 }, /* (213) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 326, -2 }, /* (214) cmd ::= SHOW MNODES */ - { 326, -2 }, /* (215) cmd ::= SHOW QNODES */ - { 326, -2 }, /* (216) cmd ::= SHOW FUNCTIONS */ - { 326, -5 }, /* (217) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 326, -2 }, /* (218) cmd ::= SHOW STREAMS */ - { 326, -2 }, /* (219) cmd ::= SHOW ACCOUNTS */ - { 326, -2 }, /* (220) cmd ::= SHOW APPS */ - { 326, -2 }, /* (221) cmd ::= SHOW CONNECTIONS */ - { 326, -2 }, /* (222) cmd ::= SHOW LICENCES */ - { 326, -2 }, /* (223) cmd ::= SHOW GRANTS */ - { 326, -4 }, /* (224) cmd ::= SHOW CREATE DATABASE db_name */ - { 326, -4 }, /* (225) cmd ::= SHOW CREATE TABLE full_table_name */ - { 326, -4 }, /* (226) cmd ::= SHOW CREATE STABLE full_table_name */ - { 326, -2 }, /* (227) cmd ::= SHOW QUERIES */ - { 326, -2 }, /* (228) cmd ::= SHOW SCORES */ - { 326, -2 }, /* (229) cmd ::= SHOW TOPICS */ - { 326, -2 }, /* (230) cmd ::= SHOW VARIABLES */ - { 326, -3 }, /* (231) cmd ::= SHOW CLUSTER VARIABLES */ - { 326, -3 }, /* (232) cmd ::= SHOW LOCAL VARIABLES */ - { 326, -5 }, /* (233) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - { 326, -2 }, /* (234) cmd ::= SHOW BNODES */ - { 326, -2 }, /* (235) cmd ::= SHOW SNODES */ - { 326, -2 }, /* (236) cmd ::= SHOW CLUSTER */ - { 326, -2 }, /* (237) cmd ::= SHOW TRANSACTIONS */ - { 326, -4 }, /* (238) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { 326, -2 }, /* (239) cmd ::= SHOW CONSUMERS */ - { 326, -2 }, /* (240) cmd ::= SHOW SUBSCRIPTIONS */ - { 326, -5 }, /* (241) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - { 326, -7 }, /* (242) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - { 326, -3 }, /* (243) cmd ::= SHOW VNODES NK_INTEGER */ - { 326, -3 }, /* (244) cmd ::= SHOW VNODES NK_STRING */ - { 326, -3 }, /* (245) cmd ::= SHOW db_name_cond_opt ALIVE */ - { 326, -3 }, /* (246) cmd ::= SHOW CLUSTER ALIVE */ - { 377, 0 }, /* (247) db_name_cond_opt ::= */ - { 377, -2 }, /* (248) db_name_cond_opt ::= db_name NK_DOT */ - { 378, 0 }, /* (249) like_pattern_opt ::= */ - { 378, -2 }, /* (250) like_pattern_opt ::= LIKE NK_STRING */ - { 379, -1 }, /* (251) table_name_cond ::= table_name */ - { 380, 0 }, /* (252) from_db_opt ::= */ - { 380, -2 }, /* (253) from_db_opt ::= FROM db_name */ - { 381, 0 }, /* (254) tag_list_opt ::= */ - { 381, -1 }, /* (255) tag_list_opt ::= tag_item */ - { 381, -3 }, /* (256) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - { 382, -1 }, /* (257) tag_item ::= TBNAME */ - { 382, -1 }, /* (258) tag_item ::= QTAGS */ - { 382, -1 }, /* (259) tag_item ::= column_name */ - { 382, -2 }, /* (260) tag_item ::= column_name column_alias */ - { 382, -3 }, /* (261) tag_item ::= column_name AS column_alias */ - { 326, -8 }, /* (262) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ - { 326, -9 }, /* (263) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ - { 326, -4 }, /* (264) cmd ::= DROP INDEX exists_opt full_index_name */ - { 384, -1 }, /* (265) full_index_name ::= index_name */ - { 384, -3 }, /* (266) full_index_name ::= db_name NK_DOT index_name */ - { 385, -10 }, /* (267) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { 385, -12 }, /* (268) 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 */ - { 387, -1 }, /* (269) func_list ::= func */ - { 387, -3 }, /* (270) func_list ::= func_list NK_COMMA func */ - { 390, -4 }, /* (271) func ::= sma_func_name NK_LP expression_list NK_RP */ - { 391, -1 }, /* (272) sma_func_name ::= function_name */ - { 391, -1 }, /* (273) sma_func_name ::= COUNT */ - { 391, -1 }, /* (274) sma_func_name ::= FIRST */ - { 391, -1 }, /* (275) sma_func_name ::= LAST */ - { 391, -1 }, /* (276) sma_func_name ::= LAST_ROW */ - { 389, 0 }, /* (277) sma_stream_opt ::= */ - { 389, -3 }, /* (278) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - { 389, -3 }, /* (279) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - { 389, -3 }, /* (280) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - { 326, -6 }, /* (281) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - { 326, -7 }, /* (282) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 326, -9 }, /* (283) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - { 326, -7 }, /* (284) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 326, -9 }, /* (285) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - { 326, -4 }, /* (286) cmd ::= DROP TOPIC exists_opt topic_name */ - { 326, -7 }, /* (287) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 326, -2 }, /* (288) cmd ::= DESC full_table_name */ - { 326, -2 }, /* (289) cmd ::= DESCRIBE full_table_name */ - { 326, -3 }, /* (290) cmd ::= RESET QUERY CACHE */ - { 326, -4 }, /* (291) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - { 326, -4 }, /* (292) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - { 394, 0 }, /* (293) analyze_opt ::= */ - { 394, -1 }, /* (294) analyze_opt ::= ANALYZE */ - { 395, 0 }, /* (295) explain_options ::= */ - { 395, -3 }, /* (296) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 395, -3 }, /* (297) explain_options ::= explain_options RATIO NK_FLOAT */ - { 326, -10 }, /* (298) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 326, -4 }, /* (299) cmd ::= DROP FUNCTION exists_opt function_name */ - { 397, 0 }, /* (300) agg_func_opt ::= */ - { 397, -1 }, /* (301) agg_func_opt ::= AGGREGATE */ - { 398, 0 }, /* (302) bufsize_opt ::= */ - { 398, -2 }, /* (303) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 326, -12 }, /* (304) 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 */ - { 326, -4 }, /* (305) cmd ::= DROP STREAM exists_opt stream_name */ - { 401, 0 }, /* (306) col_list_opt ::= */ - { 401, -3 }, /* (307) col_list_opt ::= NK_LP col_name_list NK_RP */ - { 402, 0 }, /* (308) tag_def_or_ref_opt ::= */ - { 402, -1 }, /* (309) tag_def_or_ref_opt ::= tags_def */ - { 402, -4 }, /* (310) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - { 400, 0 }, /* (311) stream_options ::= */ - { 400, -3 }, /* (312) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 400, -3 }, /* (313) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 400, -4 }, /* (314) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 400, -3 }, /* (315) stream_options ::= stream_options WATERMARK duration_literal */ - { 400, -4 }, /* (316) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - { 400, -3 }, /* (317) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - { 403, 0 }, /* (318) subtable_opt ::= */ - { 403, -4 }, /* (319) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - { 326, -3 }, /* (320) cmd ::= KILL CONNECTION NK_INTEGER */ - { 326, -3 }, /* (321) cmd ::= KILL QUERY NK_STRING */ - { 326, -3 }, /* (322) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 326, -2 }, /* (323) cmd ::= BALANCE VGROUP */ - { 326, -4 }, /* (324) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 326, -4 }, /* (325) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 326, -3 }, /* (326) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 405, -2 }, /* (327) dnode_list ::= DNODE NK_INTEGER */ - { 405, -3 }, /* (328) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 326, -4 }, /* (329) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 326, -1 }, /* (330) cmd ::= query_or_subquery */ - { 326, -1 }, /* (331) cmd ::= insert_query */ - { 396, -7 }, /* (332) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - { 396, -4 }, /* (333) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - { 329, -1 }, /* (334) literal ::= NK_INTEGER */ - { 329, -1 }, /* (335) literal ::= NK_FLOAT */ - { 329, -1 }, /* (336) literal ::= NK_STRING */ - { 329, -1 }, /* (337) literal ::= NK_BOOL */ - { 329, -2 }, /* (338) literal ::= TIMESTAMP NK_STRING */ - { 329, -1 }, /* (339) literal ::= duration_literal */ - { 329, -1 }, /* (340) literal ::= NULL */ - { 329, -1 }, /* (341) literal ::= NK_QUESTION */ - { 373, -1 }, /* (342) duration_literal ::= NK_VARIABLE */ - { 407, -1 }, /* (343) signed ::= NK_INTEGER */ - { 407, -2 }, /* (344) signed ::= NK_PLUS NK_INTEGER */ - { 407, -2 }, /* (345) signed ::= NK_MINUS NK_INTEGER */ - { 407, -1 }, /* (346) signed ::= NK_FLOAT */ - { 407, -2 }, /* (347) signed ::= NK_PLUS NK_FLOAT */ - { 407, -2 }, /* (348) signed ::= NK_MINUS NK_FLOAT */ - { 362, -1 }, /* (349) signed_literal ::= signed */ - { 362, -1 }, /* (350) signed_literal ::= NK_STRING */ - { 362, -1 }, /* (351) signed_literal ::= NK_BOOL */ - { 362, -2 }, /* (352) signed_literal ::= TIMESTAMP NK_STRING */ - { 362, -1 }, /* (353) signed_literal ::= duration_literal */ - { 362, -1 }, /* (354) signed_literal ::= NULL */ - { 362, -1 }, /* (355) signed_literal ::= literal_func */ - { 362, -1 }, /* (356) signed_literal ::= NK_QUESTION */ - { 409, -1 }, /* (357) literal_list ::= signed_literal */ - { 409, -3 }, /* (358) literal_list ::= literal_list NK_COMMA signed_literal */ - { 337, -1 }, /* (359) db_name ::= NK_ID */ - { 368, -1 }, /* (360) table_name ::= NK_ID */ - { 360, -1 }, /* (361) column_name ::= NK_ID */ - { 375, -1 }, /* (362) function_name ::= NK_ID */ - { 410, -1 }, /* (363) table_alias ::= NK_ID */ - { 383, -1 }, /* (364) column_alias ::= NK_ID */ - { 331, -1 }, /* (365) user_name ::= NK_ID */ - { 338, -1 }, /* (366) topic_name ::= NK_ID */ - { 399, -1 }, /* (367) stream_name ::= NK_ID */ - { 393, -1 }, /* (368) cgroup_name ::= NK_ID */ - { 386, -1 }, /* (369) index_name ::= NK_ID */ - { 411, -1 }, /* (370) expr_or_subquery ::= expression */ - { 404, -1 }, /* (371) expression ::= literal */ - { 404, -1 }, /* (372) expression ::= pseudo_column */ - { 404, -1 }, /* (373) expression ::= column_reference */ - { 404, -1 }, /* (374) expression ::= function_expression */ - { 404, -1 }, /* (375) expression ::= case_when_expression */ - { 404, -3 }, /* (376) expression ::= NK_LP expression NK_RP */ - { 404, -2 }, /* (377) expression ::= NK_PLUS expr_or_subquery */ - { 404, -2 }, /* (378) expression ::= NK_MINUS expr_or_subquery */ - { 404, -3 }, /* (379) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - { 404, -3 }, /* (380) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - { 404, -3 }, /* (381) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - { 404, -3 }, /* (382) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - { 404, -3 }, /* (383) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - { 404, -3 }, /* (384) expression ::= column_reference NK_ARROW NK_STRING */ - { 404, -3 }, /* (385) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - { 404, -3 }, /* (386) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - { 365, -1 }, /* (387) expression_list ::= expr_or_subquery */ - { 365, -3 }, /* (388) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - { 413, -1 }, /* (389) column_reference ::= column_name */ - { 413, -3 }, /* (390) column_reference ::= table_name NK_DOT column_name */ - { 412, -1 }, /* (391) pseudo_column ::= ROWTS */ - { 412, -1 }, /* (392) pseudo_column ::= TBNAME */ - { 412, -3 }, /* (393) pseudo_column ::= table_name NK_DOT TBNAME */ - { 412, -1 }, /* (394) pseudo_column ::= QSTART */ - { 412, -1 }, /* (395) pseudo_column ::= QEND */ - { 412, -1 }, /* (396) pseudo_column ::= QDURATION */ - { 412, -1 }, /* (397) pseudo_column ::= WSTART */ - { 412, -1 }, /* (398) pseudo_column ::= WEND */ - { 412, -1 }, /* (399) pseudo_column ::= WDURATION */ - { 412, -1 }, /* (400) pseudo_column ::= IROWTS */ - { 412, -1 }, /* (401) pseudo_column ::= ISFILLED */ - { 412, -1 }, /* (402) pseudo_column ::= QTAGS */ - { 414, -4 }, /* (403) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 414, -4 }, /* (404) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 414, -6 }, /* (405) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - { 414, -1 }, /* (406) function_expression ::= literal_func */ - { 408, -3 }, /* (407) literal_func ::= noarg_func NK_LP NK_RP */ - { 408, -1 }, /* (408) literal_func ::= NOW */ - { 418, -1 }, /* (409) noarg_func ::= NOW */ - { 418, -1 }, /* (410) noarg_func ::= TODAY */ - { 418, -1 }, /* (411) noarg_func ::= TIMEZONE */ - { 418, -1 }, /* (412) noarg_func ::= DATABASE */ - { 418, -1 }, /* (413) noarg_func ::= CLIENT_VERSION */ - { 418, -1 }, /* (414) noarg_func ::= SERVER_VERSION */ - { 418, -1 }, /* (415) noarg_func ::= SERVER_STATUS */ - { 418, -1 }, /* (416) noarg_func ::= CURRENT_USER */ - { 418, -1 }, /* (417) noarg_func ::= USER */ - { 416, -1 }, /* (418) star_func ::= COUNT */ - { 416, -1 }, /* (419) star_func ::= FIRST */ - { 416, -1 }, /* (420) star_func ::= LAST */ - { 416, -1 }, /* (421) star_func ::= LAST_ROW */ - { 417, -1 }, /* (422) star_func_para_list ::= NK_STAR */ - { 417, -1 }, /* (423) star_func_para_list ::= other_para_list */ - { 419, -1 }, /* (424) other_para_list ::= star_func_para */ - { 419, -3 }, /* (425) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 420, -1 }, /* (426) star_func_para ::= expr_or_subquery */ - { 420, -3 }, /* (427) star_func_para ::= table_name NK_DOT NK_STAR */ - { 415, -4 }, /* (428) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - { 415, -5 }, /* (429) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - { 421, -1 }, /* (430) when_then_list ::= when_then_expr */ - { 421, -2 }, /* (431) when_then_list ::= when_then_list when_then_expr */ - { 424, -4 }, /* (432) when_then_expr ::= WHEN common_expression THEN common_expression */ - { 422, 0 }, /* (433) case_when_else_opt ::= */ - { 422, -2 }, /* (434) case_when_else_opt ::= ELSE common_expression */ - { 425, -3 }, /* (435) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - { 425, -5 }, /* (436) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - { 425, -6 }, /* (437) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - { 425, -3 }, /* (438) predicate ::= expr_or_subquery IS NULL */ - { 425, -4 }, /* (439) predicate ::= expr_or_subquery IS NOT NULL */ - { 425, -3 }, /* (440) predicate ::= expr_or_subquery in_op in_predicate_value */ - { 426, -1 }, /* (441) compare_op ::= NK_LT */ - { 426, -1 }, /* (442) compare_op ::= NK_GT */ - { 426, -1 }, /* (443) compare_op ::= NK_LE */ - { 426, -1 }, /* (444) compare_op ::= NK_GE */ - { 426, -1 }, /* (445) compare_op ::= NK_NE */ - { 426, -1 }, /* (446) compare_op ::= NK_EQ */ - { 426, -1 }, /* (447) compare_op ::= LIKE */ - { 426, -2 }, /* (448) compare_op ::= NOT LIKE */ - { 426, -1 }, /* (449) compare_op ::= MATCH */ - { 426, -1 }, /* (450) compare_op ::= NMATCH */ - { 426, -1 }, /* (451) compare_op ::= CONTAINS */ - { 427, -1 }, /* (452) in_op ::= IN */ - { 427, -2 }, /* (453) in_op ::= NOT IN */ - { 428, -3 }, /* (454) in_predicate_value ::= NK_LP literal_list NK_RP */ - { 429, -1 }, /* (455) boolean_value_expression ::= boolean_primary */ - { 429, -2 }, /* (456) boolean_value_expression ::= NOT boolean_primary */ - { 429, -3 }, /* (457) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 429, -3 }, /* (458) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 430, -1 }, /* (459) boolean_primary ::= predicate */ - { 430, -3 }, /* (460) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 423, -1 }, /* (461) common_expression ::= expr_or_subquery */ - { 423, -1 }, /* (462) common_expression ::= boolean_value_expression */ - { 431, 0 }, /* (463) from_clause_opt ::= */ - { 431, -2 }, /* (464) from_clause_opt ::= FROM table_reference_list */ - { 432, -1 }, /* (465) table_reference_list ::= table_reference */ - { 432, -3 }, /* (466) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 433, -1 }, /* (467) table_reference ::= table_primary */ - { 433, -1 }, /* (468) table_reference ::= joined_table */ - { 434, -2 }, /* (469) table_primary ::= table_name alias_opt */ - { 434, -4 }, /* (470) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 434, -2 }, /* (471) table_primary ::= subquery alias_opt */ - { 434, -1 }, /* (472) table_primary ::= parenthesized_joined_table */ - { 436, 0 }, /* (473) alias_opt ::= */ - { 436, -1 }, /* (474) alias_opt ::= table_alias */ - { 436, -2 }, /* (475) alias_opt ::= AS table_alias */ - { 438, -3 }, /* (476) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 438, -3 }, /* (477) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 435, -6 }, /* (478) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 439, 0 }, /* (479) join_type ::= */ - { 439, -1 }, /* (480) join_type ::= INNER */ - { 441, -12 }, /* (481) query_specification ::= SELECT set_quantifier_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 */ - { 442, 0 }, /* (482) set_quantifier_opt ::= */ - { 442, -1 }, /* (483) set_quantifier_opt ::= DISTINCT */ - { 442, -1 }, /* (484) set_quantifier_opt ::= ALL */ - { 443, -1 }, /* (485) select_list ::= select_item */ - { 443, -3 }, /* (486) select_list ::= select_list NK_COMMA select_item */ - { 451, -1 }, /* (487) select_item ::= NK_STAR */ - { 451, -1 }, /* (488) select_item ::= common_expression */ - { 451, -2 }, /* (489) select_item ::= common_expression column_alias */ - { 451, -3 }, /* (490) select_item ::= common_expression AS column_alias */ - { 451, -3 }, /* (491) select_item ::= table_name NK_DOT NK_STAR */ - { 406, 0 }, /* (492) where_clause_opt ::= */ - { 406, -2 }, /* (493) where_clause_opt ::= WHERE search_condition */ - { 444, 0 }, /* (494) partition_by_clause_opt ::= */ - { 444, -3 }, /* (495) partition_by_clause_opt ::= PARTITION BY partition_list */ - { 452, -1 }, /* (496) partition_list ::= partition_item */ - { 452, -3 }, /* (497) partition_list ::= partition_list NK_COMMA partition_item */ - { 453, -1 }, /* (498) partition_item ::= expr_or_subquery */ - { 453, -2 }, /* (499) partition_item ::= expr_or_subquery column_alias */ - { 453, -3 }, /* (500) partition_item ::= expr_or_subquery AS column_alias */ - { 448, 0 }, /* (501) twindow_clause_opt ::= */ - { 448, -6 }, /* (502) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 448, -4 }, /* (503) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - { 448, -6 }, /* (504) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 448, -8 }, /* (505) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 448, -7 }, /* (506) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - { 388, 0 }, /* (507) sliding_opt ::= */ - { 388, -4 }, /* (508) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 447, 0 }, /* (509) fill_opt ::= */ - { 447, -4 }, /* (510) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 447, -6 }, /* (511) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 454, -1 }, /* (512) fill_mode ::= NONE */ - { 454, -1 }, /* (513) fill_mode ::= PREV */ - { 454, -1 }, /* (514) fill_mode ::= NULL */ - { 454, -1 }, /* (515) fill_mode ::= LINEAR */ - { 454, -1 }, /* (516) fill_mode ::= NEXT */ - { 449, 0 }, /* (517) group_by_clause_opt ::= */ - { 449, -3 }, /* (518) group_by_clause_opt ::= GROUP BY group_by_list */ - { 455, -1 }, /* (519) group_by_list ::= expr_or_subquery */ - { 455, -3 }, /* (520) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - { 450, 0 }, /* (521) having_clause_opt ::= */ - { 450, -2 }, /* (522) having_clause_opt ::= HAVING search_condition */ - { 445, 0 }, /* (523) range_opt ::= */ - { 445, -6 }, /* (524) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - { 446, 0 }, /* (525) every_opt ::= */ - { 446, -4 }, /* (526) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 456, -4 }, /* (527) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 457, -1 }, /* (528) query_simple ::= query_specification */ - { 457, -1 }, /* (529) query_simple ::= union_query_expression */ - { 461, -4 }, /* (530) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - { 461, -3 }, /* (531) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - { 462, -1 }, /* (532) query_simple_or_subquery ::= query_simple */ - { 462, -1 }, /* (533) query_simple_or_subquery ::= subquery */ - { 392, -1 }, /* (534) query_or_subquery ::= query_expression */ - { 392, -1 }, /* (535) query_or_subquery ::= subquery */ - { 458, 0 }, /* (536) order_by_clause_opt ::= */ - { 458, -3 }, /* (537) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 459, 0 }, /* (538) slimit_clause_opt ::= */ - { 459, -2 }, /* (539) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 459, -4 }, /* (540) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 459, -4 }, /* (541) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 460, 0 }, /* (542) limit_clause_opt ::= */ - { 460, -2 }, /* (543) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 460, -4 }, /* (544) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 460, -4 }, /* (545) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 437, -3 }, /* (546) subquery ::= NK_LP query_expression NK_RP */ - { 437, -3 }, /* (547) subquery ::= NK_LP subquery NK_RP */ - { 440, -1 }, /* (548) search_condition ::= common_expression */ - { 463, -1 }, /* (549) sort_specification_list ::= sort_specification */ - { 463, -3 }, /* (550) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 464, -3 }, /* (551) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - { 465, 0 }, /* (552) ordering_specification_opt ::= */ - { 465, -1 }, /* (553) ordering_specification_opt ::= ASC */ - { 465, -1 }, /* (554) ordering_specification_opt ::= DESC */ - { 466, 0 }, /* (555) null_ordering_opt ::= */ - { 466, -2 }, /* (556) null_ordering_opt ::= NULLS FIRST */ - { 466, -2 }, /* (557) null_ordering_opt ::= NULLS LAST */ + { 328, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 328, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 329, 0 }, /* (2) account_options ::= */ + { 329, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 329, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 329, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 329, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 329, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 329, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 329, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 329, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 329, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 330, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 330, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 332, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 332, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 332, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 332, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 332, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 332, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 332, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 332, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 332, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 332, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 328, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ + { 328, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 328, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + { 328, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + { 328, -3 }, /* (28) cmd ::= DROP USER user_name */ + { 334, 0 }, /* (29) sysinfo_opt ::= */ + { 334, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ + { 328, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ + { 328, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ + { 335, -1 }, /* (33) privileges ::= ALL */ + { 335, -1 }, /* (34) privileges ::= priv_type_list */ + { 335, -1 }, /* (35) privileges ::= SUBSCRIBE */ + { 337, -1 }, /* (36) priv_type_list ::= priv_type */ + { 337, -3 }, /* (37) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + { 338, -1 }, /* (38) priv_type ::= READ */ + { 338, -1 }, /* (39) priv_type ::= WRITE */ + { 336, -3 }, /* (40) priv_level ::= NK_STAR NK_DOT NK_STAR */ + { 336, -3 }, /* (41) priv_level ::= db_name NK_DOT NK_STAR */ + { 336, -1 }, /* (42) priv_level ::= topic_name */ + { 328, -3 }, /* (43) cmd ::= CREATE DNODE dnode_endpoint */ + { 328, -5 }, /* (44) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + { 328, -4 }, /* (45) cmd ::= DROP DNODE NK_INTEGER force_opt */ + { 328, -4 }, /* (46) cmd ::= DROP DNODE dnode_endpoint force_opt */ + { 328, -4 }, /* (47) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 328, -5 }, /* (48) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 328, -4 }, /* (49) cmd ::= ALTER ALL DNODES NK_STRING */ + { 328, -5 }, /* (50) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 341, -1 }, /* (51) dnode_endpoint ::= NK_STRING */ + { 341, -1 }, /* (52) dnode_endpoint ::= NK_ID */ + { 341, -1 }, /* (53) dnode_endpoint ::= NK_IPTOKEN */ + { 342, 0 }, /* (54) force_opt ::= */ + { 342, -1 }, /* (55) force_opt ::= FORCE */ + { 328, -3 }, /* (56) cmd ::= ALTER LOCAL NK_STRING */ + { 328, -4 }, /* (57) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 328, -5 }, /* (58) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 328, -5 }, /* (59) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 328, -5 }, /* (60) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + { 328, -5 }, /* (61) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + { 328, -5 }, /* (62) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + { 328, -5 }, /* (63) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + { 328, -5 }, /* (64) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + { 328, -5 }, /* (65) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + { 328, -5 }, /* (66) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 328, -4 }, /* (67) cmd ::= DROP DATABASE exists_opt db_name */ + { 328, -2 }, /* (68) cmd ::= USE db_name */ + { 328, -4 }, /* (69) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 328, -3 }, /* (70) cmd ::= FLUSH DATABASE db_name */ + { 328, -4 }, /* (71) cmd ::= TRIM DATABASE db_name speed_opt */ + { 328, -3 }, /* (72) cmd ::= COMPACT DATABASE db_name */ + { 343, -3 }, /* (73) not_exists_opt ::= IF NOT EXISTS */ + { 343, 0 }, /* (74) not_exists_opt ::= */ + { 345, -2 }, /* (75) exists_opt ::= IF EXISTS */ + { 345, 0 }, /* (76) exists_opt ::= */ + { 344, 0 }, /* (77) db_options ::= */ + { 344, -3 }, /* (78) db_options ::= db_options BUFFER NK_INTEGER */ + { 344, -3 }, /* (79) db_options ::= db_options CACHEMODEL NK_STRING */ + { 344, -3 }, /* (80) db_options ::= db_options CACHESIZE NK_INTEGER */ + { 344, -3 }, /* (81) db_options ::= db_options COMP NK_INTEGER */ + { 344, -3 }, /* (82) db_options ::= db_options DURATION NK_INTEGER */ + { 344, -3 }, /* (83) db_options ::= db_options DURATION NK_VARIABLE */ + { 344, -3 }, /* (84) db_options ::= db_options MAXROWS NK_INTEGER */ + { 344, -3 }, /* (85) db_options ::= db_options MINROWS NK_INTEGER */ + { 344, -3 }, /* (86) db_options ::= db_options KEEP integer_list */ + { 344, -3 }, /* (87) db_options ::= db_options KEEP variable_list */ + { 344, -3 }, /* (88) db_options ::= db_options PAGES NK_INTEGER */ + { 344, -3 }, /* (89) db_options ::= db_options PAGESIZE NK_INTEGER */ + { 344, -3 }, /* (90) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ + { 344, -3 }, /* (91) db_options ::= db_options PRECISION NK_STRING */ + { 344, -3 }, /* (92) db_options ::= db_options REPLICA NK_INTEGER */ + { 344, -3 }, /* (93) db_options ::= db_options VGROUPS NK_INTEGER */ + { 344, -3 }, /* (94) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 344, -3 }, /* (95) db_options ::= db_options RETENTIONS retention_list */ + { 344, -3 }, /* (96) db_options ::= db_options SCHEMALESS NK_INTEGER */ + { 344, -3 }, /* (97) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + { 344, -3 }, /* (98) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + { 344, -3 }, /* (99) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + { 344, -4 }, /* (100) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + { 344, -3 }, /* (101) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + { 344, -4 }, /* (102) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + { 344, -3 }, /* (103) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + { 344, -3 }, /* (104) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + { 344, -3 }, /* (105) db_options ::= db_options STT_TRIGGER NK_INTEGER */ + { 344, -3 }, /* (106) db_options ::= db_options TABLE_PREFIX NK_INTEGER */ + { 344, -3 }, /* (107) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ + { 346, -1 }, /* (108) alter_db_options ::= alter_db_option */ + { 346, -2 }, /* (109) alter_db_options ::= alter_db_options alter_db_option */ + { 351, -2 }, /* (110) alter_db_option ::= BUFFER NK_INTEGER */ + { 351, -2 }, /* (111) alter_db_option ::= CACHEMODEL NK_STRING */ + { 351, -2 }, /* (112) alter_db_option ::= CACHESIZE NK_INTEGER */ + { 351, -2 }, /* (113) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + { 351, -2 }, /* (114) alter_db_option ::= KEEP integer_list */ + { 351, -2 }, /* (115) alter_db_option ::= KEEP variable_list */ + { 351, -2 }, /* (116) alter_db_option ::= PAGES NK_INTEGER */ + { 351, -2 }, /* (117) alter_db_option ::= REPLICA NK_INTEGER */ + { 351, -2 }, /* (118) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + { 351, -2 }, /* (119) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + { 348, -1 }, /* (120) integer_list ::= NK_INTEGER */ + { 348, -3 }, /* (121) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 349, -1 }, /* (122) variable_list ::= NK_VARIABLE */ + { 349, -3 }, /* (123) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 350, -1 }, /* (124) retention_list ::= retention */ + { 350, -3 }, /* (125) retention_list ::= retention_list NK_COMMA retention */ + { 352, -3 }, /* (126) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 347, 0 }, /* (127) speed_opt ::= */ + { 347, -2 }, /* (128) speed_opt ::= MAX_SPEED NK_INTEGER */ + { 328, -9 }, /* (129) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 328, -3 }, /* (130) cmd ::= CREATE TABLE multi_create_clause */ + { 328, -9 }, /* (131) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 328, -3 }, /* (132) cmd ::= DROP TABLE multi_drop_clause */ + { 328, -4 }, /* (133) cmd ::= DROP STABLE exists_opt full_table_name */ + { 328, -3 }, /* (134) cmd ::= ALTER TABLE alter_table_clause */ + { 328, -3 }, /* (135) cmd ::= ALTER STABLE alter_table_clause */ + { 360, -2 }, /* (136) alter_table_clause ::= full_table_name alter_table_options */ + { 360, -5 }, /* (137) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 360, -4 }, /* (138) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 360, -5 }, /* (139) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 360, -5 }, /* (140) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 360, -5 }, /* (141) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 360, -4 }, /* (142) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 360, -5 }, /* (143) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 360, -5 }, /* (144) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 360, -6 }, /* (145) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 357, -1 }, /* (146) multi_create_clause ::= create_subtable_clause */ + { 357, -2 }, /* (147) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 365, -10 }, /* (148) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ + { 359, -1 }, /* (149) multi_drop_clause ::= drop_table_clause */ + { 359, -2 }, /* (150) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 368, -2 }, /* (151) drop_table_clause ::= exists_opt full_table_name */ + { 366, 0 }, /* (152) specific_cols_opt ::= */ + { 366, -3 }, /* (153) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + { 353, -1 }, /* (154) full_table_name ::= table_name */ + { 353, -3 }, /* (155) full_table_name ::= db_name NK_DOT table_name */ + { 354, -1 }, /* (156) column_def_list ::= column_def */ + { 354, -3 }, /* (157) column_def_list ::= column_def_list NK_COMMA column_def */ + { 371, -2 }, /* (158) column_def ::= column_name type_name */ + { 371, -4 }, /* (159) column_def ::= column_name type_name COMMENT NK_STRING */ + { 363, -1 }, /* (160) type_name ::= BOOL */ + { 363, -1 }, /* (161) type_name ::= TINYINT */ + { 363, -1 }, /* (162) type_name ::= SMALLINT */ + { 363, -1 }, /* (163) type_name ::= INT */ + { 363, -1 }, /* (164) type_name ::= INTEGER */ + { 363, -1 }, /* (165) type_name ::= BIGINT */ + { 363, -1 }, /* (166) type_name ::= FLOAT */ + { 363, -1 }, /* (167) type_name ::= DOUBLE */ + { 363, -4 }, /* (168) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 363, -1 }, /* (169) type_name ::= TIMESTAMP */ + { 363, -4 }, /* (170) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 363, -2 }, /* (171) type_name ::= TINYINT UNSIGNED */ + { 363, -2 }, /* (172) type_name ::= SMALLINT UNSIGNED */ + { 363, -2 }, /* (173) type_name ::= INT UNSIGNED */ + { 363, -2 }, /* (174) type_name ::= BIGINT UNSIGNED */ + { 363, -1 }, /* (175) type_name ::= JSON */ + { 363, -4 }, /* (176) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 363, -1 }, /* (177) type_name ::= MEDIUMBLOB */ + { 363, -1 }, /* (178) type_name ::= BLOB */ + { 363, -4 }, /* (179) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 363, -1 }, /* (180) type_name ::= DECIMAL */ + { 363, -4 }, /* (181) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 363, -6 }, /* (182) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 355, 0 }, /* (183) tags_def_opt ::= */ + { 355, -1 }, /* (184) tags_def_opt ::= tags_def */ + { 358, -4 }, /* (185) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 356, 0 }, /* (186) table_options ::= */ + { 356, -3 }, /* (187) table_options ::= table_options COMMENT NK_STRING */ + { 356, -3 }, /* (188) table_options ::= table_options MAX_DELAY duration_list */ + { 356, -3 }, /* (189) table_options ::= table_options WATERMARK duration_list */ + { 356, -5 }, /* (190) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + { 356, -3 }, /* (191) table_options ::= table_options TTL NK_INTEGER */ + { 356, -5 }, /* (192) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 356, -3 }, /* (193) table_options ::= table_options DELETE_MARK duration_list */ + { 361, -1 }, /* (194) alter_table_options ::= alter_table_option */ + { 361, -2 }, /* (195) alter_table_options ::= alter_table_options alter_table_option */ + { 374, -2 }, /* (196) alter_table_option ::= COMMENT NK_STRING */ + { 374, -2 }, /* (197) alter_table_option ::= TTL NK_INTEGER */ + { 372, -1 }, /* (198) duration_list ::= duration_literal */ + { 372, -3 }, /* (199) duration_list ::= duration_list NK_COMMA duration_literal */ + { 373, -1 }, /* (200) rollup_func_list ::= rollup_func_name */ + { 373, -3 }, /* (201) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + { 376, -1 }, /* (202) rollup_func_name ::= function_name */ + { 376, -1 }, /* (203) rollup_func_name ::= FIRST */ + { 376, -1 }, /* (204) rollup_func_name ::= LAST */ + { 369, -1 }, /* (205) col_name_list ::= col_name */ + { 369, -3 }, /* (206) col_name_list ::= col_name_list NK_COMMA col_name */ + { 378, -1 }, /* (207) col_name ::= column_name */ + { 328, -2 }, /* (208) cmd ::= SHOW DNODES */ + { 328, -2 }, /* (209) cmd ::= SHOW USERS */ + { 328, -3 }, /* (210) cmd ::= SHOW USER PRIVILEGES */ + { 328, -2 }, /* (211) cmd ::= SHOW DATABASES */ + { 328, -4 }, /* (212) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 328, -4 }, /* (213) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 328, -3 }, /* (214) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 328, -2 }, /* (215) cmd ::= SHOW MNODES */ + { 328, -2 }, /* (216) cmd ::= SHOW QNODES */ + { 328, -2 }, /* (217) cmd ::= SHOW FUNCTIONS */ + { 328, -5 }, /* (218) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 328, -2 }, /* (219) cmd ::= SHOW STREAMS */ + { 328, -2 }, /* (220) cmd ::= SHOW ACCOUNTS */ + { 328, -2 }, /* (221) cmd ::= SHOW APPS */ + { 328, -2 }, /* (222) cmd ::= SHOW CONNECTIONS */ + { 328, -2 }, /* (223) cmd ::= SHOW LICENCES */ + { 328, -2 }, /* (224) cmd ::= SHOW GRANTS */ + { 328, -4 }, /* (225) cmd ::= SHOW CREATE DATABASE db_name */ + { 328, -4 }, /* (226) cmd ::= SHOW CREATE TABLE full_table_name */ + { 328, -4 }, /* (227) cmd ::= SHOW CREATE STABLE full_table_name */ + { 328, -2 }, /* (228) cmd ::= SHOW QUERIES */ + { 328, -2 }, /* (229) cmd ::= SHOW SCORES */ + { 328, -2 }, /* (230) cmd ::= SHOW TOPICS */ + { 328, -2 }, /* (231) cmd ::= SHOW VARIABLES */ + { 328, -3 }, /* (232) cmd ::= SHOW CLUSTER VARIABLES */ + { 328, -3 }, /* (233) cmd ::= SHOW LOCAL VARIABLES */ + { 328, -5 }, /* (234) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + { 328, -2 }, /* (235) cmd ::= SHOW BNODES */ + { 328, -2 }, /* (236) cmd ::= SHOW SNODES */ + { 328, -2 }, /* (237) cmd ::= SHOW CLUSTER */ + { 328, -2 }, /* (238) cmd ::= SHOW TRANSACTIONS */ + { 328, -4 }, /* (239) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 328, -2 }, /* (240) cmd ::= SHOW CONSUMERS */ + { 328, -2 }, /* (241) cmd ::= SHOW SUBSCRIPTIONS */ + { 328, -5 }, /* (242) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + { 328, -7 }, /* (243) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + { 328, -3 }, /* (244) cmd ::= SHOW VNODES NK_INTEGER */ + { 328, -3 }, /* (245) cmd ::= SHOW VNODES NK_STRING */ + { 328, -3 }, /* (246) cmd ::= SHOW db_name_cond_opt ALIVE */ + { 328, -3 }, /* (247) cmd ::= SHOW CLUSTER ALIVE */ + { 379, 0 }, /* (248) db_name_cond_opt ::= */ + { 379, -2 }, /* (249) db_name_cond_opt ::= db_name NK_DOT */ + { 380, 0 }, /* (250) like_pattern_opt ::= */ + { 380, -2 }, /* (251) like_pattern_opt ::= LIKE NK_STRING */ + { 381, -1 }, /* (252) table_name_cond ::= table_name */ + { 382, 0 }, /* (253) from_db_opt ::= */ + { 382, -2 }, /* (254) from_db_opt ::= FROM db_name */ + { 383, 0 }, /* (255) tag_list_opt ::= */ + { 383, -1 }, /* (256) tag_list_opt ::= tag_item */ + { 383, -3 }, /* (257) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + { 384, -1 }, /* (258) tag_item ::= TBNAME */ + { 384, -1 }, /* (259) tag_item ::= QTAGS */ + { 384, -1 }, /* (260) tag_item ::= column_name */ + { 384, -2 }, /* (261) tag_item ::= column_name column_alias */ + { 384, -3 }, /* (262) tag_item ::= column_name AS column_alias */ + { 328, -8 }, /* (263) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ + { 328, -9 }, /* (264) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ + { 328, -4 }, /* (265) cmd ::= DROP INDEX exists_opt full_index_name */ + { 386, -1 }, /* (266) full_index_name ::= index_name */ + { 386, -3 }, /* (267) full_index_name ::= db_name NK_DOT index_name */ + { 387, -10 }, /* (268) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 387, -12 }, /* (269) 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 */ + { 389, -1 }, /* (270) func_list ::= func */ + { 389, -3 }, /* (271) func_list ::= func_list NK_COMMA func */ + { 392, -4 }, /* (272) func ::= sma_func_name NK_LP expression_list NK_RP */ + { 393, -1 }, /* (273) sma_func_name ::= function_name */ + { 393, -1 }, /* (274) sma_func_name ::= COUNT */ + { 393, -1 }, /* (275) sma_func_name ::= FIRST */ + { 393, -1 }, /* (276) sma_func_name ::= LAST */ + { 393, -1 }, /* (277) sma_func_name ::= LAST_ROW */ + { 391, 0 }, /* (278) sma_stream_opt ::= */ + { 391, -3 }, /* (279) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + { 391, -3 }, /* (280) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + { 391, -3 }, /* (281) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + { 328, -6 }, /* (282) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + { 328, -7 }, /* (283) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 328, -9 }, /* (284) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 328, -7 }, /* (285) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 328, -9 }, /* (286) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 328, -4 }, /* (287) cmd ::= DROP TOPIC exists_opt topic_name */ + { 328, -7 }, /* (288) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 328, -2 }, /* (289) cmd ::= DESC full_table_name */ + { 328, -2 }, /* (290) cmd ::= DESCRIBE full_table_name */ + { 328, -3 }, /* (291) cmd ::= RESET QUERY CACHE */ + { 328, -4 }, /* (292) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + { 328, -4 }, /* (293) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + { 396, 0 }, /* (294) analyze_opt ::= */ + { 396, -1 }, /* (295) analyze_opt ::= ANALYZE */ + { 397, 0 }, /* (296) explain_options ::= */ + { 397, -3 }, /* (297) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 397, -3 }, /* (298) explain_options ::= explain_options RATIO NK_FLOAT */ + { 328, -10 }, /* (299) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 328, -4 }, /* (300) cmd ::= DROP FUNCTION exists_opt function_name */ + { 399, 0 }, /* (301) agg_func_opt ::= */ + { 399, -1 }, /* (302) agg_func_opt ::= AGGREGATE */ + { 400, 0 }, /* (303) bufsize_opt ::= */ + { 400, -2 }, /* (304) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 328, -12 }, /* (305) 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 */ + { 328, -4 }, /* (306) cmd ::= DROP STREAM exists_opt stream_name */ + { 403, 0 }, /* (307) col_list_opt ::= */ + { 403, -3 }, /* (308) col_list_opt ::= NK_LP col_name_list NK_RP */ + { 404, 0 }, /* (309) tag_def_or_ref_opt ::= */ + { 404, -1 }, /* (310) tag_def_or_ref_opt ::= tags_def */ + { 404, -4 }, /* (311) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + { 402, 0 }, /* (312) stream_options ::= */ + { 402, -3 }, /* (313) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 402, -3 }, /* (314) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 402, -4 }, /* (315) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 402, -3 }, /* (316) stream_options ::= stream_options WATERMARK duration_literal */ + { 402, -4 }, /* (317) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + { 402, -3 }, /* (318) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + { 402, -4 }, /* (319) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + { 405, 0 }, /* (320) subtable_opt ::= */ + { 405, -4 }, /* (321) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + { 328, -3 }, /* (322) cmd ::= KILL CONNECTION NK_INTEGER */ + { 328, -3 }, /* (323) cmd ::= KILL QUERY NK_STRING */ + { 328, -3 }, /* (324) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 328, -2 }, /* (325) cmd ::= BALANCE VGROUP */ + { 328, -4 }, /* (326) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 328, -4 }, /* (327) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 328, -3 }, /* (328) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 407, -2 }, /* (329) dnode_list ::= DNODE NK_INTEGER */ + { 407, -3 }, /* (330) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 328, -4 }, /* (331) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 328, -1 }, /* (332) cmd ::= query_or_subquery */ + { 328, -1 }, /* (333) cmd ::= insert_query */ + { 398, -7 }, /* (334) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + { 398, -4 }, /* (335) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + { 331, -1 }, /* (336) literal ::= NK_INTEGER */ + { 331, -1 }, /* (337) literal ::= NK_FLOAT */ + { 331, -1 }, /* (338) literal ::= NK_STRING */ + { 331, -1 }, /* (339) literal ::= NK_BOOL */ + { 331, -2 }, /* (340) literal ::= TIMESTAMP NK_STRING */ + { 331, -1 }, /* (341) literal ::= duration_literal */ + { 331, -1 }, /* (342) literal ::= NULL */ + { 331, -1 }, /* (343) literal ::= NK_QUESTION */ + { 375, -1 }, /* (344) duration_literal ::= NK_VARIABLE */ + { 409, -1 }, /* (345) signed ::= NK_INTEGER */ + { 409, -2 }, /* (346) signed ::= NK_PLUS NK_INTEGER */ + { 409, -2 }, /* (347) signed ::= NK_MINUS NK_INTEGER */ + { 409, -1 }, /* (348) signed ::= NK_FLOAT */ + { 409, -2 }, /* (349) signed ::= NK_PLUS NK_FLOAT */ + { 409, -2 }, /* (350) signed ::= NK_MINUS NK_FLOAT */ + { 364, -1 }, /* (351) signed_literal ::= signed */ + { 364, -1 }, /* (352) signed_literal ::= NK_STRING */ + { 364, -1 }, /* (353) signed_literal ::= NK_BOOL */ + { 364, -2 }, /* (354) signed_literal ::= TIMESTAMP NK_STRING */ + { 364, -1 }, /* (355) signed_literal ::= duration_literal */ + { 364, -1 }, /* (356) signed_literal ::= NULL */ + { 364, -1 }, /* (357) signed_literal ::= literal_func */ + { 364, -1 }, /* (358) signed_literal ::= NK_QUESTION */ + { 411, -1 }, /* (359) literal_list ::= signed_literal */ + { 411, -3 }, /* (360) literal_list ::= literal_list NK_COMMA signed_literal */ + { 339, -1 }, /* (361) db_name ::= NK_ID */ + { 370, -1 }, /* (362) table_name ::= NK_ID */ + { 362, -1 }, /* (363) column_name ::= NK_ID */ + { 377, -1 }, /* (364) function_name ::= NK_ID */ + { 412, -1 }, /* (365) table_alias ::= NK_ID */ + { 385, -1 }, /* (366) column_alias ::= NK_ID */ + { 333, -1 }, /* (367) user_name ::= NK_ID */ + { 340, -1 }, /* (368) topic_name ::= NK_ID */ + { 401, -1 }, /* (369) stream_name ::= NK_ID */ + { 395, -1 }, /* (370) cgroup_name ::= NK_ID */ + { 388, -1 }, /* (371) index_name ::= NK_ID */ + { 413, -1 }, /* (372) expr_or_subquery ::= expression */ + { 406, -1 }, /* (373) expression ::= literal */ + { 406, -1 }, /* (374) expression ::= pseudo_column */ + { 406, -1 }, /* (375) expression ::= column_reference */ + { 406, -1 }, /* (376) expression ::= function_expression */ + { 406, -1 }, /* (377) expression ::= case_when_expression */ + { 406, -3 }, /* (378) expression ::= NK_LP expression NK_RP */ + { 406, -2 }, /* (379) expression ::= NK_PLUS expr_or_subquery */ + { 406, -2 }, /* (380) expression ::= NK_MINUS expr_or_subquery */ + { 406, -3 }, /* (381) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + { 406, -3 }, /* (382) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + { 406, -3 }, /* (383) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + { 406, -3 }, /* (384) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + { 406, -3 }, /* (385) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + { 406, -3 }, /* (386) expression ::= column_reference NK_ARROW NK_STRING */ + { 406, -3 }, /* (387) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + { 406, -3 }, /* (388) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + { 367, -1 }, /* (389) expression_list ::= expr_or_subquery */ + { 367, -3 }, /* (390) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + { 415, -1 }, /* (391) column_reference ::= column_name */ + { 415, -3 }, /* (392) column_reference ::= table_name NK_DOT column_name */ + { 414, -1 }, /* (393) pseudo_column ::= ROWTS */ + { 414, -1 }, /* (394) pseudo_column ::= TBNAME */ + { 414, -3 }, /* (395) pseudo_column ::= table_name NK_DOT TBNAME */ + { 414, -1 }, /* (396) pseudo_column ::= QSTART */ + { 414, -1 }, /* (397) pseudo_column ::= QEND */ + { 414, -1 }, /* (398) pseudo_column ::= QDURATION */ + { 414, -1 }, /* (399) pseudo_column ::= WSTART */ + { 414, -1 }, /* (400) pseudo_column ::= WEND */ + { 414, -1 }, /* (401) pseudo_column ::= WDURATION */ + { 414, -1 }, /* (402) pseudo_column ::= IROWTS */ + { 414, -1 }, /* (403) pseudo_column ::= ISFILLED */ + { 414, -1 }, /* (404) pseudo_column ::= QTAGS */ + { 416, -4 }, /* (405) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 416, -4 }, /* (406) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 416, -6 }, /* (407) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + { 416, -1 }, /* (408) function_expression ::= literal_func */ + { 410, -3 }, /* (409) literal_func ::= noarg_func NK_LP NK_RP */ + { 410, -1 }, /* (410) literal_func ::= NOW */ + { 420, -1 }, /* (411) noarg_func ::= NOW */ + { 420, -1 }, /* (412) noarg_func ::= TODAY */ + { 420, -1 }, /* (413) noarg_func ::= TIMEZONE */ + { 420, -1 }, /* (414) noarg_func ::= DATABASE */ + { 420, -1 }, /* (415) noarg_func ::= CLIENT_VERSION */ + { 420, -1 }, /* (416) noarg_func ::= SERVER_VERSION */ + { 420, -1 }, /* (417) noarg_func ::= SERVER_STATUS */ + { 420, -1 }, /* (418) noarg_func ::= CURRENT_USER */ + { 420, -1 }, /* (419) noarg_func ::= USER */ + { 418, -1 }, /* (420) star_func ::= COUNT */ + { 418, -1 }, /* (421) star_func ::= FIRST */ + { 418, -1 }, /* (422) star_func ::= LAST */ + { 418, -1 }, /* (423) star_func ::= LAST_ROW */ + { 419, -1 }, /* (424) star_func_para_list ::= NK_STAR */ + { 419, -1 }, /* (425) star_func_para_list ::= other_para_list */ + { 421, -1 }, /* (426) other_para_list ::= star_func_para */ + { 421, -3 }, /* (427) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 422, -1 }, /* (428) star_func_para ::= expr_or_subquery */ + { 422, -3 }, /* (429) star_func_para ::= table_name NK_DOT NK_STAR */ + { 417, -4 }, /* (430) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + { 417, -5 }, /* (431) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + { 423, -1 }, /* (432) when_then_list ::= when_then_expr */ + { 423, -2 }, /* (433) when_then_list ::= when_then_list when_then_expr */ + { 426, -4 }, /* (434) when_then_expr ::= WHEN common_expression THEN common_expression */ + { 424, 0 }, /* (435) case_when_else_opt ::= */ + { 424, -2 }, /* (436) case_when_else_opt ::= ELSE common_expression */ + { 427, -3 }, /* (437) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + { 427, -5 }, /* (438) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + { 427, -6 }, /* (439) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + { 427, -3 }, /* (440) predicate ::= expr_or_subquery IS NULL */ + { 427, -4 }, /* (441) predicate ::= expr_or_subquery IS NOT NULL */ + { 427, -3 }, /* (442) predicate ::= expr_or_subquery in_op in_predicate_value */ + { 428, -1 }, /* (443) compare_op ::= NK_LT */ + { 428, -1 }, /* (444) compare_op ::= NK_GT */ + { 428, -1 }, /* (445) compare_op ::= NK_LE */ + { 428, -1 }, /* (446) compare_op ::= NK_GE */ + { 428, -1 }, /* (447) compare_op ::= NK_NE */ + { 428, -1 }, /* (448) compare_op ::= NK_EQ */ + { 428, -1 }, /* (449) compare_op ::= LIKE */ + { 428, -2 }, /* (450) compare_op ::= NOT LIKE */ + { 428, -1 }, /* (451) compare_op ::= MATCH */ + { 428, -1 }, /* (452) compare_op ::= NMATCH */ + { 428, -1 }, /* (453) compare_op ::= CONTAINS */ + { 429, -1 }, /* (454) in_op ::= IN */ + { 429, -2 }, /* (455) in_op ::= NOT IN */ + { 430, -3 }, /* (456) in_predicate_value ::= NK_LP literal_list NK_RP */ + { 431, -1 }, /* (457) boolean_value_expression ::= boolean_primary */ + { 431, -2 }, /* (458) boolean_value_expression ::= NOT boolean_primary */ + { 431, -3 }, /* (459) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 431, -3 }, /* (460) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 432, -1 }, /* (461) boolean_primary ::= predicate */ + { 432, -3 }, /* (462) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 425, -1 }, /* (463) common_expression ::= expr_or_subquery */ + { 425, -1 }, /* (464) common_expression ::= boolean_value_expression */ + { 433, 0 }, /* (465) from_clause_opt ::= */ + { 433, -2 }, /* (466) from_clause_opt ::= FROM table_reference_list */ + { 434, -1 }, /* (467) table_reference_list ::= table_reference */ + { 434, -3 }, /* (468) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 435, -1 }, /* (469) table_reference ::= table_primary */ + { 435, -1 }, /* (470) table_reference ::= joined_table */ + { 436, -2 }, /* (471) table_primary ::= table_name alias_opt */ + { 436, -4 }, /* (472) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 436, -2 }, /* (473) table_primary ::= subquery alias_opt */ + { 436, -1 }, /* (474) table_primary ::= parenthesized_joined_table */ + { 438, 0 }, /* (475) alias_opt ::= */ + { 438, -1 }, /* (476) alias_opt ::= table_alias */ + { 438, -2 }, /* (477) alias_opt ::= AS table_alias */ + { 440, -3 }, /* (478) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 440, -3 }, /* (479) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 437, -6 }, /* (480) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 441, 0 }, /* (481) join_type ::= */ + { 441, -1 }, /* (482) join_type ::= INNER */ + { 443, -12 }, /* (483) query_specification ::= SELECT set_quantifier_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 */ + { 444, 0 }, /* (484) set_quantifier_opt ::= */ + { 444, -1 }, /* (485) set_quantifier_opt ::= DISTINCT */ + { 444, -1 }, /* (486) set_quantifier_opt ::= ALL */ + { 445, -1 }, /* (487) select_list ::= select_item */ + { 445, -3 }, /* (488) select_list ::= select_list NK_COMMA select_item */ + { 453, -1 }, /* (489) select_item ::= NK_STAR */ + { 453, -1 }, /* (490) select_item ::= common_expression */ + { 453, -2 }, /* (491) select_item ::= common_expression column_alias */ + { 453, -3 }, /* (492) select_item ::= common_expression AS column_alias */ + { 453, -3 }, /* (493) select_item ::= table_name NK_DOT NK_STAR */ + { 408, 0 }, /* (494) where_clause_opt ::= */ + { 408, -2 }, /* (495) where_clause_opt ::= WHERE search_condition */ + { 446, 0 }, /* (496) partition_by_clause_opt ::= */ + { 446, -3 }, /* (497) partition_by_clause_opt ::= PARTITION BY partition_list */ + { 454, -1 }, /* (498) partition_list ::= partition_item */ + { 454, -3 }, /* (499) partition_list ::= partition_list NK_COMMA partition_item */ + { 455, -1 }, /* (500) partition_item ::= expr_or_subquery */ + { 455, -2 }, /* (501) partition_item ::= expr_or_subquery column_alias */ + { 455, -3 }, /* (502) partition_item ::= expr_or_subquery AS column_alias */ + { 450, 0 }, /* (503) twindow_clause_opt ::= */ + { 450, -6 }, /* (504) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 450, -4 }, /* (505) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + { 450, -6 }, /* (506) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 450, -8 }, /* (507) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 450, -7 }, /* (508) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + { 390, 0 }, /* (509) sliding_opt ::= */ + { 390, -4 }, /* (510) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 449, 0 }, /* (511) fill_opt ::= */ + { 449, -4 }, /* (512) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 449, -6 }, /* (513) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 449, -6 }, /* (514) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ + { 456, -1 }, /* (515) fill_mode ::= NONE */ + { 456, -1 }, /* (516) fill_mode ::= PREV */ + { 456, -1 }, /* (517) fill_mode ::= NULL */ + { 456, -1 }, /* (518) fill_mode ::= NULL_F */ + { 456, -1 }, /* (519) fill_mode ::= LINEAR */ + { 456, -1 }, /* (520) fill_mode ::= NEXT */ + { 451, 0 }, /* (521) group_by_clause_opt ::= */ + { 451, -3 }, /* (522) group_by_clause_opt ::= GROUP BY group_by_list */ + { 457, -1 }, /* (523) group_by_list ::= expr_or_subquery */ + { 457, -3 }, /* (524) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + { 452, 0 }, /* (525) having_clause_opt ::= */ + { 452, -2 }, /* (526) having_clause_opt ::= HAVING search_condition */ + { 447, 0 }, /* (527) range_opt ::= */ + { 447, -6 }, /* (528) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + { 448, 0 }, /* (529) every_opt ::= */ + { 448, -4 }, /* (530) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 458, -4 }, /* (531) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 459, -1 }, /* (532) query_simple ::= query_specification */ + { 459, -1 }, /* (533) query_simple ::= union_query_expression */ + { 463, -4 }, /* (534) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + { 463, -3 }, /* (535) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + { 464, -1 }, /* (536) query_simple_or_subquery ::= query_simple */ + { 464, -1 }, /* (537) query_simple_or_subquery ::= subquery */ + { 394, -1 }, /* (538) query_or_subquery ::= query_expression */ + { 394, -1 }, /* (539) query_or_subquery ::= subquery */ + { 460, 0 }, /* (540) order_by_clause_opt ::= */ + { 460, -3 }, /* (541) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 461, 0 }, /* (542) slimit_clause_opt ::= */ + { 461, -2 }, /* (543) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 461, -4 }, /* (544) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 461, -4 }, /* (545) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 462, 0 }, /* (546) limit_clause_opt ::= */ + { 462, -2 }, /* (547) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 462, -4 }, /* (548) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 462, -4 }, /* (549) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 439, -3 }, /* (550) subquery ::= NK_LP query_expression NK_RP */ + { 439, -3 }, /* (551) subquery ::= NK_LP subquery NK_RP */ + { 442, -1 }, /* (552) search_condition ::= common_expression */ + { 465, -1 }, /* (553) sort_specification_list ::= sort_specification */ + { 465, -3 }, /* (554) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 466, -3 }, /* (555) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + { 467, 0 }, /* (556) ordering_specification_opt ::= */ + { 467, -1 }, /* (557) ordering_specification_opt ::= ASC */ + { 467, -1 }, /* (558) ordering_specification_opt ::= DESC */ + { 468, 0 }, /* (559) null_ordering_opt ::= */ + { 468, -2 }, /* (560) null_ordering_opt ::= NULLS FIRST */ + { 468, -2 }, /* (561) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3756,11 +3702,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,327,&yymsp[0].minor); + yy_destructor(yypParser,329,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,328,&yymsp[0].minor); + yy_destructor(yypParser,330,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -3774,20 +3720,20 @@ static YYACTIONTYPE yy_reduce( case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9); case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10); case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11); -{ yy_destructor(yypParser,327,&yymsp[-2].minor); +{ yy_destructor(yypParser,329,&yymsp[-2].minor); { } - yy_destructor(yypParser,329,&yymsp[0].minor); + yy_destructor(yypParser,331,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,330,&yymsp[0].minor); +{ yy_destructor(yypParser,332,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,328,&yymsp[-1].minor); +{ yy_destructor(yypParser,330,&yymsp[-1].minor); { } - yy_destructor(yypParser,330,&yymsp[0].minor); + yy_destructor(yypParser,332,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -3801,81 +3747,81 @@ static YYACTIONTYPE yy_reduce( case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); { } - yy_destructor(yypParser,329,&yymsp[0].minor); + yy_destructor(yypParser,331,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy455, &yymsp[-1].minor.yy0, yymsp[0].minor.yy169); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy225, &yymsp[-1].minor.yy0, yymsp[0].minor.yy705); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy455, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy225, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy455, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy225, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy455, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy225, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy455); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy225); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy169 = 1; } +{ yymsp[1].minor.yy705 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy169 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy705 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 31: /* cmd ::= GRANT privileges ON priv_level TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy91, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy455); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy641, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225); } break; case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy91, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy455); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy641, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy91 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy641 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 36: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==36); -{ yylhsminor.yy91 = yymsp[0].minor.yy91; } - yymsp[0].minor.yy91 = yylhsminor.yy91; +{ yylhsminor.yy641 = yymsp[0].minor.yy641; } + yymsp[0].minor.yy641 = yylhsminor.yy641; break; case 35: /* privileges ::= SUBSCRIBE */ -{ yymsp[0].minor.yy91 = PRIVILEGE_TYPE_SUBSCRIBE; } +{ yymsp[0].minor.yy641 = PRIVILEGE_TYPE_SUBSCRIBE; } break; case 37: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy91 = yymsp[-2].minor.yy91 | yymsp[0].minor.yy91; } - yymsp[-2].minor.yy91 = yylhsminor.yy91; +{ yylhsminor.yy641 = yymsp[-2].minor.yy641 | yymsp[0].minor.yy641; } + yymsp[-2].minor.yy641 = yylhsminor.yy641; break; case 38: /* priv_type ::= READ */ -{ yymsp[0].minor.yy91 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy641 = PRIVILEGE_TYPE_READ; } break; case 39: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy91 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy641 = PRIVILEGE_TYPE_WRITE; } break; case 40: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy455 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy455 = yylhsminor.yy455; +{ yylhsminor.yy225 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy225 = yylhsminor.yy225; break; case 41: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy455 = yymsp[-2].minor.yy455; } - yymsp[-2].minor.yy455 = yylhsminor.yy455; +{ yylhsminor.yy225 = yymsp[-2].minor.yy225; } + yymsp[-2].minor.yy225 = yylhsminor.yy225; break; case 42: /* priv_level ::= topic_name */ - case 272: /* sma_func_name ::= function_name */ yytestcase(yyruleno==272); - case 474: /* alias_opt ::= table_alias */ yytestcase(yyruleno==474); -{ yylhsminor.yy455 = yymsp[0].minor.yy455; } - yymsp[0].minor.yy455 = yylhsminor.yy455; + case 273: /* sma_func_name ::= function_name */ yytestcase(yyruleno==273); + case 476: /* alias_opt ::= table_alias */ yytestcase(yyruleno==476); +{ yylhsminor.yy225 = yymsp[0].minor.yy225; } + yymsp[0].minor.yy225 = yylhsminor.yy225; break; case 43: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy455, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy225, NULL); } break; case 44: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy0); } break; case 45: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy163); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy103); } break; case 46: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy455, yymsp[0].minor.yy163); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy225, yymsp[0].minor.yy103); } break; case 47: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3892,50 +3838,50 @@ static YYACTIONTYPE yy_reduce( case 51: /* dnode_endpoint ::= NK_STRING */ case 52: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==52); case 53: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==53); - case 273: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==273); - case 274: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==274); - case 275: /* sma_func_name ::= LAST */ yytestcase(yyruleno==275); - case 276: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==276); - case 359: /* db_name ::= NK_ID */ yytestcase(yyruleno==359); - case 360: /* table_name ::= NK_ID */ yytestcase(yyruleno==360); - case 361: /* column_name ::= NK_ID */ yytestcase(yyruleno==361); - case 362: /* function_name ::= NK_ID */ yytestcase(yyruleno==362); - case 363: /* table_alias ::= NK_ID */ yytestcase(yyruleno==363); - case 364: /* column_alias ::= NK_ID */ yytestcase(yyruleno==364); - case 365: /* user_name ::= NK_ID */ yytestcase(yyruleno==365); - case 366: /* topic_name ::= NK_ID */ yytestcase(yyruleno==366); - case 367: /* stream_name ::= NK_ID */ yytestcase(yyruleno==367); - case 368: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==368); - case 369: /* index_name ::= NK_ID */ yytestcase(yyruleno==369); - case 409: /* noarg_func ::= NOW */ yytestcase(yyruleno==409); - case 410: /* noarg_func ::= TODAY */ yytestcase(yyruleno==410); - case 411: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==411); - case 412: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==412); - case 413: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==413); - case 414: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==414); - case 415: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==415); - case 416: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==416); - case 417: /* noarg_func ::= USER */ yytestcase(yyruleno==417); - case 418: /* star_func ::= COUNT */ yytestcase(yyruleno==418); - case 419: /* star_func ::= FIRST */ yytestcase(yyruleno==419); - case 420: /* star_func ::= LAST */ yytestcase(yyruleno==420); - case 421: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==421); -{ yylhsminor.yy455 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy455 = yylhsminor.yy455; + case 274: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==274); + case 275: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==275); + case 276: /* sma_func_name ::= LAST */ yytestcase(yyruleno==276); + case 277: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==277); + case 361: /* db_name ::= NK_ID */ yytestcase(yyruleno==361); + case 362: /* table_name ::= NK_ID */ yytestcase(yyruleno==362); + case 363: /* column_name ::= NK_ID */ yytestcase(yyruleno==363); + case 364: /* function_name ::= NK_ID */ yytestcase(yyruleno==364); + case 365: /* table_alias ::= NK_ID */ yytestcase(yyruleno==365); + case 366: /* column_alias ::= NK_ID */ yytestcase(yyruleno==366); + case 367: /* user_name ::= NK_ID */ yytestcase(yyruleno==367); + case 368: /* topic_name ::= NK_ID */ yytestcase(yyruleno==368); + case 369: /* stream_name ::= NK_ID */ yytestcase(yyruleno==369); + case 370: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==370); + case 371: /* index_name ::= NK_ID */ yytestcase(yyruleno==371); + case 411: /* noarg_func ::= NOW */ yytestcase(yyruleno==411); + case 412: /* noarg_func ::= TODAY */ yytestcase(yyruleno==412); + case 413: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==413); + case 414: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==414); + case 415: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==415); + case 416: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==416); + case 417: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==417); + case 418: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==418); + case 419: /* noarg_func ::= USER */ yytestcase(yyruleno==419); + case 420: /* star_func ::= COUNT */ yytestcase(yyruleno==420); + case 421: /* star_func ::= FIRST */ yytestcase(yyruleno==421); + case 422: /* star_func ::= LAST */ yytestcase(yyruleno==422); + case 423: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==423); +{ yylhsminor.yy225 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy225 = yylhsminor.yy225; break; case 54: /* force_opt ::= */ - case 73: /* not_exists_opt ::= */ yytestcase(yyruleno==73); - case 75: /* exists_opt ::= */ yytestcase(yyruleno==75); - case 293: /* analyze_opt ::= */ yytestcase(yyruleno==293); - case 300: /* agg_func_opt ::= */ yytestcase(yyruleno==300); - case 482: /* set_quantifier_opt ::= */ yytestcase(yyruleno==482); -{ yymsp[1].minor.yy163 = false; } + case 74: /* not_exists_opt ::= */ yytestcase(yyruleno==74); + case 76: /* exists_opt ::= */ yytestcase(yyruleno==76); + case 294: /* analyze_opt ::= */ yytestcase(yyruleno==294); + case 301: /* agg_func_opt ::= */ yytestcase(yyruleno==301); + case 484: /* set_quantifier_opt ::= */ yytestcase(yyruleno==484); +{ yymsp[1].minor.yy103 = false; } break; case 55: /* force_opt ::= FORCE */ - case 294: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==294); - case 301: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==301); - case 483: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==483); -{ yymsp[0].minor.yy163 = true; } + case 295: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==295); + case 302: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==302); + case 485: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==485); +{ yymsp[0].minor.yy103 = true; } break; case 56: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3968,1363 +3914,1376 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 66: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy163, &yymsp[-1].minor.yy455, yymsp[0].minor.yy44); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy103, &yymsp[-1].minor.yy225, yymsp[0].minor.yy42); } break; case 67: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy163, &yymsp[0].minor.yy455); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy103, &yymsp[0].minor.yy225); } break; case 68: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy455); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy225); } break; case 69: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy455, yymsp[0].minor.yy44); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy225, yymsp[0].minor.yy42); } break; case 70: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy455); } +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy225); } break; case 71: /* cmd ::= TRIM DATABASE db_name speed_opt */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy455, yymsp[0].minor.yy832); } +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy225, yymsp[0].minor.yy508); } break; - case 72: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy163 = true; } + case 72: /* cmd ::= COMPACT DATABASE db_name */ +{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[0].minor.yy225); } break; - case 74: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy163 = true; } + case 73: /* not_exists_opt ::= IF NOT EXISTS */ +{ yymsp[-2].minor.yy103 = true; } break; - case 76: /* db_options ::= */ -{ yymsp[1].minor.yy44 = createDefaultDatabaseOptions(pCxt); } + case 75: /* exists_opt ::= IF EXISTS */ +{ yymsp[-1].minor.yy103 = true; } break; - case 77: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 77: /* db_options ::= */ +{ yymsp[1].minor.yy42 = createDefaultDatabaseOptions(pCxt); } break; - case 78: /* db_options ::= db_options CACHEMODEL NK_STRING */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 78: /* db_options ::= db_options BUFFER NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 79: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 79: /* db_options ::= db_options CACHEMODEL NK_STRING */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 80: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 80: /* db_options ::= db_options CACHESIZE NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 81: /* db_options ::= db_options DURATION NK_INTEGER */ - case 82: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==82); -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 81: /* db_options ::= db_options COMP NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 83: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 82: /* db_options ::= db_options DURATION NK_INTEGER */ + case 83: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==83); +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 84: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 84: /* db_options ::= db_options MAXROWS NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 85: /* db_options ::= db_options KEEP integer_list */ - case 86: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==86); -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_KEEP, yymsp[0].minor.yy684); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 85: /* db_options ::= db_options MINROWS NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 87: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 86: /* db_options ::= db_options KEEP integer_list */ + case 87: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==87); +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_KEEP, yymsp[0].minor.yy110); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 88: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 88: /* db_options ::= db_options PAGES NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 89: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 89: /* db_options ::= db_options PAGESIZE NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 90: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 90: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 91: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 91: /* db_options ::= db_options PRECISION NK_STRING */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 92: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 92: /* db_options ::= db_options REPLICA NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 93: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 93: /* db_options ::= db_options VGROUPS NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 94: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_RETENTIONS, yymsp[0].minor.yy684); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 94: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 95: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 95: /* db_options ::= db_options RETENTIONS retention_list */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_RETENTIONS, yymsp[0].minor.yy110); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 96: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 96: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 97: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 97: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 98: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 98: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 99: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + case 99: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; + break; + case 100: /* 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.yy44 = setDatabaseOption(pCxt, yymsp[-3].minor.yy44, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-3].minor.yy42, DB_OPTION_WAL_RETENTION_PERIOD, &t); } - yymsp[-3].minor.yy44 = yylhsminor.yy44; + yymsp[-3].minor.yy42 = yylhsminor.yy42; break; - case 100: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 101: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 101: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + case 102: /* 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.yy44 = setDatabaseOption(pCxt, yymsp[-3].minor.yy44, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-3].minor.yy42, DB_OPTION_WAL_RETENTION_SIZE, &t); } - yymsp[-3].minor.yy44 = yylhsminor.yy44; - break; - case 102: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; - break; - case 103: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; - break; - case 104: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; - break; - case 105: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; - break; - case 106: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ -{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; - break; - case 107: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy44 = createAlterDatabaseOptions(pCxt); yylhsminor.yy44 = setAlterDatabaseOption(pCxt, yylhsminor.yy44, &yymsp[0].minor.yy153); } - yymsp[0].minor.yy44 = yylhsminor.yy44; - break; - case 108: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy44 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy44, &yymsp[0].minor.yy153); } - yymsp[-1].minor.yy44 = yylhsminor.yy44; - break; - case 109: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy153.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; } - break; - case 110: /* alter_db_option ::= CACHEMODEL NK_STRING */ -{ yymsp[-1].minor.yy153.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; } - break; - case 111: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -{ yymsp[-1].minor.yy153.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; } - break; - case 112: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy153.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; } - break; - case 113: /* alter_db_option ::= KEEP integer_list */ - case 114: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==114); -{ yymsp[-1].minor.yy153.type = DB_OPTION_KEEP; yymsp[-1].minor.yy153.pList = yymsp[0].minor.yy684; } - break; - case 115: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy153.type = DB_OPTION_PAGES; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; } - break; - case 116: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy153.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; } - break; - case 117: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -{ yymsp[-1].minor.yy153.type = DB_OPTION_WAL; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; } - break; - case 118: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -{ yymsp[-1].minor.yy153.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; } - break; - case 119: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy684 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy684 = yylhsminor.yy684; - break; - case 120: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 328: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==328); -{ yylhsminor.yy684 = addNodeToList(pCxt, yymsp[-2].minor.yy684, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy684 = yylhsminor.yy684; - break; - case 121: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy684 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy684 = yylhsminor.yy684; - break; - case 122: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy684 = addNodeToList(pCxt, yymsp[-2].minor.yy684, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy684 = yylhsminor.yy684; - break; - case 123: /* retention_list ::= retention */ - case 145: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==145); - case 148: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==148); - case 155: /* column_def_list ::= column_def */ yytestcase(yyruleno==155); - case 199: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==199); - case 204: /* col_name_list ::= col_name */ yytestcase(yyruleno==204); - case 255: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==255); - case 269: /* func_list ::= func */ yytestcase(yyruleno==269); - case 357: /* literal_list ::= signed_literal */ yytestcase(yyruleno==357); - case 424: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==424); - case 430: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==430); - case 485: /* select_list ::= select_item */ yytestcase(yyruleno==485); - case 496: /* partition_list ::= partition_item */ yytestcase(yyruleno==496); - case 549: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==549); -{ yylhsminor.yy684 = createNodeList(pCxt, yymsp[0].minor.yy44); } - yymsp[0].minor.yy684 = yylhsminor.yy684; - break; - case 124: /* retention_list ::= retention_list NK_COMMA retention */ - case 156: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==156); - case 200: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==200); - case 205: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==205); - case 256: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==256); - case 270: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==270); - case 358: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==358); - case 425: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==425); - case 486: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==486); - case 497: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==497); - case 550: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==550); -{ yylhsminor.yy684 = addNodeToList(pCxt, yymsp[-2].minor.yy684, yymsp[0].minor.yy44); } - yymsp[-2].minor.yy684 = yylhsminor.yy684; - break; - case 125: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy44 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; - break; - case 126: /* speed_opt ::= */ - case 302: /* bufsize_opt ::= */ yytestcase(yyruleno==302); -{ yymsp[1].minor.yy832 = 0; } - break; - case 127: /* speed_opt ::= MAX_SPEED NK_INTEGER */ - case 303: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==303); -{ yymsp[-1].minor.yy832 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } - break; - case 128: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 130: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==130); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy163, yymsp[-5].minor.yy44, yymsp[-3].minor.yy684, yymsp[-1].minor.yy684, yymsp[0].minor.yy44); } - break; - case 129: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy684); } - break; - case 131: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy684); } - break; - case 132: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy163, yymsp[0].minor.yy44); } - break; - case 133: /* cmd ::= ALTER TABLE alter_table_clause */ - case 330: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==330); - case 331: /* cmd ::= insert_query */ yytestcase(yyruleno==331); -{ pCxt->pRootNode = yymsp[0].minor.yy44; } - break; - case 134: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy44); } - break; - case 135: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy44 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy44, yymsp[0].minor.yy44); } - yymsp[-1].minor.yy44 = yylhsminor.yy44; - break; - case 136: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy44 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy44, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy455, yymsp[0].minor.yy260); } - yymsp[-4].minor.yy44 = yylhsminor.yy44; - break; - case 137: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy44 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy44, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy455); } - yymsp[-3].minor.yy44 = yylhsminor.yy44; - break; - case 138: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy44 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy44, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy455, yymsp[0].minor.yy260); } - yymsp[-4].minor.yy44 = yylhsminor.yy44; - break; - case 139: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy44 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy44, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy455, &yymsp[0].minor.yy455); } - yymsp[-4].minor.yy44 = yylhsminor.yy44; - break; - case 140: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy44 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy44, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy455, yymsp[0].minor.yy260); } - yymsp[-4].minor.yy44 = yylhsminor.yy44; - break; - case 141: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy44 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy44, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy455); } - yymsp[-3].minor.yy44 = yylhsminor.yy44; - break; - case 142: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy44 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy44, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy455, yymsp[0].minor.yy260); } - yymsp[-4].minor.yy44 = yylhsminor.yy44; - break; - case 143: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy44 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy44, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy455, &yymsp[0].minor.yy455); } - yymsp[-4].minor.yy44 = yylhsminor.yy44; - break; - case 144: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy44 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy44, &yymsp[-2].minor.yy455, yymsp[0].minor.yy44); } - yymsp[-5].minor.yy44 = yylhsminor.yy44; - break; - case 146: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 149: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==149); - case 431: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==431); -{ yylhsminor.yy684 = addNodeToList(pCxt, yymsp[-1].minor.yy684, yymsp[0].minor.yy44); } - yymsp[-1].minor.yy684 = yylhsminor.yy684; + yymsp[-3].minor.yy42 = yylhsminor.yy42; + break; + case 103: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; + break; + case 104: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; + break; + case 105: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; + break; + case 106: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; + break; + case 107: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ +{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; + break; + case 108: /* alter_db_options ::= alter_db_option */ +{ yylhsminor.yy42 = createAlterDatabaseOptions(pCxt); yylhsminor.yy42 = setAlterDatabaseOption(pCxt, yylhsminor.yy42, &yymsp[0].minor.yy459); } + yymsp[0].minor.yy42 = yylhsminor.yy42; + break; + case 109: /* alter_db_options ::= alter_db_options alter_db_option */ +{ yylhsminor.yy42 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy42, &yymsp[0].minor.yy459); } + yymsp[-1].minor.yy42 = yylhsminor.yy42; + break; + case 110: /* alter_db_option ::= BUFFER NK_INTEGER */ +{ yymsp[-1].minor.yy459.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } + break; + case 111: /* alter_db_option ::= CACHEMODEL NK_STRING */ +{ yymsp[-1].minor.yy459.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } + break; + case 112: /* alter_db_option ::= CACHESIZE NK_INTEGER */ +{ yymsp[-1].minor.yy459.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } + break; + case 113: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ +{ yymsp[-1].minor.yy459.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } + break; + case 114: /* alter_db_option ::= KEEP integer_list */ + case 115: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==115); +{ yymsp[-1].minor.yy459.type = DB_OPTION_KEEP; yymsp[-1].minor.yy459.pList = yymsp[0].minor.yy110; } + break; + case 116: /* alter_db_option ::= PAGES NK_INTEGER */ +{ yymsp[-1].minor.yy459.type = DB_OPTION_PAGES; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } + break; + case 117: /* alter_db_option ::= REPLICA NK_INTEGER */ +{ yymsp[-1].minor.yy459.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } + break; + case 118: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ +{ yymsp[-1].minor.yy459.type = DB_OPTION_WAL; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } + break; + case 119: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ +{ yymsp[-1].minor.yy459.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } + break; + case 120: /* integer_list ::= NK_INTEGER */ +{ yylhsminor.yy110 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy110 = yylhsminor.yy110; + break; + case 121: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ + case 330: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==330); +{ yylhsminor.yy110 = addNodeToList(pCxt, yymsp[-2].minor.yy110, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy110 = yylhsminor.yy110; + break; + case 122: /* variable_list ::= NK_VARIABLE */ +{ yylhsminor.yy110 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy110 = yylhsminor.yy110; + break; + case 123: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ +{ yylhsminor.yy110 = addNodeToList(pCxt, yymsp[-2].minor.yy110, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy110 = yylhsminor.yy110; + break; + case 124: /* retention_list ::= retention */ + case 146: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==146); + case 149: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==149); + case 156: /* column_def_list ::= column_def */ yytestcase(yyruleno==156); + case 200: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==200); + case 205: /* col_name_list ::= col_name */ yytestcase(yyruleno==205); + case 256: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==256); + case 270: /* func_list ::= func */ yytestcase(yyruleno==270); + case 359: /* literal_list ::= signed_literal */ yytestcase(yyruleno==359); + case 426: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==426); + case 432: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==432); + case 487: /* select_list ::= select_item */ yytestcase(yyruleno==487); + case 498: /* partition_list ::= partition_item */ yytestcase(yyruleno==498); + case 553: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==553); +{ yylhsminor.yy110 = createNodeList(pCxt, yymsp[0].minor.yy42); } + yymsp[0].minor.yy110 = yylhsminor.yy110; + break; + case 125: /* retention_list ::= retention_list NK_COMMA retention */ + case 157: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==157); + case 201: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==201); + case 206: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==206); + case 257: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==257); + case 271: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==271); + case 360: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==360); + case 427: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==427); + case 488: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==488); + case 499: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==499); + case 554: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==554); +{ yylhsminor.yy110 = addNodeToList(pCxt, yymsp[-2].minor.yy110, yymsp[0].minor.yy42); } + yymsp[-2].minor.yy110 = yylhsminor.yy110; + break; + case 126: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ +{ yylhsminor.yy42 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; + break; + case 127: /* speed_opt ::= */ + case 303: /* bufsize_opt ::= */ yytestcase(yyruleno==303); +{ yymsp[1].minor.yy508 = 0; } + break; + case 128: /* speed_opt ::= MAX_SPEED NK_INTEGER */ + case 304: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==304); +{ yymsp[-1].minor.yy508 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + break; + case 129: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 131: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==131); +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy103, yymsp[-5].minor.yy42, yymsp[-3].minor.yy110, yymsp[-1].minor.yy110, yymsp[0].minor.yy42); } + break; + case 130: /* cmd ::= CREATE TABLE multi_create_clause */ +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy110); } + break; + case 132: /* cmd ::= DROP TABLE multi_drop_clause */ +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy110); } + break; + case 133: /* cmd ::= DROP STABLE exists_opt full_table_name */ +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy103, yymsp[0].minor.yy42); } + break; + case 134: /* cmd ::= ALTER TABLE alter_table_clause */ + case 332: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==332); + case 333: /* cmd ::= insert_query */ yytestcase(yyruleno==333); +{ pCxt->pRootNode = yymsp[0].minor.yy42; } + break; + case 135: /* cmd ::= ALTER STABLE alter_table_clause */ +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy42); } + break; + case 136: /* alter_table_clause ::= full_table_name alter_table_options */ +{ yylhsminor.yy42 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy42, yymsp[0].minor.yy42); } + yymsp[-1].minor.yy42 = yylhsminor.yy42; + break; + case 137: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ +{ yylhsminor.yy42 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy42, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy225, yymsp[0].minor.yy448); } + yymsp[-4].minor.yy42 = yylhsminor.yy42; + break; + case 138: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ +{ yylhsminor.yy42 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy42, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy225); } + yymsp[-3].minor.yy42 = yylhsminor.yy42; + break; + case 139: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ +{ yylhsminor.yy42 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy42, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy225, yymsp[0].minor.yy448); } + yymsp[-4].minor.yy42 = yylhsminor.yy42; + break; + case 140: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ +{ yylhsminor.yy42 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy42, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy225, &yymsp[0].minor.yy225); } + yymsp[-4].minor.yy42 = yylhsminor.yy42; + break; + case 141: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ +{ yylhsminor.yy42 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy42, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy225, yymsp[0].minor.yy448); } + yymsp[-4].minor.yy42 = yylhsminor.yy42; + break; + case 142: /* alter_table_clause ::= full_table_name DROP TAG column_name */ +{ yylhsminor.yy42 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy42, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy225); } + yymsp[-3].minor.yy42 = yylhsminor.yy42; + break; + case 143: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ +{ yylhsminor.yy42 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy42, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy225, yymsp[0].minor.yy448); } + yymsp[-4].minor.yy42 = yylhsminor.yy42; + break; + case 144: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ +{ yylhsminor.yy42 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy42, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy225, &yymsp[0].minor.yy225); } + yymsp[-4].minor.yy42 = yylhsminor.yy42; + break; + case 145: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ +{ yylhsminor.yy42 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy42, &yymsp[-2].minor.yy225, yymsp[0].minor.yy42); } + yymsp[-5].minor.yy42 = yylhsminor.yy42; + break; + case 147: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 150: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==150); + case 433: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==433); +{ yylhsminor.yy110 = addNodeToList(pCxt, yymsp[-1].minor.yy110, yymsp[0].minor.yy42); } + yymsp[-1].minor.yy110 = yylhsminor.yy110; break; - case 147: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ -{ yylhsminor.yy44 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy163, yymsp[-8].minor.yy44, yymsp[-6].minor.yy44, yymsp[-5].minor.yy684, yymsp[-2].minor.yy684, yymsp[0].minor.yy44); } - yymsp[-9].minor.yy44 = yylhsminor.yy44; + case 148: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ +{ yylhsminor.yy42 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy103, yymsp[-8].minor.yy42, yymsp[-6].minor.yy42, yymsp[-5].minor.yy110, yymsp[-2].minor.yy110, yymsp[0].minor.yy42); } + yymsp[-9].minor.yy42 = yylhsminor.yy42; break; - case 150: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy44 = createDropTableClause(pCxt, yymsp[-1].minor.yy163, yymsp[0].minor.yy44); } - yymsp[-1].minor.yy44 = yylhsminor.yy44; + case 151: /* drop_table_clause ::= exists_opt full_table_name */ +{ yylhsminor.yy42 = createDropTableClause(pCxt, yymsp[-1].minor.yy103, yymsp[0].minor.yy42); } + yymsp[-1].minor.yy42 = yylhsminor.yy42; break; - case 151: /* specific_cols_opt ::= */ - case 182: /* tags_def_opt ::= */ yytestcase(yyruleno==182); - case 254: /* tag_list_opt ::= */ yytestcase(yyruleno==254); - case 306: /* col_list_opt ::= */ yytestcase(yyruleno==306); - case 308: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==308); - case 494: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==494); - case 517: /* group_by_clause_opt ::= */ yytestcase(yyruleno==517); - case 536: /* order_by_clause_opt ::= */ yytestcase(yyruleno==536); -{ yymsp[1].minor.yy684 = NULL; } + case 152: /* specific_cols_opt ::= */ + case 183: /* tags_def_opt ::= */ yytestcase(yyruleno==183); + case 255: /* tag_list_opt ::= */ yytestcase(yyruleno==255); + case 307: /* col_list_opt ::= */ yytestcase(yyruleno==307); + case 309: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==309); + case 496: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==496); + case 521: /* group_by_clause_opt ::= */ yytestcase(yyruleno==521); + case 540: /* order_by_clause_opt ::= */ yytestcase(yyruleno==540); +{ yymsp[1].minor.yy110 = NULL; } break; - case 152: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 307: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==307); -{ yymsp[-2].minor.yy684 = yymsp[-1].minor.yy684; } + case 153: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ + case 308: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==308); +{ yymsp[-2].minor.yy110 = yymsp[-1].minor.yy110; } break; - case 153: /* full_table_name ::= table_name */ -{ yylhsminor.yy44 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy455, NULL); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 154: /* full_table_name ::= table_name */ +{ yylhsminor.yy42 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy225, NULL); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 154: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy44 = createRealTableNode(pCxt, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy455, NULL); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 155: /* full_table_name ::= db_name NK_DOT table_name */ +{ yylhsminor.yy42 = createRealTableNode(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225, NULL); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 157: /* column_def ::= column_name type_name */ -{ yylhsminor.yy44 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy455, yymsp[0].minor.yy260, NULL); } - yymsp[-1].minor.yy44 = yylhsminor.yy44; + case 158: /* column_def ::= column_name type_name */ +{ yylhsminor.yy42 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy225, yymsp[0].minor.yy448, NULL); } + yymsp[-1].minor.yy42 = yylhsminor.yy42; break; - case 158: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy44 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy455, yymsp[-2].minor.yy260, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy44 = yylhsminor.yy44; + case 159: /* column_def ::= column_name type_name COMMENT NK_STRING */ +{ yylhsminor.yy42 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy225, yymsp[-2].minor.yy448, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy42 = yylhsminor.yy42; break; - case 159: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_BOOL); } + case 160: /* type_name ::= BOOL */ +{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 160: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_TINYINT); } + case 161: /* type_name ::= TINYINT */ +{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 161: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + case 162: /* type_name ::= SMALLINT */ +{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 162: /* type_name ::= INT */ - case 163: /* type_name ::= INTEGER */ yytestcase(yyruleno==163); -{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_INT); } + case 163: /* type_name ::= INT */ + case 164: /* type_name ::= INTEGER */ yytestcase(yyruleno==164); +{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 164: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_BIGINT); } + case 165: /* type_name ::= BIGINT */ +{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 165: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_FLOAT); } + case 166: /* type_name ::= FLOAT */ +{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 166: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + case 167: /* type_name ::= DOUBLE */ +{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 167: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy260 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + case 168: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy448 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 168: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + case 169: /* type_name ::= TIMESTAMP */ +{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 169: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy260 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + case 170: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy448 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 170: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy260 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + case 171: /* type_name ::= TINYINT UNSIGNED */ +{ yymsp[-1].minor.yy448 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 171: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy260 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + case 172: /* type_name ::= SMALLINT UNSIGNED */ +{ yymsp[-1].minor.yy448 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 172: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy260 = createDataType(TSDB_DATA_TYPE_UINT); } + case 173: /* type_name ::= INT UNSIGNED */ +{ yymsp[-1].minor.yy448 = createDataType(TSDB_DATA_TYPE_UINT); } break; - case 173: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy260 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + case 174: /* type_name ::= BIGINT UNSIGNED */ +{ yymsp[-1].minor.yy448 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 174: /* type_name ::= JSON */ -{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_JSON); } + case 175: /* type_name ::= JSON */ +{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 175: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy260 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + case 176: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy448 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; - case 176: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + case 177: /* type_name ::= MEDIUMBLOB */ +{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 177: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_BLOB); } + case 178: /* type_name ::= BLOB */ +{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 178: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy260 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + case 179: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy448 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; - case 179: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 180: /* type_name ::= DECIMAL */ +{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 180: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy260 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 181: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy448 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 181: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy260 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 182: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy448 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 183: /* tags_def_opt ::= tags_def */ - case 309: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==309); - case 423: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==423); -{ yylhsminor.yy684 = yymsp[0].minor.yy684; } - yymsp[0].minor.yy684 = yylhsminor.yy684; + case 184: /* tags_def_opt ::= tags_def */ + case 310: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==310); + case 425: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==425); +{ yylhsminor.yy110 = yymsp[0].minor.yy110; } + yymsp[0].minor.yy110 = yylhsminor.yy110; break; - case 184: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ - case 310: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==310); -{ yymsp[-3].minor.yy684 = yymsp[-1].minor.yy684; } + case 185: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ + case 311: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==311); +{ yymsp[-3].minor.yy110 = yymsp[-1].minor.yy110; } break; - case 185: /* table_options ::= */ -{ yymsp[1].minor.yy44 = createDefaultTableOptions(pCxt); } + case 186: /* table_options ::= */ +{ yymsp[1].minor.yy42 = createDefaultTableOptions(pCxt); } break; - case 186: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy44 = setTableOption(pCxt, yymsp[-2].minor.yy44, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 187: /* table_options ::= table_options COMMENT NK_STRING */ +{ yylhsminor.yy42 = setTableOption(pCxt, yymsp[-2].minor.yy42, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 187: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy44 = setTableOption(pCxt, yymsp[-2].minor.yy44, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy684); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 188: /* table_options ::= table_options MAX_DELAY duration_list */ +{ yylhsminor.yy42 = setTableOption(pCxt, yymsp[-2].minor.yy42, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy110); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 188: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy44 = setTableOption(pCxt, yymsp[-2].minor.yy44, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy684); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 189: /* table_options ::= table_options WATERMARK duration_list */ +{ yylhsminor.yy42 = setTableOption(pCxt, yymsp[-2].minor.yy42, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy110); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 189: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy44 = setTableOption(pCxt, yymsp[-4].minor.yy44, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy684); } - yymsp[-4].minor.yy44 = yylhsminor.yy44; + case 190: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ +{ yylhsminor.yy42 = setTableOption(pCxt, yymsp[-4].minor.yy42, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy110); } + yymsp[-4].minor.yy42 = yylhsminor.yy42; break; - case 190: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy44 = setTableOption(pCxt, yymsp[-2].minor.yy44, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 191: /* table_options ::= table_options TTL NK_INTEGER */ +{ yylhsminor.yy42 = setTableOption(pCxt, yymsp[-2].minor.yy42, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 191: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy44 = setTableOption(pCxt, yymsp[-4].minor.yy44, TABLE_OPTION_SMA, yymsp[-1].minor.yy684); } - yymsp[-4].minor.yy44 = yylhsminor.yy44; + case 192: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ yylhsminor.yy42 = setTableOption(pCxt, yymsp[-4].minor.yy42, TABLE_OPTION_SMA, yymsp[-1].minor.yy110); } + yymsp[-4].minor.yy42 = yylhsminor.yy42; break; - case 192: /* table_options ::= table_options DELETE_MARK duration_list */ -{ yylhsminor.yy44 = setTableOption(pCxt, yymsp[-2].minor.yy44, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy684); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 193: /* table_options ::= table_options DELETE_MARK duration_list */ +{ yylhsminor.yy42 = setTableOption(pCxt, yymsp[-2].minor.yy42, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy110); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 193: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy44 = createAlterTableOptions(pCxt); yylhsminor.yy44 = setTableOption(pCxt, yylhsminor.yy44, yymsp[0].minor.yy153.type, &yymsp[0].minor.yy153.val); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 194: /* alter_table_options ::= alter_table_option */ +{ yylhsminor.yy42 = createAlterTableOptions(pCxt); yylhsminor.yy42 = setTableOption(pCxt, yylhsminor.yy42, yymsp[0].minor.yy459.type, &yymsp[0].minor.yy459.val); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 194: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy44 = setTableOption(pCxt, yymsp[-1].minor.yy44, yymsp[0].minor.yy153.type, &yymsp[0].minor.yy153.val); } - yymsp[-1].minor.yy44 = yylhsminor.yy44; + case 195: /* alter_table_options ::= alter_table_options alter_table_option */ +{ yylhsminor.yy42 = setTableOption(pCxt, yymsp[-1].minor.yy42, yymsp[0].minor.yy459.type, &yymsp[0].minor.yy459.val); } + yymsp[-1].minor.yy42 = yylhsminor.yy42; break; - case 195: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy153.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; } + case 196: /* alter_table_option ::= COMMENT NK_STRING */ +{ yymsp[-1].minor.yy459.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } break; - case 196: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy153.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; } + case 197: /* alter_table_option ::= TTL NK_INTEGER */ +{ yymsp[-1].minor.yy459.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } break; - case 197: /* duration_list ::= duration_literal */ - case 387: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==387); -{ yylhsminor.yy684 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy44)); } - yymsp[0].minor.yy684 = yylhsminor.yy684; + case 198: /* duration_list ::= duration_literal */ + case 389: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==389); +{ yylhsminor.yy110 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy42)); } + yymsp[0].minor.yy110 = yylhsminor.yy110; break; - case 198: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 388: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==388); -{ yylhsminor.yy684 = addNodeToList(pCxt, yymsp[-2].minor.yy684, releaseRawExprNode(pCxt, yymsp[0].minor.yy44)); } - yymsp[-2].minor.yy684 = yylhsminor.yy684; + case 199: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 390: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==390); +{ yylhsminor.yy110 = addNodeToList(pCxt, yymsp[-2].minor.yy110, releaseRawExprNode(pCxt, yymsp[0].minor.yy42)); } + yymsp[-2].minor.yy110 = yylhsminor.yy110; break; - case 201: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy44 = createFunctionNode(pCxt, &yymsp[0].minor.yy455, NULL); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 202: /* rollup_func_name ::= function_name */ +{ yylhsminor.yy42 = createFunctionNode(pCxt, &yymsp[0].minor.yy225, NULL); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 202: /* rollup_func_name ::= FIRST */ - case 203: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==203); - case 258: /* tag_item ::= QTAGS */ yytestcase(yyruleno==258); -{ yylhsminor.yy44 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 203: /* rollup_func_name ::= FIRST */ + case 204: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==204); + case 259: /* tag_item ::= QTAGS */ yytestcase(yyruleno==259); +{ yylhsminor.yy42 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 206: /* col_name ::= column_name */ - case 259: /* tag_item ::= column_name */ yytestcase(yyruleno==259); -{ yylhsminor.yy44 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy455); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 207: /* col_name ::= column_name */ + case 260: /* tag_item ::= column_name */ yytestcase(yyruleno==260); +{ yylhsminor.yy42 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy225); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 207: /* cmd ::= SHOW DNODES */ + case 208: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } break; - case 208: /* cmd ::= SHOW USERS */ + case 209: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } break; - case 209: /* cmd ::= SHOW USER PRIVILEGES */ + case 210: /* cmd ::= SHOW USER PRIVILEGES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } break; - case 210: /* cmd ::= SHOW DATABASES */ + case 211: /* cmd ::= SHOW DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; - case 211: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy44, yymsp[0].minor.yy44, OP_TYPE_LIKE); } + case 212: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy42, yymsp[0].minor.yy42, OP_TYPE_LIKE); } break; - case 212: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy44, yymsp[0].minor.yy44, OP_TYPE_LIKE); } + case 213: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy42, yymsp[0].minor.yy42, OP_TYPE_LIKE); } break; - case 213: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy44, NULL, OP_TYPE_LIKE); } + case 214: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy42, NULL, OP_TYPE_LIKE); } break; - case 214: /* cmd ::= SHOW MNODES */ + case 215: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } break; - case 215: /* cmd ::= SHOW QNODES */ + case 216: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } break; - case 216: /* cmd ::= SHOW FUNCTIONS */ + case 217: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; - case 217: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy44, yymsp[-1].minor.yy44, OP_TYPE_EQUAL); } + case 218: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy42, yymsp[-1].minor.yy42, OP_TYPE_EQUAL); } break; - case 218: /* cmd ::= SHOW STREAMS */ + case 219: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } break; - case 219: /* cmd ::= SHOW ACCOUNTS */ + case 220: /* cmd ::= SHOW ACCOUNTS */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 220: /* cmd ::= SHOW APPS */ + case 221: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } break; - case 221: /* cmd ::= SHOW CONNECTIONS */ + case 222: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } break; - case 222: /* cmd ::= SHOW LICENCES */ - case 223: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==223); + case 223: /* cmd ::= SHOW LICENCES */ + case 224: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==224); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } break; - case 224: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy455); } + case 225: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy225); } break; - case 225: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy44); } + case 226: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy42); } break; - case 226: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy44); } + case 227: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy42); } break; - case 227: /* cmd ::= SHOW QUERIES */ + case 228: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } break; - case 228: /* cmd ::= SHOW SCORES */ + case 229: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } break; - case 229: /* cmd ::= SHOW TOPICS */ + case 230: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } break; - case 230: /* cmd ::= SHOW VARIABLES */ - case 231: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==231); + case 231: /* cmd ::= SHOW VARIABLES */ + case 232: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==232); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } break; - case 232: /* cmd ::= SHOW LOCAL VARIABLES */ + case 233: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; - case 233: /* 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.yy44); } + case 234: /* 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.yy42); } break; - case 234: /* cmd ::= SHOW BNODES */ + case 235: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } break; - case 235: /* cmd ::= SHOW SNODES */ + case 236: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } break; - case 236: /* cmd ::= SHOW CLUSTER */ + case 237: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } break; - case 237: /* cmd ::= SHOW TRANSACTIONS */ + case 238: /* cmd ::= SHOW TRANSACTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; - case 238: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy44); } + case 239: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy42); } break; - case 239: /* cmd ::= SHOW CONSUMERS */ + case 240: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } break; - case 240: /* cmd ::= SHOW SUBSCRIPTIONS */ + case 241: /* cmd ::= SHOW SUBSCRIPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; - case 241: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy44, yymsp[-1].minor.yy44, OP_TYPE_EQUAL); } + case 242: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy42, yymsp[-1].minor.yy42, OP_TYPE_EQUAL); } break; - case 242: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy44, yymsp[0].minor.yy44, yymsp[-3].minor.yy684); } + case 243: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy42, yymsp[0].minor.yy42, yymsp[-3].minor.yy110); } break; - case 243: /* cmd ::= SHOW VNODES NK_INTEGER */ + case 244: /* cmd ::= SHOW VNODES NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } break; - case 244: /* cmd ::= SHOW VNODES NK_STRING */ + case 245: /* cmd ::= SHOW VNODES NK_STRING */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &yymsp[0].minor.yy0)); } break; - case 245: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy44, QUERY_NODE_SHOW_DB_ALIVE_STMT); } + case 246: /* cmd ::= SHOW db_name_cond_opt ALIVE */ +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy42, QUERY_NODE_SHOW_DB_ALIVE_STMT); } break; - case 246: /* cmd ::= SHOW CLUSTER ALIVE */ + case 247: /* cmd ::= SHOW CLUSTER ALIVE */ { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } break; - case 247: /* db_name_cond_opt ::= */ - case 252: /* from_db_opt ::= */ yytestcase(yyruleno==252); -{ yymsp[1].minor.yy44 = createDefaultDatabaseCondValue(pCxt); } + case 248: /* db_name_cond_opt ::= */ + case 253: /* from_db_opt ::= */ yytestcase(yyruleno==253); +{ yymsp[1].minor.yy42 = createDefaultDatabaseCondValue(pCxt); } break; - case 248: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy44 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy455); } - yymsp[-1].minor.yy44 = yylhsminor.yy44; + case 249: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy42 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy225); } + yymsp[-1].minor.yy42 = yylhsminor.yy42; break; - case 249: /* like_pattern_opt ::= */ - case 318: /* subtable_opt ::= */ yytestcase(yyruleno==318); - case 433: /* case_when_else_opt ::= */ yytestcase(yyruleno==433); - case 463: /* from_clause_opt ::= */ yytestcase(yyruleno==463); - case 492: /* where_clause_opt ::= */ yytestcase(yyruleno==492); - case 501: /* twindow_clause_opt ::= */ yytestcase(yyruleno==501); - case 507: /* sliding_opt ::= */ yytestcase(yyruleno==507); - case 509: /* fill_opt ::= */ yytestcase(yyruleno==509); - case 521: /* having_clause_opt ::= */ yytestcase(yyruleno==521); - case 523: /* range_opt ::= */ yytestcase(yyruleno==523); - case 525: /* every_opt ::= */ yytestcase(yyruleno==525); - case 538: /* slimit_clause_opt ::= */ yytestcase(yyruleno==538); - case 542: /* limit_clause_opt ::= */ yytestcase(yyruleno==542); -{ yymsp[1].minor.yy44 = NULL; } + case 250: /* like_pattern_opt ::= */ + case 320: /* subtable_opt ::= */ yytestcase(yyruleno==320); + case 435: /* case_when_else_opt ::= */ yytestcase(yyruleno==435); + case 465: /* from_clause_opt ::= */ yytestcase(yyruleno==465); + case 494: /* where_clause_opt ::= */ yytestcase(yyruleno==494); + case 503: /* twindow_clause_opt ::= */ yytestcase(yyruleno==503); + case 509: /* sliding_opt ::= */ yytestcase(yyruleno==509); + case 511: /* fill_opt ::= */ yytestcase(yyruleno==511); + case 525: /* having_clause_opt ::= */ yytestcase(yyruleno==525); + case 527: /* range_opt ::= */ yytestcase(yyruleno==527); + case 529: /* every_opt ::= */ yytestcase(yyruleno==529); + case 542: /* slimit_clause_opt ::= */ yytestcase(yyruleno==542); + case 546: /* limit_clause_opt ::= */ yytestcase(yyruleno==546); +{ yymsp[1].minor.yy42 = NULL; } break; - case 250: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 251: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 251: /* table_name_cond ::= table_name */ -{ yylhsminor.yy44 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy455); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 252: /* table_name_cond ::= table_name */ +{ yylhsminor.yy42 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy225); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 253: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy44 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy455); } + case 254: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy42 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy225); } break; - case 257: /* tag_item ::= TBNAME */ -{ yylhsminor.yy44 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 258: /* tag_item ::= TBNAME */ +{ yylhsminor.yy42 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 260: /* tag_item ::= column_name column_alias */ -{ yylhsminor.yy44 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy455), &yymsp[0].minor.yy455); } - yymsp[-1].minor.yy44 = yylhsminor.yy44; + case 261: /* tag_item ::= column_name column_alias */ +{ yylhsminor.yy42 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy225), &yymsp[0].minor.yy225); } + yymsp[-1].minor.yy42 = yylhsminor.yy42; break; - case 261: /* tag_item ::= column_name AS column_alias */ -{ yylhsminor.yy44 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy455), &yymsp[0].minor.yy455); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 262: /* tag_item ::= column_name AS column_alias */ +{ yylhsminor.yy42 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy225), &yymsp[0].minor.yy225); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 262: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy163, yymsp[-3].minor.yy44, yymsp[-1].minor.yy44, NULL, yymsp[0].minor.yy44); } + case 263: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy103, yymsp[-3].minor.yy42, yymsp[-1].minor.yy42, NULL, yymsp[0].minor.yy42); } break; - case 263: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy163, yymsp[-5].minor.yy44, yymsp[-3].minor.yy44, yymsp[-1].minor.yy684, NULL); } + case 264: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy103, yymsp[-5].minor.yy42, yymsp[-3].minor.yy42, yymsp[-1].minor.yy110, NULL); } break; - case 264: /* cmd ::= DROP INDEX exists_opt full_index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy163, yymsp[0].minor.yy44); } + case 265: /* cmd ::= DROP INDEX exists_opt full_index_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy103, yymsp[0].minor.yy42); } break; - case 265: /* full_index_name ::= index_name */ -{ yylhsminor.yy44 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy455); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 266: /* full_index_name ::= index_name */ +{ yylhsminor.yy42 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy225); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 266: /* full_index_name ::= db_name NK_DOT index_name */ -{ yylhsminor.yy44 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy455); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 267: /* full_index_name ::= db_name NK_DOT index_name */ +{ yylhsminor.yy42 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 267: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy44 = createIndexOption(pCxt, yymsp[-7].minor.yy684, releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), NULL, yymsp[-1].minor.yy44, yymsp[0].minor.yy44); } + case 268: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-9].minor.yy42 = createIndexOption(pCxt, yymsp[-7].minor.yy110, releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), NULL, yymsp[-1].minor.yy42, yymsp[0].minor.yy42); } break; - case 268: /* 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.yy44 = createIndexOption(pCxt, yymsp[-9].minor.yy684, releaseRawExprNode(pCxt, yymsp[-5].minor.yy44), releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), yymsp[-1].minor.yy44, yymsp[0].minor.yy44); } + case 269: /* 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.yy42 = createIndexOption(pCxt, yymsp[-9].minor.yy110, releaseRawExprNode(pCxt, yymsp[-5].minor.yy42), releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), yymsp[-1].minor.yy42, yymsp[0].minor.yy42); } break; - case 271: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy44 = createFunctionNode(pCxt, &yymsp[-3].minor.yy455, yymsp[-1].minor.yy684); } - yymsp[-3].minor.yy44 = yylhsminor.yy44; + case 272: /* func ::= sma_func_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy42 = createFunctionNode(pCxt, &yymsp[-3].minor.yy225, yymsp[-1].minor.yy110); } + yymsp[-3].minor.yy42 = yylhsminor.yy42; break; - case 277: /* sma_stream_opt ::= */ - case 311: /* stream_options ::= */ yytestcase(yyruleno==311); -{ yymsp[1].minor.yy44 = createStreamOptions(pCxt); } + case 278: /* sma_stream_opt ::= */ + case 312: /* stream_options ::= */ yytestcase(yyruleno==312); +{ yymsp[1].minor.yy42 = createStreamOptions(pCxt); } break; - case 278: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - case 315: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==315); -{ ((SStreamOptions*)yymsp[-2].minor.yy44)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy44); yylhsminor.yy44 = yymsp[-2].minor.yy44; } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 279: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + case 316: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==316); +{ ((SStreamOptions*)yymsp[-2].minor.yy42)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy42); yylhsminor.yy42 = yymsp[-2].minor.yy42; } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 279: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy44)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy44); yylhsminor.yy44 = yymsp[-2].minor.yy44; } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 280: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy42)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy42); yylhsminor.yy42 = yymsp[-2].minor.yy42; } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 280: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy44)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy44); yylhsminor.yy44 = yymsp[-2].minor.yy44; } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 281: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy42)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy42); yylhsminor.yy42 = yymsp[-2].minor.yy42; } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 281: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy163, &yymsp[-2].minor.yy455, yymsp[0].minor.yy44); } + case 282: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy103, &yymsp[-2].minor.yy225, yymsp[0].minor.yy42); } break; - case 282: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy163, &yymsp[-3].minor.yy455, &yymsp[0].minor.yy455, false); } + case 283: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy103, &yymsp[-3].minor.yy225, &yymsp[0].minor.yy225, false); } break; - case 283: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy163, &yymsp[-5].minor.yy455, &yymsp[0].minor.yy455, true); } + case 284: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy103, &yymsp[-5].minor.yy225, &yymsp[0].minor.yy225, true); } break; - case 284: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy163, &yymsp[-3].minor.yy455, yymsp[0].minor.yy44, false); } + case 285: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy103, &yymsp[-3].minor.yy225, yymsp[0].minor.yy42, false); } break; - case 285: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy163, &yymsp[-5].minor.yy455, yymsp[0].minor.yy44, true); } + case 286: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy103, &yymsp[-5].minor.yy225, yymsp[0].minor.yy42, true); } break; - case 286: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy163, &yymsp[0].minor.yy455); } + case 287: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy103, &yymsp[0].minor.yy225); } break; - case 287: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy163, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy455); } + case 288: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy103, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225); } break; - case 288: /* cmd ::= DESC full_table_name */ - case 289: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==289); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy44); } + case 289: /* cmd ::= DESC full_table_name */ + case 290: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==290); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy42); } break; - case 290: /* cmd ::= RESET QUERY CACHE */ + case 291: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 291: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 292: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==292); -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy163, yymsp[-1].minor.yy44, yymsp[0].minor.yy44); } + case 292: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 293: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==293); +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy103, yymsp[-1].minor.yy42, yymsp[0].minor.yy42); } break; - case 295: /* explain_options ::= */ -{ yymsp[1].minor.yy44 = createDefaultExplainOptions(pCxt); } + case 296: /* explain_options ::= */ +{ yymsp[1].minor.yy42 = createDefaultExplainOptions(pCxt); } break; - case 296: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy44 = setExplainVerbose(pCxt, yymsp[-2].minor.yy44, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 297: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy42 = setExplainVerbose(pCxt, yymsp[-2].minor.yy42, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 297: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy44 = setExplainRatio(pCxt, yymsp[-2].minor.yy44, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 298: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy42 = setExplainRatio(pCxt, yymsp[-2].minor.yy42, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 298: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy163, yymsp[-8].minor.yy163, &yymsp[-5].minor.yy455, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy260, yymsp[0].minor.yy832); } + case 299: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy103, yymsp[-8].minor.yy103, &yymsp[-5].minor.yy225, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy448, yymsp[0].minor.yy508); } break; - case 299: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy163, &yymsp[0].minor.yy455); } + case 300: /* cmd ::= DROP FUNCTION exists_opt function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy103, &yymsp[0].minor.yy225); } break; - case 304: /* 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.yy163, &yymsp[-8].minor.yy455, yymsp[-5].minor.yy44, yymsp[-7].minor.yy44, yymsp[-3].minor.yy684, yymsp[-2].minor.yy44, yymsp[0].minor.yy44, yymsp[-4].minor.yy684); } + case 305: /* 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.yy103, &yymsp[-8].minor.yy225, yymsp[-5].minor.yy42, yymsp[-7].minor.yy42, yymsp[-3].minor.yy110, yymsp[-2].minor.yy42, yymsp[0].minor.yy42, yymsp[-4].minor.yy110); } break; - case 305: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy163, &yymsp[0].minor.yy455); } + case 306: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy103, &yymsp[0].minor.yy225); } break; - case 312: /* stream_options ::= stream_options TRIGGER AT_ONCE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy44)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy44 = yymsp[-2].minor.yy44; } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 313: /* stream_options ::= stream_options TRIGGER AT_ONCE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy42)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy42 = yymsp[-2].minor.yy42; } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 313: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy44)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy44 = yymsp[-2].minor.yy44; } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 314: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy42)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy42 = yymsp[-2].minor.yy42; } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 314: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-3].minor.yy44)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy44)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy44); yylhsminor.yy44 = yymsp[-3].minor.yy44; } - yymsp[-3].minor.yy44 = yylhsminor.yy44; + case 315: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-3].minor.yy42)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy42)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy42); yylhsminor.yy42 = yymsp[-3].minor.yy42; } + yymsp[-3].minor.yy42 = yylhsminor.yy42; break; - case 316: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -{ ((SStreamOptions*)yymsp[-3].minor.yy44)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy44 = yymsp[-3].minor.yy44; } - yymsp[-3].minor.yy44 = yylhsminor.yy44; + case 317: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +{ ((SStreamOptions*)yymsp[-3].minor.yy42)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy42 = yymsp[-3].minor.yy42; } + yymsp[-3].minor.yy42 = yylhsminor.yy42; break; - case 317: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -{ ((SStreamOptions*)yymsp[-2].minor.yy44)->fillHistory = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy44 = yymsp[-2].minor.yy44; } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 318: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +{ ((SStreamOptions*)yymsp[-2].minor.yy42)->fillHistory = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy42 = yymsp[-2].minor.yy42; } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 319: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 508: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==508); - case 526: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==526); -{ yymsp[-3].minor.yy44 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy44); } + case 319: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +{ ((SStreamOptions*)yymsp[-3].minor.yy42)->ignoreUpdate = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy42 = yymsp[-3].minor.yy42; } + yymsp[-3].minor.yy42 = yylhsminor.yy42; break; - case 320: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 321: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 510: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==510); + case 530: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==530); +{ yymsp[-3].minor.yy42 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy42); } + break; + case 322: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 321: /* cmd ::= KILL QUERY NK_STRING */ + case 323: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 322: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 324: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 323: /* cmd ::= BALANCE VGROUP */ + case 325: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 324: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 326: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 325: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy684); } + case 327: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy110); } break; - case 326: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 328: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 327: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy684 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 329: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy110 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 329: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy44, yymsp[0].minor.yy44); } + case 331: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy42, yymsp[0].minor.yy42); } break; - case 332: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -{ yymsp[-6].minor.yy44 = createInsertStmt(pCxt, yymsp[-4].minor.yy44, yymsp[-2].minor.yy684, yymsp[0].minor.yy44); } + case 334: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +{ yymsp[-6].minor.yy42 = createInsertStmt(pCxt, yymsp[-4].minor.yy42, yymsp[-2].minor.yy110, yymsp[0].minor.yy42); } break; - case 333: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -{ yymsp[-3].minor.yy44 = createInsertStmt(pCxt, yymsp[-1].minor.yy44, NULL, yymsp[0].minor.yy44); } + case 335: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +{ yymsp[-3].minor.yy42 = createInsertStmt(pCxt, yymsp[-1].minor.yy42, NULL, yymsp[0].minor.yy42); } break; - case 334: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 336: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 335: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 337: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 336: /* literal ::= NK_STRING */ -{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 338: /* literal ::= NK_STRING */ +{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 337: /* literal ::= NK_BOOL */ -{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 339: /* literal ::= NK_BOOL */ +{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 338: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy44 = yylhsminor.yy44; + case 340: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy42 = yylhsminor.yy42; break; - case 339: /* literal ::= duration_literal */ - case 349: /* signed_literal ::= signed */ yytestcase(yyruleno==349); - case 370: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==370); - case 371: /* expression ::= literal */ yytestcase(yyruleno==371); - case 372: /* expression ::= pseudo_column */ yytestcase(yyruleno==372); - case 373: /* expression ::= column_reference */ yytestcase(yyruleno==373); - case 374: /* expression ::= function_expression */ yytestcase(yyruleno==374); - case 375: /* expression ::= case_when_expression */ yytestcase(yyruleno==375); - case 406: /* function_expression ::= literal_func */ yytestcase(yyruleno==406); - case 455: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==455); - case 459: /* boolean_primary ::= predicate */ yytestcase(yyruleno==459); - case 461: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==461); - case 462: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==462); - case 465: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==465); - case 467: /* table_reference ::= table_primary */ yytestcase(yyruleno==467); - case 468: /* table_reference ::= joined_table */ yytestcase(yyruleno==468); - case 472: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==472); - case 528: /* query_simple ::= query_specification */ yytestcase(yyruleno==528); - case 529: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==529); - case 532: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==532); - case 534: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==534); -{ yylhsminor.yy44 = yymsp[0].minor.yy44; } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 341: /* literal ::= duration_literal */ + case 351: /* signed_literal ::= signed */ yytestcase(yyruleno==351); + case 372: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==372); + case 373: /* expression ::= literal */ yytestcase(yyruleno==373); + case 374: /* expression ::= pseudo_column */ yytestcase(yyruleno==374); + case 375: /* expression ::= column_reference */ yytestcase(yyruleno==375); + case 376: /* expression ::= function_expression */ yytestcase(yyruleno==376); + case 377: /* expression ::= case_when_expression */ yytestcase(yyruleno==377); + case 408: /* function_expression ::= literal_func */ yytestcase(yyruleno==408); + case 457: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==457); + case 461: /* boolean_primary ::= predicate */ yytestcase(yyruleno==461); + case 463: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==463); + case 464: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==464); + case 467: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==467); + case 469: /* table_reference ::= table_primary */ yytestcase(yyruleno==469); + case 470: /* table_reference ::= joined_table */ yytestcase(yyruleno==470); + case 474: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==474); + case 532: /* query_simple ::= query_specification */ yytestcase(yyruleno==532); + case 533: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==533); + case 536: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==536); + case 538: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==538); +{ yylhsminor.yy42 = yymsp[0].minor.yy42; } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 340: /* literal ::= NULL */ -{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 342: /* literal ::= NULL */ +{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 341: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 343: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 342: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 344: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 343: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 345: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 344: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + case 346: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 345: /* signed ::= NK_MINUS NK_INTEGER */ + case 347: /* 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.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy44 = yylhsminor.yy44; + yymsp[-1].minor.yy42 = yylhsminor.yy42; break; - case 346: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 348: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 347: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 349: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 348: /* signed ::= NK_MINUS NK_FLOAT */ + case 350: /* 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.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy44 = yylhsminor.yy44; + yymsp[-1].minor.yy42 = yylhsminor.yy42; break; - case 350: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 352: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 351: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 353: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 352: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 354: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 353: /* signed_literal ::= duration_literal */ - case 355: /* signed_literal ::= literal_func */ yytestcase(yyruleno==355); - case 426: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==426); - case 488: /* select_item ::= common_expression */ yytestcase(yyruleno==488); - case 498: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==498); - case 533: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==533); - case 535: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==535); - case 548: /* search_condition ::= common_expression */ yytestcase(yyruleno==548); -{ yylhsminor.yy44 = releaseRawExprNode(pCxt, yymsp[0].minor.yy44); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 355: /* signed_literal ::= duration_literal */ + case 357: /* signed_literal ::= literal_func */ yytestcase(yyruleno==357); + case 428: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==428); + case 490: /* select_item ::= common_expression */ yytestcase(yyruleno==490); + case 500: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==500); + case 537: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==537); + case 539: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==539); + case 552: /* search_condition ::= common_expression */ yytestcase(yyruleno==552); +{ yylhsminor.yy42 = releaseRawExprNode(pCxt, yymsp[0].minor.yy42); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 354: /* signed_literal ::= NULL */ -{ yylhsminor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 356: /* signed_literal ::= NULL */ +{ yylhsminor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 356: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy44 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 358: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy42 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 376: /* expression ::= NK_LP expression NK_RP */ - case 460: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==460); - case 547: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==547); -{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy44)); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 378: /* expression ::= NK_LP expression NK_RP */ + case 462: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==462); + case 551: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==551); +{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy42)); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 377: /* expression ::= NK_PLUS expr_or_subquery */ + case 379: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy44)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy42)); } - yymsp[-1].minor.yy44 = yylhsminor.yy44; + yymsp[-1].minor.yy42 = yylhsminor.yy42; break; - case 378: /* expression ::= NK_MINUS expr_or_subquery */ + case 380: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy44), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy42), NULL)); } - yymsp[-1].minor.yy44 = yylhsminor.yy44; + yymsp[-1].minor.yy42 = yylhsminor.yy42; break; - case 379: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 381: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 380: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 382: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 381: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 383: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 382: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 384: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 383: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 385: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 384: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 386: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 385: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 387: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 386: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 388: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 389: /* column_reference ::= column_name */ -{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy455, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy455)); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 391: /* column_reference ::= column_name */ +{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy225, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy225)); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 390: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy455, createColumnNode(pCxt, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy455)); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 392: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225, createColumnNode(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225)); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 391: /* pseudo_column ::= ROWTS */ - case 392: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==392); - case 394: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==394); - case 395: /* pseudo_column ::= QEND */ yytestcase(yyruleno==395); - case 396: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==396); - case 397: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==397); - case 398: /* pseudo_column ::= WEND */ yytestcase(yyruleno==398); - case 399: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==399); - case 400: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==400); - case 401: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==401); - case 402: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==402); - case 408: /* literal_func ::= NOW */ yytestcase(yyruleno==408); -{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 393: /* pseudo_column ::= ROWTS */ + case 394: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==394); + case 396: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==396); + case 397: /* pseudo_column ::= QEND */ yytestcase(yyruleno==397); + case 398: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==398); + case 399: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==399); + case 400: /* pseudo_column ::= WEND */ yytestcase(yyruleno==400); + case 401: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==401); + case 402: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==402); + case 403: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==403); + case 404: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==404); + case 410: /* literal_func ::= NOW */ yytestcase(yyruleno==410); +{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 393: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy455)))); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 395: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy225)))); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 403: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 404: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==404); -{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy455, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy455, yymsp[-1].minor.yy684)); } - yymsp[-3].minor.yy44 = yylhsminor.yy44; + case 405: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 406: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==406); +{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy225, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy225, yymsp[-1].minor.yy110)); } + yymsp[-3].minor.yy42 = yylhsminor.yy42; break; - case 405: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ -{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), yymsp[-1].minor.yy260)); } - yymsp[-5].minor.yy44 = yylhsminor.yy44; + case 407: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ +{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), yymsp[-1].minor.yy448)); } + yymsp[-5].minor.yy42 = yylhsminor.yy42; break; - case 407: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy455, NULL)); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 409: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy225, NULL)); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 422: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy684 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy684 = yylhsminor.yy684; + case 424: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy110 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy110 = yylhsminor.yy110; break; - case 427: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 491: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==491); -{ yylhsminor.yy44 = createColumnNode(pCxt, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 429: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 493: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==493); +{ yylhsminor.yy42 = createColumnNode(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 428: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy684, yymsp[-1].minor.yy44)); } - yymsp[-3].minor.yy44 = yylhsminor.yy44; + case 430: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy110, yymsp[-1].minor.yy42)); } + yymsp[-3].minor.yy42 = yylhsminor.yy42; break; - case 429: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), yymsp[-2].minor.yy684, yymsp[-1].minor.yy44)); } - yymsp[-4].minor.yy44 = yylhsminor.yy44; + case 431: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), yymsp[-2].minor.yy110, yymsp[-1].minor.yy42)); } + yymsp[-4].minor.yy42 = yylhsminor.yy42; break; - case 432: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -{ yymsp[-3].minor.yy44 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44)); } + case 434: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy42 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42)); } break; - case 434: /* case_when_else_opt ::= ELSE common_expression */ -{ yymsp[-1].minor.yy44 = releaseRawExprNode(pCxt, yymsp[0].minor.yy44); } + case 436: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy42 = releaseRawExprNode(pCxt, yymsp[0].minor.yy42); } break; - case 435: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 440: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==440); + case 437: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 442: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==442); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy704, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy2, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 436: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 438: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy44); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy44), releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy42); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy42), releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); } - yymsp[-4].minor.yy44 = yylhsminor.yy44; + yymsp[-4].minor.yy42 = yylhsminor.yy42; break; - case 437: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 439: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy44); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy44), releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy42); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy42), releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); } - yymsp[-5].minor.yy44 = yylhsminor.yy44; + yymsp[-5].minor.yy42 = yylhsminor.yy42; break; - case 438: /* predicate ::= expr_or_subquery IS NULL */ + case 440: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), NULL)); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 439: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 441: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), NULL)); } - yymsp[-3].minor.yy44 = yylhsminor.yy44; + yymsp[-3].minor.yy42 = yylhsminor.yy42; break; - case 441: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy704 = OP_TYPE_LOWER_THAN; } + case 443: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy2 = OP_TYPE_LOWER_THAN; } break; - case 442: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy704 = OP_TYPE_GREATER_THAN; } + case 444: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy2 = OP_TYPE_GREATER_THAN; } break; - case 443: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy704 = OP_TYPE_LOWER_EQUAL; } + case 445: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy2 = OP_TYPE_LOWER_EQUAL; } break; - case 444: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy704 = OP_TYPE_GREATER_EQUAL; } + case 446: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy2 = OP_TYPE_GREATER_EQUAL; } break; - case 445: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy704 = OP_TYPE_NOT_EQUAL; } + case 447: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy2 = OP_TYPE_NOT_EQUAL; } break; - case 446: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy704 = OP_TYPE_EQUAL; } + case 448: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy2 = OP_TYPE_EQUAL; } break; - case 447: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy704 = OP_TYPE_LIKE; } + case 449: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy2 = OP_TYPE_LIKE; } break; - case 448: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy704 = OP_TYPE_NOT_LIKE; } + case 450: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy2 = OP_TYPE_NOT_LIKE; } break; - case 449: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy704 = OP_TYPE_MATCH; } + case 451: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy2 = OP_TYPE_MATCH; } break; - case 450: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy704 = OP_TYPE_NMATCH; } + case 452: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy2 = OP_TYPE_NMATCH; } break; - case 451: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy704 = OP_TYPE_JSON_CONTAINS; } + case 453: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy2 = OP_TYPE_JSON_CONTAINS; } break; - case 452: /* in_op ::= IN */ -{ yymsp[0].minor.yy704 = OP_TYPE_IN; } + case 454: /* in_op ::= IN */ +{ yymsp[0].minor.yy2 = OP_TYPE_IN; } break; - case 453: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy704 = OP_TYPE_NOT_IN; } + case 455: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy2 = OP_TYPE_NOT_IN; } break; - case 454: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy684)); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 456: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy110)); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 456: /* boolean_value_expression ::= NOT boolean_primary */ + case 458: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy44), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy42), NULL)); } - yymsp[-1].minor.yy44 = yylhsminor.yy44; + yymsp[-1].minor.yy42 = yylhsminor.yy42; break; - case 457: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 459: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 458: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 460: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44); - yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); + yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 464: /* from_clause_opt ::= FROM table_reference_list */ - case 493: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==493); - case 522: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==522); -{ yymsp[-1].minor.yy44 = yymsp[0].minor.yy44; } + case 466: /* from_clause_opt ::= FROM table_reference_list */ + case 495: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==495); + case 526: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==526); +{ yymsp[-1].minor.yy42 = yymsp[0].minor.yy42; } break; - case 466: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy44 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy44, yymsp[0].minor.yy44, NULL); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 468: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy42 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy42, yymsp[0].minor.yy42, NULL); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 469: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy44 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy455, &yymsp[0].minor.yy455); } - yymsp[-1].minor.yy44 = yylhsminor.yy44; + case 471: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy42 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy225, &yymsp[0].minor.yy225); } + yymsp[-1].minor.yy42 = yylhsminor.yy42; break; - case 470: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy44 = createRealTableNode(pCxt, &yymsp[-3].minor.yy455, &yymsp[-1].minor.yy455, &yymsp[0].minor.yy455); } - yymsp[-3].minor.yy44 = yylhsminor.yy44; + case 472: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy42 = createRealTableNode(pCxt, &yymsp[-3].minor.yy225, &yymsp[-1].minor.yy225, &yymsp[0].minor.yy225); } + yymsp[-3].minor.yy42 = yylhsminor.yy42; break; - case 471: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy44 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy44), &yymsp[0].minor.yy455); } - yymsp[-1].minor.yy44 = yylhsminor.yy44; + case 473: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy42 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy42), &yymsp[0].minor.yy225); } + yymsp[-1].minor.yy42 = yylhsminor.yy42; break; - case 473: /* alias_opt ::= */ -{ yymsp[1].minor.yy455 = nil_token; } + case 475: /* alias_opt ::= */ +{ yymsp[1].minor.yy225 = nil_token; } break; - case 475: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy455 = yymsp[0].minor.yy455; } + case 477: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy225 = yymsp[0].minor.yy225; } break; - case 476: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 477: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==477); -{ yymsp[-2].minor.yy44 = yymsp[-1].minor.yy44; } + case 478: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 479: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==479); +{ yymsp[-2].minor.yy42 = yymsp[-1].minor.yy42; } break; - case 478: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy44 = createJoinTableNode(pCxt, yymsp[-4].minor.yy724, yymsp[-5].minor.yy44, yymsp[-2].minor.yy44, yymsp[0].minor.yy44); } - yymsp[-5].minor.yy44 = yylhsminor.yy44; + case 480: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy42 = createJoinTableNode(pCxt, yymsp[-4].minor.yy638, yymsp[-5].minor.yy42, yymsp[-2].minor.yy42, yymsp[0].minor.yy42); } + yymsp[-5].minor.yy42 = yylhsminor.yy42; break; - case 479: /* join_type ::= */ -{ yymsp[1].minor.yy724 = JOIN_TYPE_INNER; } + case 481: /* join_type ::= */ +{ yymsp[1].minor.yy638 = JOIN_TYPE_INNER; } break; - case 480: /* join_type ::= INNER */ -{ yymsp[0].minor.yy724 = JOIN_TYPE_INNER; } + case 482: /* join_type ::= INNER */ +{ yymsp[0].minor.yy638 = JOIN_TYPE_INNER; } break; - case 481: /* query_specification ::= SELECT set_quantifier_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 483: /* query_specification ::= SELECT set_quantifier_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[-11].minor.yy44 = createSelectStmt(pCxt, yymsp[-10].minor.yy163, yymsp[-9].minor.yy684, yymsp[-8].minor.yy44); - yymsp[-11].minor.yy44 = addWhereClause(pCxt, yymsp[-11].minor.yy44, yymsp[-7].minor.yy44); - yymsp[-11].minor.yy44 = addPartitionByClause(pCxt, yymsp[-11].minor.yy44, yymsp[-6].minor.yy684); - yymsp[-11].minor.yy44 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy44, yymsp[-2].minor.yy44); - yymsp[-11].minor.yy44 = addGroupByClause(pCxt, yymsp[-11].minor.yy44, yymsp[-1].minor.yy684); - yymsp[-11].minor.yy44 = addHavingClause(pCxt, yymsp[-11].minor.yy44, yymsp[0].minor.yy44); - yymsp[-11].minor.yy44 = addRangeClause(pCxt, yymsp[-11].minor.yy44, yymsp[-5].minor.yy44); - yymsp[-11].minor.yy44 = addEveryClause(pCxt, yymsp[-11].minor.yy44, yymsp[-4].minor.yy44); - yymsp[-11].minor.yy44 = addFillClause(pCxt, yymsp[-11].minor.yy44, yymsp[-3].minor.yy44); + yymsp[-11].minor.yy42 = createSelectStmt(pCxt, yymsp[-10].minor.yy103, yymsp[-9].minor.yy110, yymsp[-8].minor.yy42); + yymsp[-11].minor.yy42 = addWhereClause(pCxt, yymsp[-11].minor.yy42, yymsp[-7].minor.yy42); + yymsp[-11].minor.yy42 = addPartitionByClause(pCxt, yymsp[-11].minor.yy42, yymsp[-6].minor.yy110); + yymsp[-11].minor.yy42 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy42, yymsp[-2].minor.yy42); + yymsp[-11].minor.yy42 = addGroupByClause(pCxt, yymsp[-11].minor.yy42, yymsp[-1].minor.yy110); + yymsp[-11].minor.yy42 = addHavingClause(pCxt, yymsp[-11].minor.yy42, yymsp[0].minor.yy42); + yymsp[-11].minor.yy42 = addRangeClause(pCxt, yymsp[-11].minor.yy42, yymsp[-5].minor.yy42); + yymsp[-11].minor.yy42 = addEveryClause(pCxt, yymsp[-11].minor.yy42, yymsp[-4].minor.yy42); + yymsp[-11].minor.yy42 = addFillClause(pCxt, yymsp[-11].minor.yy42, yymsp[-3].minor.yy42); } break; - case 484: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy163 = false; } + case 486: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy103 = false; } break; - case 487: /* select_item ::= NK_STAR */ -{ yylhsminor.yy44 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy44 = yylhsminor.yy44; + case 489: /* select_item ::= NK_STAR */ +{ yylhsminor.yy42 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 489: /* select_item ::= common_expression column_alias */ - case 499: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==499); -{ yylhsminor.yy44 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy44), &yymsp[0].minor.yy455); } - yymsp[-1].minor.yy44 = yylhsminor.yy44; + case 491: /* select_item ::= common_expression column_alias */ + case 501: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==501); +{ yylhsminor.yy42 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy42), &yymsp[0].minor.yy225); } + yymsp[-1].minor.yy42 = yylhsminor.yy42; break; - case 490: /* select_item ::= common_expression AS column_alias */ - case 500: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==500); -{ yylhsminor.yy44 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), &yymsp[0].minor.yy455); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 492: /* select_item ::= common_expression AS column_alias */ + case 502: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==502); +{ yylhsminor.yy42 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), &yymsp[0].minor.yy225); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 495: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 518: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==518); - case 537: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==537); -{ yymsp[-2].minor.yy684 = yymsp[0].minor.yy684; } + case 497: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 522: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==522); + case 541: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==541); +{ yymsp[-2].minor.yy110 = yymsp[0].minor.yy110; } break; - case 502: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy44 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), releaseRawExprNode(pCxt, yymsp[-1].minor.yy44)); } + case 504: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy42 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), releaseRawExprNode(pCxt, yymsp[-1].minor.yy42)); } break; - case 503: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy44 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy44)); } + case 505: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy42 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy42)); } break; - case 504: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy44 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), NULL, yymsp[-1].minor.yy44, yymsp[0].minor.yy44); } + case 506: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy42 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), NULL, yymsp[-1].minor.yy42, yymsp[0].minor.yy42); } break; - case 505: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy44 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy44), releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), yymsp[-1].minor.yy44, yymsp[0].minor.yy44); } + case 507: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy42 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy42), releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), yymsp[-1].minor.yy42, yymsp[0].minor.yy42); } break; - case 506: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -{ yymsp[-6].minor.yy44 = createEventWindowNode(pCxt, yymsp[-3].minor.yy44, yymsp[0].minor.yy44); } + case 508: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +{ yymsp[-6].minor.yy42 = createEventWindowNode(pCxt, yymsp[-3].minor.yy42, yymsp[0].minor.yy42); } break; - case 510: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy44 = createFillNode(pCxt, yymsp[-1].minor.yy22, NULL); } + case 512: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy42 = createFillNode(pCxt, yymsp[-1].minor.yy410, NULL); } break; - case 511: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy44 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy684)); } + case 513: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy42 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy110)); } break; - case 512: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy22 = FILL_MODE_NONE; } + case 514: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy42 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy110)); } break; - case 513: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy22 = FILL_MODE_PREV; } + case 515: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy410 = FILL_MODE_NONE; } break; - case 514: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy22 = FILL_MODE_NULL; } + case 516: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy410 = FILL_MODE_PREV; } break; - case 515: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy22 = FILL_MODE_LINEAR; } + case 517: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy410 = FILL_MODE_NULL; } break; - case 516: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy22 = FILL_MODE_NEXT; } + case 518: /* fill_mode ::= NULL_F */ +{ yymsp[0].minor.yy410 = FILL_MODE_NULL_F; } break; - case 519: /* group_by_list ::= expr_or_subquery */ -{ yylhsminor.yy684 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy44))); } - yymsp[0].minor.yy684 = yylhsminor.yy684; + case 519: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy410 = FILL_MODE_LINEAR; } break; - case 520: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -{ yylhsminor.yy684 = addNodeToList(pCxt, yymsp[-2].minor.yy684, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy44))); } - yymsp[-2].minor.yy684 = yylhsminor.yy684; + case 520: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy410 = FILL_MODE_NEXT; } break; - case 524: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -{ yymsp[-5].minor.yy44 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), releaseRawExprNode(pCxt, yymsp[-1].minor.yy44)); } + case 523: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy110 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); } + yymsp[0].minor.yy110 = yylhsminor.yy110; break; - case 527: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 524: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy110 = addNodeToList(pCxt, yymsp[-2].minor.yy110, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); } + yymsp[-2].minor.yy110 = yylhsminor.yy110; + break; + case 528: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy42 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), releaseRawExprNode(pCxt, yymsp[-1].minor.yy42)); } + break; + case 531: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy44 = addOrderByClause(pCxt, yymsp[-3].minor.yy44, yymsp[-2].minor.yy684); - yylhsminor.yy44 = addSlimitClause(pCxt, yylhsminor.yy44, yymsp[-1].minor.yy44); - yylhsminor.yy44 = addLimitClause(pCxt, yylhsminor.yy44, yymsp[0].minor.yy44); + yylhsminor.yy42 = addOrderByClause(pCxt, yymsp[-3].minor.yy42, yymsp[-2].minor.yy110); + yylhsminor.yy42 = addSlimitClause(pCxt, yylhsminor.yy42, yymsp[-1].minor.yy42); + yylhsminor.yy42 = addLimitClause(pCxt, yylhsminor.yy42, yymsp[0].minor.yy42); } - yymsp[-3].minor.yy44 = yylhsminor.yy44; + yymsp[-3].minor.yy42 = yylhsminor.yy42; break; - case 530: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -{ yylhsminor.yy44 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy44, yymsp[0].minor.yy44); } - yymsp[-3].minor.yy44 = yylhsminor.yy44; + case 534: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy42 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy42, yymsp[0].minor.yy42); } + yymsp[-3].minor.yy42 = yylhsminor.yy42; break; - case 531: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -{ yylhsminor.yy44 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy44, yymsp[0].minor.yy44); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 535: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy42 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy42, yymsp[0].minor.yy42); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 539: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 543: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==543); -{ yymsp[-1].minor.yy44 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 543: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 547: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==547); +{ yymsp[-1].minor.yy42 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 540: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 544: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==544); -{ yymsp[-3].minor.yy44 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 544: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 548: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==548); +{ yymsp[-3].minor.yy42 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 541: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 545: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==545); -{ yymsp[-3].minor.yy44 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 545: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 549: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==549); +{ yymsp[-3].minor.yy42 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 546: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy44); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 550: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy42); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 551: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy44 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), yymsp[-1].minor.yy490, yymsp[0].minor.yy23); } - yymsp[-2].minor.yy44 = yylhsminor.yy44; + case 555: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy42 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), yymsp[-1].minor.yy106, yymsp[0].minor.yy599); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 552: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy490 = ORDER_ASC; } + case 556: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy106 = ORDER_ASC; } break; - case 553: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy490 = ORDER_ASC; } + case 557: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy106 = ORDER_ASC; } break; - case 554: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy490 = ORDER_DESC; } + case 558: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy106 = ORDER_DESC; } break; - case 555: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy23 = NULL_ORDER_DEFAULT; } + case 559: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy599 = NULL_ORDER_DEFAULT; } break; - case 556: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy23 = NULL_ORDER_FIRST; } + case 560: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy599 = NULL_ORDER_FIRST; } break; - case 557: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy23 = NULL_ORDER_LAST; } + case 561: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy599 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index a7a11d8edf..fab1fc4919 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -21,6 +21,26 @@ namespace ParserTest { class ParserInitialCTest : public ParserDdlTest {}; +/* + * COMPACT DATABASE db_name + */ +TEST_F(ParserInitialCTest, compact) { + SCompactDbReq expect = {0}; + + auto setCompactDbReq = [&](const char* pDb) { snprintf(expect.db, sizeof(expect.db), "0.%s", pDb); }; + + setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { + ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_COMPACT_DATABASE_STMT); + ASSERT_EQ(pQuery->pCmdMsg->msgType, TDMT_MND_COMPACT_DB); + SCompactDbReq req = {0}; + ASSERT_EQ(tDeserializeSCompactDbReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS); + ASSERT_EQ(std::string(req.db), std::string(expect.db)); + }); + + setCompactDbReq("wxy_db"); + run("COMPACT DATABASE wxy_db"); +} + /* * CREATE ACCOUNT account_name PASS value [create_account_options] * @@ -755,13 +775,13 @@ TEST_F(ParserInitialCTest, createStream) { }; auto setCreateStreamReq = [&](const char* pStream, const char* pSrcDb, const char* pSql, const char* pDstStb, - int8_t createStb = STREAM_CREATE_STABLE_TRUE, int8_t igExists = 0) { + int8_t igExists = 0) { snprintf(expect.name, sizeof(expect.name), "0.%s", pStream); snprintf(expect.sourceDB, sizeof(expect.sourceDB), "0.%s", pSrcDb); snprintf(expect.targetStbFullName, sizeof(expect.targetStbFullName), "0.test.%s", pDstStb); expect.igExists = igExists; expect.sql = strdup(pSql); - expect.createStb = createStb; + expect.createStb = STREAM_CREATE_STABLE_TRUE; expect.triggerType = STREAM_TRIGGER_AT_ONCE; expect.maxDelay = 0; expect.watermark = 0; @@ -769,15 +789,18 @@ TEST_F(ParserInitialCTest, createStream) { expect.igExpired = STREAM_DEFAULT_IGNORE_EXPIRED; }; - auto setStreamOptions = [&](int8_t triggerType = STREAM_TRIGGER_AT_ONCE, int64_t maxDelay = 0, int64_t watermark = 0, - int8_t igExpired = STREAM_DEFAULT_IGNORE_EXPIRED, - int8_t fillHistory = STREAM_DEFAULT_FILL_HISTORY) { - expect.triggerType = triggerType; - expect.maxDelay = maxDelay; - expect.watermark = watermark; - expect.fillHistory = fillHistory; - expect.igExpired = igExpired; - }; + auto setStreamOptions = + [&](int8_t createStb = STREAM_CREATE_STABLE_TRUE, int8_t triggerType = STREAM_TRIGGER_AT_ONCE, + int64_t maxDelay = 0, int64_t watermark = 0, int8_t igExpired = STREAM_DEFAULT_IGNORE_EXPIRED, + int8_t fillHistory = STREAM_DEFAULT_FILL_HISTORY, int8_t igUpdate = STREAM_DEFAULT_IGNORE_UPDATE) { + expect.createStb = createStb; + expect.triggerType = triggerType; + expect.maxDelay = maxDelay; + expect.watermark = watermark; + expect.fillHistory = fillHistory; + expect.igExpired = igExpired; + expect.igUpdate = igUpdate; + }; auto addTag = [&](const char* pFieldName, uint8_t type, int32_t bytes = 0) { SField field = {0}; @@ -824,6 +847,7 @@ TEST_F(ParserInitialCTest, createStream) { } ASSERT_EQ(req.checkpointFreq, expect.checkpointFreq); ASSERT_EQ(req.createStb, expect.createStb); + ASSERT_EQ(req.igUpdate, expect.igUpdate); tFreeSCMCreateStreamReq(&req); }); @@ -833,13 +857,13 @@ TEST_F(ParserInitialCTest, createStream) { setCreateStreamReq( "s1", "test", - "create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired 0 fill_history 1 into st3 " - "as select count(*) from t1 interval(10s)", - "st3", 1, 1); - setStreamOptions(STREAM_TRIGGER_MAX_DELAY, 20 * MILLISECOND_PER_SECOND, 10 * MILLISECOND_PER_SECOND, 0, 1); - run("CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED 0 FILL_HISTORY 1 INTO st3 AS " - "SELECT COUNT(*) " - "FROM t1 INTERVAL(10S)"); + "create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired 0 fill_history 1 ignore " + "update 1 into st3 as select count(*) from t1 interval(10s)", + "st3", 1); + setStreamOptions(STREAM_CREATE_STABLE_TRUE, STREAM_TRIGGER_MAX_DELAY, 20 * MILLISECOND_PER_SECOND, + 10 * MILLISECOND_PER_SECOND, 0, 1, 1); + run("CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED 0 FILL_HISTORY 1 IGNORE " + "UPDATE 1 INTO st3 AS SELECT COUNT(*) FROM t1 INTERVAL(10S)"); clearCreateStreamReq(); setCreateStreamReq("s1", "test", @@ -856,7 +880,8 @@ TEST_F(ParserInitialCTest, createStream) { setCreateStreamReq( "s1", "test", "create stream s1 into st1 tags(tag2) as select max(c1), c2 from t1 partition by tbname tag2 interval(10s)", - "st1", STREAM_CREATE_STABLE_FALSE); + "st1"); + setStreamOptions(STREAM_CREATE_STABLE_FALSE); run("CREATE STREAM s1 INTO st1 TAGS(tag2) AS SELECT MAX(c1), c2 FROM t1 PARTITION BY TBNAME tag2 INTERVAL(10S)"); clearCreateStreamReq(); } diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 208f548457..c9ee83a647 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -343,6 +343,13 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect pScan->node.groupAction = GROUP_ACTION_NONE; pScan->node.resultDataOrder = DATA_ORDER_LEVEL_IN_BLOCK; + if (pCxt->pPlanCxt->streamQuery) { + pScan->triggerType = pCxt->pPlanCxt->triggerType; + pScan->watermark = pCxt->pPlanCxt->watermark; + pScan->deleteMark = pCxt->pPlanCxt->deleteMark; + pScan->igExpired = pCxt->pPlanCxt->igExpired; + pScan->igCheckUpdate = pCxt->pPlanCxt->igCheckUpdate; + } // set columns to scan if (TSDB_CODE_SUCCESS == code) { @@ -719,6 +726,7 @@ static int32_t createWindowLogicNodeFinalize(SLogicPlanContext* pCxt, SSelectStm pWindow->watermark = pCxt->pPlanCxt->watermark; pWindow->deleteMark = pCxt->pPlanCxt->deleteMark; pWindow->igExpired = pCxt->pPlanCxt->igExpired; + pWindow->igCheckUpdate = pCxt->pPlanCxt->igCheckUpdate; } pWindow->inputTsOrder = ORDER_ASC; pWindow->outputTsOrder = ORDER_ASC; diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 18aaabf448..16a5ef7bae 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -328,10 +328,6 @@ static void scanPathOptSetScanWin(SScanLogicNode* pScan) { pScan->sliding = ((SWindowLogicNode*)pParent)->sliding; pScan->intervalUnit = ((SWindowLogicNode*)pParent)->intervalUnit; pScan->slidingUnit = ((SWindowLogicNode*)pParent)->slidingUnit; - pScan->triggerType = ((SWindowLogicNode*)pParent)->triggerType; - pScan->watermark = ((SWindowLogicNode*)pParent)->watermark; - pScan->deleteMark = ((SWindowLogicNode*)pParent)->deleteMark; - pScan->igExpired = ((SWindowLogicNode*)pParent)->igExpired; } } diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index f83704be87..e9a2efaac7 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -582,6 +582,7 @@ static int32_t createTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubp pTableScan->triggerType = pScanLogicNode->triggerType; pTableScan->watermark = pScanLogicNode->watermark; pTableScan->igExpired = pScanLogicNode->igExpired; + pTableScan->igCheckUpdate = pScanLogicNode->igCheckUpdate; pTableScan->assignBlockUid = pCxt->pPlanCxt->rSmaQuery ? true : false; int32_t code = createScanPhysiNodeFinalize(pCxt, pSubplan, pScanLogicNode, (SScanPhysiNode*)pTableScan, pPhyNode); @@ -1718,6 +1719,7 @@ static int32_t createQueryInserter(SPhysiPlanContext* pCxt, SVnodeModifyLogicNod strcpy(pInserter->tableName, pModify->tableName); pInserter->vgId = pModify->pVgroupList->vgroups[0].vgId; pInserter->epSet = pModify->pVgroupList->vgroups[0].epSet; + pInserter->explain = (QUERY_NODE_EXPLAIN_STMT == nodeType(pCxt->pPlanCxt->pAstRoot) ? true : false); vgroupInfoToNodeAddr(pModify->pVgroupList->vgroups, &pSubplan->execNode); int32_t code = setListSlotId(pCxt, pSubplan->pNode->pOutputDataBlockDesc->dataBlockId, -1, pModify->pInsertCols, diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 1e35529d27..5645e969a2 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -516,7 +516,7 @@ int32_t qwHandlePostPhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inp } if (QW_EVENT_RECEIVED(ctx, QW_EVENT_DROP)) { - if (QW_PHASE_POST_FETCH != phase || qwTaskNotInExec(ctx)) { + if (QW_PHASE_POST_FETCH != phase || ((!QW_QUERY_RUNNING(ctx)) && qwTaskNotInExec(ctx))) { QW_ERR_JRET(qwDropTask(QW_FPARAMS())); QW_ERR_JRET(ctx->rspCode); } diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 1bfbab0591..fb8a7a42ba 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -537,7 +537,9 @@ int32_t schProcessOnExplainDone(SSchJob *pJob, SSchTask *pTask, SRetrieveTableRs SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_SUCC); - schProcessOnDataFetched(pJob); + if (!SCH_IS_INSERT_JOB(pJob)) { + schProcessOnDataFetched(pJob); + } return TSDB_CODE_SUCCESS; } @@ -682,7 +684,7 @@ void schFreeJobImpl(void *job) { int32_t schJobFetchRows(SSchJob *pJob) { int32_t code = 0; - if (!(pJob->attr.explainMode == EXPLAIN_MODE_STATIC)) { + if (!(pJob->attr.explainMode == EXPLAIN_MODE_STATIC) && !(SCH_IS_EXPLAIN_JOB(pJob) && SCH_IS_INSERT_JOB(pJob))) { SCH_ERR_RET(schLaunchFetchTask(pJob)); if (schChkCurrentOp(pJob, SCH_OP_FETCH, true)) { diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 5ceb8228b0..ad675cf383 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -341,6 +341,14 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); } + if (taosArrayGetSize(pTask->parents) == 0 && SCH_IS_EXPLAIN_JOB(pJob) && SCH_IS_INSERT_JOB(pJob)) { + SRetrieveTableRsp *pRsp = NULL; + SCH_ERR_JRET(qExecExplainEnd(pJob->explainCtx, &pRsp)); + if (pRsp) { + SCH_ERR_JRET(schProcessOnExplainDone(pJob, pTask, pRsp)); + } + } + SQueryTableRsp rsp = {0}; if (tDeserializeSQueryTableRsp(msg, msgSize, &rsp) < 0) { SCH_TASK_ELOG("tDeserializeSQueryTableRsp failed, msgSize:%d", msgSize); diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index 56c3c3ebef..2ef351cbb0 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -128,7 +128,7 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath, int memset(statePath, 0, 1024); tstrncpy(statePath, path, 1024); } - if (tdbOpen(statePath, szPage, pages, &pState->pTdbState->db, 0) < 0) { + if (tdbOpen(statePath, szPage, pages, &pState->pTdbState->db, 1) < 0) { goto _err; } diff --git a/source/libs/sync/src/syncCommit.c b/source/libs/sync/src/syncCommit.c index 67ed1e0701..6d256a735d 100644 --- a/source/libs/sync/src/syncCommit.c +++ b/source/libs/sync/src/syncCommit.c @@ -110,7 +110,7 @@ int64_t syncNodeCheckCommitIndex(SSyncNode* ths, SyncIndex indexLikely) { if (indexLikely > ths->commitIndex && syncNodeAgreedUpon(ths, indexLikely)) { SyncIndex commitIndex = indexLikely; syncNodeUpdateCommitIndex(ths, commitIndex); - sTrace("vgId:%d, agreed upon. role:%d, term:%" PRId64 ", index: %" PRId64 "", ths->vgId, ths->state, + sTrace("vgId:%d, agreed upon. role:%d, term:%" PRId64 ", index:%" PRId64 "", ths->vgId, ths->state, ths->raftStore.currentTerm, commitIndex); } return ths->commitIndex; diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 77b87a885b..1d96412ba3 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -85,7 +85,7 @@ int64_t syncOpen(SSyncInfo* pSyncInfo) { int32_t syncStart(int64_t rid) { SSyncNode* pSyncNode = syncNodeAcquire(rid); if (pSyncNode == NULL) { - sError("failed to acquire rid: %" PRId64 " of tsNodeReftId for pSyncNode", rid); + sError("failed to acquire rid:%" PRId64 " of tsNodeReftId for pSyncNode", rid); return -1; } @@ -756,7 +756,7 @@ int32_t syncNodeLogStoreRestoreOnNeed(SSyncNode* pNode) { SyncIndex lastVer = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore); if (lastVer < commitIndex || firstVer > commitIndex + 1) { if (pNode->pLogStore->syncLogRestoreFromSnapshot(pNode->pLogStore, commitIndex)) { - sError("vgId:%d, failed to restore log store from snapshot since %s. lastVer: %" PRId64 ", snapshotVer: %" PRId64, + sError("vgId:%d, failed to restore log store from snapshot since %s. lastVer:%" PRId64 ", snapshotVer:%" PRId64, pNode->vgId, terrstr(), lastVer, commitIndex); return -1; } @@ -1112,7 +1112,7 @@ int32_t syncNodeRestore(SSyncNode* pSyncNode) { SyncIndex endIndex = pSyncNode->pLogBuf->endIndex; if (lastVer != -1 && endIndex != lastVer + 1) { terrno = TSDB_CODE_WAL_LOG_INCOMPLETE; - sError("vgId:%d, failed to restore sync node since %s. expected lastLogIndex: %" PRId64 ", lastVer: %" PRId64 "", + sError("vgId:%d, failed to restore sync node since %s. expected lastLogIndex:%" PRId64 ", lastVer:%" PRId64 "", pSyncNode->vgId, terrstr(), endIndex - 1, lastVer); return -1; } @@ -1831,7 +1831,7 @@ void syncNodeCandidate2Leader(SSyncNode* pSyncNode) { SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); ASSERT(lastIndex >= 0); - sInfo("vgId:%d, become leader. term: %" PRId64 ", commit index: %" PRId64 ", last index: %" PRId64 "", + sInfo("vgId:%d, become leader. term:%" PRId64 ", commit index:%" PRId64 ", last index:%" PRId64 "", pSyncNode->vgId, pSyncNode->raftStore.currentTerm, pSyncNode->commitIndex, lastIndex); } @@ -1850,7 +1850,7 @@ void syncNodeFollower2Candidate(SSyncNode* pSyncNode) { ASSERT(pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER); pSyncNode->state = TAOS_SYNC_STATE_CANDIDATE; SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); - sInfo("vgId:%d, become candidate from follower. term: %" PRId64 ", commit index: %" PRId64 ", last index: %" PRId64, + sInfo("vgId:%d, become candidate from follower. term:%" PRId64 ", commit index:%" PRId64 ", last index:%" PRId64, pSyncNode->vgId, pSyncNode->raftStore.currentTerm, pSyncNode->commitIndex, lastIndex); sNTrace(pSyncNode, "follower to candidate"); @@ -1860,7 +1860,7 @@ void syncNodeLeader2Follower(SSyncNode* pSyncNode) { ASSERT(pSyncNode->state == TAOS_SYNC_STATE_LEADER); syncNodeBecomeFollower(pSyncNode, "leader to follower"); SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); - sInfo("vgId:%d, become follower from leader. term: %" PRId64 ", commit index: %" PRId64 ", last index: %" PRId64, + sInfo("vgId:%d, become follower from leader. term:%" PRId64 ", commit index:%" PRId64 ", last index:%" PRId64, pSyncNode->vgId, pSyncNode->raftStore.currentTerm, pSyncNode->commitIndex, lastIndex); sNTrace(pSyncNode, "leader to follower"); @@ -1870,7 +1870,7 @@ void syncNodeCandidate2Follower(SSyncNode* pSyncNode) { ASSERT(pSyncNode->state == TAOS_SYNC_STATE_CANDIDATE); syncNodeBecomeFollower(pSyncNode, "candidate to follower"); SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); - sInfo("vgId:%d, become follower from candidate. term: %" PRId64 ", commit index: %" PRId64 ", last index: %" PRId64, + sInfo("vgId:%d, become follower from candidate. term:%" PRId64 ", commit index:%" PRId64 ", last index:%" PRId64, pSyncNode->vgId, pSyncNode->raftStore.currentTerm, pSyncNode->commitIndex, lastIndex); sNTrace(pSyncNode, "candidate to follower"); @@ -2310,7 +2310,7 @@ int32_t syncNodeAppend(SSyncNode* ths, SSyncRaftEntry* pEntry) { // proceed match index, with replicating on needed SyncIndex matchIndex = syncLogBufferProceed(ths->pLogBuf, ths, NULL); - sTrace("vgId:%d, append raft entry. index: %" PRId64 ", term: %" PRId64 " pBuf: [%" PRId64 " %" PRId64 " %" PRId64 + sTrace("vgId:%d, append raft entry. index:%" PRId64 ", term:%" PRId64 " pBuf: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", ths->vgId, pEntry->index, pEntry->term, ths->pLogBuf->startIndex, ths->pLogBuf->commitIndex, ths->pLogBuf->matchIndex, ths->pLogBuf->endIndex); @@ -2483,7 +2483,7 @@ int32_t syncNodeOnHeartbeat(SSyncNode* ths, const SRpcMsg* pRpcMsg) { sError("vgId:%d, sync enqueue step-down msg error, code:%d", ths->vgId, code); rpcFreeCont(rpcMsgLocalCmd.pCont); } else { - sTrace("vgId:%d, sync enqueue step-down msg, new-term: %" PRId64, ths->vgId, pSyncMsg->currentTerm); + sTrace("vgId:%d, sync enqueue step-down msg, new-term:%" PRId64, ths->vgId, pSyncMsg->currentTerm); } } } @@ -2549,7 +2549,7 @@ int32_t syncNodeOnLocalCmd(SSyncNode* ths, const SRpcMsg* pRpcMsg) { (void)syncNodeUpdateCommitIndex(ths, pMsg->commitIndex); } if (syncLogBufferCommit(ths->pLogBuf, ths, ths->commitIndex) < 0) { - sError("vgId:%d, failed to commit raft log since %s. commit index: %" PRId64 "", ths->vgId, terrstr(), + sError("vgId:%d, failed to commit raft log since %s. commit index:%" PRId64 "", ths->vgId, terrstr(), ths->commitIndex); } } else { diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index bb3bb0d6a4..b3eb5684cf 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -132,16 +132,16 @@ SSyncRaftEntry* syncEntryBuildDummy(SyncTerm term, SyncIndex index, int32_t vgId int32_t syncLogValidateAlignmentOfCommit(SSyncNode* pNode, SyncIndex commitIndex) { SyncIndex firstVer = pNode->pLogStore->syncLogBeginIndex(pNode->pLogStore); if (firstVer > commitIndex + 1) { - sError("vgId:%d, firstVer of WAL log greater than tsdb commit version + 1. firstVer: %" PRId64 - ", tsdb commit version: %" PRId64 "", + sError("vgId:%d, firstVer of WAL log greater than tsdb commit version + 1. firstVer:%" PRId64 + ", tsdb commit version:%" PRId64 "", pNode->vgId, firstVer, commitIndex); return -1; } SyncIndex lastVer = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore); if (lastVer < commitIndex) { - sError("vgId:%d, lastVer of WAL log less than tsdb commit version. lastVer: %" PRId64 - ", tsdb commit version: %" PRId64 "", + sError("vgId:%d, lastVer of WAL log less than tsdb commit version. lastVer:%" PRId64 + ", tsdb commit version:%" PRId64 "", pNode->vgId, lastVer, commitIndex); return -1; } @@ -293,7 +293,7 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt bool inBuf = true; if (index <= pBuf->commitIndex) { - sTrace("vgId:%d, already committed. index: %" PRId64 ", term: %" PRId64 ". log buffer: [%" PRId64 " %" PRId64 + sTrace("vgId:%d, already committed. index:%" PRId64 ", term:%" PRId64 ". log buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", pNode->vgId, pEntry->index, pEntry->term, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); @@ -306,7 +306,7 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt } if (index - pBuf->startIndex >= pBuf->size) { - sWarn("vgId:%d, out of buffer range. index: %" PRId64 ", term: %" PRId64 ". log buffer: [%" PRId64 " %" PRId64 + sWarn("vgId:%d, out of buffer range. index:%" PRId64 ", term:%" PRId64 ". log buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", pNode->vgId, pEntry->index, pEntry->term, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); @@ -314,8 +314,8 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt } if (index > pBuf->matchIndex && lastMatchTerm != prevTerm) { - sWarn("vgId:%d, not ready to accept. index: %" PRId64 ", term: %" PRId64 ": prevterm: %" PRId64 - " != lastmatch: %" PRId64 ". log buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", + sWarn("vgId:%d, not ready to accept. index:%" PRId64 ", term:%" PRId64 ": prevterm:%" PRId64 + " != lastmatch:%" PRId64 ". log buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", pNode->vgId, pEntry->index, pEntry->term, prevTerm, lastMatchTerm, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); goto _out; @@ -328,7 +328,7 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt if (pEntry->term != pExist->term) { (void)syncLogBufferRollback(pBuf, pNode, index); } else { - sTrace("vgId:%d, duplicate log entry received. index: %" PRId64 ", term: %" PRId64 ". log buffer: [%" PRId64 + sTrace("vgId:%d, duplicate log entry received. index:%" PRId64 ", term:%" PRId64 ". log buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", pNode->vgId, pEntry->index, pEntry->term, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); @@ -434,7 +434,7 @@ int64_t syncLogBufferProceed(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncTerm* p // increase match index pBuf->matchIndex = index; - sTrace("vgId:%d, log buffer proceed. start index: %" PRId64 ", match index: %" PRId64 ", end index: %" PRId64, + sTrace("vgId:%d, log buffer proceed. start index:%" PRId64 ", match index:%" PRId64 ", end index:%" PRId64, pNode->vgId, pBuf->startIndex, pBuf->matchIndex, pBuf->endIndex); // replicate on demand @@ -475,7 +475,7 @@ int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, Syn } if (pEntry->originalRpcType == TDMT_VND_COMMIT) { - sInfo("vgId:%d, fsm execute vnode commit. index: %" PRId64 ", term: %" PRId64 "", pNode->vgId, pEntry->index, + sInfo("vgId:%d, fsm execute vnode commit. index:%" PRId64 ", term:%" PRId64 "", pNode->vgId, pEntry->index, pEntry->term); } @@ -528,7 +528,7 @@ int32_t syncLogBufferCommit(SSyncLogBuffer* pBuf, SSyncNode* pNode, int64_t comm goto _out; } - sTrace("vgId:%d, commit. log buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 "), role: %d, term: %" PRId64, + sTrace("vgId:%d, commit. log buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 "), role:%d, term:%" PRId64, pNode->vgId, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex, role, term); // execute in fsm @@ -541,19 +541,19 @@ int32_t syncLogBufferCommit(SSyncLogBuffer* pBuf, SSyncNode* pNode, int64_t comm // execute it if (!syncUtilUserCommit(pEntry->originalRpcType)) { - sInfo("vgId:%d, commit sync barrier. index: %" PRId64 ", term:%" PRId64 ", type: %s", vgId, pEntry->index, + sInfo("vgId:%d, commit sync barrier. index:%" PRId64 ", term:%" PRId64 ", type:%s", vgId, pEntry->index, pEntry->term, TMSG_INFO(pEntry->originalRpcType)); } if (syncLogFsmExecute(pNode, pFsm, role, term, pEntry, 0) != 0) { sError("vgId:%d, failed to execute sync log entry. index:%" PRId64 ", term:%" PRId64 - ", role: %d, current term: %" PRId64, + ", role:%d, current term:%" PRId64, vgId, pEntry->index, pEntry->term, role, term); goto _out; } pBuf->commitIndex = index; - sTrace("vgId:%d, committed index: %" PRId64 ", term: %" PRId64 ", role: %d, current term: %" PRId64 "", pNode->vgId, + sTrace("vgId:%d, committed index:%" PRId64 ", term:%" PRId64 ", role:%d, current term:%" PRId64 "", pNode->vgId, pEntry->index, pEntry->term, role, term); if (!inBuf) { @@ -614,7 +614,7 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { SRaftId* pDestId = &pNode->replicasId[pMgr->peerId]; if (pMgr->retryBackoff == SYNC_MAX_RETRY_BACKOFF) { syncLogReplMgrReset(pMgr); - sWarn("vgId:%d, reset sync log repl mgr since retry backoff exceeding limit. peer: %" PRIx64, pNode->vgId, + sWarn("vgId:%d, reset sync log repl mgr since retry backoff exceeding limit. peer:%" PRIx64, pNode->vgId, pDestId->addr); return -1; } @@ -639,7 +639,7 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { if (pMgr->states[pos].acked) { if (pMgr->matchIndex < index && pMgr->states[pos].timeMs + (syncGetRetryMaxWaitMs() << 3) < nowMs) { syncLogReplMgrReset(pMgr); - sWarn("vgId:%d, reset sync log repl mgr since stagnation. index: %" PRId64 ", peer: %" PRIx64, pNode->vgId, + sWarn("vgId:%d, reset sync log repl mgr since stagnation. index:%" PRId64 ", peer:%" PRIx64, pNode->vgId, index, pDestId->addr); goto _out; } @@ -648,7 +648,7 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { bool barrier = false; if (syncLogReplMgrReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) { - sError("vgId:%d, failed to replicate sync log entry since %s. index: %" PRId64 ", dest: %" PRIx64 "", pNode->vgId, + sError("vgId:%d, failed to replicate sync log entry since %s. index:%" PRId64 ", dest:%" PRIx64 "", pNode->vgId, terrstr(), index, pDestId->addr); goto _out; } @@ -670,8 +670,8 @@ _out: if (retried) { pMgr->retryBackoff = syncLogGetNextRetryBackoff(pMgr); SSyncLogBuffer* pBuf = pNode->pLogBuf; - sInfo("vgId:%d, resend %d sync log entries. dest: %" PRIx64 ", indexes: %" PRId64 " ..., terms: ... %" PRId64 - ", retryWaitMs: %" PRId64 ", mgr: [%" PRId64 " %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 + sInfo("vgId:%d, resend %d sync log entries. dest:%" PRIx64 ", indexes:%" PRId64 " ..., terms: ... %" PRId64 + ", retryWaitMs:%" PRId64 ", mgr: [%" PRId64 " %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", pNode->vgId, count, pDestId->addr, firstIndex, term, retryWaitMs, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); @@ -714,7 +714,7 @@ int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* p } if (pMsg->success == false && pMsg->matchIndex >= pMsg->lastSendIndex) { - sWarn("vgId:%d, failed to rollback match index. peer: dnode:%d, match index: %" PRId64 ", last sent: %" PRId64, + sWarn("vgId:%d, failed to rollback match index. peer: dnode:%d, match index:%" PRId64 ", last sent:%" PRId64, pNode->vgId, DID(&destId), pMsg->matchIndex, pMsg->lastSendIndex); if (syncNodeStartSnapshot(pNode, &destId) < 0) { sError("vgId:%d, failed to start snapshot for peer dnode:%d", pNode->vgId, DID(&destId)); @@ -761,7 +761,7 @@ int32_t syncLogReplMgrProcessHeartbeatReply(SSyncLogReplMgr* pMgr, SSyncNode* pN SSyncLogBuffer* pBuf = pNode->pLogBuf; taosThreadMutexLock(&pBuf->mutex); if (pMsg->startTime != 0 && pMsg->startTime != pMgr->peerStartTime) { - sInfo("vgId:%d, reset sync log repl mgr in heartbeat. peer: %" PRIx64 ", start time:%" PRId64 ", old:%" PRId64 "", + sInfo("vgId:%d, reset sync log repl mgr in heartbeat. peer:%" PRIx64 ", start time:%" PRId64 ", old:%" PRId64 "", pNode->vgId, pMsg->srcId.addr, pMsg->startTime, pMgr->peerStartTime); syncLogReplMgrReset(pMgr); pMgr->peerStartTime = pMsg->startTime; @@ -774,7 +774,7 @@ int32_t syncLogReplMgrProcessReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sync SSyncLogBuffer* pBuf = pNode->pLogBuf; taosThreadMutexLock(&pBuf->mutex); if (pMsg->startTime != pMgr->peerStartTime) { - sInfo("vgId:%d, reset sync log repl mgr in appendlog reply. peer: %" PRIx64 ", start time:%" PRId64 + sInfo("vgId:%d, reset sync log repl mgr in appendlog reply. peer:%" PRIx64 ", start time:%" PRId64 ", old:%" PRId64, pNode->vgId, pMsg->srcId.addr, pMsg->startTime, pMgr->peerStartTime); syncLogReplMgrReset(pMgr); @@ -815,7 +815,7 @@ int32_t syncLogReplMgrReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sy bool barrier = false; SyncTerm term = -1; if (syncLogReplMgrReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) { - sError("vgId:%d, failed to replicate log entry since %s. index: %" PRId64 ", dest: 0x%016" PRIx64 "", pNode->vgId, + sError("vgId:%d, failed to replicate log entry since %s. index:%" PRId64 ", dest: 0x%016" PRIx64 "", pNode->vgId, terrstr(), index, pDestId->addr); return -1; } @@ -830,7 +830,7 @@ int32_t syncLogReplMgrReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sy pMgr->endIndex = index + 1; SSyncLogBuffer* pBuf = pNode->pLogBuf; - sTrace("vgId:%d, probe peer:%" PRIx64 " with msg of index:%" PRId64 " term: %" PRId64 ". mgr (rs:%d): [%" PRId64 + sTrace("vgId:%d, probe peer:%" PRIx64 " with msg of index:%" PRId64 " term:%" PRId64 ". mgr (rs:%d): [%" PRId64 " %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", pNode->vgId, pDestId->addr, index, term, pMgr->restored, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); @@ -860,7 +860,7 @@ int32_t syncLogReplMgrReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode) bool barrier = false; SyncTerm term = -1; if (syncLogReplMgrReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) { - sError("vgId:%d, failed to replicate log entry since %s. index: %" PRId64 ", dest: 0x%016" PRIx64 "", pNode->vgId, + sError("vgId:%d, failed to replicate log entry since %s. index:%" PRId64 ", dest: 0x%016" PRIx64 "", pNode->vgId, terrstr(), index, pDestId->addr); return -1; } @@ -874,7 +874,7 @@ int32_t syncLogReplMgrReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode) pMgr->endIndex = index + 1; if (barrier) { - sInfo("vgId:%d, replicated sync barrier to dest: %" PRIx64 ". index: %" PRId64 ", term: %" PRId64 + sInfo("vgId:%d, replicated sync barrier to dest:%" PRIx64 ". index:%" PRId64 ", term:%" PRId64 ", repl mgr: rs(%d) [%" PRId64 " %" PRId64 ", %" PRId64 ")", pNode->vgId, pDestId->addr, index, term, pMgr->restored, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex); @@ -885,7 +885,7 @@ int32_t syncLogReplMgrReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode) syncLogReplMgrRetryOnNeed(pMgr, pNode); SSyncLogBuffer* pBuf = pNode->pLogBuf; - sTrace("vgId:%d, replicated %d msgs to peer: %" PRIx64 ". indexes: %" PRId64 "..., terms: ...%" PRId64 + sTrace("vgId:%d, replicated %d msgs to peer:%" PRIx64 ". indexes:%" PRId64 "..., terms: ...%" PRId64 ", mgr: (rs:%d) [%" PRId64 " %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", pNode->vgId, count, pDestId->addr, firstIndex, term, pMgr->restored, pMgr->startIndex, pMgr->matchIndex, @@ -1028,7 +1028,7 @@ int32_t syncLogBufferRollback(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncIndex return 0; } - sInfo("vgId:%d, rollback sync log buffer. toindex: %" PRId64 ", buffer: [%" PRId64 " %" PRId64 " %" PRId64 + sInfo("vgId:%d, rollback sync log buffer. toindex:%" PRId64 ", buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", pNode->vgId, toIndex, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); @@ -1119,11 +1119,11 @@ int32_t syncLogReplMgrReplicateOneTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sy pEntry = syncLogBufferGetOneEntry(pBuf, pNode, index, &inBuf); if (pEntry == NULL) { - sError("vgId:%d, failed to get raft entry for index: %" PRId64 "", pNode->vgId, index); + sError("vgId:%d, failed to get raft entry for index:%" PRId64 "", pNode->vgId, index); if (terrno == TSDB_CODE_WAL_LOG_NOT_EXIST) { SSyncLogReplMgr* pMgr = syncNodeGetLogReplMgr(pNode, pDestId); if (pMgr) { - sInfo("vgId:%d, reset sync log repl mgr of peer: %" PRIx64 " since %s. index: %" PRId64, pNode->vgId, + sInfo("vgId:%d, reset sync log repl mgr of peer:%" PRIx64 " since %s. index:%" PRId64, pNode->vgId, pDestId->addr, terrstr(), index); (void)syncLogReplMgrReset(pMgr); } @@ -1134,7 +1134,7 @@ int32_t syncLogReplMgrReplicateOneTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sy prevLogTerm = syncLogReplMgrGetPrevLogTerm(pMgr, pNode, index); if (prevLogTerm < 0) { - sError("vgId:%d, failed to get prev log term since %s. index: %" PRId64 "", pNode->vgId, terrstr(), index); + sError("vgId:%d, failed to get prev log term since %s. index:%" PRId64 "", pNode->vgId, terrstr(), index); goto _err; } if (pTerm) *pTerm = pEntry->term; @@ -1147,7 +1147,7 @@ int32_t syncLogReplMgrReplicateOneTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sy (void)syncNodeSendAppendEntries(pNode, pDestId, &msgOut); - sTrace("vgId:%d, replicate one msg index: %" PRId64 " term: %" PRId64 " prevterm: %" PRId64 " to dest: 0x%016" PRIx64, + sTrace("vgId:%d, replicate one msg index:%" PRId64 " term:%" PRId64 " prevterm:%" PRId64 " to dest: 0x%016" PRIx64, pNode->vgId, pEntry->index, pEntry->term, prevLogTerm, pDestId->addr); if (!inBuf) { diff --git a/source/libs/sync/src/syncRaftEntry.c b/source/libs/sync/src/syncRaftEntry.c index 988a86cc67..623f1b77a4 100644 --- a/source/libs/sync/src/syncRaftEntry.c +++ b/source/libs/sync/src/syncRaftEntry.c @@ -91,7 +91,7 @@ SSyncRaftEntry* syncEntryBuildNoop(SyncTerm term, SyncIndex index, int32_t vgId) void syncEntryDestroy(SSyncRaftEntry* pEntry) { if (pEntry != NULL) { - sTrace("free entry: %p", pEntry); + sTrace("free entry:%p", pEntry); taosMemoryFree(pEntry); } } diff --git a/source/libs/sync/src/syncRaftLog.c b/source/libs/sync/src/syncRaftLog.c index e6569d9974..9299651999 100644 --- a/source/libs/sync/src/syncRaftLog.c +++ b/source/libs/sync/src/syncRaftLog.c @@ -249,6 +249,7 @@ int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncR int64_t ts2 = taosGetTimestampNs(); code = walReadVer(pWalHandle, index); + walReadReset(pWalHandle); int64_t ts3 = taosGetTimestampNs(); // code = walReadVerCached(pWalHandle, index); diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index e61bcc9ffc..18f263cc95 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -510,16 +510,8 @@ SyncIndex syncNodeGetSnapBeginIndex(SSyncNode *ths) { SSyncLogStoreData *pData = ths->pLogStore->data; SWal *pWal = pData->pWal; - bool isEmpty = ths->pLogStore->syncLogIsEmpty(ths->pLogStore); int64_t walCommitVer = walGetCommittedVer(pWal); - - if (!isEmpty && ths->commitIndex != walCommitVer) { - sNError(ths, "commit not same, wal-commit:%" PRId64 ", commit:%" PRId64 ", ignore", walCommitVer, - ths->commitIndex); - snapStart = walCommitVer + 1; - } else { - snapStart = ths->commitIndex + 1; - } + snapStart = TMAX(ths->commitIndex, walCommitVer) + 1; sNInfo(ths, "snapshot begin index is %" PRId64, snapStart); } diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index 6a50572cba..97641b8f41 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -43,7 +43,7 @@ void syncUtilNodeInfo2EpSet(const SNodeInfo* pInfo, SEpSet* pEpSet) { bool syncUtilNodeInfo2RaftId(const SNodeInfo* pInfo, SyncGroupId vgId, SRaftId* raftId) { uint32_t ipv4 = taosGetIpv4FromFqdn(pInfo->nodeFqdn); if (ipv4 == 0xFFFFFFFF || ipv4 == 1) { - sError("failed to resolve ipv4 addr, fqdn: %s", pInfo->nodeFqdn); + sError("failed to resolve ipv4 addr, fqdn:%s", pInfo->nodeFqdn); terrno = TSDB_CODE_TSC_INVALID_FQDN; return false; } diff --git a/source/libs/tdb/src/db/tdbPage.c b/source/libs/tdb/src/db/tdbPage.c index f19c3f28c0..c6310f4985 100644 --- a/source/libs/tdb/src/db/tdbPage.c +++ b/source/libs/tdb/src/db/tdbPage.c @@ -484,77 +484,50 @@ static int tdbPageFree(SPage *pPage, int idx, SCell *pCell, int szCell) { return 0; } +typedef struct { + int32_t iCell; + int32_t offset; +} SCellIdx; +static int32_t tCellIdxCmprFn(const void *p1, const void *p2) { + if (((SCellIdx *)p1)->offset < ((SCellIdx *)p2)->offset) { + return -1; + } else if (((SCellIdx *)p1)->offset > ((SCellIdx *)p2)->offset) { + return 1; + } else { + return 0; + } +} static int tdbPageDefragment(SPage *pPage) { - int nFree; - int nCells; - SCell *pCell; - SCell *pNextCell; - SCell *pTCell; - int szCell; - int idx; - int iCell; + int32_t nFree = TDB_PAGE_NFREE(pPage); + int32_t nCell = TDB_PAGE_NCELLS(pPage); - nFree = TDB_PAGE_NFREE(pPage); - nCells = TDB_PAGE_NCELLS(pPage); - - if (pPage->pFreeEnd - pPage->pFreeStart >= nFree) { - tdbError("tdb/page-defragment: invalid free range, nFree: %d.", nFree); - return -1; + SCellIdx *aCellIdx = (SCellIdx *)tdbOsMalloc(sizeof(SCellIdx) * nCell); + if (aCellIdx == NULL) return -1; + for (int32_t iCell = 0; iCell < nCell; iCell++) { + aCellIdx[iCell].iCell = iCell; + aCellIdx[iCell].offset = TDB_PAGE_CELL_OFFSET_AT(pPage, iCell); } + taosSort(aCellIdx, nCell, sizeof(SCellIdx), tCellIdxCmprFn); - // Loop to compact the page content - // Here we use an O(n^2) algorithm to do the job since - // this is a low frequency job. - pNextCell = (u8 *)pPage->pPageFtr; - pCell = NULL; - for (iCell = 0;; iCell++) { - // compact over - if (iCell == nCells) { - pPage->pFreeEnd = pNextCell; - break; + SCell *pNextCell = (u8 *)pPage->pPageFtr; + for (int32_t iCell = nCell - 1; iCell >= 0; iCell--) { + SCell *pCell = TDB_PAGE_CELL_AT(pPage, aCellIdx[iCell].iCell); + int32_t szCell = pPage->xCellSize(pPage, pCell, 0, NULL, NULL); + + ASSERT(pNextCell - szCell >= pCell); + + pNextCell -= szCell; + if (pNextCell > pCell) { + memmove(pNextCell, pCell, szCell); + TDB_PAGE_CELL_OFFSET_AT_SET(pPage, aCellIdx[iCell].iCell, pNextCell - pPage->pData); } - - for (int i = 0; i < nCells; i++) { - if (TDB_PAGE_CELL_OFFSET_AT(pPage, i) < pNextCell - pPage->pData) { - pTCell = TDB_PAGE_CELL_AT(pPage, i); - if (pCell == NULL || pCell < pTCell) { - pCell = pTCell; - idx = i; - } - } else { - continue; - } - } - - if (NULL == pCell) { - tdbError("tdb/page-defragment: null ptr pCell."); - return -1; - } - - szCell = (*pPage->xCellSize)(pPage, pCell, 0, NULL, NULL); - - if (pCell + szCell > pNextCell) { - tdbError("tdb/page-defragment: invalid cell range, pCell: %p, szCell: %d, pNextCell: %p.", pCell, szCell, - pNextCell); - return -1; - } - - if (pCell + szCell < pNextCell) { - memmove(pNextCell - szCell, pCell, szCell); - } - - pCell = NULL; - pNextCell = pNextCell - szCell; - TDB_PAGE_CELL_OFFSET_AT_SET(pPage, idx, pNextCell - pPage->pData); } - - if (pPage->pFreeEnd - pPage->pFreeStart != nFree) { - tdbError("tdb/page-defragment: invalid free range, nFree: %d.", nFree); - return -1; - } - + pPage->pFreeEnd = pNextCell; TDB_PAGE_CCELLS_SET(pPage, pPage->pFreeEnd - pPage->pData); TDB_PAGE_FCELL_SET(pPage, 0); + tdbOsFree(aCellIdx); + + ASSERT(pPage->pFreeEnd - pPage->pFreeStart == nFree); return 0; } diff --git a/source/libs/tdb/test/CMakeLists.txt b/source/libs/tdb/test/CMakeLists.txt index 2621e02b02..fd4d7c101d 100644 --- a/source/libs/tdb/test/CMakeLists.txt +++ b/source/libs/tdb/test/CMakeLists.txt @@ -6,7 +6,11 @@ target_link_libraries(tdbTest tdb gtest gtest_main) add_executable(tdbUtilTest "tdbUtilTest.cpp") target_link_libraries(tdbUtilTest tdb gtest gtest_main) -# tdbUtilTest +# overflow pages testing add_executable(tdbExOVFLTest "tdbExOVFLTest.cpp") target_link_libraries(tdbExOVFLTest tdb gtest gtest_main) +# page defragment testing +add_executable(tdbPageDefragmentTest "tdbPageDefragmentTest.cpp") +target_link_libraries(tdbPageDefragmentTest tdb gtest gtest_main) + diff --git a/source/libs/tdb/test/tdbPageDefragmentTest.cpp b/source/libs/tdb/test/tdbPageDefragmentTest.cpp new file mode 100644 index 0000000000..7aeef94d14 --- /dev/null +++ b/source/libs/tdb/test/tdbPageDefragmentTest.cpp @@ -0,0 +1,722 @@ +#include + +#define ALLOW_FORBID_FUNC +#include "os.h" +#include "tdb.h" + +#include +#include +#include +#include +#include "tlog.h" + +typedef struct SPoolMem { + int64_t size; + struct SPoolMem *prev; + struct SPoolMem *next; +} SPoolMem; + +static SPoolMem *openPool() { + SPoolMem *pPool = (SPoolMem *)taosMemoryMalloc(sizeof(*pPool)); + + pPool->prev = pPool->next = pPool; + pPool->size = 0; + + return pPool; +} + +static void clearPool(SPoolMem *pPool) { + SPoolMem *pMem; + + do { + pMem = pPool->next; + + if (pMem == pPool) break; + + pMem->next->prev = pMem->prev; + pMem->prev->next = pMem->next; + pPool->size -= pMem->size; + + taosMemoryFree(pMem); + } while (1); + + assert(pPool->size == 0); +} + +static void closePool(SPoolMem *pPool) { + clearPool(pPool); + taosMemoryFree(pPool); +} + +static void *poolMalloc(void *arg, size_t size) { + void *ptr = NULL; + SPoolMem *pPool = (SPoolMem *)arg; + SPoolMem *pMem; + + pMem = (SPoolMem *)taosMemoryMalloc(sizeof(*pMem) + size); + if (pMem == NULL) { + assert(0); + } + + pMem->size = sizeof(*pMem) + size; + pMem->next = pPool->next; + pMem->prev = pPool; + + pPool->next->prev = pMem; + pPool->next = pMem; + pPool->size += pMem->size; + + ptr = (void *)(&pMem[1]); + return ptr; +} + +static void poolFree(void *arg, void *ptr) { + SPoolMem *pPool = (SPoolMem *)arg; + SPoolMem *pMem; + + pMem = &(((SPoolMem *)ptr)[-1]); + + pMem->next->prev = pMem->prev; + pMem->prev->next = pMem->next; + pPool->size -= pMem->size; + + taosMemoryFree(pMem); +} + +static int tKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2) { + int k1, k2; + + std::string s1((char *)pKey1 + 3, kLen1 - 3); + std::string s2((char *)pKey2 + 3, kLen2 - 3); + k1 = stoi(s1); + k2 = stoi(s2); + + if (k1 < k2) { + return -1; + } else if (k1 > k2) { + return 1; + } else { + return 0; + } +} + +static int tDefaultKeyCmpr(const void *pKey1, int keyLen1, const void *pKey2, int keyLen2) { + int mlen; + int cret; + + ASSERT(keyLen1 > 0 && keyLen2 > 0 && pKey1 != NULL && pKey2 != NULL); + + mlen = keyLen1 < keyLen2 ? keyLen1 : keyLen2; + cret = memcmp(pKey1, pKey2, mlen); + if (cret == 0) { + if (keyLen1 < keyLen2) { + cret = -1; + } else if (keyLen1 > keyLen2) { + cret = 1; + } else { + cret = 0; + } + } + return cret; +} + +// TEST(TdbPageDefragmentTest, DISABLED_TbUpsertTest) { +// TEST(TdbPageDefragmentTest, TbUpsertTest) { +//} + +// TEST(TdbPageDefragmentTest, DISABLED_TbPGetTest) { +// TEST(TdbPageDefragmentTest, TbPGetTest) { +//} + +static void generateBigVal(char *val, int valLen) { + for (int i = 0; i < valLen; ++i) { + char c = char(i & 0xff); + if (c == 0) { + c = 1; + } + val[i] = c; + } +} + +static TDB *openEnv(char const *envName, int const pageSize, int const pageNum) { + TDB *pEnv = NULL; + + int ret = tdbOpen(envName, pageSize, pageNum, &pEnv, 0); + if (ret) { + pEnv = NULL; + } + + return pEnv; +} + +static void insertOfp(void) { + int ret = 0; + + taosRemoveDir("tdb"); + + // open Env + int const pageSize = 4096; + int const pageNum = 64; + TDB *pEnv = openEnv("tdb", pageSize, pageNum); + GTEST_ASSERT_NE(pEnv, nullptr); + + // open db + TTB *pDb = NULL; + tdb_cmpr_fn_t compFunc = tKeyCmpr; + // ret = tdbTbOpen("ofp_insert.db", -1, -1, compFunc, pEnv, &pDb, 0); + ret = tdbTbOpen("ofp_insert.db", 12, -1, compFunc, pEnv, &pDb, 0); + GTEST_ASSERT_EQ(ret, 0); + + // open the pool + SPoolMem *pPool = openPool(); + + // start a transaction + TXN *txn = NULL; + + tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED); + + // generate value payload + // char val[((4083 - 4 - 3 - 2) + 1) * 100]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4) + char val[32605]; + int valLen = sizeof(val) / sizeof(val[0]); + generateBigVal(val, valLen); + + // insert the generated big data + // char const *key = "key1"; + char const *key = "key123456789"; + ret = tdbTbInsert(pDb, key, strlen(key), val, valLen, txn); + GTEST_ASSERT_EQ(ret, 0); + + // commit current transaction + tdbCommit(pEnv, txn); + tdbPostCommit(pEnv, txn); +} + +TEST(TdbPageDefragmentTest, DISABLED_TbInsertTest) { + // TEST(TdbPageDefragmentTest, TbInsertTest) { + // ofp inserting + insertOfp(); +} + +TEST(TdbPageDefragmentTest, DISABLED_TbGetTest) { + // TEST(TdbPageDefragmentTest, TbGetTest) { + insertOfp(); + + // open Env + int const pageSize = 4096; + int const pageNum = 64; + TDB *pEnv = openEnv("tdb", pageSize, pageNum); + GTEST_ASSERT_NE(pEnv, nullptr); + + // open db + TTB *pDb = NULL; + tdb_cmpr_fn_t compFunc = tKeyCmpr; + // int ret = tdbTbOpen("ofp_insert.db", -1, -1, compFunc, pEnv, &pDb, 0); + int ret = tdbTbOpen("ofp_insert.db", 12, -1, compFunc, pEnv, &pDb, 0); + GTEST_ASSERT_EQ(ret, 0); + + // generate value payload + // char val[((4083 - 4 - 3 - 2) + 1) * 100]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4) + char val[32605]; + int valLen = sizeof(val) / sizeof(val[0]); + generateBigVal(val, valLen); + + { // Query the data + void *pVal = NULL; + int vLen; + + // char const *key = "key1"; + char const *key = "key123456789"; + ret = tdbTbGet(pDb, key, strlen(key), &pVal, &vLen); + ASSERT(ret == 0); + GTEST_ASSERT_EQ(ret, 0); + + GTEST_ASSERT_EQ(vLen, valLen); + GTEST_ASSERT_EQ(memcmp(val, pVal, vLen), 0); + + tdbFree(pVal); + } +} + +TEST(TdbPageDefragmentTest, DISABLED_TbDeleteTest) { + // TEST(TdbPageDefragmentTest, TbDeleteTest) { + int ret = 0; + + taosRemoveDir("tdb"); + + // open Env + int const pageSize = 4096; + int const pageNum = 64; + TDB *pEnv = openEnv("tdb", pageSize, pageNum); + GTEST_ASSERT_NE(pEnv, nullptr); + + // open db + TTB *pDb = NULL; + tdb_cmpr_fn_t compFunc = tKeyCmpr; + ret = tdbTbOpen("ofp_insert.db", -1, -1, compFunc, pEnv, &pDb, 0); + GTEST_ASSERT_EQ(ret, 0); + + // open the pool + SPoolMem *pPool = openPool(); + + // start a transaction + TXN *txn; + + tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED); + + // generate value payload + // char val[((4083 - 4 - 3 - 2) + 1) * 100]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4) + char val[((4083 - 4 - 3 - 2) + 1) * 2]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4) + int valLen = sizeof(val) / sizeof(val[0]); + generateBigVal(val, valLen); + + { // insert the generated big data + ret = tdbTbInsert(pDb, "key1", strlen("key1"), val, valLen, txn); + GTEST_ASSERT_EQ(ret, 0); + } + + { // query the data + void *pVal = NULL; + int vLen; + + ret = tdbTbGet(pDb, "key1", strlen("key1"), &pVal, &vLen); + ASSERT(ret == 0); + GTEST_ASSERT_EQ(ret, 0); + + GTEST_ASSERT_EQ(vLen, valLen); + GTEST_ASSERT_EQ(memcmp(val, pVal, vLen), 0); + + tdbFree(pVal); + } + /* open to debug committed file +tdbCommit(pEnv, &txn); +tdbTxnClose(&txn); + +++txnid; +tdbTxnOpen(&txn, txnid, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED); +tdbBegin(pEnv, &txn); + */ + { // upsert the data + ret = tdbTbUpsert(pDb, "key1", strlen("key1"), "value1", strlen("value1"), txn); + GTEST_ASSERT_EQ(ret, 0); + } + + { // query the upserted data + void *pVal = NULL; + int vLen; + + ret = tdbTbGet(pDb, "key1", strlen("key1"), &pVal, &vLen); + ASSERT(ret == 0); + GTEST_ASSERT_EQ(ret, 0); + + GTEST_ASSERT_EQ(vLen, strlen("value1")); + GTEST_ASSERT_EQ(memcmp("value1", pVal, vLen), 0); + + tdbFree(pVal); + } + + { // delete the data + ret = tdbTbDelete(pDb, "key1", strlen("key1"), txn); + GTEST_ASSERT_EQ(ret, 0); + } + + { // query the deleted data + void *pVal = NULL; + int vLen = -1; + + ret = tdbTbGet(pDb, "key1", strlen("key1"), &pVal, &vLen); + ASSERT(ret == -1); + GTEST_ASSERT_EQ(ret, -1); + + GTEST_ASSERT_EQ(vLen, -1); + GTEST_ASSERT_EQ(pVal, nullptr); + + tdbFree(pVal); + } + + // commit current transaction + tdbCommit(pEnv, txn); + tdbPostCommit(pEnv, txn); +} + +TEST(TdbPageDefragmentTest, DISABLED_simple_insert1) { + // TEST(TdbPageDefragmentTest, simple_insert1) { + int ret; + TDB *pEnv; + TTB *pDb; + tdb_cmpr_fn_t compFunc; + int nData = 1; + TXN *txn; + int const pageSize = 4096; + + taosRemoveDir("tdb"); + + // Open Env + ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0); + GTEST_ASSERT_EQ(ret, 0); + + // Create a database + compFunc = tKeyCmpr; + ret = tdbTbOpen("db.db", -1, -1, compFunc, pEnv, &pDb, 0); + GTEST_ASSERT_EQ(ret, 0); + + { + char key[64]; + // char val[(4083 - 4 - 3 - 2)]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4) + char val[(4083 - 4 - 3 - 2) + 1]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4) + int64_t poolLimit = 4096; // 1M pool limit + SPoolMem *pPool; + + // open the pool + pPool = openPool(); + + // start a transaction + tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED); + + for (int iData = 1; iData <= nData; iData++) { + sprintf(key, "key0"); + sprintf(val, "value%d", iData); + + // ret = tdbTbInsert(pDb, key, strlen(key), val, strlen(val), &txn); + // GTEST_ASSERT_EQ(ret, 0); + + // generate value payload + int valLen = sizeof(val) / sizeof(val[0]); + for (int i = 6; i < valLen; ++i) { + char c = char(i & 0xff); + if (c == 0) { + c = 1; + } + val[i] = c; + } + + ret = tdbTbInsert(pDb, "key1", strlen("key1"), val, valLen, txn); + GTEST_ASSERT_EQ(ret, 0); + + // if pool is full, commit the transaction and start a new one + if (pPool->size >= poolLimit) { + // commit current transaction + tdbCommit(pEnv, txn); + tdbPostCommit(pEnv, txn); + + // start a new transaction + clearPool(pPool); + + tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED); + } + } + + // commit the transaction + tdbCommit(pEnv, txn); + tdbPostCommit(pEnv, txn); + + { // Query the data + void *pVal = NULL; + int vLen; + + for (int i = 1; i <= nData; i++) { + sprintf(key, "key%d", i); + // sprintf(val, "value%d", i); + + ret = tdbTbGet(pDb, key, strlen(key), &pVal, &vLen); + ASSERT(ret == 0); + GTEST_ASSERT_EQ(ret, 0); + + GTEST_ASSERT_EQ(vLen, sizeof(val) / sizeof(val[0])); + GTEST_ASSERT_EQ(memcmp(val, pVal, vLen), 0); + } + + tdbFree(pVal); + } + + { // Iterate to query the DB data + TBC *pDBC; + void *pKey = NULL; + void *pVal = NULL; + int vLen, kLen; + int count = 0; + + ret = tdbTbcOpen(pDb, &pDBC, NULL); + GTEST_ASSERT_EQ(ret, 0); + + tdbTbcMoveToFirst(pDBC); + + for (;;) { + ret = tdbTbcNext(pDBC, &pKey, &kLen, &pVal, &vLen); + if (ret < 0) break; + + // std::cout.write((char *)pKey, kLen) /* << " " << kLen */ << " "; + // std::cout.write((char *)pVal, vLen) /* << " " << vLen */; + // std::cout << std::endl; + + count++; + } + + GTEST_ASSERT_EQ(count, nData); + + tdbTbcClose(pDBC); + + tdbFree(pKey); + tdbFree(pVal); + } + } + + ret = tdbTbDrop(pDb); + GTEST_ASSERT_EQ(ret, 0); + + // Close a database + tdbTbClose(pDb); + + // Close Env + ret = tdbClose(pEnv); + GTEST_ASSERT_EQ(ret, 0); +} + +// TEST(TdbPageDefragmentTest, DISABLED_seq_insert) { +TEST(TdbPageDefragmentTest, seq_insert) { + int ret = 0; + TDB *pEnv = NULL; + TTB *pDb = NULL; + tdb_cmpr_fn_t compFunc; + int nData = 64 * 1024; + TXN *txn = NULL; + int const pageSize = 1 * 1024 * 1024; + + taosRemoveDir("tdb"); + + // Open Env + ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0); + GTEST_ASSERT_EQ(ret, 0); + + // Create a database + compFunc = tKeyCmpr; + ret = tdbTbOpen("db.db", -1, -1, compFunc, pEnv, &pDb, 0); + GTEST_ASSERT_EQ(ret, 0); + + // 1, insert nData kv + { + char key[64]; + // char val[(4083 - 4 - 3 - 2)]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4) + char val[(4083 - 4 - 3 - 2) + 1]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4) + int64_t poolLimit = 4096; // 1M pool limit + SPoolMem *pPool; + + // open the pool + pPool = openPool(); + + // start a transaction + tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED); + + for (int iData = 0; iData < nData; ++iData) { + sprintf(key, "key%d", iData); + sprintf(val, "value%d", iData); + + ret = tdbTbInsert(pDb, key, strlen(key), val, strlen(val), txn); + GTEST_ASSERT_EQ(ret, 0); + /* + // generate value payload + int valLen = sizeof(val) / sizeof(val[0]); + for (int i = 6; i < valLen; ++i) { + char c = char(i & 0xff); + if (c == 0) { + c = 1; + } + val[i] = c; + } + + ret = tdbTbInsert(pDb, key, strlen(key), val, valLen, txn); + GTEST_ASSERT_EQ(ret, 0); + */ + // if pool is full, commit the transaction and start a new one + if (pPool->size >= poolLimit) { + // commit current transaction + tdbCommit(pEnv, txn); + tdbPostCommit(pEnv, txn); + + // start a new transaction + clearPool(pPool); + + tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED); + } + } + + // commit the transaction + tdbCommit(pEnv, txn); + tdbPostCommit(pEnv, txn); + + // 2, delete nData/2 records + } + + // Close a database + tdbTbClose(pDb); + + // Close Env + ret = tdbClose(pEnv); + GTEST_ASSERT_EQ(ret, 0); +} + +// TEST(TdbPageDefragmentTest, DISABLED_seq_delete) { +TEST(TdbPageDefragmentTest, seq_delete) { + int ret = 0; + TDB *pEnv = NULL; + TTB *pDb = NULL; + tdb_cmpr_fn_t compFunc; + int nData = 64 * 1024; + TXN *txn = NULL; + int const pageSize = 1 * 1024 * 1024; + + // Open Env + ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0); + GTEST_ASSERT_EQ(ret, 0); + + // Create a database + compFunc = tKeyCmpr; + ret = tdbTbOpen("db.db", -1, -1, compFunc, pEnv, &pDb, 0); + GTEST_ASSERT_EQ(ret, 0); + + // 2, delete nData/2 records + { + char key[64]; + // char val[(4083 - 4 - 3 - 2)]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4) + char val[(4083 - 4 - 3 - 2) + 1]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4) + int64_t poolLimit = 4096; // 1M pool limit + SPoolMem *pPool; + + // open the pool + pPool = openPool(); + + // start a transaction + tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED); + + for (int iData = 1; iData <= nData; iData++) { + if (iData % 2 == 0) continue; + + sprintf(key, "key%d", iData); + sprintf(val, "value%d", iData); + + { // delete the data + ret = tdbTbDelete(pDb, key, strlen(key), txn); + GTEST_ASSERT_EQ(ret, 0); + } + + /* + // generate value payload + int valLen = sizeof(val) / sizeof(val[0]); + for (int i = 6; i < valLen; ++i) { + char c = char(i & 0xff); + if (c == 0) { + c = 1; + } + val[i] = c; + } + + ret = tdbTbInsert(pDb, key, strlen(key), val, valLen, txn); + GTEST_ASSERT_EQ(ret, 0); + */ + // if pool is full, commit the transaction and start a new one + if (pPool->size >= poolLimit) { + // commit current transaction + tdbCommit(pEnv, txn); + tdbPostCommit(pEnv, txn); + + // start a new transaction + clearPool(pPool); + + tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED); + } + } + + // commit the transaction + tdbCommit(pEnv, txn); + tdbPostCommit(pEnv, txn); + } + + // Close a database + tdbTbClose(pDb); + + // Close Env + ret = tdbClose(pEnv); + GTEST_ASSERT_EQ(ret, 0); +} + +// TEST(TdbPageDefragmentTest, DISABLED_defragment_insert) { +TEST(TdbPageDefragmentTest, defragment_insert) { + int ret = 0; + TDB *pEnv = NULL; + TTB *pDb = NULL; + tdb_cmpr_fn_t compFunc; + int nData = 64 * 1024; + TXN *txn = NULL; + int const pageSize = 1 * 1024 * 1024; + + // Open Env + ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0); + GTEST_ASSERT_EQ(ret, 0); + + // Create a database + compFunc = tKeyCmpr; + ret = tdbTbOpen("db.db", -1, -1, compFunc, pEnv, &pDb, 0); + GTEST_ASSERT_EQ(ret, 0); + + // 3, insert 32k records + { + char key[64]; + // char val[(4083 - 4 - 3 - 2)]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4) + char val[(4083 - 4 - 3 - 2) + 1]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4) + int64_t poolLimit = 4096; // 1M pool limit + SPoolMem *pPool; + + // open the pool + pPool = openPool(); + + // start a transaction + tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED); + + for (int iData = nData + 1; iData <= nData * 2; iData++) { + // if (iData % 2 == 0) continue; + sprintf(key, "key%d", iData); + sprintf(val, "value%d", iData); + + ret = tdbTbInsert(pDb, key, strlen(key), val, strlen(val), txn); + GTEST_ASSERT_EQ(ret, 0); + /* + // generate value payload + int valLen = sizeof(val) / sizeof(val[0]); + for (int i = 6; i < valLen; ++i) { + char c = char(i & 0xff); + if (c == 0) { + c = 1; + } + val[i] = c; + } + + ret = tdbTbInsert(pDb, key, strlen(key), val, valLen, txn); + GTEST_ASSERT_EQ(ret, 0); + */ + // if pool is full, commit the transaction and start a new one + if (pPool->size >= poolLimit) { + // commit current transaction + tdbCommit(pEnv, txn); + tdbPostCommit(pEnv, txn); + + // start a new transaction + clearPool(pPool); + + tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED); + } + } + + // commit the transaction + tdbCommit(pEnv, txn); + tdbPostCommit(pEnv, txn); + + // 2, delete nData/2 records + } + + // Close a database + tdbTbClose(pDb); + + // Close Env + ret = tdbClose(pEnv); + GTEST_ASSERT_EQ(ret, 0); +} diff --git a/source/libs/tfs/src/tfs.c b/source/libs/tfs/src/tfs.c index d73b65c3b5..1d20b4d43d 100644 --- a/source/libs/tfs/src/tfs.c +++ b/source/libs/tfs/src/tfs.c @@ -295,7 +295,7 @@ int32_t tfsRmdir(STfs *pTfs, const char *rname) { for (int32_t id = 0; id < pTier->ndisk; id++) { STfsDisk *pDisk = pTier->disks[id]; snprintf(aname, TMPNAME_LEN, "%s%s%s", pDisk->path, TD_DIRSEP, rname); - uInfo("tfs remove dir : path:%s aname:%s rname:[%s]", pDisk->path, aname, rname); + uInfo("tfs remove dir:%s aname:%s rname:[%s]", pDisk->path, aname, rname); taosRemoveDir(aname); } } diff --git a/source/libs/transport/src/tmsgcb.c b/source/libs/transport/src/tmsgcb.c index 9b8f1dfd07..fc95cab76e 100644 --- a/source/libs/transport/src/tmsgcb.c +++ b/source/libs/transport/src/tmsgcb.c @@ -60,11 +60,15 @@ void tmsgReleaseHandle(SRpcHandleInfo* pHandle, int8_t type) { (*defaultMsgCb.re void tmsgReportStartup(const char* name, const char* desc) { (*defaultMsgCb.reportStartupFp)(name, desc); } bool tmsgUpdateDnodeInfo(int32_t* dnodeId, int64_t* clusterId, char* fqdn, uint16_t* port) { - return (*defaultMsgCb.updateDnodeInfoFp)(defaultMsgCb.data, dnodeId, clusterId, fqdn, port); + if (defaultMsgCb.updateDnodeInfoFp) { + return (*defaultMsgCb.updateDnodeInfoFp)(defaultMsgCb.data, dnodeId, clusterId, fqdn, port); + } else { + return false; + } } void tmsgUpdateDnodeEpSet(SEpSet* epset) { for (int32_t i = 0; i < epset->numOfEps; ++i) { tmsgUpdateDnodeInfo(NULL, NULL, epset->eps[i].fqdn, &epset->eps[i].port); } -} \ No newline at end of file +} diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 1a99db5f99..111742a6f4 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -671,7 +671,7 @@ static SCliConn* cliCreateConn(SCliThrd* pThrd) { conn->stream = (uv_stream_t*)taosMemoryMalloc(sizeof(uv_tcp_t)); uv_tcp_init(pThrd->loop, (uv_tcp_t*)(conn->stream)); conn->stream->data = conn; - transSetConnOption((uv_tcp_t*)conn->stream); + // transSetConnOption((uv_tcp_t*)conn->stream); uv_timer_t* timer = taosArrayGetSize(pThrd->timerList) > 0 ? *(uv_timer_t**)taosArrayPop(pThrd->timerList) : NULL; if (timer == NULL) { @@ -778,7 +778,7 @@ static void cliSendCb(uv_write_t* req, int status) { SCliMsg* pMsg = !transQueueEmpty(&pConn->cliMsgs) ? transQueueGet(&pConn->cliMsgs, 0) : NULL; if (pMsg != NULL) { int64_t cost = taosGetTimestampUs() - pMsg->st; - if (cost > 1000) { + if (cost > 1000 * 20) { tWarn("%s conn %p send cost:%dus, send exception", CONN_GET_INST_LABEL(pConn), pConn, (int)cost); } } @@ -800,9 +800,12 @@ static void cliSendCb(uv_write_t* req, int status) { } void cliSend(SCliConn* pConn) { - bool empty = transQueueEmpty(&pConn->cliMsgs); - ASSERTS(empty == false, "trans-cli get invalid msg"); - if (empty == true) { + SCliThrd* pThrd = pConn->hostThrd; + STrans* pTransInst = pThrd->pTransInst; + + if (transQueueEmpty(&pConn->cliMsgs)) { + tError("%s conn %p not msg to send", pTransInst->label, pConn); + cliHandleExcept(pConn); return; } @@ -812,9 +815,6 @@ void cliSend(SCliConn* pConn) { STransConnCtx* pCtx = pCliMsg->ctx; - SCliThrd* pThrd = pConn->hostThrd; - STrans* pTransInst = pThrd->pTransInst; - STransMsg* pMsg = (STransMsg*)(&pCliMsg->msg); if (pMsg->pCont == 0) { pMsg->pCont = (void*)rpcMallocCont(0); @@ -1045,6 +1045,12 @@ static FORCE_INLINE uint32_t cliGetIpFromFqdnCache(SHashObj* cache, char* fqdn) uint32_t* v = taosHashGet(cache, fqdn, strlen(fqdn)); if (v == NULL) { addr = taosGetIpv4FromFqdn(fqdn); + if (addr == 0xffffffff) { + terrno = TAOS_SYSTEM_ERROR(errno); + tError("failed to get ip from fqdn:%s since %s", fqdn, terrstr()); + return addr; + } + taosHashPut(cache, fqdn, strlen(fqdn), &addr, sizeof(addr)); } else { addr = *v; @@ -1061,9 +1067,10 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { STransConnCtx* pCtx = pMsg->ctx; cliMayCvtFqdnToIp(&pCtx->epSet, &pThrd->cvtAddr); + STraceId* trace = &pMsg->msg.info.traceId; if (!EPSET_IS_VALID(&pCtx->epSet)) { - tError("invalid epset"); + tGError("%s, msg %s sent with invalid epset", pTransInst->label, TMSG_INFO(pMsg->msg.msgType)); destroyCmsg(pMsg); return; } @@ -1116,15 +1123,45 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { conn->ip = strdup(EPSET_GET_INUSE_IP(&pCtx->epSet)); conn->port = EPSET_GET_INUSE_PORT(&pCtx->epSet); + uint32_t ipaddr = cliGetIpFromFqdnCache(pThrd->fqdn2ipCache, conn->ip); + if (ipaddr == 0xffffffff) { + uv_timer_stop(conn->timer); + conn->timer->data = NULL; + taosArrayPush(pThrd->timerList, &conn->timer); + conn->timer = NULL; + + cliHandleExcept(conn); + return; + } + struct sockaddr_in addr; addr.sin_family = AF_INET; - addr.sin_addr.s_addr = cliGetIpFromFqdnCache(pThrd->fqdn2ipCache, conn->ip); + addr.sin_addr.s_addr = ipaddr; addr.sin_port = (uint16_t)htons((uint16_t)conn->port); - STraceId* trace = &(pMsg->msg.info.traceId); tGTrace("%s conn %p try to connect to %s:%d", pTransInst->label, conn, conn->ip, conn->port); + int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 4); + if (fd == -1) { + tGError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn, + tstrerror(TAOS_SYSTEM_ERROR(errno))); + cliHandleExcept(conn); + errno = 0; + return; + } + int ret = uv_tcp_open((uv_tcp_t*)conn->stream, fd); + if (ret != 0) { + tGError("%s conn %p failed to set stream, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret)); + cliHandleExcept(conn); + return; + } + ret = transSetConnOption((uv_tcp_t*)conn->stream); + if (ret != 0) { + tGError("%s conn %p failed to set socket opt, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret)); + cliHandleExcept(conn); + return; + } - int ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb); + ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb); if (ret != 0) { tGError("%s conn %p failed to connect to %s:%d, reason:%s", pTransInst->label, conn, conn->ip, conn->port, uv_err_name(ret)); @@ -1139,7 +1176,6 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { } uv_timer_start(conn->timer, cliConnTimeout, TRANS_CONN_TIMEOUT, 0); } - STraceId* trace = &pMsg->msg.info.traceId; tGTrace("%s conn %p ready", pTransInst->label, conn); } static void cliAsyncCb(uv_async_t* handle) { @@ -1275,7 +1311,11 @@ void* transInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads, for (int i = 0; i < cli->numOfThreads; i++) { SCliThrd* pThrd = createThrdObj(shandle); - int err = taosThreadCreate(&pThrd->thread, NULL, cliWorkThread, (void*)(pThrd)); + if (pThrd == NULL) { + return NULL; + } + + int err = taosThreadCreate(&pThrd->thread, NULL, cliWorkThread, (void*)(pThrd)); if (err == 0) { tDebug("success to create tranport-cli thread:%d", i); } @@ -1332,9 +1372,23 @@ static SCliThrd* createThrdObj(void* trans) { taosThreadMutexInit(&pThrd->msgMtx, NULL); pThrd->loop = (uv_loop_t*)taosMemoryMalloc(sizeof(uv_loop_t)); - uv_loop_init(pThrd->loop); - + int err = uv_loop_init(pThrd->loop); + if (err != 0) { + tError("failed to init uv_loop, reason:%s", uv_err_name(err)); + taosMemoryFree(pThrd->loop); + taosThreadMutexDestroy(&pThrd->msgMtx); + taosMemoryFree(pThrd); + return NULL; + } pThrd->asyncPool = transAsyncPoolCreate(pThrd->loop, 8, pThrd, cliAsyncCb); + if (pThrd->asyncPool == NULL) { + tError("failed to init async pool"); + uv_loop_close(pThrd->loop); + taosMemoryFree(pThrd->loop); + taosThreadMutexDestroy(&pThrd->msgMtx); + taosMemoryFree(pThrd); + return NULL; + } pThrd->prepare = taosMemoryCalloc(1, sizeof(uv_prepare_t)); uv_prepare_init(pThrd->loop, pThrd->prepare); diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index 1161ed7c00..4c107a88f1 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -205,6 +205,10 @@ bool transReadComplete(SConnBuffer* connBuf) { } int transSetConnOption(uv_tcp_t* stream) { +#if defined(WINDOWS) || defined(DARWIN) +#else + uv_tcp_keepalive(stream, 1, 20); +#endif return uv_tcp_nodelay(stream, 1); // int ret = uv_tcp_keepalive(stream, 5, 60); } @@ -214,24 +218,37 @@ SAsyncPool* transAsyncPoolCreate(uv_loop_t* loop, int sz, void* arg, AsyncCB cb) pool->nAsync = sz; pool->asyncs = taosMemoryCalloc(1, sizeof(uv_async_t) * pool->nAsync); - for (int i = 0; i < pool->nAsync; i++) { + int i = 0, err = 0; + for (i = 0; i < pool->nAsync; i++) { + uv_async_t* async = &(pool->asyncs[i]); + SAsyncItem* item = taosMemoryCalloc(1, sizeof(SAsyncItem)); item->pThrd = arg; QUEUE_INIT(&item->qmsg); taosThreadMutexInit(&item->mtx, NULL); - uv_async_t* async = &(pool->asyncs[i]); - uv_async_init(loop, async, cb); async->data = item; + err = uv_async_init(loop, async, cb); + if (err != 0) { + tError("failed to init async, reason:%s", uv_err_name(err)); + break; + } } + + if (i != pool->nAsync) { + transAsyncPoolDestroy(pool); + pool = NULL; + } + return pool; } void transAsyncPoolDestroy(SAsyncPool* pool) { for (int i = 0; i < pool->nAsync; i++) { uv_async_t* async = &(pool->asyncs[i]); - SAsyncItem* item = async->data; + if (item == NULL) continue; + taosThreadMutexDestroy(&item->mtx); taosMemoryFree(item); } diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c index d068ede52d..e31616f53e 100644 --- a/source/libs/wal/src/walRead.c +++ b/source/libs/wal/src/walRead.c @@ -576,3 +576,12 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) { return 0; } + +void walReadReset(SWalReader *pReader) { + taosThreadMutexLock(&pReader->mutex); + taosCloseFile(&pReader->pIdxFile); + taosCloseFile(&pReader->pLogFile); + pReader->curInvalid = 1; + pReader->curFileFirstVer = -1; + taosThreadMutexUnlock(&pReader->mutex); +} diff --git a/source/os/CMakeLists.txt b/source/os/CMakeLists.txt index 2a4fcbcf76..db066a82b6 100644 --- a/source/os/CMakeLists.txt +++ b/source/os/CMakeLists.txt @@ -37,7 +37,9 @@ if(CHECK_STR2INT_ERROR) add_definitions(-DTD_CHECK_STR_TO_INT_ERROR) endif() target_link_libraries( - os PUBLIC pthread + os + PUBLIC pthread + PUBLIC zlibstatic ) if(TD_WINDOWS) target_link_libraries( @@ -51,6 +53,10 @@ elseif(TD_DARWIN_64) target_link_libraries( os PUBLIC dl m iconv ) +elseif(TD_ALPINE) + target_link_libraries( + os PUBLIC dl m rt unwind + ) else() target_link_libraries( os PUBLIC dl m rt @@ -63,4 +69,4 @@ ENDIF () if(${BUILD_TEST}) add_subdirectory(test) -endif(${BUILD_TEST}) \ No newline at end of file +endif(${BUILD_TEST}) diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index 71b3125de8..8cc9885adb 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -15,6 +15,7 @@ #define ALLOW_FORBID_FUNC #include "os.h" #include "osSemaphore.h" +#include "zlib.h" #ifdef WINDOWS #include @@ -870,3 +871,48 @@ bool taosCheckAccessFile(const char *pathname, int32_t tdFileAccessOptions) { } bool taosCheckExistFile(const char *pathname) { return taosCheckAccessFile(pathname, TD_FILE_ACCESS_EXIST_OK); }; + +int32_t taosCompressFile(char *srcFileName, char *destFileName) { + int32_t compressSize = 163840; + int32_t ret = 0; + int32_t len = 0; + char *data = taosMemoryMalloc(compressSize); + gzFile dstFp = NULL; + + TdFilePtr pSrcFile = taosOpenFile(srcFileName, TD_FILE_READ | TD_FILE_STREAM); + if (pSrcFile == NULL) { + ret = -1; + goto cmp_end; + } + + TdFilePtr pFile = taosOpenFile(destFileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); + if (pFile == NULL) { + ret = -2; + goto cmp_end; + } + + dstFp = gzdopen(pFile->fd, "wb6f"); + if (dstFp == NULL) { + ret = -3; + taosCloseFile(&pFile); + goto cmp_end; + } + + while (!feof(pSrcFile->fp)) { + len = (int32_t)fread(data, 1, compressSize, pSrcFile->fp); + (void)gzwrite(dstFp, data, len); + } + +cmp_end: + if (pSrcFile) { + taosCloseFile(&pSrcFile); + } + + if (dstFp) { + gzclose(dstFp); + } + + taosMemoryFree(data); + + return ret; +} diff --git a/source/os/src/osMath.c b/source/os/src/osMath.c index 3b42c141df..b466f89a1d 100644 --- a/source/os/src/osMath.c +++ b/source/os/src/osMath.c @@ -16,7 +16,7 @@ #define ALLOW_FORBID_FUNC #define _DEFAULT_SOURCE #include -#include "os.h" +#include "talgo.h" #ifdef WINDOWS void swapStr(char* j, char* J, int width) { @@ -41,7 +41,7 @@ int32_t qsortHelper(const void* p1, const void* p2, const void* param) { void taosSort(void* base, int64_t sz, int64_t width, __compar_fn_t compar) { #ifdef _ALPINE void* param = compar; - taosqsort(base, width, sz, param, qsortHelper); + taosqsort(base, sz, width, param, qsortHelper); #else qsort(base, sz, width, compar); #endif diff --git a/source/os/src/osMemory.c b/source/os/src/osMemory.c index 3825b8e074..e685cc8351 100644 --- a/source/os/src/osMemory.c +++ b/source/os/src/osMemory.c @@ -346,7 +346,7 @@ int64_t taosMemorySize(void *ptr) { } void taosMemoryTrim(int32_t size) { -#if defined(WINDOWS) || defined(DARWIN) +#if defined(WINDOWS) || defined(DARWIN) || defined(_ALPINE) // do nothing return; #else diff --git a/source/os/src/osSocket.c b/source/os/src/osSocket.c index 715c2632e0..ddb8eca0eb 100644 --- a/source/os/src/osSocket.c +++ b/source/os/src/osSocket.c @@ -55,7 +55,7 @@ typedef struct TdSocket { #endif int refId; SocketFd fd; -} * TdSocketPtr, TdSocket; +} *TdSocketPtr, TdSocket; typedef struct TdSocketServer { #if SOCKET_WITH_LOCK @@ -63,7 +63,7 @@ typedef struct TdSocketServer { #endif int refId; SocketFd fd; -} * TdSocketServerPtr, TdSocketServer; +} *TdSocketServerPtr, TdSocketServer; typedef struct TdEpoll { #if SOCKET_WITH_LOCK @@ -71,7 +71,7 @@ typedef struct TdEpoll { #endif int refId; EpollFd fd; -} * TdEpollPtr, TdEpoll; +} *TdEpollPtr, TdEpoll; #if 0 int32_t taosSendto(TdSocketPtr pSocket, void *buf, int len, unsigned int flags, const struct sockaddr *dest_addr, @@ -944,7 +944,7 @@ uint32_t taosGetIpv4FromFqdn(const char *fqdn) { iResult = WSAStartup(MAKEWORD(2, 2), &wsaData); if (iResult != 0) { // printf("WSAStartup failed: %d\n", iResult); - return 1; + return 0xFFFFFFFF; } #endif struct addrinfo hints = {0}; @@ -1005,7 +1005,7 @@ int32_t taosGetFqdn(char *fqdn) { // immediately // hints.ai_family = AF_INET; strcpy(fqdn, hostname); - strcpy(fqdn+strlen(hostname), ".local"); + strcpy(fqdn + strlen(hostname), ".local"); #else // __APPLE__ struct addrinfo hints = {0}; struct addrinfo *result = NULL; @@ -1060,7 +1060,7 @@ int32_t taosCreateSocketWithTimeout(uint32_t timeout) { #if defined(WINDOWS) SOCKET fd; #else - int fd; + int fd; #endif if ((fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) { return -1; @@ -1071,11 +1071,12 @@ int32_t taosCreateSocketWithTimeout(uint32_t timeout) { return -1; } #elif defined(_TD_DARWIN_64) - uint32_t conn_timeout_ms = timeout * 1000; - if (0 != setsockopt(fd, IPPROTO_TCP, TCP_CONNECTIONTIMEOUT, (char *)&conn_timeout_ms, sizeof(conn_timeout_ms))) { - taosCloseSocketNoCheck1(fd); - return -1; - } + // invalid config + // uint32_t conn_timeout_ms = timeout * 1000; + // if (0 != setsockopt(fd, IPPROTO_TCP, TCP_CONNECTIONTIMEOUT, (char *)&conn_timeout_ms, sizeof(conn_timeout_ms))) { + // taosCloseSocketNoCheck1(fd); + // return -1; + //} #else // Linux like systems uint32_t conn_timeout_ms = timeout * 1000; if (0 != setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, (char *)&conn_timeout_ms, sizeof(conn_timeout_ms))) { diff --git a/source/os/src/osString.c b/source/os/src/osString.c index b9f537ad34..ae4a8a5cad 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -351,7 +351,7 @@ char *taosStrCaseStr(const char *str, const char *pattern) { int64_t taosStr2Int64(const char *str, char **pEnd, int32_t radix) { int64_t tmp = strtoll(str, pEnd, radix); -#ifdef DARWIN +#if defined(DARWIN) || defined(_ALPINE) if (errno == EINVAL) errno = 0; #endif #ifdef TD_CHECK_STR_TO_INT_ERROR @@ -363,7 +363,7 @@ int64_t taosStr2Int64(const char *str, char **pEnd, int32_t radix) { uint64_t taosStr2UInt64(const char *str, char **pEnd, int32_t radix) { uint64_t tmp = strtoull(str, pEnd, radix); -#ifdef DARWIN +#if defined(DARWIN) || defined(_ALPINE) if (errno == EINVAL) errno = 0; #endif #ifdef TD_CHECK_STR_TO_INT_ERROR @@ -375,7 +375,7 @@ uint64_t taosStr2UInt64(const char *str, char **pEnd, int32_t radix) { int32_t taosStr2Int32(const char *str, char **pEnd, int32_t radix) { int32_t tmp = strtol(str, pEnd, radix); -#ifdef DARWIN +#if defined(DARWIN) || defined(_ALPINE) if (errno == EINVAL) errno = 0; #endif #ifdef TD_CHECK_STR_TO_INT_ERROR @@ -387,7 +387,7 @@ int32_t taosStr2Int32(const char *str, char **pEnd, int32_t radix) { uint32_t taosStr2UInt32(const char *str, char **pEnd, int32_t radix) { uint32_t tmp = strtol(str, pEnd, radix); -#ifdef DARWIN +#if defined(DARWIN) || defined(_ALPINE) if (errno == EINVAL) errno = 0; #endif #ifdef TD_CHECK_STR_TO_INT_ERROR @@ -399,7 +399,7 @@ uint32_t taosStr2UInt32(const char *str, char **pEnd, int32_t radix) { int16_t taosStr2Int16(const char *str, char **pEnd, int32_t radix) { int32_t tmp = strtol(str, pEnd, radix); -#ifdef DARWIN +#if defined(DARWIN) || defined(_ALPINE) if (errno == EINVAL) errno = 0; #endif #ifdef TD_CHECK_STR_TO_INT_ERROR @@ -413,7 +413,7 @@ int16_t taosStr2Int16(const char *str, char **pEnd, int32_t radix) { uint16_t taosStr2UInt16(const char *str, char **pEnd, int32_t radix) { uint32_t tmp = strtoul(str, pEnd, radix); -#ifdef DARWIN +#if defined(DARWIN) || defined(_ALPINE) if (errno == EINVAL) errno = 0; #endif #ifdef TD_CHECK_STR_TO_INT_ERROR @@ -437,7 +437,7 @@ int8_t taosStr2Int8(const char *str, char **pEnd, int32_t radix) { uint8_t taosStr2UInt8(const char *str, char **pEnd, int32_t radix) { uint32_t tmp = strtoul(str, pEnd, radix); -#ifdef DARWIN +#if defined(DARWIN) || defined(_ALPINE) if (errno == EINVAL) errno = 0; #endif #ifdef TD_CHECK_STR_TO_INT_ERROR diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index b5c6edc829..6471dad033 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -124,7 +124,7 @@ static char tsProcIOFile[25] = {0}; static void taosGetProcIOnfos() { tsPageSizeKB = sysconf(_SC_PAGESIZE) / 1024; tsOpenMax = sysconf(_SC_OPEN_MAX); - tsStreamMax = sysconf(_SC_STREAM_MAX); + tsStreamMax = TMAX(sysconf(_SC_STREAM_MAX), 0); tsProcId = (pid_t)syscall(SYS_gettid); snprintf(tsProcMemFile, sizeof(tsProcMemFile), "/proc/%d/status", tsProcId); diff --git a/source/os/src/osTimer.c b/source/os/src/osTimer.c index d1c233ea9c..5a57007d17 100644 --- a/source/os/src/osTimer.c +++ b/source/os/src/osTimer.c @@ -99,8 +99,8 @@ static void *taosProcessAlarmSignal(void *tharg) { setThreadName("tmr"); #ifdef _ALPINE - sevent.sigev_notify = SIGEV_THREAD; - sevent.sigev_value.sival_int = syscall(__NR_gettid); + sevent.sigev_notify = SIGEV_THREAD_ID; + sevent.sigev_notify_thread_id = syscall(__NR_gettid); #else sevent.sigev_notify = SIGEV_THREAD_ID; sevent._sigev_un._tid = syscall(__NR_gettid); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index bab3edc870..fecdb4d32a 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -88,6 +88,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_NEED_RETRY, "Retry needed") TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_RPC_MEMORY_QUEUE, "Out of memory in rpc queue") TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_TIMESTAMP, "Invalid timestamp format") TAOS_DEFINE_ERROR(TSDB_CODE_MSG_DECODE_ERROR, "Msg decode error") +TAOS_DEFINE_ERROR(TSDB_CODE_MSG_ENCODE_ERROR, "Msg encode error") TAOS_DEFINE_ERROR(TSDB_CODE_NO_AVAIL_DISK, "No available disk") TAOS_DEFINE_ERROR(TSDB_CODE_NOT_FOUND, "Not found") TAOS_DEFINE_ERROR(TSDB_CODE_NO_DISKSPACE, "Out of disk space") @@ -289,6 +290,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_STREAM_NOT_EXIST, "Stream not exist") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_STREAM_OPTION, "Invalid stream option") TAOS_DEFINE_ERROR(TSDB_CODE_MND_STREAM_MUST_BE_DELETED, "Stream must be dropped first") TAOS_DEFINE_ERROR(TSDB_CODE_MND_MULTI_REPLICA_SOURCE_DB, "Stream temporarily does not support source db having replica > 1") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_STREAMS, "Too many streams") // mnode-sma TAOS_DEFINE_ERROR(TSDB_CODE_MND_SMA_ALREADY_EXIST, "SMA already exists") diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 62f074db5b..89dd51a892 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -115,7 +115,6 @@ static int32_t taosPushLogBuffer(SLogBuff *pLogBuf, const char *msg, int32_t m static SLogBuff *taosLogBuffNew(int32_t bufSize); static void taosCloseLogByFd(TdFilePtr pFile); static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum); -static int32_t taosCompressFile(char *srcFileName, char *destFileName); static FORCE_INLINE void taosUpdateDaylight() { struct tm Tm, *ptm; @@ -748,50 +747,6 @@ static void *taosAsyncOutputLog(void *param) { return NULL; } -int32_t taosCompressFile(char *srcFileName, char *destFileName) { - int32_t compressSize = 163840; - int32_t ret = 0; - int32_t len = 0; - char *data = taosMemoryMalloc(compressSize); - // gzFile dstFp = NULL; - - // srcFp = fopen(srcFileName, "r"); - TdFilePtr pSrcFile = taosOpenFile(srcFileName, TD_FILE_READ); - if (pSrcFile == NULL) { - ret = -1; - goto cmp_end; - } - - TdFilePtr pFile = taosOpenFile(destFileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); - if (pFile == NULL) { - ret = -2; - goto cmp_end; - } - - // dstFp = gzdopen(fd, "wb6f"); - // if (dstFp == NULL) { - // ret = -3; - // close(fd); - // goto cmp_end; - // } - // - // while (!feof(srcFp)) { - // len = (int32_t)fread(data, 1, compressSize, srcFp); - // (void)gzwrite(dstFp, data, len); - // } - -cmp_end: - if (pSrcFile) { - taosCloseFile(&pSrcFile); - } - // if (dstFp) { - // gzclose(dstFp); - // } - taosMemoryFree(data); - - return ret; -} - bool taosAssertDebug(bool condition, const char *file, int32_t line, const char *format, ...) { if (condition) return false; diff --git a/source/util/src/tpagedbuf.c b/source/util/src/tpagedbuf.c index 7c60862c56..3cecfdff9c 100644 --- a/source/util/src/tpagedbuf.c +++ b/source/util/src/tpagedbuf.c @@ -5,11 +5,11 @@ #include "thash.h" #include "tlog.h" -#define GET_PAYLOAD_DATA(_p) ((char*)(_p)->pData + POINTER_BYTES) -#define BUF_PAGE_IN_MEM(_p) ((_p)->pData != NULL) +#define GET_PAYLOAD_DATA(_p) ((char*)(_p)->pData + POINTER_BYTES) +#define BUF_PAGE_IN_MEM(_p) ((_p)->pData != NULL) #define CLEAR_BUF_PAGE_IN_MEM_FLAG(_p) ((_p)->pData = NULL) -#define HAS_DATA_IN_DISK(_p) ((_p)->offset >= 0) -#define NO_IN_MEM_AVAILABLE_PAGES(_b) (listNEles((_b)->lruList) >= (_b)->inMemPages) +#define HAS_DATA_IN_DISK(_p) ((_p)->offset >= 0) +#define NO_IN_MEM_AVAILABLE_PAGES(_b) (listNEles((_b)->lruList) >= (_b)->inMemPages) typedef struct SPageDiskInfo { int64_t offset; @@ -17,7 +17,7 @@ typedef struct SPageDiskInfo { } SPageDiskInfo, SFreeListItem; struct SPageInfo { - SListNode* pn; // point to list node struct. it is NULL when the page is evicted from the in-memory buffer + SListNode* pn; // point to list node struct. it is NULL when the page is evicted from the in-memory buffer void* pData; int64_t offset; int32_t pageId; @@ -52,10 +52,13 @@ struct SDiskbasedBuf { }; static int32_t createDiskFile(SDiskbasedBuf* pBuf) { - if (pBuf->path == NULL) { // prepare the file name when needed it + if (pBuf->path == NULL) { // prepare the file name when needed it char path[PATH_MAX] = {0}; taosGetTmpfilePath(pBuf->prefix, "paged-buf", path); pBuf->path = taosMemoryStrDup(path); + if (pBuf->path == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } } pBuf->pFile = @@ -126,6 +129,30 @@ static uint64_t allocateNewPositionInFile(SDiskbasedBuf* pBuf, size_t size) { static FORCE_INLINE size_t getAllocPageSize(int32_t pageSize) { return pageSize + POINTER_BYTES + sizeof(SFilePage); } +static int32_t doFlushBufPageImpl(SDiskbasedBuf* pBuf, int64_t offset, const char* pData, int32_t size) { + int32_t ret = taosLSeekFile(pBuf->pFile, offset, SEEK_SET); + if (ret == -1) { + terrno = TAOS_SYSTEM_ERROR(errno); + return terrno; + } + + ret = (int32_t)taosWriteFile(pBuf->pFile, pData, size); + if (ret != size) { + terrno = TAOS_SYSTEM_ERROR(errno); + return terrno; + } + + // extend the file + if (pBuf->fileSize < offset + size) { + pBuf->fileSize = offset + size; + } + + pBuf->statis.flushBytes += size; + pBuf->statis.flushPages += 1; + + return TSDB_CODE_SUCCESS; +} + static char* doFlushBufPage(SDiskbasedBuf* pBuf, SPageInfo* pg) { if (pg->pData == NULL || pg->used) { uError("invalid params in paged buffer process when flushing buf to disk, %s", pBuf->id); @@ -134,12 +161,15 @@ static char* doFlushBufPage(SDiskbasedBuf* pBuf, SPageInfo* pg) { } int32_t size = pBuf->pageSize; - char* t = NULL; + int64_t offset = pg->offset; + + char* t = NULL; if ((!HAS_DATA_IN_DISK(pg)) || pg->dirty) { void* payload = GET_PAYLOAD_DATA(pg); t = doCompressData(payload, pBuf->pageSize, &size, pBuf); if (size < 0) { uError("failed to compress data when flushing data to disk, %s", pBuf->id); + terrno = TSDB_CODE_INVALID_PARA; return NULL; } } @@ -147,59 +177,29 @@ static char* doFlushBufPage(SDiskbasedBuf* pBuf, SPageInfo* pg) { // this page is flushed to disk for the first time if (pg->dirty) { if (!HAS_DATA_IN_DISK(pg)) { - pg->offset = allocateNewPositionInFile(pBuf, size); + offset = allocateNewPositionInFile(pBuf, size); pBuf->nextPos += size; - int32_t ret = taosLSeekFile(pBuf->pFile, pg->offset, SEEK_SET); - if (ret == -1) { - terrno = TAOS_SYSTEM_ERROR(errno); + int32_t code = doFlushBufPageImpl(pBuf, offset, t, size); + if (code != TSDB_CODE_SUCCESS) { return NULL; } - - ret = (int32_t)taosWriteFile(pBuf->pFile, t, size); - if (ret != size) { - terrno = TAOS_SYSTEM_ERROR(errno); - return NULL; - } - - // extend the file size - if (pBuf->fileSize < pg->offset + size) { - pBuf->fileSize = pg->offset + size; - } - - pBuf->statis.flushBytes += size; - pBuf->statis.flushPages += 1; } else { // length becomes greater, current space is not enough, allocate new place, otherwise, do nothing if (pg->length < size) { // 1. add current space to free list - SPageDiskInfo dinfo = {.length = pg->length, .offset = pg->offset}; + SPageDiskInfo dinfo = {.length = pg->length, .offset = offset}; taosArrayPush(pBuf->pFree, &dinfo); // 2. allocate new position, and update the info - pg->offset = allocateNewPositionInFile(pBuf, size); + offset = allocateNewPositionInFile(pBuf, size); pBuf->nextPos += size; } - // 3. write to disk. - int32_t ret = taosLSeekFile(pBuf->pFile, pg->offset, SEEK_SET); - if (ret == -1) { - terrno = TAOS_SYSTEM_ERROR(errno); + int32_t code = doFlushBufPageImpl(pBuf, offset, t, size); + if (code != TSDB_CODE_SUCCESS) { return NULL; } - - ret = (int32_t)taosWriteFile(pBuf->pFile, t, size); - if (ret != size) { - terrno = TAOS_SYSTEM_ERROR(errno); - return NULL; - } - - if (pBuf->fileSize < pg->offset + size) { - pBuf->fileSize = pg->offset + size; - } - - pBuf->statis.flushBytes += size; - pBuf->statis.flushPages += 1; } } else { // NOTE: the size may be -1, the this recycle page has not been flushed to disk yet. size = pg->length; @@ -209,9 +209,10 @@ static char* doFlushBufPage(SDiskbasedBuf* pBuf, SPageInfo* pg) { memset(pDataBuf, 0, getAllocPageSize(pBuf->pageSize)); #ifdef BUF_PAGE_DEBUG - uDebug("page_flush %p, pageId:%d, offset:%d", pDataBuf, pg->pageId, pg->offset); + uDebug("page_flush %p, pageId:%d, offset:%d", pDataBuf, pg->pageId, offset); #endif + pg->offset = offset; pg->length = size; // on disk size return pDataBuf; } @@ -236,7 +237,7 @@ static char* flushBufPage(SDiskbasedBuf* pBuf, SPageInfo* pg) { // load file block data in disk static int32_t loadPageFromDisk(SDiskbasedBuf* pBuf, SPageInfo* pg) { if (pg->offset < 0 || pg->length <= 0) { - uError("failed to load buf page from disk, offset:%"PRId64", length:%d, %s", pg->offset, pg->length, pBuf->id); + uError("failed to load buf page from disk, offset:%" PRId64 ", length:%d, %s", pg->offset, pg->length, pBuf->id); return TSDB_CODE_INVALID_PARA; } @@ -303,6 +304,7 @@ static SListNode* getEldestUnrefedPage(SDiskbasedBuf* pBuf) { static char* evictBufPage(SDiskbasedBuf* pBuf) { SListNode* pn = getEldestUnrefedPage(pBuf); if (pn == NULL) { // no available buffer pages now, return. + terrno = TSDB_CODE_OUT_OF_MEMORY; return NULL; } @@ -382,14 +384,14 @@ int32_t createDiskbasedBuf(SDiskbasedBuf** pBuf, int32_t pagesize, int32_t inMem goto _error; } - pPBuf->prefix = (char*) dir; + pPBuf->prefix = (char*)dir; pPBuf->emptyDummyIdList = taosArrayInit(1, sizeof(int32_t)); // qDebug("QInfo:0x%"PRIx64" create resBuf for output, page size:%d, inmem buf pages:%d, file:%s", qId, // pPBuf->pageSize, pPBuf->inMemPages, pPBuf->path); return TSDB_CODE_SUCCESS; - _error: +_error: destroyDiskbasedBuf(pPBuf); return TSDB_CODE_OUT_OF_MEMORY; } @@ -399,11 +401,12 @@ static char* doExtractPage(SDiskbasedBuf* pBuf) { if (NO_IN_MEM_AVAILABLE_PAGES(pBuf)) { availablePage = evictBufPage(pBuf); if (availablePage == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - uWarn("no available buf pages, current:%d, max:%d", listNEles(pBuf->lruList), pBuf->inMemPages) + uWarn("no available buf pages, current:%d, max:%d, reason: %s, %s", listNEles(pBuf->lruList), pBuf->inMemPages, + terrstr(), pBuf->id) } } else { - availablePage = taosMemoryCalloc(1, getAllocPageSize(pBuf->pageSize)); // add extract bytes in case of zipped buffer increased. + availablePage = + taosMemoryCalloc(1, getAllocPageSize(pBuf->pageSize)); // add extract bytes in case of zipped buffer increased. if (availablePage == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; } @@ -551,9 +554,7 @@ void releaseBufPageInfo(SDiskbasedBuf* pBuf, SPageInfo* pi) { size_t getTotalBufSize(const SDiskbasedBuf* pBuf) { return (size_t)pBuf->totalBufSize; } -SArray* getDataBufPagesIdList(SDiskbasedBuf* pBuf) { - return pBuf->pIdList; -} +SArray* getDataBufPagesIdList(SDiskbasedBuf* pBuf) { return pBuf->pIdList; } void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) { if (pBuf == NULL) { @@ -567,7 +568,7 @@ void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) { needRemoveFile = true; uDebug( "Paged buffer closed, total:%.2f Kb (%d Pages), inmem size:%.2f Kb (%d Pages), file size:%.2f Kb, page " - "size:%.2f Kb, %s\n", + "size:%.2f Kb, %s", pBuf->totalBufSize / 1024.0, pBuf->numOfPages, listNEles(pBuf->lruList) * pBuf->pageSize / 1024.0, listNEles(pBuf->lruList), pBuf->fileSize / 1024.0, pBuf->pageSize / 1024.0f, pBuf->id); @@ -584,8 +585,7 @@ void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) { ps->releasePages, ps->flushBytes / 1024.0f, ps->flushPages, ps->loadBytes / 1024.0f, ps->loadPages); } else { uDebug( - "Get/Release pages:%d/%d, flushToDisk:%.2f Kb (%d Pages), loadFromDisk:%.2f Kb (%d Pages), avgPageSize:%.2f " - "Kb", + "Get/Release pages:%d/%d, flushToDisk:%.2f Kb (%d Pages), loadFromDisk:%.2f Kb (%d Pages), avgPgSize:%.2f Kb", ps->getPages, ps->releasePages, ps->flushBytes / 1024.0f, ps->flushPages, ps->loadBytes / 1024.0f, ps->loadPages, ps->loadBytes / (1024.0 * ps->loadPages)); } @@ -628,9 +628,7 @@ SPageInfo* getLastPageInfo(SArray* pList) { return pPgInfo; } -int32_t getPageId(const SPageInfo* pPgInfo) { - return pPgInfo->pageId; -} +int32_t getPageId(const SPageInfo* pPgInfo) { return pPgInfo->pageId; } int32_t getBufPageSize(const SDiskbasedBuf* pBuf) { return pBuf->pageSize; } @@ -686,7 +684,7 @@ void dBufPrintStatis(const SDiskbasedBuf* pBuf) { ps->getPages, ps->releasePages, ps->flushBytes / 1024.0f, ps->flushPages, ps->loadBytes / 1024.0f, ps->loadPages, ps->loadBytes / (1024.0 * ps->loadPages)); } else { - //printf("no page loaded\n"); + // printf("no page loaded\n"); } } diff --git a/source/util/src/trbtree.c b/source/util/src/trbtree.c index ffae5441aa..e7386d5912 100644 --- a/source/util/src/trbtree.c +++ b/source/util/src/trbtree.c @@ -147,6 +147,10 @@ static SRBTreeNode *tRBTreePredecessor(SRBTree *pTree, SRBTreeNode *pNode) { void tRBTreeCreate(SRBTree *pTree, tRBTreeCmprFn cmprFn) { pTree->cmprFn = cmprFn; + tRBTreeClear(pTree); +} + +void tRBTreeClear(SRBTree *pTree) { pTree->n = 0; pTree->NIL = &pTree->NILNODE; pTree->NIL->color = BLACK; @@ -423,6 +427,22 @@ SRBTreeNode *tRBTreeDropByKey(SRBTree *pTree, void *pKey) { return pNode; } +SRBTreeNode *tRBTreeDropMin(SRBTree *pTree) { + SRBTreeNode *pNode = tRBTreeMin(pTree); + if (pNode) { + tRBTreeDrop(pTree, pNode); + } + return pNode; +} + +SRBTreeNode *tRBTreeDropMax(SRBTree *pTree) { + SRBTreeNode *pNode = tRBTreeMax(pTree); + if (pNode) { + tRBTreeDrop(pTree, pNode); + } + return pNode; +} + SRBTreeNode *tRBTreeGet(SRBTree *pTree, const SRBTreeNode *pKeyNode) { SRBTreeNode *pNode = pTree->root; diff --git a/tests/docs-examples-test/python.sh b/tests/docs-examples-test/python.sh index ccb391b752..31342b33d7 100644 --- a/tests/docs-examples-test/python.sh +++ b/tests/docs-examples-test/python.sh @@ -83,4 +83,5 @@ python3 fast_write_example.py # 20 pip3 install kafka-python -python3 kafka_example.py +python3 kafka_example_consumer.py + diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index fe6573ed4b..38c0b3e1ee 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -180,6 +180,7 @@ ,,y,script,./test.sh -f tsim/query/sys_tbname.sim ,,y,script,./test.sh -f tsim/query/groupby.sim ,,y,script,./test.sh -f tsim/query/event.sim +,,y,script,./test.sh -f tsim/query/forceFill.sim ,,y,script,./test.sh -f tsim/qnode/basic1.sim ,,y,script,./test.sh -f tsim/snode/basic1.sim ,,y,script,./test.sh -f tsim/mnode/basic1.sim @@ -409,7 +410,7 @@ ,,y,script,./test.sh -f tmp/monitor.sim #system test - +,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/balance_vgroups_r1.py -N 6 ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/taosShell.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/taosShellError.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/taosShellNetChk.py @@ -1054,6 +1055,11 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/out_of_order.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/out_of_order.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/out_of_order.py -Q 4 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -R +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 2 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/odbc.py ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 4 diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index a1682f47b3..ddb3bfaa26 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -15,6 +15,7 @@ import sys import os import os.path import platform +import distro import subprocess from time import sleep import base64 @@ -22,6 +23,7 @@ import json import copy from fabric2 import Connection from util.log import * +from shutil import which class TDSimClient: @@ -166,9 +168,9 @@ class TDDnode: if value: selfPath = os.path.dirname(os.path.realpath(__file__)) if ("community" in selfPath): - self.execPath = os.path.abspath(self.path + "/community/tests/script/sh/exec.sh") + self.execPath = os.path.abspath(self.path + "/community/tests/script/sh/exec.sh") else: - self.execPath = os.path.abspath(self.path + "/tests/script/sh/exec.sh") + self.execPath = os.path.abspath(self.path + "/tests/script/sh/exec.sh") def getDataSize(self): totalSize = 0 @@ -686,7 +688,7 @@ class TDDnodes: if ("community" in selfPath): self.stopDnodesPath = os.path.abspath(self.path + "/community/tests/script/sh/stop_dnodes.sh") self.stopDnodesSigintPath = os.path.abspath(self.path + "/community/tests/script/sh/sigint_stop_dnodes.sh") - else: + else: self.stopDnodesPath = os.path.abspath(self.path + "/tests/script/sh/stop_dnodes.sh") self.stopDnodesSigintPath = os.path.abspath(self.path + "/tests/script/sh/sigint_stop_dnodes.sh") tdLog.info("run in address sanitizer mode") @@ -765,7 +767,8 @@ class TDDnodes: def stopAll(self): tdLog.info("stop all dnodes, asan:%d" % self.asan) - if self.asan: + distro_id = distro.id() + if self.asan and distro_id != "alpine": tdLog.info("execute script: %s" % self.stopDnodesPath) os.system(self.stopDnodesPath) tdLog.info("execute finished") @@ -777,24 +780,41 @@ class TDDnodes: for i in range(len(self.dnodes)): self.dnodes[i].stop() - psCmd = "ps -ef | grep -w taosd | grep 'root' | grep -v grep| grep -v defunct | awk '{print $2}' | xargs" - processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() - if processID: - cmd = "sudo systemctl stop taosd" - os.system(cmd) - # if os.system(cmd) != 0 : - # tdLog.exit(cmd) - psCmd = "ps -ef|grep -w taosd| grep -v grep| grep -v defunct | awk '{print $2}' | xargs" - processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() - while(processID): - if platform.system().lower() == 'windows': - killCmd = "kill -9 %s > nul 2>&1" % processID - else: - killCmd = "kill -9 %s > /dev/null 2>&1" % processID - os.system(killCmd) - time.sleep(1) - processID = subprocess.check_output( - psCmd, shell=True).decode("utf-8").strip() + + if (distro_id == "alpine"): + print(distro_id) + psCmd = "ps -ef | grep -w taosd | grep 'root' | grep -v grep| grep -v defunct | awk '{print $2}' | xargs" + processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() + while(processID): + print(processID) + if platform.system().lower() == 'windows': + killCmd = "kill -9 %s > nul 2>&1" % processID + else: + killCmd = "kill -9 %s > /dev/null 2>&1" % processID + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8").strip() + + else: + psCmd = "ps -ef | grep -w taosd | grep 'root' | grep -v grep| grep -v defunct | awk '{print $2}' | xargs" + processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() + if processID: + cmd = "sudo systemctl stop taosd" + os.system(cmd) + # if os.system(cmd) != 0 : + # tdLog.exit(cmd) + psCmd = "ps -ef|grep -w taosd| grep -v grep| grep -v defunct | awk '{print $2}' | xargs" + processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() + while(processID): + if platform.system().lower() == 'windows': + killCmd = "kill -9 %s > nul 2>&1" % processID + else: + killCmd = "kill -9 %s > /dev/null 2>&1" % processID + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8").strip() if self.killValgrind == 1: psCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}' | xargs" diff --git a/tests/requirements.txt b/tests/requirements.txt index cebe5b9d36..d2edbfb32d 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -4,3 +4,7 @@ fabric2 psutil pandas toml +distro +requests +pexpect +faker \ No newline at end of file diff --git a/tests/script/sh/cfg.sh b/tests/script/sh/cfg.sh index 7d4d747e54..bf58185f62 100755 --- a/tests/script/sh/cfg.sh +++ b/tests/script/sh/cfg.sh @@ -45,11 +45,7 @@ fi TAOS_DIR=`pwd` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` -if [[ "$OS_TYPE" != "Darwin" ]]; then - cut_opt="--field=" -else - cut_opt="-f " -fi +cut_opt="-f " if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` diff --git a/tests/script/sh/checkAsan.sh b/tests/script/sh/checkAsan.sh index 7225722791..31fe80829f 100755 --- a/tests/script/sh/checkAsan.sh +++ b/tests/script/sh/checkAsan.sh @@ -2,7 +2,19 @@ set +e #set -x +if [[ "$OSTYPE" == "darwin"* ]]; then + TD_OS="Darwin" +else + OS=$(cat /etc/*-release | grep "^NAME=" | cut -d= -f2) + len=$(echo ${#OS}) + len=$((len-2)) + TD_OS=$(echo -ne ${OS:1:${len}} | cut -d" " -f1) +fi +if [[ "$TD_OS" == "Alpine" ]]; then + echo -e "os is Alpine,skip check Asan" + exit 0 +fi unset LD_PRELOAD SCRIPT_DIR=`dirname $0` cd $SCRIPT_DIR/../ diff --git a/tests/script/sh/clear.sh b/tests/script/sh/clear.sh index 4ee296cf05..587a33f633 100755 --- a/tests/script/sh/clear.sh +++ b/tests/script/sh/clear.sh @@ -48,11 +48,7 @@ fi TAOS_DIR=`pwd` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` -if [[ "$OS_TYPE" != "Darwin" ]]; then - cut_opt="--field=" -else - cut_opt="-f " -fi +cut_opt="-f " if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index 217bd66ef6..7da8da09bf 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -39,11 +39,7 @@ fi TAOS_DIR=`pwd` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` -if [[ "$OS_TYPE" != "Darwin" ]]; then - cut_opt="--field=" -else - cut_opt="-f " -fi +cut_opt="-f " if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` diff --git a/tests/script/sh/exec-default.sh b/tests/script/sh/exec-default.sh index f648315c67..0a83fa1dc8 100755 --- a/tests/script/sh/exec-default.sh +++ b/tests/script/sh/exec-default.sh @@ -54,11 +54,7 @@ fi TAOS_DIR=`pwd` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` -if [[ "$OS_TYPE" != "Darwin" ]]; then - cut_opt="--field=" -else - cut_opt="-f " -fi +cut_opt="-f " if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` diff --git a/tests/script/sh/exec-no-random-fail.sh b/tests/script/sh/exec-no-random-fail.sh index e01b18a8e6..b15783afb5 100755 --- a/tests/script/sh/exec-no-random-fail.sh +++ b/tests/script/sh/exec-no-random-fail.sh @@ -54,11 +54,7 @@ fi TAOS_DIR=`pwd` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` -if [[ "$OS_TYPE" != "Darwin" ]]; then - cut_opt="--field=" -else - cut_opt="-f " -fi +cut_opt="-f " if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` diff --git a/tests/script/sh/exec-random-fail.sh b/tests/script/sh/exec-random-fail.sh index 1f31899e3a..15f2864ca6 100755 --- a/tests/script/sh/exec-random-fail.sh +++ b/tests/script/sh/exec-random-fail.sh @@ -54,11 +54,7 @@ fi TAOS_DIR=`pwd` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` -if [[ "$OS_TYPE" != "Darwin" ]]; then - cut_opt="--field=" -else - cut_opt="-f " -fi +cut_opt="-f " if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` diff --git a/tests/script/sh/exec.sh b/tests/script/sh/exec.sh index c8cb121b8a..f548a4cc41 100755 --- a/tests/script/sh/exec.sh +++ b/tests/script/sh/exec.sh @@ -10,6 +10,14 @@ set +e #set -x +if [[ "$OSTYPE" == "darwin"* ]]; then + TD_OS="Darwin" +else + OS=$(cat /etc/*-release | grep "^NAME=" | cut -d= -f2) + len=$(echo ${#OS}) + len=$((len-2)) + TD_OS=$(echo -ne ${OS:1:${len}} | cut -d" " -f1) +fi unset LD_PRELOAD UNAME_BIN=`which uname` @@ -44,7 +52,10 @@ do ;; esac done - +if [[ "$VALGRIND_OPTION" = "true" ]] && [[ "$TD_OS" == "Alpine" ]]; then + echo alpine skip valgrind + VALGRIND_OPTION="false" +fi SCRIPT_DIR=`dirname $0` cd $SCRIPT_DIR/../ SCRIPT_DIR=`pwd` @@ -59,11 +70,7 @@ fi TAOS_DIR=`pwd` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` -if [[ "$OS_TYPE" != "Darwin" ]]; then - cut_opt="--field=" -else - cut_opt="-f " -fi +cut_opt="-f " if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` diff --git a/tests/script/sh/exec_tarbitrator.sh b/tests/script/sh/exec_tarbitrator.sh index e985bd6585..eacf5fd226 100755 --- a/tests/script/sh/exec_tarbitrator.sh +++ b/tests/script/sh/exec_tarbitrator.sh @@ -51,11 +51,7 @@ fi TAOS_DIR=`pwd` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` -if [[ "$OS_TYPE" != "Darwin" ]]; then - cut_opt="--field=" -else - cut_opt="-f " -fi +cut_opt="-f " if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` diff --git a/tests/script/sh/mv_old_data.sh b/tests/script/sh/mv_old_data.sh index 3f4be6714f..1a6bd22c62 100755 --- a/tests/script/sh/mv_old_data.sh +++ b/tests/script/sh/mv_old_data.sh @@ -20,11 +20,7 @@ fi TAOS_DIR=`pwd` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` -if [[ "$OS_TYPE" != "Darwin" ]]; then - cut_opt="--field=" -else - cut_opt="-f " -fi +cut_opt="-f " if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` diff --git a/tests/script/test.sh b/tests/script/test.sh index 19180382fd..b10865dd65 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -51,11 +51,7 @@ fi TOP_DIR=`pwd` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` -if [[ "$OS_TYPE" != "Darwin" ]]; then - cut_opt="--field=" -else - cut_opt="-f " -fi +cut_opt="-f " if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` diff --git a/tests/script/tsim/compute/block_dist.sim b/tests/script/tsim/compute/block_dist.sim index 2d0a4e8902..4fdcf63e34 100644 --- a/tests/script/tsim/compute/block_dist.sim +++ b/tests/script/tsim/compute/block_dist.sim @@ -91,6 +91,10 @@ print ============== TD-5998 sql_error select _block_dist() from (select * from $nt) sql_error select _block_dist() from (select * from $mt) +print ============== TD-22140 & TD-22165 +sql_error show table distributed information_schema.ins_databases +sql_error show table distributed performance_schema.perf_apps + print =============== clear sql drop database $db sql select * from information_schema.ins_databases diff --git a/tests/script/tsim/dnode/balance3.sim b/tests/script/tsim/dnode/balance3.sim index 2fb284b466..d0235e096e 100644 --- a/tests/script/tsim/dnode/balance3.sim +++ b/tests/script/tsim/dnode/balance3.sim @@ -130,13 +130,13 @@ print dnode4 openVnodes $data(4)[2] if $data(1)[2] != 1 then return -1 endi -if $data(2)[2] != 1 then +if $data(2)[2] != 2 then return -1 endi if $data(3)[2] != 2 then return -1 endi -if $data(4)[2] != 2 then +if $data(4)[2] != 1 then return -1 endi @@ -216,7 +216,7 @@ endi print ========== step4 sql create database d3 replica 3 vgroups 1 -sql create table d3.t3 (t timestamp, i int) +sql create table d3.t3 (t timestamp, i int) sql insert into d3.t3 values(now+1s, 35) sql insert into d3.t3 values(now+2s, 34) sql insert into d3.t3 values(now+3s, 33) @@ -231,10 +231,10 @@ print dnode5 openVnodes $data(5)[2] if $data(1)[2] != 2 then return -1 endi -if $data(3)[2] != 2 then +if $data(3)[2] != 3 then return -1 endi -if $data(4)[2] != 3 then +if $data(4)[2] != 2 then return -1 endi if $data(5)[2] != 2 then @@ -315,10 +315,10 @@ endi if $data(3)[2] != null then return -1 endi -if $data(4)[2] != 2 then +if $data(4)[2] != 3 then return -1 endi -if $data(5)[2] != 3 then +if $data(5)[2] != 2 then return -1 endi if $data(6)[2] != 2 then diff --git a/tests/script/tsim/dnode/balancex.sim b/tests/script/tsim/dnode/balancex.sim index 0cfc64a954..6f077be521 100644 --- a/tests/script/tsim/dnode/balancex.sim +++ b/tests/script/tsim/dnode/balancex.sim @@ -145,10 +145,10 @@ print dnode2 openVnodes $data(4)[2] if $data(1)[2] != 1 then return -1 endi -if $data(2)[2] != 1 then +if $data(2)[2] != 2 then return -1 endi -if $data(3)[2] != 2 then +if $data(3)[2] != 1 then return -1 endi if $data(4)[2] != 1 then diff --git a/tests/script/tsim/dnode/drop_dnode_force.sim b/tests/script/tsim/dnode/drop_dnode_force.sim index 26e48933be..425e5f48b2 100644 --- a/tests/script/tsim/dnode/drop_dnode_force.sim +++ b/tests/script/tsim/dnode/drop_dnode_force.sim @@ -120,9 +120,9 @@ if $rows != 12 then return -1 endi -print =============== step3: create qnode snode on dnode 2 -sql create qnode on dnode 2 -sql create snode on dnode 2 +print =============== step3: create qnode snode on dnode 3 +sql create qnode on dnode 3 +sql create snode on dnode 3 sql select * from information_schema.ins_qnodes if $rows != 1 then return -1 @@ -136,16 +136,16 @@ print =============== step4: create mnode on dnode 2 sql create mnode on dnode 3 sql create mnode on dnode 2 $x = 0 -step4: +step4: $x = $x + 1 sleep 1000 if $x == 10 then return -1 endi sql select * from information_schema.ins_mnodes -x step4 -print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] -print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] -print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[1][4] +print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] +print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] +print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[1][4] #if $data(1)[2] != leader then # goto step4 #endi @@ -157,7 +157,7 @@ endi #endi print =============== step5: create dnode 5 -system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT system sh/exec.sh -n dnode5 -s start $x = 0 step5: @@ -179,10 +179,10 @@ endi if $data(1)[4] != ready then goto step5 endi -if $data(2)[4] != offline then +if $data(2)[4] != ready then goto step5 endi -if $data(3)[4] != ready then +if $data(3)[4] != offline then goto step5 endi if $data(4)[4] != ready then @@ -192,9 +192,9 @@ if $data(5)[4] != ready then goto step5 endi -print =============== step5a: drop dnode 2 -sql_error drop dnode 2 -sql drop dnode 2 force +print =============== step5a: drop dnode 3 +sql_error drop dnode 3 +sql drop dnode 3 force print select * from information_schema.ins_dnodes; sql select * from information_schema.ins_dnodes; diff --git a/tests/script/tsim/dnode/vnode_clean.sim b/tests/script/tsim/dnode/vnode_clean.sim index ba1d083c68..aead25938e 100644 --- a/tests/script/tsim/dnode/vnode_clean.sim +++ b/tests/script/tsim/dnode/vnode_clean.sim @@ -207,10 +207,10 @@ print dnode2 openVnodes $data(4)[2] if $data(1)[2] != 1 then return -1 endi -if $data(3)[2] != 1 then +if $data(3)[2] != 2 then return -1 endi -if $data(4)[2] != 2 then +if $data(4)[2] != 1 then return -1 endi diff --git a/tests/script/tsim/parser/regressiontest.sim b/tests/script/tsim/parser/regressiontest.sim index 3ce2b47b44..c08b1bbf27 100644 --- a/tests/script/tsim/parser/regressiontest.sim +++ b/tests/script/tsim/parser/regressiontest.sim @@ -15,7 +15,7 @@ $db = $dbPrefix . $i sql drop database if exists $db -x step1 step1: -sql create database $db vgroups 1; +sql create database $db vgroups 1 cachemodel 'last_row' sql use $db sql create table $tb (ts timestamp, c1 int) @@ -31,13 +31,8 @@ sql insert into $tb values ( $ts , $x ) $x = $x + 1 endw -print ================== restart server to commit data into disk -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode1 -s start -print ================== server restart completed -sql connect +sql flush database $db -sql use $db sql delete from $tb where ts=1537146000000 sql delete from $tb where ts=1537146409500 @@ -63,7 +58,6 @@ if $rows != 8198 then return -1 endi -print ===========================> TD-22077 && TD-21877 sql drop database if exists $db -x step1 sql create database $db vgroups 1; @@ -88,6 +82,8 @@ endw sql flush database $db +print ===========================> TD-22077 && TD-21877 + sql insert into t1 values('2018-09-17 09:00:26', 26); sql insert into t2 values('2018-09-17 09:00:25', 25); @@ -97,4 +93,103 @@ sql flush database reg_db0; sql delete from st1 where ts<='2018-9-17 09:00:26'; sql select * from st1; +sql drop table t1 +sql drop table t2 + +print =========================================>TD-22196 +sql create table t1 using st1 tags(1); + +$i = 0 +$ts = 1674977959000 +$rowNum = 200 + +$x = 0 +while $x < $rowNum +$xs = $x * $delta +$ts = $ts0 + $xs +sql insert into t1 values ( $ts , $x ) +$x = $x + 1 +$ts = $ts + 1000 +endw + +sql flush database $db +sql select min(c),max(c) from t1 +if $data00 != 0 then + return -1 +endi + +if $data01 != 199 then + return -1 +endi + +sql drop table t1 + +$rowNum = 8200 +$ts0 = 1537146000000 +sql create table t1 (ts timestamp, c1 int) + +$i = 0 +$ts = $ts0 + +$x = 0 +while $x < $rowNum +$xs = $x * $delta +$ts = $ts0 + $xs +sql insert into t1 values ( $ts , $x ) +$x = $x + 1 +endw + +sql delete from t1 where ts<=1537146409500 + +sql flush database $db + +print =====================================>TD-22007 +sql select count(*) from t1 interval(10a) + +sql drop table t1 + +sql create table st1 (ts timestamp, k int) tags(a int); +sql insert into t1 using st1 tags(1) values('2020-1-1 10:10:10', 0); +sql insert into t2 using st1 tags(1) values('2020-1-1 10:10:11', 1); +sql insert into t3 using st1 tags(1) values('2020-1-1 10:10:12', 2); +sql insert into t4 using st1 tags(1) values('2020-1-1 10:10:13', 3); +sql insert into t5 using st1 tags(1) values('2020-1-1 10:10:14', 4); +sql insert into t6 using st1 tags(2) values('2020-1-1 10:10:15', 5); +sql insert into t7 using st1 tags(2) values('2020-1-1 10:10:16', 6); +sql insert into t8 using st1 tags(2) values('2020-1-1 10:10:17', 7); +sql insert into t9 using st1 tags(2) values('2020-1-1 10:10:18', 8); +sql insert into t10 using st1 tags(2) values('2020-1-1 10:10:19', 9); + +sql select count(*) from st1 +if $data00 != 10 then + return -1 +endi + +sql select last_row(*) from st1 group by a +if $rows != 2 then + return -1 +endi + +if $data00 != @20-01-01 10:10:19.000@ then + return -1 +endi + +if $data01 != 9 then + return -1 +endi + +if $data10 != @20-01-01 10:10:14.000@ then + return -1 +endi + +if $data11 != 4 then + return -1 +endi + +print ===============================================> TS-2613 +sql select * from information_schema.ins_databases limit 1 offset 1; +if $rows != 1 then + return -1 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/query/explain.sim b/tests/script/tsim/query/explain.sim index 78d905233b..eb6b102bd9 100644 --- a/tests/script/tsim/query/explain.sim +++ b/tests/script/tsim/query/explain.sim @@ -29,43 +29,62 @@ sql insert into tb4 values (now, 4, "Bitmap Heap Scan on tenk1 t1 (cost=5.07..2 #sql create table tb4 using st2 tags(4); #sql insert into tb4 values (now, 4, "Bitmap Heap Scan on tenk1 t1 (cost=5.07..229.20 rows=101 width=244) (actual time=0.080..0.526 rows=100 loops=1)"); +# for explain insert into select +sql create table t1 (ts timestamp, f1 int, f2 binary(200), t1 int); print ======== step2 sql explain select * from st1 where -2; +sql explain insert into t1 select * from st1 where -2; sql explain select ts from tb1; +sql explain insert into t1(ts) select ts from tb1; sql explain select * from st1; +sql explain insert into t1 select * from st1; sql explain select * from st1 order by ts; +sql explain insert into t1 select * from st1 order by ts; sql explain select * from information_schema.ins_stables; sql explain select count(*),sum(f1) from tb1; sql explain select count(*),sum(f1) from st1; sql explain select count(*),sum(f1) from st1 group by f1; #sql explain select count(f1) from tb1 interval(10s, 2s) sliding(3s) fill(prev); +sql explain insert into t1(ts, t1) select _wstart, count(*) from st1 interval(10s); print ======== step3 sql explain verbose true select * from st1 where -2; +sql explain verbose true insert into t1 select * from st1 where -2; sql explain verbose true select ts from tb1 where f1 > 0; +sql explain verbose true insert into t1(ts) select ts from tb1 where f1 > 0; sql explain verbose true select * from st1 where f1 > 0 and ts > '2020-10-31 00:00:00' and ts < '2021-10-31 00:00:00'; +sql explain verbose true insert into t1 select * from st1 where f1 > 0 and ts > '2020-10-31 00:00:00' and ts < '2021-10-31 00:00:00'; sql explain verbose true select count(*) from st1 partition by tbname slimit 1 soffset 2 limit 2 offset 1; sql explain verbose true select * from information_schema.ins_stables where db_name='db2'; sql explain verbose true select st1.f1 from st1 join st2 on st1.ts=st2.ts and st1.f1 > 0; +sql explain verbose true insert into t1(ts) select st1.f1 from st1 join st2 on st1.ts=st2.ts and st1.f1 > 0; +sql explain verbose true insert into t1(ts, t1) select _wstart, count(*) from st1 interval(10s); print ======== step4 sql explain analyze select ts from st1 where -2; +sql explain analyze insert into t1(ts) select ts from st1 where -2; sql explain analyze select ts from tb1; +sql explain analyze insert into t1(ts) select ts from tb1; sql explain analyze select ts from st1; -sql explain analyze select ts from st1; +sql explain analyze insert into t1(ts) select ts from st1; sql explain analyze select ts from st1 order by ts; +sql explain analyze insert into t1(ts) select ts from st1 order by ts; sql explain analyze select * from information_schema.ins_stables; sql explain analyze select count(*),sum(f1) from tb1; sql explain analyze select count(*),sum(f1) from st1; sql explain analyze select count(*),sum(f1) from st1 group by f1; +sql explain analyze insert into t1(ts, t1) select _wstart, count(*) from st1 interval(10s); print ======== step5 sql explain analyze verbose true select ts from st1 where -2; +sql explain analyze verbose true insert into t1(ts) select ts from st1 where -2; sql explain analyze verbose true select ts from tb1; +sql explain analyze verbose true insert into t1(ts) select ts from tb1; sql explain analyze verbose true select ts from st1; -sql explain analyze verbose true select ts from st1; +sql explain analyze verbose true insert into t1(ts) select ts from st1; sql explain analyze verbose true select ts from st1 order by ts; +sql explain analyze verbose true insert into t1(ts) select ts from st1 order by ts; sql explain analyze verbose true select * from information_schema.ins_stables; sql explain analyze verbose true select count(*),sum(f1) from tb1; sql explain analyze verbose true select count(*),sum(f1) from st1; diff --git a/tests/script/tsim/query/forceFill.sim b/tests/script/tsim/query/forceFill.sim new file mode 100644 index 0000000000..37eb85baaa --- /dev/null +++ b/tests/script/tsim/query/forceFill.sim @@ -0,0 +1,367 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql drop database if exists db1; +sql create database db1 vgroups 10; +sql use db1; +sql create stable sta (ts timestamp, f1 double, f2 binary(200)) tags(t1 int); +sql create table tba1 using sta tags(1); +sql insert into tba1 values ('2022-04-26 15:15:01', 1.0, "a"); +sql insert into tba1 values ('2022-04-26 15:15:02', 2.0, "b"); +sql insert into tba1 values ('2022-04-26 15:15:04', 4.0, "b"); +sql insert into tba1 values ('2022-04-26 15:15:05', 5.0, "b"); + +sql select avg(f1) from tba1 where ts >= '2022-04-26 15:15:00' and ts <= '2022-04-26 15:15:06' interval(1s) fill(value_f, 8.8); +if $rows != 7 then + return -1 +endi +if $data00 != 8.800000000 then + return -1 +endi +if $data10 != 1.000000000 then + return -1 +endi +if $data20 != 2.000000000 then + return -1 +endi +if $data30 != 8.800000000 then + return -1 +endi +if $data40 != 4.000000000 then + return -1 +endi +if $data50 != 5.000000000 then + return -1 +endi +if $data60 != 8.800000000 then + return -1 +endi +sql select avg(f1) from tba1 where ts >= '2022-04-26 15:15:00' and ts <= '2022-04-26 15:15:06' interval(1s) fill(value, 8.8); +if $rows != 7 then + return -1 +endi +if $data00 != 8.800000000 then + return -1 +endi +if $data10 != 1.000000000 then + return -1 +endi +if $data20 != 2.000000000 then + return -1 +endi +if $data30 != 8.800000000 then + return -1 +endi +if $data40 != 4.000000000 then + return -1 +endi +if $data50 != 5.000000000 then + return -1 +endi +if $data60 != 8.800000000 then + return -1 +endi +sql select avg(f1) from tba1 where ts >= '2022-04-26 15:15:00' and ts <= '2022-04-26 15:15:06' interval(1s) fill(null); +if $rows != 7 then + return -1 +endi +if $data00 != NULL then + return -1 +endi +if $data10 != 1.000000000 then + return -1 +endi +if $data20 != 2.000000000 then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != 4.000000000 then + return -1 +endi +if $data50 != 5.000000000 then + return -1 +endi +if $data60 != NULL then + return -1 +endi +sql select avg(f1) from tba1 where ts >= '2022-04-26 15:15:00' and ts <= '2022-04-26 15:15:06' interval(1s) fill(null_f); +if $rows != 7 then + return -1 +endi +if $data00 != NULL then + return -1 +endi +if $data10 != 1.000000000 then + return -1 +endi +if $data20 != 2.000000000 then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != 4.000000000 then + return -1 +endi +if $data50 != 5.000000000 then + return -1 +endi +if $data60 != NULL then + return -1 +endi +sql select avg(f1) from tba1 where ts >= '2022-04-26 15:15:06' and ts <= '2022-04-26 15:15:10' interval(1s) fill(value, 8.8); +if $rows != 0 then + return -1 +endi +sql select avg(f1) from tba1 where ts >= '2022-04-26 15:15:06' and ts <= '2022-04-26 15:15:10' interval(1s) fill(value_f, 8.8); +if $rows != 5 then + return -1 +endi +if $data00 != 8.800000000 then + return -1 +endi +if $data10 != 8.800000000 then + return -1 +endi +if $data20 != 8.800000000 then + return -1 +endi +if $data30 != 8.800000000 then + return -1 +endi +if $data40 != 8.800000000 then + return -1 +endi +sql select avg(f1) from tba1 where ts >= '2022-04-26 15:15:06' and ts <= '2022-04-26 15:15:10' interval(1s) fill(null); +if $rows != 0 then + return -1 +endi +sql select avg(f1) from tba1 where ts >= '2022-04-26 15:15:06' and ts <= '2022-04-26 15:15:10' interval(1s) fill(null_f); +if $rows != 5 then + return -1 +endi +if $data00 != NULL then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != NULL then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != NULL then + return -1 +endi +sql select avg(f1) from tba1 where ts >= '2022-04-26 15:16:00' and ts <= '2022-04-26 19:15:59' interval(1s) fill(value_f, 8.8); +if $rows != 14400 then + return -1 +endi +if $data00 != 8.800000000 then + return -1 +endi +sql select avg(f1) from tba1 where ts >= '2022-04-26 15:16:00' and ts <= '2022-04-26 19:15:59' interval(1s) fill(null_f); +if $rows != 14400 then + return -1 +endi +if $data00 != NULL then + return -1 +endi +sql select interp(f1) from tba1 range('2022-04-26 15:15:00','2022-04-26 15:15:06') every(1s) fill(value_f, 8.8); +if $rows != 7 then + return -1 +endi +if $data00 != 8.800000000 then + return -1 +endi +if $data10 != 1.000000000 then + return -1 +endi +if $data20 != 2.000000000 then + return -1 +endi +if $data30 != 8.800000000 then + return -1 +endi +if $data40 != 4.000000000 then + return -1 +endi +if $data50 != 5.000000000 then + return -1 +endi +if $data60 != 8.800000000 then + return -1 +endi +sql select interp(f1) from tba1 range('2022-04-26 15:15:00','2022-04-26 15:15:06') every(1s) fill(value, 8.8); +if $rows != 7 then + return -1 +endi +if $data00 != 8.800000000 then + return -1 +endi +if $data10 != 1.000000000 then + return -1 +endi +if $data20 != 2.000000000 then + return -1 +endi +if $data30 != 8.800000000 then + return -1 +endi +if $data40 != 4.000000000 then + return -1 +endi +if $data50 != 5.000000000 then + return -1 +endi +if $data60 != 8.800000000 then + return -1 +endi +sql select interp(f1) from tba1 range('2022-04-26 15:15:00','2022-04-26 15:15:06') every(1s) fill(null); +if $rows != 7 then + return -1 +endi +if $data00 != NULL then + return -1 +endi +if $data10 != 1.000000000 then + return -1 +endi +if $data20 != 2.000000000 then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != 4.000000000 then + return -1 +endi +if $data50 != 5.000000000 then + return -1 +endi +if $data60 != NULL then + return -1 +endi +sql select interp(f1) from tba1 range('2022-04-26 15:15:00','2022-04-26 15:15:06') every(1s) fill(null_f); +if $rows != 7 then + return -1 +endi +if $data00 != NULL then + return -1 +endi +if $data10 != 1.000000000 then + return -1 +endi +if $data20 != 2.000000000 then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != 4.000000000 then + return -1 +endi +if $data50 != 5.000000000 then + return -1 +endi +if $data60 != NULL then + return -1 +endi +sql select interp(f1) from tba1 range('2022-04-26 15:15:06','2022-04-26 15:15:10') every(1s) fill(value, 8.8); +if $rows != 5 then + return -1 +endi +if $data00 != 8.800000000 then + return -1 +endi +if $data10 != 8.800000000 then + return -1 +endi +if $data20 != 8.800000000 then + return -1 +endi +if $data30 != 8.800000000 then + return -1 +endi +if $data40 != 8.800000000 then + return -1 +endi +sql select interp(f1) from tba1 range('2022-04-26 15:15:06','2022-04-26 15:15:10') every(1s) fill(value_f, 8.8); +if $rows != 5 then + return -1 +endi +if $data00 != 8.800000000 then + return -1 +endi +if $data10 != 8.800000000 then + return -1 +endi +if $data20 != 8.800000000 then + return -1 +endi +if $data30 != 8.800000000 then + return -1 +endi +if $data40 != 8.800000000 then + return -1 +endi +sql select interp(f1) from tba1 range('2022-04-26 15:15:06','2022-04-26 15:15:10') every(1s) fill(null); +if $rows != 5 then + return -1 +endi +if $data00 != NULL then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != NULL then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != NULL then + return -1 +endi +sql select interp(f1) from tba1 range('2022-04-26 15:15:06','2022-04-26 15:15:10') every(1s) fill(null_f); +if $rows != 5 then + return -1 +endi +if $data00 != NULL then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != NULL then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != NULL then + return -1 +endi +sql select interp(f1) from tba1 range('2022-04-26 15:16:00','2022-04-26 19:15:59') every(1s) fill(value_f, 8.8); +if $rows != 14400 then + return -1 +endi +if $data00 != 8.800000000 then + return -1 +endi +sql select interp(f1) from tba1 range('2022-04-26 15:16:00','2022-04-26 19:15:59') every(1s) fill(null_f); +if $rows != 14400 then + return -1 +endi +if $data00 != NULL then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/scalar/tsConvert.sim b/tests/script/tsim/scalar/tsConvert.sim index 75efdb442f..ad8d3b3b93 100644 --- a/tests/script/tsim/scalar/tsConvert.sim +++ b/tests/script/tsim/scalar/tsConvert.sim @@ -13,7 +13,7 @@ sql insert into tb1 values ('2022-07-10 16:31:00', 1, '1'); sql insert into tb1 values ('2022-07-10 16:32:00', 2, '2'); sql insert into tb1 values ('2022-07-10 16:33:00', 3, '3'); sql insert into tb1 values ('2022-07-10 16:34:00', 4, '4'); -sql select * from (select ts,TIMETRUNCATE(ts,1d),TIMETRUNCATE(ts,1h),timediff(TIMETRUNCATE(ts,1d),TIMETRUNCATE(ts,1h),1h) as td from tb1 where ts >='2022-06-01 00:00:00' and ts <=' 2022-11-3 23:59:59' ) t where td >12; +sql select * from (select ts,TIMETRUNCATE(ts,1d),TIMETRUNCATE(ts,1h),timediff(TIMETRUNCATE(ts,1d),TIMETRUNCATE(ts,1h),1h) as td from tb1 where ts >='2022-06-01 00:00:00' and ts <='2022-11-3 23:59:59' ) t where td >12; if $rows != 4 then return -1 endi diff --git a/tests/script/tsim/stream/basic3.sim b/tests/script/tsim/stream/basic3.sim index e598919e34..2df33541b4 100644 --- a/tests/script/tsim/stream/basic3.sim +++ b/tests/script/tsim/stream/basic3.sim @@ -81,6 +81,15 @@ if $rows == 0 then return -1 endi +sleep 3000 + +sql drop stream if exists streamd1; +sql drop stream if exists streamd2; +sql drop stream if exists streamd3; +sql drop stream if exists streamd4; +sql drop stream if exists streamd5; +sql drop stream if exists streamd6; + sql create stream streamd10 into streamd10 as select _wstart, _wend, count(*), first(ca), last(cb) as c2 from t1 interval(10s); sql desc streamd10; @@ -100,15 +109,6 @@ if $rows == 0 then return -1 endi -sleep 3000 - -sql drop stream if exists streamd1; -sql drop stream if exists streamd2; -sql drop stream if exists streamd3; -sql drop stream if exists streamd4; -sql drop stream if exists streamd5; -sql drop stream if exists streamd6; - _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/drop_stream.sim b/tests/script/tsim/stream/drop_stream.sim index 1a474bd9ae..7ff9632a3e 100644 --- a/tests/script/tsim/stream/drop_stream.sim +++ b/tests/script/tsim/stream/drop_stream.sim @@ -55,62 +55,62 @@ sql create stream stb_asin_stream trigger at_once into output_asin_stb as select sql create stream ctb_asin_stream trigger at_once into output_asin_ctb as select ts, asin(c1), asin(c2), c3 from scalar_ct1; sql create stream tb_asin_stream trigger at_once into output_asin_tb as select ts, asin(c1), asin(c2), c3 from scalar_tb; sql create stream stb_atan_stream trigger at_once into output_atan_stb as select ts, atan(c1), atan(c2), c3 from scalar_stb partition by tbname; -sql create stream ctb_atan_stream trigger at_once into output_atan_ctb as select ts, atan(c1), atan(c2), c3 from scalar_ct1; -sql create stream tb_atan_stream trigger at_once into output_atan_tb as select ts, atan(c1), atan(c2), c3 from scalar_tb; -sql create stream stb_ceil_stream trigger at_once into output_ceil_stb as select ts, ceil(c1), ceil(c2), c3 from scalar_stb partition by tbname; -sql create stream ctb_ceil_stream trigger at_once into output_ceil_ctb as select ts, ceil(c1), ceil(c2), c3 from scalar_ct1; -sql create stream tb_ceil_stream trigger at_once into output_ceil_tb as select ts, ceil(c1), ceil(c2), c3 from scalar_tb; -sql create stream stb_cos_stream trigger at_once into output_cos_stb as select ts, cos(c1), cos(c2), c3 from scalar_stb partition by tbname; -sql create stream ctb_cos_stream trigger at_once into output_cos_ctb as select ts, cos(c1), cos(c2), c3 from scalar_ct1; -sql create stream tb_cos_stream trigger at_once into output_cos_tb as select ts, cos(c1), cos(c2), c3 from scalar_tb; -sql create stream stb_floor_stream trigger at_once into output_floor_stb as select ts, floor(c1), floor(c2), c3 from scalar_stb partition by tbname; -sql create stream ctb_floor_stream trigger at_once into output_floor_ctb as select ts, floor(c1), floor(c2), c3 from scalar_ct1; -sql create stream tb_floor_stream trigger at_once into output_floor_tb as select ts, floor(c1), floor(c2), c3 from scalar_tb; -sql create stream stb_log_stream trigger at_once into output_log_stb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_stb partition by tbname; -sql create stream ctb_log_stream trigger at_once into output_log_ctb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_ct1; -sql create stream tb_log_stream trigger at_once into output_log_tb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_tb; -sql create stream stb_pow_stream trigger at_once into output_pow_stb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_stb partition by tbname; -sql create stream ctb_pow_stream trigger at_once into output_pow_ctb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_ct1; -sql create stream tb_pow_stream trigger at_once into output_pow_tb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_tb; -sql create stream stb_round_stream trigger at_once into output_round_stb as select ts, round(c1), round(c2), c3 from scalar_stb partition by tbname; -sql create stream ctb_round_stream trigger at_once into output_round_ctb as select ts, round(c1), round(c2), c3 from scalar_ct1; -sql create stream tb_round_stream trigger at_once into output_round_tb as select ts, round(c1), round(c2), c3 from scalar_tb; -sql create stream stb_sin_stream trigger at_once into output_sin_stb as select ts, sin(c1), sin(c2), c3 from scalar_stb partition by tbname; -sql create stream ctb_sin_stream trigger at_once into output_sin_ctb as select ts, sin(c1), sin(c2), c3 from scalar_ct1; -sql create stream tb_sin_stream trigger at_once into output_sin_tb as select ts, sin(c1), sin(c2), c3 from scalar_tb; -sql create stream stb_sqrt_stream trigger at_once into output_sqrt_stb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_stb partition by tbname; -sql create stream ctb_sqrt_stream trigger at_once into output_sqrt_ctb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_ct1; -sql create stream tb_sqrt_stream trigger at_once into output_sqrt_tb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_tb; -sql create stream stb_tan_stream trigger at_once into output_tan_stb as select ts, tan(c1), tan(c2), c3 from scalar_stb partition by tbname; -sql create stream ctb_tan_stream trigger at_once into output_tan_ctb as select ts, tan(c1), tan(c2), c3 from scalar_ct1; -sql create stream tb_tan_stream trigger at_once into output_tan_tb as select ts, tan(c1), tan(c2), c3 from scalar_tb; -sql create stream stb_char_length_stream into output_char_length_stb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_stb partition by tbname; -sql create stream ctb_char_length_stream into output_char_length_ctb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_ct1; -sql create stream tb_char_length_stream into output_char_length_tb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_tb; -sql create stream stb_concat_stream into output_concat_stb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_stb partition by tbname; -sql create stream ctb_concat_stream into output_concat_ctb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_ct1; -sql create stream tb_concat_stream into output_concat_tb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_tb; -sql create stream stb_concat_ws_stream into output_concat_ws_stb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_stb partition by tbname; -sql create stream ctb_concat_ws_stream into output_concat_ws_ctb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_ct1; -sql create stream tb_concat_ws_stream into output_concat_ws_tb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_tb; -sql create stream stb_length_stream into output_length_stb as select ts, length(c3), length(c4), length(c5) from scalar_stb partition by tbname; -sql create stream ctb_length_stream into output_length_ctb as select ts, length(c3), length(c4), length(c5) from scalar_ct1; -sql create stream tb_length_stream into output_length_tb as select ts, length(c3), length(c4), length(c5) from scalar_tb; -sql create stream stb_lower_stream into output_lower_stb as select ts, lower(c3), lower(c4), lower(c5) from scalar_stb partition by tbname; -sql create stream ctb_lower_stream into output_lower_ctb as select ts, lower(c3), lower(c4), lower(c5) from scalar_ct1; -sql create stream tb_lower_stream into output_lower_tb as select ts, lower(c3), lower(c4), lower(c5) from scalar_tb; -sql create stream stb_ltrim_stream into output_ltrim_stb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_stb partition by tbname; -sql create stream ctb_ltrim_stream into output_ltrim_ctb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_ct1; -sql create stream tb_ltrim_stream into output_ltrim_tb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_tb; -sql create stream stb_rtrim_stream into output_rtrim_stb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_stb partition by tbname; -sql create stream ctb_rtrim_stream into output_rtrim_ctb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_ct1; -sql create stream tb_rtrim_stream into output_rtrim_tb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_tb; -sql create stream stb_substr_stream into output_substr_stb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_stb partition by tbname; -sql create stream ctb_substr_stream into output_substr_ctb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_ct1; -sql create stream tb_substr_stream into output_substr_tb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_tb; -sql create stream stb_upper_stream into output_upper_stb as select ts, upper(c3), upper(c4), upper(c5) from scalar_stb partition by tbname; -sql create stream ctb_upper_stream into output_upper_ctb as select ts, upper(c3), upper(c4), upper(c5) from scalar_ct1; -sql create stream tb_upper_stream into output_upper_tb as select ts, upper(c3), upper(c4), upper(c5) from scalar_tb; +# sql create stream ctb_atan_stream trigger at_once into output_atan_ctb as select ts, atan(c1), atan(c2), c3 from scalar_ct1; +# sql create stream tb_atan_stream trigger at_once into output_atan_tb as select ts, atan(c1), atan(c2), c3 from scalar_tb; +# sql create stream stb_ceil_stream trigger at_once into output_ceil_stb as select ts, ceil(c1), ceil(c2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_ceil_stream trigger at_once into output_ceil_ctb as select ts, ceil(c1), ceil(c2), c3 from scalar_ct1; +# sql create stream tb_ceil_stream trigger at_once into output_ceil_tb as select ts, ceil(c1), ceil(c2), c3 from scalar_tb; +# sql create stream stb_cos_stream trigger at_once into output_cos_stb as select ts, cos(c1), cos(c2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_cos_stream trigger at_once into output_cos_ctb as select ts, cos(c1), cos(c2), c3 from scalar_ct1; +# sql create stream tb_cos_stream trigger at_once into output_cos_tb as select ts, cos(c1), cos(c2), c3 from scalar_tb; +# sql create stream stb_floor_stream trigger at_once into output_floor_stb as select ts, floor(c1), floor(c2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_floor_stream trigger at_once into output_floor_ctb as select ts, floor(c1), floor(c2), c3 from scalar_ct1; +# sql create stream tb_floor_stream trigger at_once into output_floor_tb as select ts, floor(c1), floor(c2), c3 from scalar_tb; +# sql create stream stb_log_stream trigger at_once into output_log_stb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_log_stream trigger at_once into output_log_ctb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_ct1; +# sql create stream tb_log_stream trigger at_once into output_log_tb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_tb; +# sql create stream stb_pow_stream trigger at_once into output_pow_stb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_pow_stream trigger at_once into output_pow_ctb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_ct1; +# sql create stream tb_pow_stream trigger at_once into output_pow_tb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_tb; +# sql create stream stb_round_stream trigger at_once into output_round_stb as select ts, round(c1), round(c2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_round_stream trigger at_once into output_round_ctb as select ts, round(c1), round(c2), c3 from scalar_ct1; +# sql create stream tb_round_stream trigger at_once into output_round_tb as select ts, round(c1), round(c2), c3 from scalar_tb; +# sql create stream stb_sin_stream trigger at_once into output_sin_stb as select ts, sin(c1), sin(c2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_sin_stream trigger at_once into output_sin_ctb as select ts, sin(c1), sin(c2), c3 from scalar_ct1; +# sql create stream tb_sin_stream trigger at_once into output_sin_tb as select ts, sin(c1), sin(c2), c3 from scalar_tb; +# sql create stream stb_sqrt_stream trigger at_once into output_sqrt_stb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_sqrt_stream trigger at_once into output_sqrt_ctb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_ct1; +# sql create stream tb_sqrt_stream trigger at_once into output_sqrt_tb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_tb; +# sql create stream stb_tan_stream trigger at_once into output_tan_stb as select ts, tan(c1), tan(c2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_tan_stream trigger at_once into output_tan_ctb as select ts, tan(c1), tan(c2), c3 from scalar_ct1; +# sql create stream tb_tan_stream trigger at_once into output_tan_tb as select ts, tan(c1), tan(c2), c3 from scalar_tb; +# sql create stream stb_char_length_stream into output_char_length_stb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_stb partition by tbname; +# sql create stream ctb_char_length_stream into output_char_length_ctb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_ct1; +# sql create stream tb_char_length_stream into output_char_length_tb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_tb; +# sql create stream stb_concat_stream into output_concat_stb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_stb partition by tbname; +# sql create stream ctb_concat_stream into output_concat_ctb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_ct1; +# sql create stream tb_concat_stream into output_concat_tb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_tb; +# sql create stream stb_concat_ws_stream into output_concat_ws_stb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_stb partition by tbname; +# sql create stream ctb_concat_ws_stream into output_concat_ws_ctb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_ct1; +# sql create stream tb_concat_ws_stream into output_concat_ws_tb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_tb; +# sql create stream stb_length_stream into output_length_stb as select ts, length(c3), length(c4), length(c5) from scalar_stb partition by tbname; +# sql create stream ctb_length_stream into output_length_ctb as select ts, length(c3), length(c4), length(c5) from scalar_ct1; +# sql create stream tb_length_stream into output_length_tb as select ts, length(c3), length(c4), length(c5) from scalar_tb; +# sql create stream stb_lower_stream into output_lower_stb as select ts, lower(c3), lower(c4), lower(c5) from scalar_stb partition by tbname; +# sql create stream ctb_lower_stream into output_lower_ctb as select ts, lower(c3), lower(c4), lower(c5) from scalar_ct1; +# sql create stream tb_lower_stream into output_lower_tb as select ts, lower(c3), lower(c4), lower(c5) from scalar_tb; +# sql create stream stb_ltrim_stream into output_ltrim_stb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_stb partition by tbname; +# sql create stream ctb_ltrim_stream into output_ltrim_ctb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_ct1; +# sql create stream tb_ltrim_stream into output_ltrim_tb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_tb; +# sql create stream stb_rtrim_stream into output_rtrim_stb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_stb partition by tbname; +# sql create stream ctb_rtrim_stream into output_rtrim_ctb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_ct1; +# sql create stream tb_rtrim_stream into output_rtrim_tb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_tb; +# sql create stream stb_substr_stream into output_substr_stb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_stb partition by tbname; +# sql create stream ctb_substr_stream into output_substr_ctb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_ct1; +# sql create stream tb_substr_stream into output_substr_tb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_tb; +# sql create stream stb_upper_stream into output_upper_stb as select ts, upper(c3), upper(c4), upper(c5) from scalar_stb partition by tbname; +# sql create stream ctb_upper_stream into output_upper_ctb as select ts, upper(c3), upper(c4), upper(c5) from scalar_ct1; +# sql create stream tb_upper_stream into output_upper_tb as select ts, upper(c3), upper(c4), upper(c5) from scalar_tb; sql insert into scalar_ct1 values (1656668180503, 100, 100.1, "beijing", "taos", "Taos"); sql insert into scalar_ct1 values (1656668180503+1s, -50, -50.1, "tianjin", "taosdata", "Taosdata"); sql insert into scalar_ct1 values (1656668180503+2s, 0, Null, "hebei", "TDengine", Null); @@ -146,62 +146,62 @@ sql create stream stb_asin_stream trigger at_once into output_asin_stb as select sql create stream ctb_asin_stream trigger at_once into output_asin_ctb as select ts, asin(c1), asin(c2), c3 from scalar_ct1; sql create stream tb_asin_stream trigger at_once into output_asin_tb as select ts, asin(c1), asin(c2), c3 from scalar_tb; sql create stream stb_atan_stream trigger at_once into output_atan_stb as select ts, atan(c1), atan(c2), c3 from scalar_stb partition by tbname; -sql create stream ctb_atan_stream trigger at_once into output_atan_ctb as select ts, atan(c1), atan(c2), c3 from scalar_ct1; -sql create stream tb_atan_stream trigger at_once into output_atan_tb as select ts, atan(c1), atan(c2), c3 from scalar_tb; -sql create stream stb_ceil_stream trigger at_once into output_ceil_stb as select ts, ceil(c1), ceil(c2), c3 from scalar_stb partition by tbname; -sql create stream ctb_ceil_stream trigger at_once into output_ceil_ctb as select ts, ceil(c1), ceil(c2), c3 from scalar_ct1; -sql create stream tb_ceil_stream trigger at_once into output_ceil_tb as select ts, ceil(c1), ceil(c2), c3 from scalar_tb; -sql create stream stb_cos_stream trigger at_once into output_cos_stb as select ts, cos(c1), cos(c2), c3 from scalar_stb partition by tbname; -sql create stream ctb_cos_stream trigger at_once into output_cos_ctb as select ts, cos(c1), cos(c2), c3 from scalar_ct1; -sql create stream tb_cos_stream trigger at_once into output_cos_tb as select ts, cos(c1), cos(c2), c3 from scalar_tb; -sql create stream stb_floor_stream trigger at_once into output_floor_stb as select ts, floor(c1), floor(c2), c3 from scalar_stb partition by tbname; -sql create stream ctb_floor_stream trigger at_once into output_floor_ctb as select ts, floor(c1), floor(c2), c3 from scalar_ct1; -sql create stream tb_floor_stream trigger at_once into output_floor_tb as select ts, floor(c1), floor(c2), c3 from scalar_tb; -sql create stream stb_log_stream trigger at_once into output_log_stb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_stb partition by tbname; -sql create stream ctb_log_stream trigger at_once into output_log_ctb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_ct1; -sql create stream tb_log_stream trigger at_once into output_log_tb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_tb; -sql create stream stb_pow_stream trigger at_once into output_pow_stb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_stb partition by tbname; -sql create stream ctb_pow_stream trigger at_once into output_pow_ctb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_ct1; -sql create stream tb_pow_stream trigger at_once into output_pow_tb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_tb; -sql create stream stb_round_stream trigger at_once into output_round_stb as select ts, round(c1), round(c2), c3 from scalar_stb partition by tbname; -sql create stream ctb_round_stream trigger at_once into output_round_ctb as select ts, round(c1), round(c2), c3 from scalar_ct1; -sql create stream tb_round_stream trigger at_once into output_round_tb as select ts, round(c1), round(c2), c3 from scalar_tb; -sql create stream stb_sin_stream trigger at_once into output_sin_stb as select ts, sin(c1), sin(c2), c3 from scalar_stb partition by tbname; -sql create stream ctb_sin_stream trigger at_once into output_sin_ctb as select ts, sin(c1), sin(c2), c3 from scalar_ct1; -sql create stream tb_sin_stream trigger at_once into output_sin_tb as select ts, sin(c1), sin(c2), c3 from scalar_tb; -sql create stream stb_sqrt_stream trigger at_once into output_sqrt_stb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_stb partition by tbname; -sql create stream ctb_sqrt_stream trigger at_once into output_sqrt_ctb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_ct1; -sql create stream tb_sqrt_stream trigger at_once into output_sqrt_tb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_tb; -sql create stream stb_tan_stream trigger at_once into output_tan_stb as select ts, tan(c1), tan(c2), c3 from scalar_stb partition by tbname; -sql create stream ctb_tan_stream trigger at_once into output_tan_ctb as select ts, tan(c1), tan(c2), c3 from scalar_ct1; -sql create stream tb_tan_stream trigger at_once into output_tan_tb as select ts, tan(c1), tan(c2), c3 from scalar_tb; -sql create stream stb_char_length_stream into output_char_length_stb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_stb partition by tbname; -sql create stream ctb_char_length_stream into output_char_length_ctb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_ct1; -sql create stream tb_char_length_stream into output_char_length_tb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_tb; -sql create stream stb_concat_stream into output_concat_stb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_stb partition by tbname; -sql create stream ctb_concat_stream into output_concat_ctb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_ct1; -sql create stream tb_concat_stream into output_concat_tb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_tb; -sql create stream stb_concat_ws_stream into output_concat_ws_stb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_stb partition by tbname; -sql create stream ctb_concat_ws_stream into output_concat_ws_ctb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_ct1; -sql create stream tb_concat_ws_stream into output_concat_ws_tb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_tb; -sql create stream stb_length_stream into output_length_stb as select ts, length(c3), length(c4), length(c5) from scalar_stb partition by tbname; -sql create stream ctb_length_stream into output_length_ctb as select ts, length(c3), length(c4), length(c5) from scalar_ct1; -sql create stream tb_length_stream into output_length_tb as select ts, length(c3), length(c4), length(c5) from scalar_tb; -sql create stream stb_lower_stream into output_lower_stb as select ts, lower(c3), lower(c4), lower(c5) from scalar_stb partition by tbname; -sql create stream ctb_lower_stream into output_lower_ctb as select ts, lower(c3), lower(c4), lower(c5) from scalar_ct1; -sql create stream tb_lower_stream into output_lower_tb as select ts, lower(c3), lower(c4), lower(c5) from scalar_tb; -sql create stream stb_ltrim_stream into output_ltrim_stb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_stb partition by tbname; -sql create stream ctb_ltrim_stream into output_ltrim_ctb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_ct1; -sql create stream tb_ltrim_stream into output_ltrim_tb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_tb; -sql create stream stb_rtrim_stream into output_rtrim_stb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_stb partition by tbname; -sql create stream ctb_rtrim_stream into output_rtrim_ctb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_ct1; -sql create stream tb_rtrim_stream into output_rtrim_tb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_tb; -sql create stream stb_substr_stream into output_substr_stb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_stb partition by tbname; -sql create stream ctb_substr_stream into output_substr_ctb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_ct1; -sql create stream tb_substr_stream into output_substr_tb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_tb; -sql create stream stb_upper_stream into output_upper_stb as select ts, upper(c3), upper(c4), upper(c5) from scalar_stb partition by tbname; -sql create stream ctb_upper_stream into output_upper_ctb as select ts, upper(c3), upper(c4), upper(c5) from scalar_ct1; -sql create stream tb_upper_stream into output_upper_tb as select ts, upper(c3), upper(c4), upper(c5) from scalar_tb; +# sql create stream ctb_atan_stream trigger at_once into output_atan_ctb as select ts, atan(c1), atan(c2), c3 from scalar_ct1; +# sql create stream tb_atan_stream trigger at_once into output_atan_tb as select ts, atan(c1), atan(c2), c3 from scalar_tb; +# sql create stream stb_ceil_stream trigger at_once into output_ceil_stb as select ts, ceil(c1), ceil(c2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_ceil_stream trigger at_once into output_ceil_ctb as select ts, ceil(c1), ceil(c2), c3 from scalar_ct1; +# sql create stream tb_ceil_stream trigger at_once into output_ceil_tb as select ts, ceil(c1), ceil(c2), c3 from scalar_tb; +# sql create stream stb_cos_stream trigger at_once into output_cos_stb as select ts, cos(c1), cos(c2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_cos_stream trigger at_once into output_cos_ctb as select ts, cos(c1), cos(c2), c3 from scalar_ct1; +# sql create stream tb_cos_stream trigger at_once into output_cos_tb as select ts, cos(c1), cos(c2), c3 from scalar_tb; +# sql create stream stb_floor_stream trigger at_once into output_floor_stb as select ts, floor(c1), floor(c2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_floor_stream trigger at_once into output_floor_ctb as select ts, floor(c1), floor(c2), c3 from scalar_ct1; +# sql create stream tb_floor_stream trigger at_once into output_floor_tb as select ts, floor(c1), floor(c2), c3 from scalar_tb; +# sql create stream stb_log_stream trigger at_once into output_log_stb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_log_stream trigger at_once into output_log_ctb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_ct1; +# sql create stream tb_log_stream trigger at_once into output_log_tb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_tb; +# sql create stream stb_pow_stream trigger at_once into output_pow_stb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_pow_stream trigger at_once into output_pow_ctb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_ct1; +# sql create stream tb_pow_stream trigger at_once into output_pow_tb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_tb; +# sql create stream stb_round_stream trigger at_once into output_round_stb as select ts, round(c1), round(c2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_round_stream trigger at_once into output_round_ctb as select ts, round(c1), round(c2), c3 from scalar_ct1; +# sql create stream tb_round_stream trigger at_once into output_round_tb as select ts, round(c1), round(c2), c3 from scalar_tb; +# sql create stream stb_sin_stream trigger at_once into output_sin_stb as select ts, sin(c1), sin(c2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_sin_stream trigger at_once into output_sin_ctb as select ts, sin(c1), sin(c2), c3 from scalar_ct1; +# sql create stream tb_sin_stream trigger at_once into output_sin_tb as select ts, sin(c1), sin(c2), c3 from scalar_tb; +# sql create stream stb_sqrt_stream trigger at_once into output_sqrt_stb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_sqrt_stream trigger at_once into output_sqrt_ctb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_ct1; +# sql create stream tb_sqrt_stream trigger at_once into output_sqrt_tb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_tb; +# sql create stream stb_tan_stream trigger at_once into output_tan_stb as select ts, tan(c1), tan(c2), c3 from scalar_stb partition by tbname; +# sql create stream ctb_tan_stream trigger at_once into output_tan_ctb as select ts, tan(c1), tan(c2), c3 from scalar_ct1; +# sql create stream tb_tan_stream trigger at_once into output_tan_tb as select ts, tan(c1), tan(c2), c3 from scalar_tb; +# sql create stream stb_char_length_stream into output_char_length_stb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_stb partition by tbname; +# sql create stream ctb_char_length_stream into output_char_length_ctb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_ct1; +# sql create stream tb_char_length_stream into output_char_length_tb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_tb; +# sql create stream stb_concat_stream into output_concat_stb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_stb partition by tbname; +# sql create stream ctb_concat_stream into output_concat_ctb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_ct1; +# sql create stream tb_concat_stream into output_concat_tb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_tb; +# sql create stream stb_concat_ws_stream into output_concat_ws_stb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_stb partition by tbname; +# sql create stream ctb_concat_ws_stream into output_concat_ws_ctb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_ct1; +# sql create stream tb_concat_ws_stream into output_concat_ws_tb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_tb; +# sql create stream stb_length_stream into output_length_stb as select ts, length(c3), length(c4), length(c5) from scalar_stb partition by tbname; +# sql create stream ctb_length_stream into output_length_ctb as select ts, length(c3), length(c4), length(c5) from scalar_ct1; +# sql create stream tb_length_stream into output_length_tb as select ts, length(c3), length(c4), length(c5) from scalar_tb; +# sql create stream stb_lower_stream into output_lower_stb as select ts, lower(c3), lower(c4), lower(c5) from scalar_stb partition by tbname; +# sql create stream ctb_lower_stream into output_lower_ctb as select ts, lower(c3), lower(c4), lower(c5) from scalar_ct1; +# sql create stream tb_lower_stream into output_lower_tb as select ts, lower(c3), lower(c4), lower(c5) from scalar_tb; +# sql create stream stb_ltrim_stream into output_ltrim_stb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_stb partition by tbname; +# sql create stream ctb_ltrim_stream into output_ltrim_ctb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_ct1; +# sql create stream tb_ltrim_stream into output_ltrim_tb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_tb; +# sql create stream stb_rtrim_stream into output_rtrim_stb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_stb partition by tbname; +# sql create stream ctb_rtrim_stream into output_rtrim_ctb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_ct1; +# sql create stream tb_rtrim_stream into output_rtrim_tb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_tb; +# sql create stream stb_substr_stream into output_substr_stb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_stb partition by tbname; +# sql create stream ctb_substr_stream into output_substr_ctb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_ct1; +# sql create stream tb_substr_stream into output_substr_tb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_tb; +# sql create stream stb_upper_stream into output_upper_stb as select ts, upper(c3), upper(c4), upper(c5) from scalar_stb partition by tbname; +# sql create stream ctb_upper_stream into output_upper_ctb as select ts, upper(c3), upper(c4), upper(c5) from scalar_ct1; +# sql create stream tb_upper_stream into output_upper_tb as select ts, upper(c3), upper(c4), upper(c5) from scalar_tb; sql insert into scalar_ct1 values (1656668180503, 100, 100.1, "beijing", "taos", "Taos"); sql insert into scalar_ct1 values (1656668180503+1s, -50, -50.1, "tianjin", "taosdata", "Taosdata"); sql insert into scalar_ct1 values (1656668180503+2s, 0, Null, "hebei", "TDengine", Null); @@ -273,4 +273,4 @@ print ========== step7 system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode4 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/fillIntervalValue.sim b/tests/script/tsim/stream/fillIntervalValue.sim index fe4ec759eb..2cd419397f 100644 --- a/tests/script/tsim/stream/fillIntervalValue.sim +++ b/tests/script/tsim/stream/fillIntervalValue.sim @@ -14,6 +14,7 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20));; sql create stream streams1 trigger at_once into streamt as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(value, 100); +sql create stream streams1a trigger at_once into streamta as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(value_f, 100); sql insert into t1 values(1648791213000,1,2,3,1.0,'aaa'); sleep 100 sql insert into t1 values(1648791233000,1,2,3,1.0,'aaa'); @@ -77,6 +78,69 @@ if $data71 != 1 then goto loop0 endi + +print "force fill vaule" + +$loop_count = 0 + +loop0a: +sleep 200 +sql select * from streamta order by ts; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 8 then + print =====rows=$rows + goto loop0a +endi + +if $data01 != 1 then + print =====data01=$data01 + goto loop0a +endi + +if $data11 != 1 then + print =====data11=$data11 + goto loop0a +endi + +if $data21 != 1 then + print =====data21=$data21 + goto loop0a +endi + +if $data31 != 100 then + print =====data31=$data31 + goto loop0a +endi + +if $data41 != 1 then + print =====data41=$data41 + goto loop0a +endi + +if $data51 != 100 then + print =====data01=$data01 + goto loop0a +endi + +if $data61 != 100 then + print =====data61=$data61 + goto loop0a +endi + +if $data71 != 1 then + print =====data71=$data71 + goto loop0a +endi + + + + + sql drop stream if exists streams2; sql drop database if exists test2; sql create database test2 vgroups 1; @@ -408,6 +472,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create stream streams4 trigger at_once into streamt4 as select _wstart ts, count(*) c1, concat(tbname, 'aaa') as pname, timezone() from st where ts > 1648791000000 and ts < 1648793000000 partition by tbname interval(10s) fill(NULL); +sql create stream streams4a trigger at_once into streamt4a as select _wstart ts, count(*) c1, concat(tbname, 'aaa') as pname, timezone() from st where ts > 1648791000000 and ts < 1648793000000 partition by tbname interval(10s) fill(NULL_F); sql insert into t1 values(1648791213000,1,2,3,1.0,'aaa'); sql insert into t1 values(1648791233000,1,2,3,1.0,'aaa'); sql insert into t1 values(1648791273000,1,2,3,1.0,'aaa'); @@ -512,32 +577,104 @@ if $data[12][3] == NULL then goto loop4 endi +print "force fill null" +$loop_count = 0 +loop4a: +sleep 200 +sql select * from streamt4a order by pname, ts; +print ===> $data[0][0] , $data[0][1] , $data[0][2] , $data[0][3] +print ===> $data[1][0] , $data[1][1] , $data[1][2] , $data[1][3] +print ===> $data[2][0] , $data[2][1] , $data[2][2] , $data[2][3] +print ===> $data[3][0] , $data[3][1] , $data[3][2] , $data[3][3] +print ===> $data[4][0] , $data[4][1] , $data[4][2] , $data[4][3] +print ===> $data[5][0] , $data[5][1] , $data[5][2] , $data[5][3] +print ===> $data[6][0] , $data[6][1] , $data[6][2] , $data[6][3] +print ===> $data[7][0] , $data[7][1] , $data[7][2] , $data[7][3] +print ===> $data[8][0] , $data[8][1] , $data[8][2] , $data[8][3] +print ===> $data[9][0] , $data[9][1] , $data[9][2] , $data[9][3] +print ===> $data[10][0] , $data[10][1] , $data[10][2] , $data[10][3] +print ===> $data[11][0] , $data[11][1] , $data[11][2] , $data[11][3] +print ===> $data[12][0] , $data[12][1] , $data[12][2] , $data[12][3] +print ===> $data[13][0] , $data[13][1] , $data[13][2] , $data[13][3] +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi +if $rows != 14 then + print =====rows=$rows + goto loop4a +endi +if $data11 != NULL then + print =====data11=$data11 + goto loop4a +endi +if $data12 != t1aaa then + print =====data12=$data12 + goto loop4a +endi +if $data13 == NULL then + print =====data13=$data13 + goto loop4a +endi +if $data32 != t1aaa then + print =====data32=$data32 + goto loop4a +endi +if $data42 != t1aaa then + print =====data42=$data42 + goto loop4a +endi +if $data52 != t1aaa then + print =====data52=$data52 + goto loop4a +endi +if $data81 != NULL then + print =====data81=$data81 + goto loop4a +endi +if $data82 != t2aaa then + print =====data82=$data82 + goto loop4a +endi +if $data83 == NULL then + print =====data83=$data83 + goto loop4a +endi +if $data[10][2] != t2aaa then + print =====data[10][2]=$data[10][2] + goto loop4a +endi +if $data[11][2] != t2aaa then + print =====data[11][2]=$data[11][2] + goto loop4a +endi +if $data[12][2] != t2aaa then + print =====data[12][2]=$data[12][2] + goto loop4a +endi - - - - - - - +if $data[12][3] == NULL then + print =====data[12][3]=$data[12][3] + goto loop4a +endi @@ -584,4 +721,4 @@ print ============loop_all=$loop_all system sh/stop_dnodes.sh -#goto looptest \ No newline at end of file +#goto looptest diff --git a/tests/script/tsim/stream/ignoreCheckUpdate.sim b/tests/script/tsim/stream/ignoreCheckUpdate.sim new file mode 100644 index 0000000000..7f99c534c8 --- /dev/null +++ b/tests/script/tsim/stream/ignoreCheckUpdate.sim @@ -0,0 +1,285 @@ +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 step 1 start + +sql drop stream if exists streams0; +sql drop database if exists test; +sql create database test vgroups 1; +sql use test; +sql create table t1(ts timestamp, a int, b int , c int); + +print create stream streams0 trigger at_once ignore update 1 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 interval(10s); + +sql create stream streams0 trigger at_once ignore update 1 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 interval(10s); + +sql insert into t1 values(1648791213000,1,1,1); +sql insert into t1 values(1648791213000,2,2,2); + +$loop_count = 0 + +loop0: +sleep 300 +sql select * from streamt order by 1,2,3; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $data01 != 2 then + print =====data01=$data01 + goto loop0 +endi + +if $data02 != 2 then + print =====data02=$data02 + goto loop0 +endi + + +sql insert into t1 values(1648791213000,3,3,3); + +$loop_count = 0 + +loop1: +sleep 300 +sql select * from streamt order by 1,2,3; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $data01 != 3 then + print =====data01=$data01 + goto loop1 +endi + +if $data02 != 3 then + print =====data02=$data02 + goto loop1 +endi + +print step 1 end + +print step 2 start + +sql drop stream if exists streams1; +sql drop database if exists test1; +sql create database test1 vgroups 1; +sql use test1; +sql create table t1(ts timestamp, a int, b int , c int); + +print create stream streams1 trigger at_once ignore update 1 into streamt1 as select _wstart c1, count(*) c2, max(b) c3 from t1 session(ts, 10s); + +sql create stream streams1 trigger at_once ignore update 1 into streamt1 as select _wstart c1, count(*) c2, max(b) c3 from t1 session(ts, 10s); + +sql insert into t1 values(1648791213000,1,1,1); +sql insert into t1 values(1648791213000,2,2,2); + +$loop_count = 0 + +loop2: +sleep 300 +sql select * from streamt1 order by 1,2,3; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $data01 != 2 then + print =====data01=$data01 + goto loop2 +endi + +if $data02 != 2 then + print =====data02=$data02 + goto loop2 +endi + + +sql insert into t1 values(1648791213000,3,3,3); + +$loop_count = 0 + +loop3: + +sleep 300 +sql select * from streamt1 order by 1,2,3; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $data01 != 3 then + print =====data01=$data01 + goto loop3 +endi + +if $data02 != 3 then + print =====data02=$data02 + goto loop3 +endi + +print step 2 end + +print step 3 start + +sql drop stream if exists streams2; +sql drop database if exists test2; +sql create database test2 vgroups 1; +sql use test2; +sql create table t1(ts timestamp, a int, b int , c int); + +print create stream streams2 trigger at_once ignore update 1 into streamt2 as select _wstart c1, count(*) c2, max(b) c3 from t1 state_window(c); + +sql create stream streams2 trigger at_once ignore update 1 into streamt2 as select _wstart c1, count(*) c2, max(b) c3 from t1 state_window(c); + +sql insert into t1 values(1648791213000,1,1,1); +sql insert into t1 values(1648791213000,2,2,1); + +$loop_count = 0 + +loop2: +sleep 300 +sql select * from streamt2 order by 1,2,3; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $data01 != 2 then + print =====data01=$data01 + goto loop2 +endi + +if $data02 != 2 then + print =====data02=$data02 + goto loop2 +endi + + +sql insert into t1 values(1648791213000,3,3,1); + +$loop_count = 0 + +loop3: + +sleep 300 +sql select * from streamt2 order by 1,2,3; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $data01 != 3 then + print =====data01=$data01 + goto loop3 +endi + +if $data02 != 3 then + print =====data02=$data02 + goto loop3 +endi + +print step 3 end + +print step 4 start + +sql drop stream if exists streams3; +sql drop database if exists test3; +sql create database test3 vgroups 4; +sql use test3; +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); + +print create stream streams3 trigger at_once ignore update 1 into streamt3 as select _wstart c1, count(*) c2, max(b) c3 from st interval(10s); + +sql create stream streams3 trigger at_once ignore update 1 into streamt3 as select _wstart c1, count(*) c2, max(b) c3 from st interval(10s); + +sql insert into t1 values(1648791213000,1,1,1); +sql insert into t1 values(1648791213000,2,2,2); + +sql insert into t2 values(1648791213000,1,1,1); +sql insert into t2 values(1648791213000,2,2,2); + +$loop_count = 0 + +loop0: +sleep 300 +sql select * from streamt3 order by 1,2,3; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $data01 != 4 then + print =====data01=$data01 + goto loop0 +endi + +if $data02 != 2 then + print =====data02=$data02 + goto loop0 +endi + + +sql insert into t1 values(1648791213000,3,3,3); + +$loop_count = 0 + +loop1: +sleep 300 +sql select * from streamt3 order by 1,2,3; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $data01 != 5 then + print =====data01=$data01 + goto loop1 +endi + +if $data02 != 3 then + print =====data02=$data02 + goto loop1 +endi + +sql insert into t2 values(1648791213000,4,4,4); + +$loop_count = 0 + +loop1: +sleep 300 +sql select * from streamt3 order by 1,2,3; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $data01 != 6 then + print =====data01=$data01 + goto loop1 +endi + +if $data02 != 4 then + print =====data02=$data02 + goto loop1 +endi + +print step 4 end + +system sh/stop_dnodes.sh diff --git a/tests/script/tsim/stream/state0.sim b/tests/script/tsim/stream/state0.sim index ea7528b1cb..07abdc0040 100644 --- a/tests/script/tsim/stream/state0.sim +++ b/tests/script/tsim/stream/state0.sim @@ -16,6 +16,9 @@ print $data00 $data01 $data02 sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double, id int); + +print create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); + sql create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); sql insert into t1 values(1648791213000,1,2,3,1.0,1); @@ -79,86 +82,88 @@ endi if $data03 != 1 then print ======$data03 - return -1 + goto loop1 endi if $data04 != 1 then print ======$data04 - return -1 + goto loop1 endi if $data05 != 3 then print ======$data05 - return -1 + goto loop1 endi if $data06 != 5 then print ======$data06 - return -1 + goto loop1 endi # row 1 if $data11 != 1 then print ======$data11 - return -1 + goto loop1 endi if $data12 != 1 then print ======$data12 - return -1 + goto loop1 endi if $data13 != 2 then print ======$data13 - return -1 + goto loop1 endi if $data14 != 2 then print ======$data14 - return -1 + goto loop1 endi if $data15 != 3 then print ======$data15 - return -1 + goto loop1 endi if $data16 != 4 then print ======$data16 - return -1 + goto loop1 endi # row 2 if $data21 != 1 then print ======$data21 - return -1 + goto loop1 endi if $data22 != 1 then print ======$data22 - return -1 + goto loop1 endi if $data23 != 1 then print ======$data23 - return -1 + goto loop1 endi if $data24 != 1 then print ======$data24 - return -1 + goto loop1 endi if $data25 != 3 then print ======$data25 - return -1 + goto loop1 endi if $data26 != 6 then print ======$data26 - return -1 + goto loop1 endi +print loop1 end + sql insert into t1 values(1648791213011,1,2,3,1.0,7); $loop_count = 0 @@ -174,33 +179,31 @@ endi if $data21 != 2 then print =====data21=$data21 goto loop2 - return -1 endi if $data22 != 2 then print =====data22=$data22 goto loop2 - return -1 endi if $data23 != 2 then print ======$data23 - return -1 + goto loop2 endi if $data24 != 1 then print ======$data24 - return -1 + goto loop2 endi if $data25 != 3 then print ======$data25 - return -1 + goto loop2 endi if $data26 != 7 then print ======$data26 - return -1 + goto loop2 endi sql insert into t1 values(1648791213011,1,2,3,1.0,8); @@ -238,99 +241,93 @@ endi if $data21 != 1 then print =====data21=$data21 goto loop3 - return -1 endi if $data22 != 1 then print =====data22=$data22 goto loop3 - return -1 endi if $data23 != 10 then print ======$data23 - return -1 + goto loop3 endi if $data24 != 10 then print ======$data24 - return -1 + goto loop3 endi if $data25 != 10 then print ======$data25 - return -1 + goto loop3 endi if $data26 != 12 then print ======$data26 - return -1 + goto loop3 endi # row 3 if $data31 != 1 then print =====data31=$data31 goto loop3 - return -1 endi if $data32 != 1 then print =====data32=$data32 goto loop3 - return -1 endi if $data33 != 3 then print ======$data33 - return -1 + goto loop3 endi if $data34 != 3 then print ======$data34 - return -1 + goto loop3 endi if $data35 != 3 then print ======$data35 - return -1 + goto loop3 endi if $data36 != 10 then print ======$data36 - return -1 + goto loop3 endi # row 4 if $data41 != 1 then print =====data41=$data41 goto loop3 - return -1 endi if $data42 != 1 then print =====data42=$data42 goto loop3 - return -1 endi if $data43 != 1 then print ======$data43 - return -1 + goto loop3 endi if $data44 != 1 then print ======$data44 - return -1 + goto loop3 endi if $data45 != 3 then print ======$data45 - return -1 + goto loop3 endi if $data46 != 11 then print ======$data46 - return -1 + goto loop3 endi sql insert into t1 values(1648791213030,3,12,12,12.0,13); @@ -360,95 +357,93 @@ endi if $data02 != 2 then print ======$data02 - return -1 + goto loop4 endi if $data03 != 6 then print ======$data03 - return -1 + goto loop4 endi if $data04 != 3 then print ======$data04 - return -1 + goto loop4 endi if $data05 != 3 then print ======$data05 - return -1 + goto loop4 endi if $data06 != 15 then print ======$data06 - return -1 + goto loop4 endi # row 1 if $data11 != 1 then print =====data11=$data11 goto loop4 - return -1 endi if $data12 != 1 then print =====data12=$data12 goto loop4 - return -1 endi if $data13 != 15 then print ======$data13 - return -1 + goto loop4 endi if $data14 != 15 then print ======$data14 - return -1 + goto loop4 endi if $data15 != 15 then print ======$data15 - return -1 + goto loop4 endi if $data16 != 16 then print ======$data16 - return -1 + goto loop4 endi # row 2 if $data21 != 1 then print =====data21=$data21 goto loop4 - return -1 endi if $data22 != 1 then print =====data22=$data22 goto loop4 - return -1 endi if $data23 != 1 then print ======$data23 - return -1 + goto loop4 endi if $data24 != 1 then print ======$data24 - return -1 + goto loop4 endi if $data25 != 13 then print ======$data25 - return -1 + goto loop4 endi if $data26 != 14 then print ======$data26 - return -1 + goto loop4 endi +print loop4 end + sql create database test1 vgroups 1; sql select * from information_schema.ins_databases; @@ -457,6 +452,9 @@ print $data00 $data01 $data02 sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double, id int); + +print create stream streams2 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); + sql create stream streams2 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); sql insert into t1 values(1648791212000,2,2,3,1.0,1); @@ -502,6 +500,9 @@ sql create database test3 vgroups 1; sql use test3; sql create table t1(ts timestamp, a int, b int , c int, d double, id int); + +print create stream streams3 trigger at_once into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a); + sql create stream streams3 trigger at_once into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a); sql insert into t1 values(1648791212000,1,2,3,1.0,1); sql insert into t1 values(1648791213000,2,2,3,1.0,1); @@ -543,7 +544,6 @@ if $rows != 10 then goto loop6 endi - sql drop stream if exists streams4; sql drop database if exists test4; sql drop stable if exists streamt4; @@ -552,6 +552,9 @@ sql use test4; sql create table st (ts timestamp, c1 tinyint, c2 smallint) tags (t1 tinyint) ; sql create table t1 using st tags (-81) ; sql create table t2 using st tags (-81) ; + +print create stream if not exists streams4 trigger window_close into streamt4 as select _wstart AS startts, min(c1),count(c1) from t1 state_window(c1); + sql create stream if not exists streams4 trigger window_close into streamt4 as select _wstart AS startts, min(c1),count(c1) from t1 state_window(c1); sql insert into t1 (ts, c1) values (1668073288209, 11); @@ -636,7 +639,7 @@ sql insert into t1 (ts, c1) values (1668073288225, 65); sql insert into t1 (ts, c1) values (1668073288226, 65); $loop_count = 0 -loop8: +loop81: sleep 200 @@ -649,27 +652,27 @@ endi if $rows != 2 then print =====rows=$rows - goto loop8 + goto loop81 endi if $data01 != 11 then print =====data01=$data01 - goto loop8 + goto loop81 endi if $data02 != 5 then print =====data02=$data02 - goto loop8 + goto loop81 endi if $data11 != 29 then print =====data11=$data11 - goto loop8 + goto loop81 endi if $data12 != 1 then print =====data12=$data12 - goto loop8 + goto loop81 endi sql insert into t1 (ts, c1) values (1668073288224, 64); @@ -738,6 +741,9 @@ sql use test5; sql create table tb (ts timestamp, a int); sql insert into tb values (now + 1m , 1 ); sql create table b (c timestamp, d int, e int , f int, g double); + +print create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a); + sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a); sql insert into b values(1648791213000,NULL,NULL,NULL,NULL); sql select * from streamt order by c1, c2, c3; @@ -792,4 +798,6 @@ if $data00 != 2 then goto loop10 endi +print state0 end + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/system-test/0-others/balance_vgroups_r1.py b/tests/system-test/0-others/balance_vgroups_r1.py new file mode 100644 index 0000000000..ae504cbab1 --- /dev/null +++ b/tests/system-test/0-others/balance_vgroups_r1.py @@ -0,0 +1,99 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + + +from util import constant +from util.log import * +from util.cases import * +from util.sql import * +from util.common import * +from util.sqlset import * +from util.cluster import * +class TDTestCase: + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + self.dnode_num=len(cluster.dnodes) + self.dbname = 'db_test' + self.setsql = TDSetSql() + self.stbname = f'{self.dbname}.stb' + self.rowNum = 5 + self.tbnum = 10 + self.ts = 1537146000000 + self.binary_str = 'taosdata' + self.nchar_str = '涛思数据' + self.column_dict = { + 'ts' : 'timestamp', + 'col1': 'tinyint', + 'col2': 'smallint', + 'col3': 'int', + 'col4': 'bigint', + 'col5': 'tinyint unsigned', + 'col6': 'smallint unsigned', + 'col7': 'int unsigned', + 'col8': 'bigint unsigned', + 'col9': 'float', + 'col10': 'double', + 'col11': 'bool', + 'col12': 'binary(20)', + 'col13': 'nchar(20)' + } + self.replica = [1,3] + + def insert_data(self,column_dict,tbname,row_num): + insert_sql = self.setsql.set_insertsql(column_dict,tbname,self.binary_str,self.nchar_str) + for i in range(row_num): + insert_list = [] + self.setsql.insert_values(column_dict,i,insert_sql,insert_list,self.ts) + def prepare_data(self,dbname,stbname,column_dict,tbnum,rowNum,replica): + tag_dict = { + 't0':'int' + } + tag_values = [ + f'1' + ] + tdSql.execute(f"create database if not exists {dbname} vgroups 1 replica {replica} ") + tdSql.execute(f'use {dbname}') + tdSql.execute(self.setsql.set_create_stable_sql(stbname,column_dict,tag_dict)) + for i in range(tbnum): + tdSql.execute(f"create table {stbname}_{i} using {stbname} tags({tag_values[0]})") + self.insert_data(self.column_dict,f'{stbname}_{i}',rowNum) + def redistribute_vgroups(self,replica,stbname,tbnum,rownum): + tdSql.query('show vgroups') + vnode_id = tdSql.queryResult[0][0] + if replica == 1: + for dnode_id in range(1,self.dnode_num+1) : + tdSql.execute(f'redistribute vgroup {vnode_id} dnode {dnode_id}') + tdSql.query(f'select count(*) from {stbname}') + tdSql.checkEqual(tdSql.queryResult[0][0],tbnum*rownum) + elif replica == 3: + for dnode_id in range(1,self.dnode_num-1): + tdSql.execute(f'redistribute vgroup {vnode_id} dnode {dnode_id} dnode {dnode_id+1} dnode {dnode_id+2}') + tdSql.query(f'select count(*) from {stbname}') + tdSql.checkEqual(tdSql.queryResult[0][0],tbnum*rownum) + + def run(self): + for replica in self.replica: + self.prepare_data(self.dbname,self.stbname,self.column_dict,self.tbnum,self.rowNum,replica) + self.redistribute_vgroups(replica,self.stbname,self.tbnum,self.rowNum) + tdSql.execute(f'drop database {self.dbname}') + + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py index 1834432bc9..a5cded7a6b 100644 --- a/tests/system-test/0-others/compatibility.py +++ b/tests/system-test/0-others/compatibility.py @@ -99,6 +99,10 @@ class TDTestCase: def run(self): + distro_id = distro.id() + if distro_id == "alpine": + tdLog.info(f"alpine skip compatibility test") + return True bPath = self.getBuildPath() cPath = self.getCfgPath() dbname = "test" diff --git a/tests/system-test/1-insert/insert_drop.py b/tests/system-test/1-insert/insert_drop.py index 029d013d5b..930c65d90e 100644 --- a/tests/system-test/1-insert/insert_drop.py +++ b/tests/system-test/1-insert/insert_drop.py @@ -31,6 +31,10 @@ class TDTestCase: tdSql.execute('create database if not exists test;') tdSql.execute('create table test.stb (ts timestamp, c11 int, c12 float ) TAGS(t11 int, t12 int );') tdSql.execute('create table test.tb using test.stb TAGS (1, 1);') + + # double comma insert check error + tdSql.error("insert into test.tb(ts, c11) values(now,,100)") + sql_list = list() for i in range(5): sql = f'insert into test.tb values (now-{i}m, {i}, {i});' diff --git a/tests/system-test/2-query/case_when.py b/tests/system-test/2-query/case_when.py index cfe0399553..eebbcc3fa3 100755 --- a/tests/system-test/2-query/case_when.py +++ b/tests/system-test/2-query/case_when.py @@ -111,6 +111,17 @@ class TDTestCase: sql2 = "select (case when sum(q_smallint)=0 then null else sum(q_smallint) end) from %s.stable_1_1 limit 100;" %database self.constant_check(database,sql1,sql2,0) + #TD-20257 + sql1 = "select tbname,first(ts),q_int,q_smallint,q_bigint,case when q_int <0 then 1 else 0 end from %s.stable_1 where tbname = 'stable_1_1' and ts < now partition by tbname state_window(case when q_int <0 then 1 else 0 end);" %database + sql2 = "select tbname,first(ts),q_int,q_smallint,q_bigint,case when q_int <0 then 1 else 0 end from %s.stable_1_1 where ts < now partition by tbname state_window(case when q_int <0 then 1 else 0 end);" %database + self.constant_check(database,sql1,sql2,0) + self.constant_check(database,sql1,sql2,1) + self.constant_check(database,sql1,sql2,2) + self.constant_check(database,sql1,sql2,3) + self.constant_check(database,sql1,sql2,4) + self.constant_check(database,sql1,sql2,5) + + #TD-20260 sql1 = "select _wstart,avg(q_int),min(q_smallint) from %s.stable_1 where tbname = 'stable_1_1' and ts < now state_window(case when q_smallint <0 then 1 else 0 end);" %database sql2 = "select _wstart,avg(q_int),min(q_smallint) from %s.stable_1_1 where ts < now state_window(case when q_smallint <0 then 1 else 0 end);" %database self.constant_check(database,sql1,sql2,0) diff --git a/tests/system-test/2-query/irate.py b/tests/system-test/2-query/irate.py index 8aa2b3d420..d976edb49c 100644 --- a/tests/system-test/2-query/irate.py +++ b/tests/system-test/2-query/irate.py @@ -97,7 +97,7 @@ class TDTestCase: tdSql.execute( f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') - for i in range(9): + for i in range(1,10): tdSql.execute( f"insert into {dbname}.ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" ) diff --git a/tests/system-test/2-query/max_min_data.py b/tests/system-test/2-query/max_min_data.py new file mode 100755 index 0000000000..e3dff5da78 --- /dev/null +++ b/tests/system-test/2-query/max_min_data.py @@ -0,0 +1,159 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import random +import os +import time +import taos +import subprocess +from faker import Faker +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql +from util.dnodes import tdDnodes +from util.dnodes import * + +class TDTestCase: + updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 131 ,"querySmaOptimize":1} + + def init(self, conn, logSql, replicaVar): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + self.testcasePath = os.path.split(__file__)[0] + self.testcaseFilename = os.path.split(__file__)[-1] + os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) + + self.db = "max_min" + + def dropandcreateDB_random(self,database,n): + ts = 1630000000000 + num_random = 5 + fake = Faker('zh_CN') + tdSql.execute('''drop database if exists %s ;''' %database) + tdSql.execute('''create database %s keep 36500 ;'''%(database)) + tdSql.execute('''use %s;'''%database) + + tdSql.execute('''create stable %s.stable_1 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \ + q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) \ + tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);'''%database) + + for i in range(num_random): + tdSql.execute('''create table %s.stable_1_%d using %s.stable_1 tags('stable_1_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;''' + %(database,i,database,i,fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), + fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , + fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) + + # insert data + for i in range(num_random): + for j in range(n): + tdSql.execute('''insert into %s.stable_1_%d (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts)\ + values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d) ;''' + % (database,i,ts + i*1000 + j, fake.random_int(min=-2147483647, max=2147483647, step=1), + fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), + fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , + fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i)) + + tdSql.query("select count(*) from %s.stable_1;" %database) + tdSql.checkData(0,0,num_random*n) + tdSql.query("select count(*) from %s.stable_1_1;"%database) + tdSql.checkData(0,0,n) + + + def TD_22219_max(self,database): + + sql3 = "select count(*) from (select max(q_int) from %s.stable_1 group by tbname); ;" %database + tdSql.query(sql3) + sql_value = tdSql.getData(0,0) + self.value_check(sql_value,5) + + sql1 = "select max(q_int) from %s.stable_1_1 ;" %database + sql2 = "select max(q_int) from %s.stable_1 where tbname = 'stable_1_1' ;" %database + self.constant_check(database,sql1,sql2,0) + + sql3 = "select count(*) from (select max(q_int) from %s.stable_1 group by tbname); ;" %database + tdSql.query(sql3) + sql_value = tdSql.getData(0,0) + self.value_check(sql_value,5) + + def TD_22219_min(self,database): + + sql3 = "select count(*) from (select min(q_int) from %s.stable_1 group by tbname); ;" %database + tdSql.query(sql3) + sql_value = tdSql.getData(0,0) + self.value_check(sql_value,5) + + sql1 = "select min(q_int) from %s.stable_1_1 ;" %database + sql2 = "select min(q_int) from %s.stable_1 where tbname = 'stable_1_1' ;" %database + self.constant_check(database,sql1,sql2,0) + + sql3 = "select count(*) from (select min(q_int) from %s.stable_1 group by tbname); ;" %database + tdSql.query(sql3) + sql_value = tdSql.getData(0,0) + self.value_check(sql_value,5) + + def constant_check(self,database,sql1,sql2,column): + #column =0 代表0列, column = n代表n-1列 + tdLog.info("\n=============sql1:(%s)___sql2:(%s) ====================\n" %(sql1,sql2)) + + tdSql.query(sql1) + sql1_value = tdSql.getData(0,column) + tdSql.query(sql2) + sql2_value = tdSql.getData(0,column) + self.value_check(sql1_value,sql2_value) + + tdSql.execute(" flush database %s;" %database) + + time.sleep(3) + + tdSql.query(sql1) + sql1_flush_value = tdSql.getData(0,column) + tdSql.query(sql2) + sql2_flush_value = tdSql.getData(0,column) + self.value_check(sql1_flush_value,sql2_flush_value) + + self.value_check(sql1_value,sql1_flush_value) + self.value_check(sql2_value,sql2_flush_value) + + def value_check(self,base_value,check_value): + if base_value==check_value: + tdLog.info(f"checkEqual success, base_value={base_value},check_value={check_value}") + else : + tdLog.exit(f"checkEqual error, base_value=={base_value},check_value={check_value}") + + def run(self): + + startTime = time.time() + + os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) + + self.dropandcreateDB_random("%s" %self.db, 2000) + + self.TD_22219_max("%s" %self.db) + + self.dropandcreateDB_random("%s" %self.db, 2000) + + self.TD_22219_min("%s" %self.db) + + endTime = time.time() + print("total time %ds" % (endTime - startTime)) + + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/system-test/6-cluster/5dnode1mnode.py b/tests/system-test/6-cluster/5dnode1mnode.py index ce87bced1b..f21fae0d7b 100644 --- a/tests/system-test/6-cluster/5dnode1mnode.py +++ b/tests/system-test/6-cluster/5dnode1mnode.py @@ -145,8 +145,8 @@ class TDTestCase: tdSql.query("show db.alive;") tdSql.checkData(0, 0, 1) - # stop 5 dnode - self.TDDnodes.stoptaosd(5) + # stop 3 dnode + self.TDDnodes.stoptaosd(3) tdSql.checkDataLoop(0, 0, 2, "show cluster alive;", 20, 0.5) tdSql.query("show db.alive;") diff --git a/tests/system-test/7-tmq/tmq3mnodeSwitch.py b/tests/system-test/7-tmq/tmq3mnodeSwitch.py index abe8ed2945..cdcdadbcbb 100644 --- a/tests/system-test/7-tmq/tmq3mnodeSwitch.py +++ b/tests/system-test/7-tmq/tmq3mnodeSwitch.py @@ -236,8 +236,8 @@ class TDTestCase: tdDnodes[0].starttaosd() self.check3mnode() - tdLog.info("3. stop dnode 1") - tdDnodes[1].stoptaosd() + tdLog.info("3. stop dnode 2") + tdDnodes[2].stoptaosd() time.sleep(10) self.check3mnode1off() diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py b/tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py index 95ce03e653..37946d0c22 100644 --- a/tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py +++ b/tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py @@ -192,7 +192,7 @@ class TDTestCase: topicList = topicNameList[0] ifcheckdata = 1 ifManualCommit = 1 - keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:300, auto.offset.reset:earliest' + keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:100, auto.offset.reset:earliest' tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) tdLog.info("start consume processor 0") diff --git a/tests/system-test/7-tmq/tmqUpdate-1ctb.py b/tests/system-test/7-tmq/tmqUpdate-1ctb.py index db2ec3285d..2fa6600fb9 100644 --- a/tests/system-test/7-tmq/tmqUpdate-1ctb.py +++ b/tests/system-test/7-tmq/tmqUpdate-1ctb.py @@ -183,6 +183,7 @@ class TDTestCase: tdLog.info("restart taosd to ensure that the data falls into the disk") tdSql.query("flush database %s"%(paraDict['dbName'])) + time.sleep(10) # update to half tables paraDict['startTs'] = paraDict['startTs'] + int(self.rowsPerTbl / 2) diff --git a/tests/system-test/pytest.sh b/tests/system-test/pytest.sh index 68d49f5d06..792cab98f7 100755 --- a/tests/system-test/pytest.sh +++ b/tests/system-test/pytest.sh @@ -8,15 +8,23 @@ set +e #set -x +if [[ "$OSTYPE" == "darwin"* ]]; then + TD_OS="Darwin" +else + OS=$(cat /etc/*-release | grep "^NAME=" | cut -d= -f2) + len=$(echo ${#OS}) + len=$((len - 2)) + TD_OS=$(echo -ne ${OS:1:${len}} | cut -d" " -f1) +fi -UNAME_BIN=`which uname` -OS_TYPE=`$UNAME_BIN` +UNAME_BIN=$(which uname) +OS_TYPE=$($UNAME_BIN) cd . # Get responsible directories -CODE_DIR=`dirname $0` -CODE_DIR=`pwd` +CODE_DIR=$(dirname $0) +CODE_DIR=$(pwd) IN_TDINTERNAL="community" if [[ "$CODE_DIR" == *"$IN_TDINTERNAL"* ]]; then @@ -25,19 +33,15 @@ else cd ../../ fi -TOP_DIR=`pwd` -TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` +TOP_DIR=$(pwd) +TAOSD_DIR=$(find . -name "taosd" | grep bin | head -n1) -if [[ "$OS_TYPE" != "Darwin" ]]; then - cut_opt="--field=" -else - cut_opt="-f " -fi +cut_opt="-f " if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then - BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` + BIN_DIR=$(find . -name "taosd" | grep bin | head -n1 | cut -d '/' ${cut_opt}2,3) else - BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2` + BIN_DIR=$(find . -name "taosd" | grep bin | head -n1 | cut -d '/' ${cut_opt}2) fi declare -x BUILD_DIR=$TOP_DIR/$BIN_DIR @@ -66,35 +70,38 @@ ulimit -c unlimited #sudo sysctl -w kernel.core_pattern=$TOP_DIR/core.%p.%e echo "ExcuteCmd:" $* -AsanFile=$ASAN_DIR/psim.info -echo "AsanFile:" $AsanFile -unset LD_PRELOAD -#export LD_PRELOAD=libasan.so.5 -export LD_PRELOAD=`gcc -print-file-name=libasan.so` -echo "Preload AsanSo:" $? - -$* -a 2> $AsanFile - -unset LD_PRELOAD -for ((i=1;i<=20;i++)) -do - AsanFileLen=`cat $AsanFile | wc -l` - echo "AsanFileLen:" $AsanFileLen - if [ $AsanFileLen -gt 10 ]; then - break - fi - sleep 1 -done - -AsanFileSuccessLen=`grep -w successfully $AsanFile | wc -l` -echo "AsanFileSuccessLen:" $AsanFileSuccessLen - -if [ $AsanFileSuccessLen -gt 0 ]; then - echo "Execute script successfully and check asan" - $CODE_DIR/../script/sh/checkAsan.sh +if [[ "$TD_OS" == "Alpine" ]]; then + $* else - echo "Execute script failure" - exit 1 -fi + AsanFile=$ASAN_DIR/psim.info + echo "AsanFile:" $AsanFile + unset LD_PRELOAD + #export LD_PRELOAD=libasan.so.5 + export LD_PRELOAD=$(gcc -print-file-name=libasan.so) + echo "Preload AsanSo:" $? + + $* -a 2>$AsanFile + + unset LD_PRELOAD + for ((i = 1; i <= 20; i++)); do + AsanFileLen=$(cat $AsanFile | wc -l) + echo "AsanFileLen:" $AsanFileLen + if [ $AsanFileLen -gt 10 ]; then + break + fi + sleep 1 + done + + AsanFileSuccessLen=$(grep -w successfully $AsanFile | wc -l) + echo "AsanFileSuccessLen:" $AsanFileSuccessLen + + if [ $AsanFileSuccessLen -gt 0 ]; then + echo "Execute script successfully and check asan" + $CODE_DIR/../script/sh/checkAsan.sh + else + echo "Execute script failure" + exit 1 + fi +fi diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index d61d25602b..1461a7b373 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -7,25 +7,45 @@ IF (TD_WEBSOCKET) SET(websocket_lib_file "{taosws.dll,taosws.dll.lib}") ENDIF () MESSAGE("${Green} use libtaos-ws${ColourReset}") - - include(ExternalProject) - ExternalProject_Add(taosws-rs - PREFIX "taosws-rs" - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/taosws-rs - BUILD_ALWAYS off - DEPENDS taos - BUILD_IN_SOURCE 1 - CONFIGURE_COMMAND cmake -E echo "taosws-rs no need cmake to config" - PATCH_COMMAND - COMMAND git clean -f -d - BUILD_COMMAND - COMMAND cargo update - COMMAND cargo build --release -p taos-ws-sys --features native-tls-vendored - INSTALL_COMMAND - COMMAND cp target/release/${websocket_lib_file} ${CMAKE_BINARY_DIR}/build/lib - COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/build/include - COMMAND cmake -E copy target/release/taosws.h ${CMAKE_BINARY_DIR}/build/include - ) + IF (TD_ALPINE) + include(ExternalProject) + ExternalProject_Add(taosws-rs + PREFIX "taosws-rs" + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/taosws-rs + BUILD_ALWAYS off + DEPENDS taos + BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND cmake -E echo "taosws-rs no need cmake to config" + PATCH_COMMAND + 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 + INSTALL_COMMAND + COMMAND cp target/release/${websocket_lib_file} ${CMAKE_BINARY_DIR}/build/lib + COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/build/include + COMMAND cmake -E copy target/release/taosws.h ${CMAKE_BINARY_DIR}/build/include + ) + ELSE() + include(ExternalProject) + ExternalProject_Add(taosws-rs + PREFIX "taosws-rs" + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/taosws-rs + BUILD_ALWAYS off + DEPENDS taos + BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND cmake -E echo "taosws-rs no need cmake to config" + PATCH_COMMAND + COMMAND git clean -f -d + BUILD_COMMAND + COMMAND cargo update + COMMAND cargo build --release -p taos-ws-sys --features native-tls-vendored + INSTALL_COMMAND + COMMAND cp target/release/${websocket_lib_file} ${CMAKE_BINARY_DIR}/build/lib + COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/build/include + COMMAND cmake -E copy target/release/taosws.h ${CMAKE_BINARY_DIR}/build/include + ) + ENDIF () ENDIF () IF (TD_TAOS_TOOLS) diff --git a/tools/shell/CMakeLists.txt b/tools/shell/CMakeLists.txt index 342d6410d2..600e33feab 100644 --- a/tools/shell/CMakeLists.txt +++ b/tools/shell/CMakeLists.txt @@ -30,15 +30,23 @@ IF (CUS_NAME OR CUS_PROMPT OR CUS_EMAIL) ADD_DEFINITIONS(-I${CMAKE_CURRENT_SOURCE_DIR}/../../../enterprise/packaging) ENDIF (CUS_NAME OR CUS_PROMPT OR CUS_EMAIL) +IF (TD_LINUX AND TD_ALPINE) + SET(LINK_ARGP "/usr/lib/libargp.a") +ELSE () + SET(LINK_ARGP "") +ENDIF () + if(TD_WINDOWS) target_link_libraries(shell PUBLIC taos_static ${LINK_WEBSOCKET}) else() - target_link_libraries(shell PUBLIC taos ${LINK_WEBSOCKET} ${LINK_JEMALLOC}) + target_link_libraries(shell PUBLIC taos ${LINK_WEBSOCKET} ${LINK_JEMALLOC} ${LINK_ARGP}) endif () + target_link_libraries( shell PRIVATE os common transport util ) + target_include_directories( shell PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c index d899249b97..0612c2f455 100644 --- a/tools/shell/src/shellArguments.c +++ b/tools/shell/src/shellArguments.c @@ -97,7 +97,11 @@ void shellPrintHelp() { #ifdef LINUX #include +#ifdef _ALPINE +#include +#else #include +#endif const char *argp_program_version = version; const char *argp_program_bug_address = cusEmail; diff --git a/tools/shell/src/shellWebsocket.c b/tools/shell/src/shellWebsocket.c index e3584b6890..4ac4cfb119 100644 --- a/tools/shell/src/shellWebsocket.c +++ b/tools/shell/src/shellWebsocket.c @@ -224,8 +224,13 @@ void shellRunSingleCommandWebsocketImp(char *command) { res = ws_query_timeout(shell.ws_conn, command, shell.args.timeout); int code = ws_errno(res); if (code != 0 && !shell.stop_query) { - et = taosGetTimestampUs(); - fprintf(stderr, "\nDB: error: %s (%.6fs)\n", ws_errstr(res), (et - st)/1E6); + // websocket interface masked off first bit from standard error number. + if (TSDB_CODE_PAR_SYNTAX_ERROR == (code|0x80000000)) { + et = taosGetTimestampUs(); + fprintf(stderr, "\nDB: error: %s (%.6fs)\n", ws_errstr(res), (et - st)/1E6); + ws_free_result(res); + return; + } if (code == TSDB_CODE_WS_SEND_TIMEOUT || code == TSDB_CODE_WS_RECV_TIMEOUT) { fprintf(stderr, "Hint: use -t to increase the timeout in seconds\n"); } else if (code == TSDB_CODE_WS_INTERNAL_ERRO || code == TSDB_CODE_WS_CLOSED) {