提交 e4104307 编写于 作者: X Xiaoyu Wang

integrate constant calculate

上级 469cd23f
...@@ -127,6 +127,7 @@ bool fmIsStringFunc(int32_t funcId); ...@@ -127,6 +127,7 @@ bool fmIsStringFunc(int32_t funcId);
bool fmIsDatetimeFunc(int32_t funcId); bool fmIsDatetimeFunc(int32_t funcId);
bool fmIsTimelineFunc(int32_t funcId); bool fmIsTimelineFunc(int32_t funcId);
bool fmIsTimeorderFunc(int32_t funcId); bool fmIsTimeorderFunc(int32_t funcId);
bool fmIsPseudoColumnFunc(int32_t funcId);
bool fmIsWindowPseudoColumnFunc(int32_t funcId); bool fmIsWindowPseudoColumnFunc(int32_t funcId);
bool fmIsWindowClauseFunc(int32_t funcId); bool fmIsWindowClauseFunc(int32_t funcId);
......
...@@ -104,6 +104,10 @@ bool fmIsScalarFunc(int32_t funcId) { ...@@ -104,6 +104,10 @@ bool fmIsScalarFunc(int32_t funcId) {
return isSpecificClassifyFunc(funcId, FUNC_MGT_SCALAR_FUNC); return isSpecificClassifyFunc(funcId, FUNC_MGT_SCALAR_FUNC);
} }
bool fmIsPseudoColumnFunc(int32_t funcId) {
return isSpecificClassifyFunc(funcId, FUNC_MGT_PSEUDO_COLUMN_FUNC);
}
bool fmIsWindowPseudoColumnFunc(int32_t funcId) { bool fmIsWindowPseudoColumnFunc(int32_t funcId) {
return isSpecificClassifyFunc(funcId, FUNC_MGT_WINDOW_PC_FUNC); return isSpecificClassifyFunc(funcId, FUNC_MGT_WINDOW_PC_FUNC);
} }
......
...@@ -1491,6 +1491,7 @@ static int32_t jsonToColumnNode(const SJson* pJson, void* pObj) { ...@@ -1491,6 +1491,7 @@ static int32_t jsonToColumnNode(const SJson* pJson, void* pObj) {
return code; return code;
} }
static const char* jkValueGenByCalc = "GenByCalc";
static const char* jkValueLiteral = "Literal"; static const char* jkValueLiteral = "Literal";
static const char* jkValueDuration = "Duration"; static const char* jkValueDuration = "Duration";
static const char* jkValueTranslate = "Translate"; static const char* jkValueTranslate = "Translate";
...@@ -1544,7 +1545,7 @@ static int32_t valueNodeToJson(const void* pObj, SJson* pJson) { ...@@ -1544,7 +1545,7 @@ static int32_t valueNodeToJson(const void* pObj, SJson* pJson) {
int32_t code = exprNodeToJson(pObj, pJson); int32_t code = exprNodeToJson(pObj, pJson);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddBoolToObject(pJson, jkValueTranslate, pNode->genByCalc); code = tjsonAddBoolToObject(pJson, jkValueGenByCalc, pNode->genByCalc);
} }
if (TSDB_CODE_SUCCESS == code && !pNode->genByCalc) { if (TSDB_CODE_SUCCESS == code && !pNode->genByCalc) {
code = tjsonAddStringToObject(pJson, jkValueLiteral, pNode->literal); code = tjsonAddStringToObject(pJson, jkValueLiteral, pNode->literal);
...@@ -1617,7 +1618,7 @@ static int32_t jsonToValueNode(const SJson* pJson, void* pObj) { ...@@ -1617,7 +1618,7 @@ static int32_t jsonToValueNode(const SJson* pJson, void* pObj) {
int32_t code = jsonToExprNode(pJson, pObj); int32_t code = jsonToExprNode(pJson, pObj);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBoolValue(pJson, jkValueDuration, &pNode->genByCalc); code = tjsonGetBoolValue(pJson, jkValueGenByCalc, &pNode->genByCalc);
} }
if (TSDB_CODE_SUCCESS == code && !pNode->genByCalc) { if (TSDB_CODE_SUCCESS == code && !pNode->genByCalc) {
code = tjsonDupStringValue(pJson, jkValueLiteral, &pNode->literal); code = tjsonDupStringValue(pJson, jkValueLiteral, &pNode->literal);
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "functionMgt.h"
#include "parInt.h" #include "parInt.h"
#include "scalar.h" #include "scalar.h"
...@@ -44,6 +45,9 @@ static EDealRes calcConstOperator(SOperatorNode** pNode, void* pContext) { ...@@ -44,6 +45,9 @@ static EDealRes calcConstOperator(SOperatorNode** pNode, void* pContext) {
static EDealRes calcConstFunction(SFunctionNode** pNode, void* pContext) { static EDealRes calcConstFunction(SFunctionNode** pNode, void* pContext) {
SFunctionNode* pFunc = *pNode; SFunctionNode* pFunc = *pNode;
if (fmIsPseudoColumnFunc(pFunc->funcId)) {
return DEAL_RES_CONTINUE;
}
SNode* pParam = NULL; SNode* pParam = NULL;
FOREACH(pParam, pFunc->pParameterList) { FOREACH(pParam, pFunc->pParameterList) {
if (QUERY_NODE_VALUE != nodeType(pParam)) { if (QUERY_NODE_VALUE != nodeType(pParam)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册