sclInt.h 2.7 KB
Newer Older
D
dapan1121 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*
 * 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/>.
 */
D
dapan1121 已提交
15 16
#ifndef TDENGINE_SCALARINT_H
#define TDENGINE_SCALARINT_H
D
dapan1121 已提交
17 18 19 20

#ifdef __cplusplus
extern "C" {
#endif
S
common  
Shengliang Guan 已提交
21
#include "tcommon.h"
D
dapan1121 已提交
22 23
#include "thash.h"
#include "query.h"
D
dapan1121 已提交
24

D
dapan1121 已提交
25 26
typedef struct SScalarCtx {
  int32_t      code;
D
dapan 已提交
27
  SArray      *pBlockList;  /* element is SSDataBlock* */
D
dapan1121 已提交
28
  SHashObj    *pRes;  /* element is SScalarParam */
29
  void        *param;      // additional parameter (meta actually) for acquire value such as tbname/tags values
D
dapan1121 已提交
30
} SScalarCtx;
D
dapan1121 已提交
31

D
dapan1121 已提交
32 33

#define SCL_DATA_TYPE_DUMMY_HASH 9000
D
dapan1121 已提交
34
#define SCL_DEFAULT_OP_NUM 10
D
dapan1121 已提交
35

D
dapan 已提交
36
#define SCL_IS_CONST_NODE(_node) ((NULL == (_node)) || (QUERY_NODE_VALUE == (_node)->type) || (QUERY_NODE_NODE_LIST == (_node)->type))
D
dapan1121 已提交
37
#define SCL_IS_CONST_CALC(_ctx) (NULL == (_ctx)->pBlockList)
D
dapan1121 已提交
38 39
//#define SCL_IS_NULL_VALUE_NODE(_node) ((QUERY_NODE_VALUE == nodeType(_node)) && (TSDB_DATA_TYPE_NULL == ((SValueNode *)_node)->node.resType.type) && (((SValueNode *)_node)->placeholderNo <= 0))
#define SCL_IS_NULL_VALUE_NODE(_node) ((QUERY_NODE_VALUE == nodeType(_node)) && (TSDB_DATA_TYPE_NULL == ((SValueNode *)_node)->node.resType.type))
D
dapan1121 已提交
40

D
dapan1121 已提交
41 42 43 44 45 46 47 48 49 50 51
#define sclFatal(...)  qFatal(__VA_ARGS__)
#define sclError(...)  qError(__VA_ARGS__)
#define sclWarn(...)   qWarn(__VA_ARGS__)
#define sclInfo(...)   qInfo(__VA_ARGS__)
#define sclDebug(...)  qDebug(__VA_ARGS__)
#define sclTrace(...)  qTrace(__VA_ARGS__)

#define SCL_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0)
#define SCL_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0)
#define SCL_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0)

52
int32_t doConvertDataType(SValueNode* pValueNode, SScalarParam* out);
53
SColumnInfoData* createColumnInfoData(SDataType* pType, int32_t numOfRows);
D
dapan 已提交
54
void sclConvertToTsValueNode(int8_t precision, SValueNode* valueNode);
D
dapan1121 已提交
55

56 57 58
#define GET_PARAM_TYPE(_c)      ((_c)->columnData->info.type)
#define GET_PARAM_BYTES(_c)     ((_c)->columnData->info.bytes)
#define GET_PARAM_PRECISON(_c)  ((_c)->columnData->info.precision)
D
dapan1121 已提交
59

D
dapan 已提交
60
void sclFreeParam(SScalarParam *param);
D
dapan1121 已提交
61 62 63 64 65

#ifdef __cplusplus
}
#endif

D
dapan 已提交
66
#endif  // TDENGINE_SCALARINT_H