TDengine/include/libs/qcom/query.h

480 lines
17 KiB
C
Raw Normal View History

2021-12-14 07:24:21 +00:00
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
2021-12-14 09:13:31 +00:00
#ifndef _TD_QUERY_H_
#define _TD_QUERY_H_
2021-12-14 07:24:21 +00:00
2022-06-22 10:50:39 +00:00
// clang-foramt off
2021-12-14 07:24:21 +00:00
#ifdef __cplusplus
extern "C" {
#endif
2024-01-16 05:50:20 +00:00
#include "systable.h"
2021-12-15 01:52:37 +00:00
#include "tarray.h"
#include "thash.h"
#include "tlog.h"
2024-05-30 05:26:17 +00:00
#include "tsimplehash.h"
2021-12-29 07:01:12 +00:00
#include "tmsg.h"
#include "tmsgcb.h"
2021-12-15 01:52:37 +00:00
2022-03-21 11:49:20 +00:00
typedef enum {
2021-12-23 09:42:40 +00:00
JOB_TASK_STATUS_NULL = 0,
2022-07-02 08:59:49 +00:00
JOB_TASK_STATUS_INIT,
JOB_TASK_STATUS_EXEC,
JOB_TASK_STATUS_PART_SUCC,
2023-03-28 01:20:53 +00:00
JOB_TASK_STATUS_FETCH,
2022-07-02 08:59:49 +00:00
JOB_TASK_STATUS_SUCC,
JOB_TASK_STATUS_FAIL,
JOB_TASK_STATUS_DROP,
JOB_TASK_STATUS_MAX,
2022-03-21 11:49:20 +00:00
} EJobTaskType;
2021-12-21 10:28:28 +00:00
2022-03-21 11:49:20 +00:00
typedef enum {
2022-01-20 11:34:46 +00:00
TASK_TYPE_PERSISTENT = 1,
TASK_TYPE_TEMP,
2022-03-21 11:49:20 +00:00
} ETaskType;
2022-01-20 11:34:46 +00:00
2022-05-27 09:35:48 +00:00
typedef enum {
TARGET_TYPE_MNODE = 1,
TARGET_TYPE_VNODE,
TARGET_TYPE_OTHER,
} ETargetType;
typedef enum {
TCOL_TYPE_COLUMN = 1,
TCOL_TYPE_TAG,
TCOL_TYPE_NONE,
} ETableColumnType;
2022-06-18 08:30:46 +00:00
#define QUERY_POLICY_VNODE 1
#define QUERY_POLICY_HYBRID 2
#define QUERY_POLICY_QNODE 3
2022-09-05 05:56:42 +00:00
#define QUERY_POLICY_CLIENT 4
2022-06-18 08:30:46 +00:00
2022-10-14 01:31:18 +00:00
#define QUERY_RSP_POLICY_DELAY 0
#define QUERY_RSP_POLICY_QUICK 1
#define QUERY_MSG_MASK_SHOW_REWRITE() (1 << 0)
2024-02-04 22:51:44 +00:00
#define QUERY_MSG_MASK_AUDIT() (1 << 1)
#define QUERY_MSG_MASK_VIEW() (1 << 2)
2024-02-04 23:03:51 +00:00
#define TEST_SHOW_REWRITE_MASK(m) (((m) & QUERY_MSG_MASK_SHOW_REWRITE()) != 0)
#define TEST_AUDIT_MASK(m) (((m) & QUERY_MSG_MASK_AUDIT()) != 0)
#define TEST_VIEW_MASK(m) (((m) & QUERY_MSG_MASK_VIEW()) != 0)
2021-12-15 11:55:50 +00:00
typedef struct STableComInfo {
uint8_t numOfTags; // the number of tags in schema
uint8_t precision; // the number of precision
col_id_t numOfColumns; // the number of columns
int16_t numOfPKs;
int32_t rowSize; // row size of the schema
2021-12-15 11:55:50 +00:00
} STableComInfo;
2022-03-18 01:10:32 +00:00
typedef struct SIndexMeta {
2022-07-02 09:40:23 +00:00
#if defined(WINDOWS) || defined(_TD_DARWIN_64)
2022-04-22 01:54:27 +00:00
size_t avoidCompilationErrors;
#endif
2022-03-18 01:10:32 +00:00
} SIndexMeta;
2022-07-05 10:12:01 +00:00
typedef struct SExecResult {
2022-10-13 03:09:43 +00:00
int32_t code;
uint64_t numOfRows;
uint64_t numOfBytes;
int32_t msgType;
void* res;
2022-07-05 10:12:01 +00:00
} SExecResult;
2024-01-16 05:50:20 +00:00
#pragma pack(push, 1)
2021-12-15 11:55:50 +00:00
typedef struct SCTableMeta {
uint64_t uid;
uint64_t suid;
2023-05-10 09:44:53 +00:00
int32_t vgId;
int8_t tableType;
2021-12-15 11:55:50 +00:00
} SCTableMeta;
2023-05-10 09:44:53 +00:00
#pragma pack(pop)
2021-12-15 11:55:50 +00:00
2024-01-16 05:50:20 +00:00
#pragma pack(push, 1)
2021-12-15 11:55:50 +00:00
typedef struct STableMeta {
2022-03-08 09:22:21 +00:00
// BEGIN: KEEP THIS PART SAME WITH SCTableMeta
uint64_t uid;
uint64_t suid;
2023-05-10 09:44:53 +00:00
int32_t vgId;
int8_t tableType;
2022-03-08 09:22:21 +00:00
// END: KEEP THIS PART SAME WITH SCTableMeta
// if the table is TSDB_CHILD_TABLE, the following information is acquired from the corresponding super table meta
// info
int32_t sversion;
int32_t tversion;
2022-03-08 09:22:21 +00:00
STableComInfo tableInfo;
2024-03-12 08:46:41 +00:00
SSchemaExt* schemaExt; // There is no additional memory allocation, and the pointer is fixed to the next address of the schema content.
2022-03-08 09:22:21 +00:00
SSchema schema[];
2021-12-15 11:55:50 +00:00
} STableMeta;
2023-05-10 09:44:53 +00:00
#pragma pack(pop)
2021-12-15 11:55:50 +00:00
2023-09-28 03:44:38 +00:00
typedef struct SViewMeta {
uint64_t viewId;
2023-10-20 00:41:49 +00:00
char* user;
2023-09-28 03:44:38 +00:00
char* querySql;
2023-10-11 10:49:47 +00:00
int8_t precision;
int8_t type;
int32_t version;
int32_t numOfCols;
SSchema* pSchema;
2023-09-28 03:44:38 +00:00
} SViewMeta;
2022-02-11 11:52:07 +00:00
typedef struct SDBVgInfo {
2022-03-08 09:22:21 +00:00
int32_t vgVersion;
int16_t hashPrefix;
int16_t hashSuffix;
int8_t hashMethod;
2022-03-05 02:54:36 +00:00
int32_t numOfTable; // DB's table num, unit is TSDB_TABLE_NUM_UNIT
2022-11-09 10:48:52 +00:00
int64_t stateTs;
2024-01-16 05:50:20 +00:00
SHashObj* vgHash; // key:vgId, value:SVgroupInfo
SArray* vgArray; // SVgroupInfo
2022-02-11 11:52:07 +00:00
} SDBVgInfo;
2021-12-15 01:52:37 +00:00
typedef struct SUseDbOutput {
2022-03-08 09:22:21 +00:00
char db[TSDB_DB_FNAME_LEN];
uint64_t dbId;
SDBVgInfo* dbVgroup;
2021-12-15 01:52:37 +00:00
} SUseDbOutput;
2022-03-08 09:22:21 +00:00
enum { META_TYPE_NULL_TABLE = 1, META_TYPE_CTABLE, META_TYPE_TABLE, META_TYPE_BOTH_TABLE };
2022-01-07 10:38:51 +00:00
2021-12-15 11:55:50 +00:00
typedef struct STableMetaOutput {
2022-01-07 01:56:11 +00:00
int32_t metaType;
2022-02-08 08:53:00 +00:00
uint64_t dbId;
2022-01-28 09:50:16 +00:00
char dbFName[TSDB_DB_FNAME_LEN];
char ctbName[TSDB_TABLE_NAME_LEN];
char tbName[TSDB_TABLE_NAME_LEN];
2021-12-15 11:55:50 +00:00
SCTableMeta ctbMeta;
2022-03-08 09:22:21 +00:00
STableMeta* tbMeta;
2021-12-15 11:55:50 +00:00
} STableMetaOutput;
2021-12-14 07:24:21 +00:00
2023-09-28 03:44:38 +00:00
typedef struct SViewMetaOutput {
char name[TSDB_VIEW_NAME_LEN];
char dbFName[TSDB_DB_FNAME_LEN];
char* querySql;
int8_t precision;
int32_t numOfCols;
SSchema* pSchema;
} SViewMetaOutput;
2022-01-21 02:28:41 +00:00
typedef struct SDataBuf {
2022-06-29 09:15:08 +00:00
int32_t msgType;
2022-03-08 09:22:21 +00:00
void* pData;
uint32_t len;
void* handle;
2024-01-16 05:50:20 +00:00
int64_t handleRefId;
2022-06-29 02:51:22 +00:00
SEpSet* pEpSet;
2022-01-21 02:28:41 +00:00
} SDataBuf;
2022-05-27 09:35:48 +00:00
typedef struct STargetInfo {
ETargetType type;
2022-06-22 10:50:39 +00:00
char* dbFName; // used to update db's vgroup epset
2022-05-27 09:35:48 +00:00
int32_t vgId;
} STargetInfo;
2022-12-03 06:56:51 +00:00
typedef struct SBoundColInfo {
int16_t* pColIndex; // bound index => schema index
2022-12-03 06:56:51 +00:00
int32_t numOfCols;
int32_t numOfBound;
bool hasBoundCols;
2022-12-03 06:56:51 +00:00
} SBoundColInfo;
2024-05-30 05:26:17 +00:00
typedef struct STableColsData {
char tbName[TSDB_TABLE_NAME_LEN];
SArray* aCol;
bool getFromHash;
} STableColsData;
typedef struct STableVgUid {
uint64_t uid;
int32_t vgid;
} STableVgUid;
typedef struct STableBufInfo {
void* pCurBuff;
SArray* pBufList;
int64_t buffUnit;
int64_t buffSize;
int64_t buffIdx;
int64_t buffOffset;
} STableBufInfo;
2022-12-03 06:56:51 +00:00
typedef struct STableDataCxt {
STableMeta* pMeta;
STSchema* pSchema;
2022-12-03 06:56:51 +00:00
SBoundColInfo boundColsInfo;
SArray* pValues;
SSubmitTbData* pData;
2024-03-26 07:11:15 +00:00
SRowKey lastKey;
2022-12-03 06:56:51 +00:00
bool ordered;
bool duplicateTs;
} STableDataCxt;
2024-05-30 05:26:17 +00:00
typedef struct SStbInterlaceInfo {
2024-06-07 01:25:17 +00:00
void* pCatalog;
void* pQuery;
int32_t acctId;
char* dbname;
void* transport;
SEpSet mgmtEpSet;
void* pRequest;
uint64_t requestId;
int64_t requestSelf;
bool tbFromHash;
SHashObj* pVgroupHash;
SArray* pVgroupList;
SSHashObj* pTableHash;
int64_t tbRemainNum;
STableBufInfo tbBuf;
char firstName[TSDB_TABLE_NAME_LEN];
2024-06-05 09:12:15 +00:00
STSchema *pTSchema;
2024-05-30 05:26:17 +00:00
STableDataCxt *pDataCtx;
void *boundTags;
2024-06-07 05:50:57 +00:00
bool tableColsReady;
2024-05-30 05:26:17 +00:00
SArray *pTableCols;
int32_t pTableColsIdx;
} SStbInterlaceInfo;
2022-06-29 09:15:08 +00:00
typedef int32_t (*__async_send_cb_fn_t)(void* param, SDataBuf* pMsg, int32_t code);
2022-01-21 02:28:41 +00:00
typedef int32_t (*__async_exec_fn_t)(void* param);
2022-06-10 09:07:24 +00:00
typedef struct SRequestConnInfo {
2022-06-22 10:50:39 +00:00
void* pTrans;
uint64_t requestId;
int64_t requestObjRefId;
SEpSet mgmtEps;
2022-06-10 09:07:24 +00:00
} SRequestConnInfo;
2022-10-13 03:09:43 +00:00
typedef void (*__freeFunc)(void* param);
2022-07-18 05:32:17 +00:00
2023-04-08 17:39:09 +00:00
// todo add creator/destroyer function
2022-01-21 02:28:41 +00:00
typedef struct SMsgSendInfo {
2022-06-22 10:50:39 +00:00
__async_send_cb_fn_t fp; // async callback function
STargetInfo target; // for update epset
2022-07-18 05:32:17 +00:00
__freeFunc paramFreeFp;
2022-03-08 09:22:21 +00:00
void* param;
uint64_t requestId;
uint64_t requestObjRefId;
int32_t msgType;
SDataBuf msgInfo;
2022-01-21 02:28:41 +00:00
} SMsgSendInfo;
2022-03-04 09:26:47 +00:00
typedef struct SQueryNodeStat {
int32_t tableNum; // vg table number, unit is TSDB_TABLE_NUM_UNIT
2022-03-04 09:26:47 +00:00
} SQueryNodeStat;
2023-06-15 11:34:15 +00:00
typedef struct SQueryStat {
int64_t inputRowNum;
int32_t inputRowSize;
} SQueryStat;
2022-01-21 02:28:41 +00:00
int32_t initTaskQueue();
int32_t cleanupTaskQueue();
/**
*
* @param execFn The asynchronously execution function
* @param execParam The parameters of the execFn
* @param code The response code during execution the execFn
* @return
*/
int32_t taosAsyncExec(__async_exec_fn_t execFn, void* execParam, int32_t* code);
2024-06-26 09:27:35 +00:00
int32_t taosAsyncWait();
int32_t taosAsyncRecover();
2022-01-21 02:28:41 +00:00
2022-07-18 05:32:17 +00:00
void destroySendMsgInfo(SMsgSendInfo* pMsgBody);
2022-11-08 12:45:11 +00:00
void destroyAhandle(void* ahandle);
2022-07-20 10:48:27 +00:00
int32_t asyncSendMsgToServerExt(void* pTransporter, SEpSet* epSet, int64_t* pTransporterId, SMsgSendInfo* pInfo,
bool persistHandle, void* ctx);
2022-03-18 10:04:57 +00:00
2022-01-21 02:28:41 +00:00
/**
* Asynchronously send message to server, after the response received, the callback will be incured.
*
* @param pTransporter
* @param epSet
* @param pTransporterId
* @param pInfo
* @return
*/
2022-07-20 10:48:27 +00:00
int32_t asyncSendMsgToServer(void* pTransporter, SEpSet* epSet, int64_t* pTransporterId, SMsgSendInfo* pInfo);
2022-01-21 02:28:41 +00:00
2022-03-08 09:22:21 +00:00
int32_t queryBuildUseDbOutput(SUseDbOutput* pOut, SUseDbRsp* usedbRsp);
2022-03-02 09:24:59 +00:00
void initQueryModuleMsgHandle();
2021-12-16 08:23:25 +00:00
2022-01-21 02:28:41 +00:00
const SSchema* tGetTbnameColumnSchema();
2022-03-08 09:22:21 +00:00
bool tIsValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_t numOfTags);
2024-01-12 10:29:27 +00:00
int32_t getAsofJoinReverseOp(EOperatorType op);
2022-01-21 02:28:41 +00:00
2022-10-13 03:09:43 +00:00
int32_t queryCreateCTableMetaFromMsg(STableMetaRsp* msg, SCTableMeta* pMeta);
2022-03-08 09:22:21 +00:00
int32_t queryCreateTableMetaFromMsg(STableMetaRsp* msg, bool isSuperTable, STableMeta** pMeta);
char* jobTaskStatusStr(int32_t status);
2022-02-08 08:53:00 +00:00
SSchema createSchema(int8_t type, int32_t bytes, col_id_t colId, const char* name);
2022-06-23 12:29:14 +00:00
2022-07-04 01:08:57 +00:00
void destroyQueryExecRes(SExecResult* pRes);
2022-06-23 12:29:14 +00:00
int32_t dataConverToStr(char* str, int type, void* buf, int32_t bufSize, int32_t* len);
void parseTagDatatoJson(void* p, char** jsonStr);
2022-06-21 08:45:59 +00:00
int32_t cloneTableMeta(STableMeta* pSrc, STableMeta** pDst);
void getColumnTypeFromMeta(STableMeta* pMeta, char* pName, ETableColumnType* pType);
2022-06-21 08:45:59 +00:00
int32_t cloneDbVgInfo(SDBVgInfo* pSrc, SDBVgInfo** pDst);
2022-12-03 06:56:51 +00:00
int32_t cloneSVreateTbReq(SVCreateTbReq* pSrc, SVCreateTbReq** pDst);
void freeVgInfo(SDBVgInfo* vgInfo);
2024-01-16 05:50:20 +00:00
void freeDbCfgInfo(SDbCfgInfo* pInfo);
2022-03-10 11:05:58 +00:00
2022-06-22 10:50:39 +00:00
extern int32_t (*queryBuildMsg[TDMT_MAX])(void* input, char** msg, int32_t msgSize, int32_t* msgLen,
2022-10-13 10:48:06 +00:00
void* (*mallocFp)(int64_t));
2022-03-08 09:22:21 +00:00
extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t msgSize);
2022-03-10 11:05:58 +00:00
2022-03-08 09:22:21 +00:00
#define SET_META_TYPE_NULL(t) (t) = META_TYPE_NULL_TABLE
#define SET_META_TYPE_CTABLE(t) (t) = META_TYPE_CTABLE
#define SET_META_TYPE_TABLE(t) (t) = META_TYPE_TABLE
2022-01-07 01:56:11 +00:00
#define SET_META_TYPE_BOTH_TABLE(t) (t) = META_TYPE_BOTH_TABLE
#define NEED_CLIENT_RM_TBLMETA_ERROR(_code) \
2022-11-02 07:28:32 +00:00
((_code) == TSDB_CODE_PAR_TABLE_NOT_EXIST || (_code) == TSDB_CODE_TDB_TABLE_NOT_EXIST || \
(_code) == TSDB_CODE_PAR_INVALID_COLUMNS_NUM || (_code) == TSDB_CODE_PAR_INVALID_COLUMN || \
2022-06-22 10:50:39 +00:00
(_code) == TSDB_CODE_PAR_TAGS_NOT_MATCHED || (_code) == TSDB_CODE_PAR_VALUE_TOO_LONG || \
2022-06-08 07:34:22 +00:00
(_code) == TSDB_CODE_PAR_INVALID_DROP_COL || ((_code) == TSDB_CODE_TDB_INVALID_TABLE_ID))
#define NEED_CLIENT_REFRESH_VG_ERROR(_code) \
((_code) == TSDB_CODE_VND_HASH_MISMATCH || (_code) == TSDB_CODE_VND_INVALID_VGROUP_ID)
#define NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code) \
((_code) == TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER || (_code) == TSDB_CODE_MND_INVALID_SCHEMA_VER)
#define NEED_CLIENT_HANDLE_ERROR(_code) \
(NEED_CLIENT_RM_TBLMETA_ERROR(_code) || NEED_CLIENT_REFRESH_VG_ERROR(_code) || \
NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code))
2022-12-15 09:07:11 +00:00
#define SYNC_UNKNOWN_LEADER_REDIRECT_ERROR(_code) \
((_code) == TSDB_CODE_SYN_NOT_LEADER || (_code) == TSDB_CODE_SYN_INTERNAL_ERROR || \
(_code) == TSDB_CODE_VND_STOPPED || (_code) == TSDB_CODE_APP_IS_STARTING || (_code) == TSDB_CODE_APP_IS_STOPPING)
#define SYNC_SELF_LEADER_REDIRECT_ERROR(_code) \
((_code) == TSDB_CODE_SYN_NOT_LEADER || (_code) == TSDB_CODE_SYN_RESTORING || (_code) == TSDB_CODE_SYN_INTERNAL_ERROR)
#define SYNC_OTHER_LEADER_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_MNODE_NOT_FOUND)
2024-01-16 05:50:20 +00:00
#define NO_RET_REDIRECT_ERROR(_code) \
((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || \
(_code) == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED)
2022-12-15 09:07:11 +00:00
#define NEED_REDIRECT_ERROR(_code) \
(NO_RET_REDIRECT_ERROR(_code) || SYNC_UNKNOWN_LEADER_REDIRECT_ERROR(_code) || \
SYNC_SELF_LEADER_REDIRECT_ERROR(_code) || SYNC_OTHER_LEADER_REDIRECT_ERROR(_code))
2022-10-13 03:09:43 +00:00
#define IS_VIEW_REQUEST(_type) ((_type) == TDMT_MND_CREATE_VIEW || (_type) == TDMT_MND_DROP_VIEW)
2022-06-22 10:50:39 +00:00
#define NEED_CLIENT_RM_TBLMETA_REQ(_type) \
2022-07-26 09:43:22 +00:00
((_type) == TDMT_VND_CREATE_TABLE || (_type) == TDMT_MND_CREATE_STB || (_type) == TDMT_VND_DROP_TABLE || \
(_type) == TDMT_MND_DROP_STB || (_type) == TDMT_MND_CREATE_VIEW || (_type) == TDMT_MND_DROP_VIEW || \
2024-03-18 06:09:17 +00:00
(_type) == TDMT_MND_CREATE_TSMA || (_type) == TDMT_MND_DROP_TSMA || (_type) == TDMT_MND_DROP_TB_WITH_TSMA)
2022-03-12 09:19:50 +00:00
2022-12-15 09:07:11 +00:00
#define NEED_SCHEDULER_REDIRECT_ERROR(_code) \
(SYNC_UNKNOWN_LEADER_REDIRECT_ERROR(_code) || SYNC_SELF_LEADER_REDIRECT_ERROR(_code) || \
SYNC_OTHER_LEADER_REDIRECT_ERROR(_code))
2022-06-29 02:51:22 +00:00
2022-06-06 09:29:43 +00:00
#define REQUEST_TOTAL_EXEC_TIMES 2
2022-03-15 07:34:17 +00:00
2023-02-24 03:37:16 +00:00
#define IS_INFORMATION_SCHEMA_DB(_name) ((*(_name) == 'i') && (0 == strcmp(_name, TSDB_INFORMATION_SCHEMA_DB)))
#define IS_PERFORMANCE_SCHEMA_DB(_name) ((*(_name) == 'p') && (0 == strcmp(_name, TSDB_PERFORMANCE_SCHEMA_DB)))
#define IS_SYS_DBNAME(_dbname) (IS_INFORMATION_SCHEMA_DB(_dbname) || IS_PERFORMANCE_SCHEMA_DB(_dbname))
2022-07-20 01:39:58 +00:00
2024-02-04 08:33:43 +00:00
#define IS_AUDIT_DBNAME(_dbname) ((*(_dbname) == 'a') && (0 == strcmp(_dbname, TSDB_AUDIT_DB)))
#define IS_AUDIT_STB_NAME(_stbname) ((*(_stbname) == 'o') && (0 == strcmp(_stbname, TSDB_AUDIT_STB_OPERATION)))
#define IS_AUDIT_CTB_NAME(_ctbname) \
((*(_ctbname) == 't') && (0 == strncmp(_ctbname, TSDB_AUDIT_CTB_OPERATION, TSDB_AUDIT_CTB_OPERATION_LEN)))
2022-10-13 03:09:43 +00:00
#define qFatal(...) \
do { \
if (qDebugFlag & DEBUG_FATAL) { \
2022-09-05 05:56:42 +00:00
taosPrintLog("QRY FATAL ", DEBUG_FATAL, qDebugFlag, __VA_ARGS__); \
2022-10-13 03:09:43 +00:00
} \
2022-03-08 09:22:21 +00:00
} while (0)
2022-10-13 03:09:43 +00:00
#define qError(...) \
do { \
if (qDebugFlag & DEBUG_ERROR) { \
2022-09-05 05:56:42 +00:00
taosPrintLog("QRY ERROR ", DEBUG_ERROR, qDebugFlag, __VA_ARGS__); \
2022-10-13 03:09:43 +00:00
} \
2022-03-08 09:22:21 +00:00
} while (0)
2022-10-13 03:09:43 +00:00
#define qWarn(...) \
do { \
if (qDebugFlag & DEBUG_WARN) { \
2022-09-05 05:56:42 +00:00
taosPrintLog("QRY WARN ", DEBUG_WARN, qDebugFlag, __VA_ARGS__); \
2022-10-13 03:09:43 +00:00
} \
2022-03-08 09:22:21 +00:00
} while (0)
2022-10-13 03:09:43 +00:00
#define qInfo(...) \
do { \
if (qDebugFlag & DEBUG_INFO) { \
2022-09-05 05:56:42 +00:00
taosPrintLog("QRY ", DEBUG_INFO, qDebugFlag, __VA_ARGS__); \
2022-10-13 03:09:43 +00:00
} \
2022-03-08 09:22:21 +00:00
} while (0)
2022-10-13 03:09:43 +00:00
#define qDebug(...) \
do { \
if (qDebugFlag & DEBUG_DEBUG) { \
2022-09-05 05:56:42 +00:00
taosPrintLog("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \
2022-10-13 03:09:43 +00:00
} \
2022-03-08 09:22:21 +00:00
} while (0)
2022-10-13 03:09:43 +00:00
#define qTrace(...) \
do { \
if (qDebugFlag & DEBUG_TRACE) { \
2022-09-05 05:56:42 +00:00
taosPrintLog("QRY ", DEBUG_TRACE, qDebugFlag, __VA_ARGS__); \
2022-10-13 03:09:43 +00:00
} \
2022-03-08 09:22:21 +00:00
} while (0)
2022-10-13 03:09:43 +00:00
#define qDebugL(...) \
do { \
if (qDebugFlag & DEBUG_DEBUG) { \
2022-09-05 05:56:42 +00:00
taosPrintLongString("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \
2022-10-13 03:09:43 +00:00
} \
2022-03-08 09:22:21 +00:00
} while (0)
2021-12-14 07:24:21 +00:00
#define QRY_ERR_RET(c) \
do { \
int32_t _code = c; \
if (_code != TSDB_CODE_SUCCESS) { \
terrno = _code; \
return _code; \
} \
} while (0)
#define QRY_RET(c) \
do { \
int32_t _code = c; \
if (_code != TSDB_CODE_SUCCESS) { \
terrno = _code; \
} \
return _code; \
} while (0)
#define QRY_ERR_JRET(c) \
do { \
code = c; \
if (code != TSDB_CODE_SUCCESS) { \
terrno = code; \
goto _return; \
} \
} while (0)
2022-03-31 10:02:58 +00:00
2021-12-14 07:24:21 +00:00
#ifdef __cplusplus
}
#endif
2021-12-14 09:13:31 +00:00
#endif /*_TD_QUERY_H_*/
2022-06-22 10:50:39 +00:00
// clang-foramt on