cos/multi-write: parser part
This commit is contained in:
parent
60ef86da6d
commit
ca1262c5c5
|
@ -307,12 +307,12 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbName, ch
|
|||
"CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %dm "
|
||||
"WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d STT_TRIGGER %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
|
||||
"WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d TABLE_PREFIX %d TABLE_SUFFIX %d TSDB_PAGESIZE %d "
|
||||
"WAL_RETENTION_PERIOD %d WAL_RETENTION_SIZE %" PRId64 " KEEP_TIME_OFFSET %d",
|
||||
"WAL_RETENTION_PERIOD %d WAL_RETENTION_SIZE %" PRId64 " KEEP_TIME_OFFSET %d S3_CHUNKSIZE %d S3_KEEPLOCAL %dm S3_COMPACT %d",
|
||||
dbName, pCfg->buffer, pCfg->cacheSize, cacheModelStr(pCfg->cacheLast), pCfg->compression, pCfg->daysPerFile,
|
||||
pCfg->walFsyncPeriod, pCfg->maxRows, pCfg->minRows, pCfg->sstTrigger, pCfg->daysToKeep0, pCfg->daysToKeep1, pCfg->daysToKeep2,
|
||||
pCfg->pages, pCfg->pageSize, prec, pCfg->replications, pCfg->walLevel, pCfg->numOfVgroups,
|
||||
1 == pCfg->numOfStables, hashPrefix, pCfg->hashSuffix, pCfg->tsdbPageSize, pCfg->walRetentionPeriod, pCfg->walRetentionSize,
|
||||
pCfg->keepTimeOffset);
|
||||
pCfg->keepTimeOffset, pCfg->s3ChunkSize, pCfg->s3KeepLocal, pCfg->s3Compact);
|
||||
|
||||
if (retentions) {
|
||||
len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, " RETENTIONS %s", retentions);
|
||||
|
|
|
@ -109,6 +109,8 @@ const char* nodesNodeName(ENodeType type) {
|
|||
return "FlushDatabaseStmt";
|
||||
case QUERY_NODE_TRIM_DATABASE_STMT:
|
||||
return "TrimDatabaseStmt";
|
||||
case QUERY_NODE_S3MIGRATE_DATABASE_STMT:
|
||||
return "S3MigrateDatabaseStmt";
|
||||
case QUERY_NODE_CREATE_TABLE_STMT:
|
||||
return "CreateTableStmt";
|
||||
case QUERY_NODE_CREATE_SUBTABLE_CLAUSE:
|
||||
|
@ -807,7 +809,7 @@ static int32_t jsonToLogicScanNode(const SJson* pJson, void* pObj) {
|
|||
|
||||
static const char* jkProjectLogicPlanProjections = "Projections";
|
||||
static const char* jkProjectLogicPlanIgnoreGroupId = "IgnoreGroupId";
|
||||
static const char* jkProjectLogicPlanInputIgnoreGroup= "InputIgnoreGroup";
|
||||
static const char* jkProjectLogicPlanInputIgnoreGroup = "InputIgnoreGroup";
|
||||
|
||||
static int32_t logicProjectNodeToJson(const void* pObj, SJson* pJson) {
|
||||
const SProjectLogicNode* pNode = (const SProjectLogicNode*)pObj;
|
||||
|
@ -1323,7 +1325,6 @@ static int32_t jsonToLogicDynQueryCtrlNode(const SJson* pJson, void* pObj) {
|
|||
return code;
|
||||
}
|
||||
|
||||
|
||||
static const char* jkSubplanIdQueryId = "QueryId";
|
||||
static const char* jkSubplanIdGroupId = "GroupId";
|
||||
static const char* jkSubplanIdSubplanId = "SubplanId";
|
||||
|
@ -1830,8 +1831,6 @@ static int32_t jsonToFuncType(const SJson* pJson, void* pObj) {
|
|||
return code;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int32_t physiLastRowScanNodeToJson(const void* pObj, SJson* pJson) {
|
||||
const SLastRowScanPhysiNode* pNode = (const SLastRowScanPhysiNode*)pObj;
|
||||
|
||||
|
@ -1845,7 +1844,7 @@ static int32_t physiLastRowScanNodeToJson(const void* pObj, SJson* pJson) {
|
|||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = nodeListToJson(pJson, jkLastRowScanPhysiPlanTargets, pNode->pTargets);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonAddTArray(pJson, jkLastRowScanPhysiPlanFuncTypes, funcTypeToJson, pNode->pFuncTypes);
|
||||
}
|
||||
|
||||
|
@ -2232,7 +2231,6 @@ static int32_t physiHashJoinNodeToJson(const void* pObj, SJson* pJson) {
|
|||
return code;
|
||||
}
|
||||
|
||||
|
||||
static int32_t jsonToPhysiHashJoinNode(const SJson* pJson, void* pObj) {
|
||||
SHashJoinPhysiNode* pNode = (SHashJoinPhysiNode*)pObj;
|
||||
|
||||
|
@ -2267,7 +2265,6 @@ static int32_t jsonToPhysiHashJoinNode(const SJson* pJson, void* pObj) {
|
|||
return code;
|
||||
}
|
||||
|
||||
|
||||
static const char* jkAggPhysiPlanExprs = "Exprs";
|
||||
static const char* jkAggPhysiPlanGroupKeys = "GroupKeys";
|
||||
static const char* jkAggPhysiPlanAggFuncs = "AggFuncs";
|
||||
|
@ -2481,7 +2478,7 @@ static int32_t jsonToPhysiSortNode(const SJson* pJson, void* pObj) {
|
|||
code = tjsonGetBoolValue(pJson, jkSortPhysiPlanCalcGroupIds, &pNode->calcGroupId);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code= tjsonGetBoolValue(pJson, jkSortPhysiPlanExcludePKCol, &pNode->excludePkCol);
|
||||
code = tjsonGetBoolValue(pJson, jkSortPhysiPlanExcludePKCol, &pNode->excludePkCol);
|
||||
}
|
||||
|
||||
return code;
|
||||
|
@ -3157,7 +3154,6 @@ static const char* jkGroupCachePhysiPlanGroupByUid = "GroupByUid";
|
|||
static const char* jkGroupCachePhysiPlanGlobalGroup = "GlobalGroup";
|
||||
static const char* jkGroupCachePhysiPlanBatchFetch = "BatchFetch";
|
||||
|
||||
|
||||
static int32_t physiGroupCacheNodeToJson(const void* pObj, SJson* pJson) {
|
||||
const SGroupCachePhysiNode* pNode = (const SGroupCachePhysiNode*)pObj;
|
||||
|
||||
|
@ -3291,8 +3287,6 @@ static int32_t jsonToPhysiDynQueryCtrlNode(const SJson* pJson, void* pObj) {
|
|||
return code;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static const char* jkQueryNodeAddrId = "Id";
|
||||
static const char* jkQueryNodeAddrInUse = "InUse";
|
||||
static const char* jkQueryNodeAddrNumOfEps = "NumOfEps";
|
||||
|
@ -4788,6 +4782,10 @@ static const char* jkDatabaseOptionsNumOfVgroups = "NumOfVgroups";
|
|||
static const char* jkDatabaseOptionsSingleStable = "SingleStable";
|
||||
static const char* jkDatabaseOptionsRetentions = "Retentions";
|
||||
static const char* jkDatabaseOptionsSchemaless = "Schemaless";
|
||||
static const char* jkDatabaseOptionsS3ChunkSize = "S3ChunkSize";
|
||||
static const char* jkDatabaseOptionsS3KeepLocalNode = "S3KeepLocalNode";
|
||||
static const char* jkDatabaseOptionsS3KeepLocal = "S3KeepLocal";
|
||||
static const char* jkDatabaseOptionsS3Compact = "S3Compact";
|
||||
|
||||
static int32_t databaseOptionsToJson(const void* pObj, SJson* pJson) {
|
||||
const SDatabaseOptions* pNode = (const SDatabaseOptions*)pObj;
|
||||
|
@ -4847,6 +4845,18 @@ static int32_t databaseOptionsToJson(const void* pObj, SJson* pJson) {
|
|||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonAddIntegerToObject(pJson, jkDatabaseOptionsSchemaless, pNode->schemaless);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonAddIntegerToObject(pJson, jkDatabaseOptionsS3ChunkSize, pNode->s3ChunkSize);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonAddObject(pJson, jkDatabaseOptionsS3KeepLocalNode, nodeToJson, pNode->s3KeepLocalStr);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonAddIntegerToObject(pJson, jkDatabaseOptionsS3KeepLocal, pNode->s3KeepLocal);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonAddIntegerToObject(pJson, jkDatabaseOptionsS3Compact, pNode->s3Compact);
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
@ -4909,6 +4919,18 @@ static int32_t jsonToDatabaseOptions(const SJson* pJson, void* pObj) {
|
|||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonGetTinyIntValue(pJson, jkDatabaseOptionsSchemaless, &pNode->schemaless);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonGetIntValue(pJson, jkDatabaseOptionsS3ChunkSize, &pNode->s3ChunkSize);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = jsonToNodeObject(pJson, jkDatabaseOptionsS3KeepLocalNode, (SNode**)&pNode->s3KeepLocalStr);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonGetIntValue(pJson, jkDatabaseOptionsS3KeepLocal, &pNode->s3KeepLocal);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonGetTinyIntValue(pJson, jkDatabaseOptionsS3Compact, &pNode->s3Compact);
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
@ -5497,6 +5519,24 @@ static int32_t jsonToTrimDatabaseStmt(const SJson* pJson, void* pObj) {
|
|||
return code;
|
||||
}
|
||||
|
||||
static const char* jkS3MigrateDatabaseStmtDbName = "DbName";
|
||||
|
||||
static int32_t s3migrateDatabaseStmtToJson(const void* pObj, SJson* pJson) {
|
||||
const SS3MigrateDatabaseStmt* pNode = (const SS3MigrateDatabaseStmt*)pObj;
|
||||
|
||||
int32_t code = tjsonAddStringToObject(pJson, jkS3MigrateDatabaseStmtDbName, pNode->dbName);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t jsonToS3MigrateDatabaseStmt(const SJson* pJson, void* pObj) {
|
||||
SS3MigrateDatabaseStmt* pNode = (SS3MigrateDatabaseStmt*)pObj;
|
||||
|
||||
int32_t code = tjsonGetStringValue(pJson, jkS3MigrateDatabaseStmtDbName, pNode->dbName);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
static const char* jkCreateTableStmtDbName = "DbName";
|
||||
static const char* jkCreateTableStmtTableName = "TableName";
|
||||
static const char* jkCreateTableStmtIgnoreExists = "IgnoreExists";
|
||||
|
@ -6166,10 +6206,6 @@ static int32_t jsonToRestoreVnodeStmt(const SJson* pJson, void* pObj) {
|
|||
return jsonToRestoreComponentNodeStmt(pJson, pObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static const char* jkCreateTopicStmtTopicName = "TopicName";
|
||||
static const char* jkCreateTopicStmtSubscribeDbName = "SubscribeDbName";
|
||||
static const char* jkCreateTopicStmtIgnoreExists = "IgnoreExists";
|
||||
|
@ -6821,7 +6857,6 @@ static int32_t showCreateViewStmtToJson(const void* pObj, SJson* pJson) {
|
|||
return code;
|
||||
}
|
||||
|
||||
|
||||
static int32_t jsonToShowCreateViewStmt(const SJson* pJson, void* pObj) {
|
||||
SShowCreateViewStmt* pNode = (SShowCreateViewStmt*)pObj;
|
||||
|
||||
|
@ -6833,7 +6868,6 @@ static int32_t jsonToShowCreateViewStmt(const SJson* pJson, void* pObj) {
|
|||
return code;
|
||||
}
|
||||
|
||||
|
||||
static const char* jkShowTableDistributedStmtDbName = "DbName";
|
||||
static const char* jkShowTableDistributedStmtTableName = "TableName";
|
||||
|
||||
|
@ -7079,6 +7113,8 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
|
|||
return alterDatabaseStmtToJson(pObj, pJson);
|
||||
case QUERY_NODE_TRIM_DATABASE_STMT:
|
||||
return trimDatabaseStmtToJson(pObj, pJson);
|
||||
case QUERY_NODE_S3MIGRATE_DATABASE_STMT:
|
||||
return s3migrateDatabaseStmtToJson(pObj, pJson);
|
||||
case QUERY_NODE_CREATE_TABLE_STMT:
|
||||
return createTableStmtToJson(pObj, pJson);
|
||||
case QUERY_NODE_CREATE_SUBTABLE_CLAUSE:
|
||||
|
@ -7416,6 +7452,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
|
|||
return jsonToAlterDatabaseStmt(pJson, pObj);
|
||||
case QUERY_NODE_TRIM_DATABASE_STMT:
|
||||
return jsonToTrimDatabaseStmt(pJson, pObj);
|
||||
case QUERY_NODE_S3MIGRATE_DATABASE_STMT:
|
||||
return jsonToS3MigrateDatabaseStmt(pJson, pObj);
|
||||
case QUERY_NODE_CREATE_TABLE_STMT:
|
||||
return jsonToCreateTableStmt(pJson, pObj);
|
||||
case QUERY_NODE_CREATE_SUBTABLE_CLAUSE:
|
||||
|
|
|
@ -324,6 +324,8 @@ SNode* nodesMakeNode(ENodeType type) {
|
|||
return makeNode(type, sizeof(SFlushDatabaseStmt));
|
||||
case QUERY_NODE_TRIM_DATABASE_STMT:
|
||||
return makeNode(type, sizeof(STrimDatabaseStmt));
|
||||
case QUERY_NODE_S3MIGRATE_DATABASE_STMT:
|
||||
return makeNode(type, sizeof(SS3MigrateDatabaseStmt));
|
||||
case QUERY_NODE_CREATE_TABLE_STMT:
|
||||
return makeNode(type, sizeof(SCreateTableStmt));
|
||||
case QUERY_NODE_CREATE_SUBTABLE_CLAUSE:
|
||||
|
@ -802,6 +804,7 @@ void nodesDestroyNode(SNode* pNode) {
|
|||
case QUERY_NODE_DATABASE_OPTIONS: {
|
||||
SDatabaseOptions* pOptions = (SDatabaseOptions*)pNode;
|
||||
nodesDestroyNode((SNode*)pOptions->pDaysPerFile);
|
||||
nodesDestroyNode((SNode*)pOptions->s3KeepLocalStr);
|
||||
nodesDestroyList(pOptions->pKeep);
|
||||
nodesDestroyList(pOptions->pRetentions);
|
||||
break;
|
||||
|
@ -939,6 +942,8 @@ void nodesDestroyNode(SNode* pNode) {
|
|||
case QUERY_NODE_FLUSH_DATABASE_STMT: // no pointer field
|
||||
case QUERY_NODE_TRIM_DATABASE_STMT: // no pointer field
|
||||
break;
|
||||
case QUERY_NODE_S3MIGRATE_DATABASE_STMT: // no pointer field
|
||||
break;
|
||||
case QUERY_NODE_CREATE_TABLE_STMT: {
|
||||
SCreateTableStmt* pStmt = (SCreateTableStmt*)pNode;
|
||||
nodesDestroyList(pStmt->pCols);
|
||||
|
|
|
@ -64,6 +64,9 @@ typedef enum EDatabaseOptionType {
|
|||
DB_OPTION_STT_TRIGGER,
|
||||
DB_OPTION_TABLE_PREFIX,
|
||||
DB_OPTION_TABLE_SUFFIX,
|
||||
DB_OPTION_S3_CHUNKSIZE,
|
||||
DB_OPTION_S3_KEEPLOCAL,
|
||||
DB_OPTION_S3_COMPACT,
|
||||
DB_OPTION_KEEP_TIME_OFFSET
|
||||
} EDatabaseOptionType;
|
||||
|
||||
|
@ -90,7 +93,7 @@ typedef struct STokenPair {
|
|||
|
||||
typedef struct SShowTablesOption {
|
||||
EShowKind kind;
|
||||
SToken dbName;
|
||||
SToken dbName;
|
||||
} SShowTablesOption;
|
||||
|
||||
extern SToken nil_token;
|
||||
|
@ -106,40 +109,40 @@ SToken getTokenFromRawExprNode(SAstCreateContext* pCxt, SNode* pNode);
|
|||
SNodeList* createNodeList(SAstCreateContext* pCxt, SNode* pNode);
|
||||
SNodeList* addNodeToList(SAstCreateContext* pCxt, SNodeList* pList, SNode* pNode);
|
||||
|
||||
SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pColumnName);
|
||||
SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral);
|
||||
SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pColumnName);
|
||||
SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral);
|
||||
SNodeList* createHintNodeList(SAstCreateContext* pCxt, const SToken* pLiteral);
|
||||
SNode* createIdentifierValueNode(SAstCreateContext* pCxt, SToken* pLiteral);
|
||||
SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral);
|
||||
SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt);
|
||||
SNode* createPlaceholderValueNode(SAstCreateContext* pCxt, const SToken* pLiteral);
|
||||
SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias);
|
||||
SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType type, SNode* pParam1, SNode* pParam2);
|
||||
SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pLeft, SNode* pRight);
|
||||
SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight);
|
||||
SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight);
|
||||
SNode* createFunctionNode(SAstCreateContext* pCxt, const SToken* pFuncName, SNodeList* pParameterList);
|
||||
SNode* createCastFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SDataType dt);
|
||||
SNode* createNodeListNode(SAstCreateContext* pCxt, SNodeList* pList);
|
||||
SNode* createNodeListNodeEx(SAstCreateContext* pCxt, SNode* p1, SNode* p2);
|
||||
SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTableName, SToken* pTableAlias);
|
||||
SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const SToken* pTableAlias);
|
||||
SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, SNode* pLeft, SNode* pRight, SNode* pJoinCond);
|
||||
SNode* createViewNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pViewName);
|
||||
SNode* createLimitNode(SAstCreateContext* pCxt, const SToken* pLimit, const SToken* pOffset);
|
||||
SNode* createOrderByExprNode(SAstCreateContext* pCxt, SNode* pExpr, EOrder order, ENullOrder nullOrder);
|
||||
SNode* createSessionWindowNode(SAstCreateContext* pCxt, SNode* pCol, SNode* pGap);
|
||||
SNode* createStateWindowNode(SAstCreateContext* pCxt, SNode* pExpr);
|
||||
SNode* createEventWindowNode(SAstCreateContext* pCxt, SNode* pStartCond, SNode* pEndCond);
|
||||
SNode* createCountWindowNode(SAstCreateContext* pCxt, const SToken* pCountToken, const SToken* pSlidingToken);
|
||||
SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode* pOffset, SNode* pSliding,
|
||||
SNode* pFill);
|
||||
SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues);
|
||||
SNode* createGroupingSetNode(SAstCreateContext* pCxt, SNode* pNode);
|
||||
SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd);
|
||||
SNode* createInterpTimePoint(SAstCreateContext* pCxt, SNode* pPoint);
|
||||
SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen);
|
||||
SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse);
|
||||
SNode* createIdentifierValueNode(SAstCreateContext* pCxt, SToken* pLiteral);
|
||||
SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral);
|
||||
SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt);
|
||||
SNode* createPlaceholderValueNode(SAstCreateContext* pCxt, const SToken* pLiteral);
|
||||
SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias);
|
||||
SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType type, SNode* pParam1, SNode* pParam2);
|
||||
SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pLeft, SNode* pRight);
|
||||
SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight);
|
||||
SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight);
|
||||
SNode* createFunctionNode(SAstCreateContext* pCxt, const SToken* pFuncName, SNodeList* pParameterList);
|
||||
SNode* createCastFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SDataType dt);
|
||||
SNode* createNodeListNode(SAstCreateContext* pCxt, SNodeList* pList);
|
||||
SNode* createNodeListNodeEx(SAstCreateContext* pCxt, SNode* p1, SNode* p2);
|
||||
SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTableName, SToken* pTableAlias);
|
||||
SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const SToken* pTableAlias);
|
||||
SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, SNode* pLeft, SNode* pRight, SNode* pJoinCond);
|
||||
SNode* createViewNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pViewName);
|
||||
SNode* createLimitNode(SAstCreateContext* pCxt, const SToken* pLimit, const SToken* pOffset);
|
||||
SNode* createOrderByExprNode(SAstCreateContext* pCxt, SNode* pExpr, EOrder order, ENullOrder nullOrder);
|
||||
SNode* createSessionWindowNode(SAstCreateContext* pCxt, SNode* pCol, SNode* pGap);
|
||||
SNode* createStateWindowNode(SAstCreateContext* pCxt, SNode* pExpr);
|
||||
SNode* createEventWindowNode(SAstCreateContext* pCxt, SNode* pStartCond, SNode* pEndCond);
|
||||
SNode* createCountWindowNode(SAstCreateContext* pCxt, const SToken* pCountToken, const SToken* pSlidingToken);
|
||||
SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode* pOffset, SNode* pSliding,
|
||||
SNode* pFill);
|
||||
SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues);
|
||||
SNode* createGroupingSetNode(SAstCreateContext* pCxt, SNode* pNode);
|
||||
SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd);
|
||||
SNode* createInterpTimePoint(SAstCreateContext* pCxt, SNode* pPoint);
|
||||
SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen);
|
||||
SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse);
|
||||
|
||||
SNode* addWhereClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pWhere);
|
||||
SNode* addPartitionByClause(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pPartitionByList);
|
||||
|
@ -152,7 +155,8 @@ SNode* addLimitClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pLimit);
|
|||
SNode* addRangeClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pRange);
|
||||
SNode* addEveryClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pEvery);
|
||||
SNode* addFillClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pFill);
|
||||
SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pProjectionList, SNode* pTable, SNodeList* pHint);
|
||||
SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pProjectionList, SNode* pTable,
|
||||
SNodeList* pHint);
|
||||
SNode* setSelectStmtTagMode(SAstCreateContext* pCxt, SNode* pStmt, bool bSelectTags);
|
||||
SNode* createSetOperator(SAstCreateContext* pCxt, ESetOperatorType type, SNode* pLeft, SNode* pRight);
|
||||
|
||||
|
@ -168,6 +172,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* createS3MigrateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
||||
SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pStart, SNode* pEnd);
|
||||
SNode* createDefaultTableOptions(SAstCreateContext* pCxt);
|
||||
SNode* createAlterTableOptions(SAstCreateContext* pCxt);
|
||||
|
@ -194,7 +199,8 @@ SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, EShowKind showKind);
|
|||
SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type);
|
||||
SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, SNode* pTbName,
|
||||
EOperatorType tableCondType);
|
||||
SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, SNode* pTbName, EOperatorType tableCondType);
|
||||
SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, SNode* pTbName,
|
||||
EOperatorType tableCondType);
|
||||
SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
||||
SNode* createShowAliveStmt(SAstCreateContext* pCxt, SNode* pDbName, ENodeType type);
|
||||
SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable);
|
||||
|
|
|
@ -208,6 +208,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 ::= S3MIGRATE DATABASE db_name(A). { pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &A); }
|
||||
cmd ::= COMPACT DATABASE db_name(A) start_opt(B) end_opt(C). { pCxt->pRootNode = createCompactStmt(pCxt, &A, B, C); }
|
||||
|
||||
%type not_exists_opt { bool }
|
||||
|
@ -260,6 +261,10 @@ db_options(A) ::= db_options(B) WAL_SEGMENT_SIZE NK_INTEGER(C).
|
|||
db_options(A) ::= db_options(B) STT_TRIGGER NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STT_TRIGGER, &C); }
|
||||
db_options(A) ::= db_options(B) TABLE_PREFIX signed(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TABLE_PREFIX, C); }
|
||||
db_options(A) ::= db_options(B) TABLE_SUFFIX signed(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TABLE_SUFFIX, C); }
|
||||
db_options(A) ::= db_options(B) S3_CHUNKSIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_CHUNKSIZE, &C); }
|
||||
db_options(A) ::= db_options(B) S3_KEEPLOCAL NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_KEEPLOCAL, &C); }
|
||||
db_options(A) ::= db_options(B) S3_KEEPLOCAL NK_VARIABLE(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_KEEPLOCAL, &C); }
|
||||
db_options(A) ::= db_options(B) S3_COMPACT NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_COMPACT, &C); }
|
||||
db_options(A) ::= db_options(B) KEEP_TIME_OFFSET NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_KEEP_TIME_OFFSET, &C); }
|
||||
|
||||
alter_db_options(A) ::= alter_db_option(B). { A = createAlterDatabaseOptions(pCxt); A = setAlterDatabaseOption(pCxt, A, &B); }
|
||||
|
@ -291,6 +296,9 @@ alter_db_option(A) ::= WAL_RETENTION_SIZE NK_MINUS(B) NK_INTEGER(C).
|
|||
t.n = (C.z + C.n) - B.z;
|
||||
A.type = DB_OPTION_WAL_RETENTION_SIZE; A.val = t;
|
||||
}
|
||||
alter_db_option(A) ::= S3_KEEPLOCAL NK_INTEGER(B). { A.type = DB_OPTION_S3_KEEPLOCAL; A.val = B; }
|
||||
alter_db_option(A) ::= S3_KEEPLOCAL NK_VARIABLE(B). { A.type = DB_OPTION_S3_KEEPLOCAL; A.val = B; }
|
||||
alter_db_option(A) ::= S3_COMPACT NK_INTEGER(B). { A.type = DB_OPTION_S3_COMPACT, A.val = B; }
|
||||
alter_db_option(A) ::= KEEP_TIME_OFFSET NK_INTEGER(B). { A.type = DB_OPTION_KEEP_TIME_OFFSET; A.val = B; }
|
||||
|
||||
%type integer_list { SNodeList* }
|
||||
|
|
|
@ -228,7 +228,6 @@ static bool checkViewName(SAstCreateContext* pCxt, SToken* pViewName) {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
static bool checkStreamName(SAstCreateContext* pCxt, SToken* pStreamName) {
|
||||
trimEscape(pStreamName);
|
||||
if (pStreamName->n >= TSDB_STREAM_NAME_LEN) {
|
||||
|
@ -833,7 +832,6 @@ SNode* createViewNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pViewNam
|
|||
return (SNode*)pView;
|
||||
}
|
||||
|
||||
|
||||
SNode* createLimitNode(SAstCreateContext* pCxt, const SToken* pLimit, const SToken* pOffset) {
|
||||
CHECK_PARSER_STATUS(pCxt);
|
||||
SLimitNode* limitNode = (SLimitNode*)nodesMakeNode(QUERY_NODE_LIMIT);
|
||||
|
@ -1178,6 +1176,9 @@ SNode* createDefaultDatabaseOptions(SAstCreateContext* pCxt) {
|
|||
pOptions->sstTrigger = TSDB_DEFAULT_SST_TRIGGER;
|
||||
pOptions->tablePrefix = TSDB_DEFAULT_HASH_PREFIX;
|
||||
pOptions->tableSuffix = TSDB_DEFAULT_HASH_SUFFIX;
|
||||
pOptions->s3ChunkSize = TSDB_DEFAULT_S3_CHUNK_SIZE;
|
||||
pOptions->s3KeepLocal = TSDB_DEFAULT_S3_KEEP_LOCAL;
|
||||
pOptions->s3Compact = TSDB_DEFAULT_S3_COMPACT;
|
||||
return (SNode*)pOptions;
|
||||
}
|
||||
|
||||
|
@ -1213,6 +1214,9 @@ SNode* createAlterDatabaseOptions(SAstCreateContext* pCxt) {
|
|||
pOptions->sstTrigger = -1;
|
||||
pOptions->tablePrefix = -1;
|
||||
pOptions->tableSuffix = -1;
|
||||
pOptions->s3ChunkSize = -1;
|
||||
pOptions->s3KeepLocal = -1;
|
||||
pOptions->s3Compact = -1;
|
||||
return (SNode*)pOptions;
|
||||
}
|
||||
|
||||
|
@ -1327,6 +1331,21 @@ static SNode* setDatabaseOptionImpl(SAstCreateContext* pCxt, SNode* pOptions, ED
|
|||
nodesDestroyNode((SNode*)pNode);
|
||||
break;
|
||||
}
|
||||
case DB_OPTION_S3_CHUNKSIZE:
|
||||
pDbOptions->s3ChunkSize = taosStr2Int32(((SToken*)pVal)->z, NULL, 10);
|
||||
break;
|
||||
case DB_OPTION_S3_KEEPLOCAL: {
|
||||
SToken* pToken = pVal;
|
||||
if (TK_NK_INTEGER == pToken->type) {
|
||||
pDbOptions->s3KeepLocal = taosStr2Int32(pToken->z, NULL, 10) * 1440;
|
||||
} else {
|
||||
pDbOptions->s3KeepLocalStr = (SValueNode*)createDurationValueNode(pCxt, pToken);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DB_OPTION_S3_COMPACT:
|
||||
pDbOptions->s3Compact = taosStr2Int8(((SToken*)pVal)->z, NULL, 10);
|
||||
break;
|
||||
case DB_OPTION_KEEP_TIME_OFFSET: {
|
||||
pDbOptions->keepTimeOffset = taosStr2Int32(((SToken*)pVal)->z, NULL, 10);
|
||||
break;
|
||||
|
@ -1413,6 +1432,17 @@ SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, int32_t
|
|||
return (SNode*)pStmt;
|
||||
}
|
||||
|
||||
SNode* createS3MigrateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName) {
|
||||
CHECK_PARSER_STATUS(pCxt);
|
||||
if (!checkDbName(pCxt, pDbName, false)) {
|
||||
return NULL;
|
||||
}
|
||||
SS3MigrateDatabaseStmt* pStmt = (SS3MigrateDatabaseStmt*)nodesMakeNode(QUERY_NODE_S3MIGRATE_DATABASE_STMT);
|
||||
CHECK_OUT_OF_MEM(pStmt);
|
||||
COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName);
|
||||
return (SNode*)pStmt;
|
||||
}
|
||||
|
||||
SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pStart, SNode* pEnd) {
|
||||
CHECK_PARSER_STATUS(pCxt);
|
||||
if (!checkDbName(pCxt, pDbName, false)) {
|
||||
|
@ -1719,7 +1749,8 @@ SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pD
|
|||
return (SNode*)pStmt;
|
||||
}
|
||||
|
||||
SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, SNode* pTbName, EOperatorType tableCondType) {
|
||||
SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, SNode* pTbName,
|
||||
EOperatorType tableCondType) {
|
||||
CHECK_PARSER_STATUS(pCxt);
|
||||
SNode* pDbName = NULL;
|
||||
if (option.dbName.type == TK_NK_NIL) {
|
||||
|
@ -1795,7 +1826,6 @@ SNode* createShowCreateViewStmt(SAstCreateContext* pCxt, ENodeType type, SNode*
|
|||
return (SNode*)pStmt;
|
||||
}
|
||||
|
||||
|
||||
SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable) {
|
||||
CHECK_PARSER_STATUS(pCxt);
|
||||
SShowTableDistributedStmt* pStmt = (SShowTableDistributedStmt*)nodesMakeNode(QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT);
|
||||
|
|
|
@ -302,6 +302,10 @@ static SKeyword keywordTable[] = {
|
|||
{"_WSTART", TK_WSTART},
|
||||
{"ALIVE", TK_ALIVE},
|
||||
{"VARBINARY", TK_VARBINARY},
|
||||
{"S3_CHUNKSIZE", TK_S3_CHUNKSIZE},
|
||||
{"S3_KEEPLOCAL", TK_S3_KEEPLOCAL},
|
||||
{"S3_COMPACT", TK_S3_COMPACT},
|
||||
{"S3MIGRATE", TK_S3MIGRATE},
|
||||
{"KEEP_TIME_OFFSET", TK_KEEP_TIME_OFFSET},
|
||||
};
|
||||
// clang-format on
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue