Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f3d790c0
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f3d790c0
编写于
11月 28, 2022
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' into fix/TD-20673
上级
99604f80
1f77b78d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
1401 addition
and
1439 deletion
+1401
-1439
source/libs/command/src/command.c
source/libs/command/src/command.c
+15
-9
source/libs/executor/src/tfill.c
source/libs/executor/src/tfill.c
+29
-10
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+1
-1
source/libs/parser/src/parCalcConst.c
source/libs/parser/src/parCalcConst.c
+30
-2
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+1326
-1417
未找到文件。
source/libs/command/src/command.c
浏览文件 @
f3d790c0
...
@@ -270,10 +270,10 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S
...
@@ -270,10 +270,10 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S
"CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %dm "
"CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %dm "
"WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
"WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
"STRICT '%s' WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d"
,
"STRICT '%s' WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d"
,
dbFName
,
pCfg
->
buffer
,
pCfg
->
cacheSize
,
cacheModelStr
(
pCfg
->
cacheLast
),
pCfg
->
compression
,
pCfg
->
daysPerFile
,
pCfg
->
walFsyncPeriod
,
dbFName
,
pCfg
->
buffer
,
pCfg
->
cacheSize
,
cacheModelStr
(
pCfg
->
cacheLast
),
pCfg
->
compression
,
pCfg
->
daysPerFile
,
pCfg
->
maxRows
,
pCfg
->
minRows
,
pCfg
->
daysToKeep0
,
pCfg
->
daysToKeep1
,
pCfg
->
daysToKeep2
,
pCfg
->
pages
,
pCfg
->
walFsyncPeriod
,
pCfg
->
maxRows
,
pCfg
->
minRows
,
pCfg
->
daysToKeep0
,
pCfg
->
daysToKeep1
,
pCfg
->
daysToKeep2
,
pCfg
->
page
Size
,
prec
,
pCfg
->
replications
,
strictStr
(
pCfg
->
strict
),
pCfg
->
walLevel
,
pCfg
->
numOfVgroups
,
pCfg
->
page
s
,
pCfg
->
pageSize
,
prec
,
pCfg
->
replications
,
strictStr
(
pCfg
->
strict
),
pCfg
->
walLevel
,
1
==
pCfg
->
numOfStables
);
pCfg
->
numOfVgroups
,
1
==
pCfg
->
numOfStables
);
if
(
retentions
)
{
if
(
retentions
)
{
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
+
len
,
" RETENTIONS %s"
,
retentions
);
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
+
len
,
" RETENTIONS %s"
,
retentions
);
...
@@ -500,8 +500,8 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p
...
@@ -500,8 +500,8 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
terrno
;
return
terrno
;
}
}
int32_t
len
=
0
;
int32_t
len
=
0
;
if
(
TSDB_SUPER_TABLE
==
pCfg
->
tableType
)
{
if
(
TSDB_SUPER_TABLE
==
pCfg
->
tableType
)
{
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
,
"CREATE STABLE `%s` ("
,
tbName
);
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
,
"CREATE STABLE `%s` ("
,
tbName
);
...
@@ -533,7 +533,7 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p
...
@@ -533,7 +533,7 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p
colDataAppend
(
pCol2
,
0
,
buf2
,
false
);
colDataAppend
(
pCol2
,
0
,
buf2
,
false
);
taosMemoryFree
(
buf2
);
taosMemoryFree
(
buf2
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -691,9 +691,15 @@ static int32_t createSelectResultDataBlock(SNodeList* pProjects, SSDataBlock** p
...
@@ -691,9 +691,15 @@ static int32_t createSelectResultDataBlock(SNodeList* pProjects, SSDataBlock** p
SNode
*
pProj
=
NULL
;
SNode
*
pProj
=
NULL
;
FOREACH
(
pProj
,
pProjects
)
{
FOREACH
(
pProj
,
pProjects
)
{
SExprNode
*
pExpr
=
(
SExprNode
*
)
pProj
;
SColumnInfoData
infoData
=
{
0
};
SColumnInfoData
infoData
=
{
0
};
infoData
.
info
.
type
=
((
SExprNode
*
)
pProj
)
->
resType
.
type
;
if
(
TSDB_DATA_TYPE_NULL
==
pExpr
->
resType
.
type
)
{
infoData
.
info
.
bytes
=
((
SExprNode
*
)
pProj
)
->
resType
.
bytes
;
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
0
;
}
else
{
infoData
.
info
.
type
=
pExpr
->
resType
.
type
;
infoData
.
info
.
bytes
=
pExpr
->
resType
.
bytes
;
}
blockDataAppendColInfo
(
pBlock
,
&
infoData
);
blockDataAppendColInfo
(
pBlock
,
&
infoData
);
}
}
*
pOutput
=
pBlock
;
*
pOutput
=
pBlock
;
...
...
source/libs/executor/src/tfill.c
浏览文件 @
f3d790c0
...
@@ -1282,7 +1282,9 @@ static void doStreamFillImpl(SOperatorInfo* pOperator) {
...
@@ -1282,7 +1282,9 @@ static void doStreamFillImpl(SOperatorInfo* pOperator) {
blockDataCleanup
(
pInfo
->
pSrcBlock
);
blockDataCleanup
(
pInfo
->
pSrcBlock
);
}
}
static
void
buildDeleteRange
(
TSKEY
start
,
TSKEY
end
,
uint64_t
groupId
,
SSDataBlock
*
delRes
)
{
static
void
buildDeleteRange
(
SOperatorInfo
*
pOp
,
TSKEY
start
,
TSKEY
end
,
uint64_t
groupId
,
SSDataBlock
*
delRes
)
{
SStreamState
*
pState
=
pOp
->
pTaskInfo
->
streamInfo
.
pState
;
SSDataBlock
*
pBlock
=
delRes
;
SSDataBlock
*
pBlock
=
delRes
;
SColumnInfoData
*
pStartCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pStartCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pEndCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
END_TS_COLUMN_INDEX
);
SColumnInfoData
*
pEndCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
END_TS_COLUMN_INDEX
);
...
@@ -1290,25 +1292,42 @@ static void buildDeleteRange(TSKEY start, TSKEY end, uint64_t groupId, SSDataBlo
...
@@ -1290,25 +1292,42 @@ static void buildDeleteRange(TSKEY start, TSKEY end, uint64_t groupId, SSDataBlo
SColumnInfoData
*
pGroupCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
GROUPID_COLUMN_INDEX
);
SColumnInfoData
*
pGroupCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
GROUPID_COLUMN_INDEX
);
SColumnInfoData
*
pCalStartCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
CALCULATE_START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pCalStartCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
CALCULATE_START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pCalEndCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
CALCULATE_END_TS_COLUMN_INDEX
);
SColumnInfoData
*
pCalEndCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
CALCULATE_END_TS_COLUMN_INDEX
);
SColumnInfoData
*
pTbNameCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
TABLE_NAME_COLUMN_INDEX
);
colDataAppend
(
pStartCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
&
start
,
false
);
colDataAppend
(
pStartCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
&
start
,
false
);
colDataAppend
(
pEndCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
&
end
,
false
);
colDataAppend
(
pEndCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
&
end
,
false
);
colDataAppendNULL
(
pUidCol
,
pBlock
->
info
.
rows
);
colDataAppendNULL
(
pUidCol
,
pBlock
->
info
.
rows
);
colDataAppend
(
pGroupCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
&
groupId
,
false
);
colDataAppend
(
pGroupCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
&
groupId
,
false
);
colDataAppendNULL
(
pCalStartCol
,
pBlock
->
info
.
rows
);
colDataAppendNULL
(
pCalStartCol
,
pBlock
->
info
.
rows
);
colDataAppendNULL
(
pCalEndCol
,
pBlock
->
info
.
rows
);
colDataAppendNULL
(
pCalEndCol
,
pBlock
->
info
.
rows
);
SColumnInfoData
*
pTableCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
TABLE_NAME_COLUMN_INDEX
);
void
*
tbname
=
NULL
;
streamStateGetParName
(
pOp
->
pTaskInfo
->
streamInfo
.
pState
,
groupId
,
&
tbname
);
if
(
tbname
==
NULL
)
{
colDataAppendNULL
(
pTableCol
,
pBlock
->
info
.
rows
);
}
else
{
char
parTbName
[
VARSTR_HEADER_SIZE
+
TSDB_TABLE_NAME_LEN
];
STR_WITH_MAXSIZE_TO_VARSTR
(
parTbName
,
tbname
,
sizeof
(
parTbName
));
colDataAppend
(
pTableCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
parTbName
,
false
);
}
tdbFree
(
tbname
);
pBlock
->
info
.
rows
++
;
pBlock
->
info
.
rows
++
;
}
}
static
void
buildDeleteResult
(
S
StreamFillSupporter
*
pFillSup
,
TSKEY
startTs
,
TSKEY
endTs
,
uint64_t
groupId
,
static
void
buildDeleteResult
(
S
OperatorInfo
*
pOperator
,
TSKEY
startTs
,
TSKEY
endTs
,
uint64_t
groupId
,
SSDataBlock
*
delRes
)
{
SSDataBlock
*
delRes
)
{
SStreamFillOperatorInfo
*
pInfo
=
pOperator
->
info
;
SStreamFillSupporter
*
pFillSup
=
pInfo
->
pFillSup
;
if
(
hasPrevWindow
(
pFillSup
))
{
if
(
hasPrevWindow
(
pFillSup
))
{
TSKEY
start
=
getNextWindowTs
(
pFillSup
->
prev
.
key
,
&
pFillSup
->
interval
);
TSKEY
start
=
getNextWindowTs
(
pFillSup
->
prev
.
key
,
&
pFillSup
->
interval
);
buildDeleteRange
(
start
,
endTs
,
groupId
,
delRes
);
buildDeleteRange
(
pOperator
,
start
,
endTs
,
groupId
,
delRes
);
}
else
if
(
hasNextWindow
(
pFillSup
))
{
}
else
if
(
hasNextWindow
(
pFillSup
))
{
TSKEY
end
=
getPrevWindowTs
(
pFillSup
->
next
.
key
,
&
pFillSup
->
interval
);
TSKEY
end
=
getPrevWindowTs
(
pFillSup
->
next
.
key
,
&
pFillSup
->
interval
);
buildDeleteRange
(
startTs
,
end
,
groupId
,
delRes
);
buildDeleteRange
(
pOperator
,
startTs
,
end
,
groupId
,
delRes
);
}
else
{
}
else
{
buildDeleteRange
(
startTs
,
endTs
,
groupId
,
delRes
);
buildDeleteRange
(
pOperator
,
startTs
,
endTs
,
groupId
,
delRes
);
}
}
}
}
...
@@ -1319,7 +1338,7 @@ static void doDeleteFillResultImpl(SOperatorInfo* pOperator, TSKEY startTs, TSKE
...
@@ -1319,7 +1338,7 @@ static void doDeleteFillResultImpl(SOperatorInfo* pOperator, TSKEY startTs, TSKE
SWinKey
key
=
{.
ts
=
startTs
,
.
groupId
=
groupId
};
SWinKey
key
=
{.
ts
=
startTs
,
.
groupId
=
groupId
};
if
(
!
pInfo
->
pFillInfo
->
needFill
)
{
if
(
!
pInfo
->
pFillInfo
->
needFill
)
{
streamStateFillDel
(
pOperator
->
pTaskInfo
->
streamInfo
.
pState
,
&
key
);
streamStateFillDel
(
pOperator
->
pTaskInfo
->
streamInfo
.
pState
,
&
key
);
buildDeleteResult
(
p
Info
->
pFillSup
,
startTs
,
endTs
,
groupId
,
pInfo
->
pDelRes
);
buildDeleteResult
(
p
Operator
,
startTs
,
endTs
,
groupId
,
pInfo
->
pDelRes
);
}
else
{
}
else
{
STimeRange
tw
=
{
STimeRange
tw
=
{
.
skey
=
startTs
,
.
skey
=
startTs
,
...
@@ -1578,7 +1597,7 @@ static SStreamFillSupporter* initStreamFillSup(SStreamFillPhysiNode* pPhyFillNod
...
@@ -1578,7 +1597,7 @@ static SStreamFillSupporter* initStreamFillSup(SStreamFillPhysiNode* pPhyFillNod
destroyStreamFillSupporter
(
pFillSup
);
destroyStreamFillSupporter
(
pFillSup
);
return
NULL
;
return
NULL
;
}
}
SExprInfo
*
noFillExpr
=
createExprInfo
(
pPhyFillNode
->
pNotFillExprs
,
NULL
,
&
numOfNotFillCols
);
SExprInfo
*
noFillExpr
=
createExprInfo
(
pPhyFillNode
->
pNotFillExprs
,
NULL
,
&
numOfNotFillCols
);
code
=
initExprSupp
(
&
pFillSup
->
notFillExprSup
,
noFillExpr
,
numOfNotFillCols
);
code
=
initExprSupp
(
&
pFillSup
->
notFillExprSup
,
noFillExpr
,
numOfNotFillCols
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -1715,9 +1734,9 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi
...
@@ -1715,9 +1734,9 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi
}
}
pInfo
->
srcRowIndex
=
0
;
pInfo
->
srcRowIndex
=
0
;
setOperatorInfo
(
pOperator
,
"StreamFillOperator"
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL
,
false
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
setOperatorInfo
(
pOperator
,
"StreamFillOperator"
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL
,
false
,
OP_NOT_OPENED
,
pInfo
,
pOperator
->
fpSet
=
pTaskInfo
);
createOperatorFpSet
(
operatorDummyOpenFn
,
doStreamFill
,
NULL
,
destroyStreamFillOperatorInfo
,
NULL
);
pOperator
->
fpSet
=
createOperatorFpSet
(
operatorDummyOpenFn
,
doStreamFill
,
NULL
,
destroyStreamFillOperatorInfo
,
NULL
);
code
=
appendDownstream
(
pOperator
,
&
downstream
,
1
);
code
=
appendDownstream
(
pOperator
,
&
downstream
,
1
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
source/libs/parser/inc/sql.y
浏览文件 @
f3d790c0
...
@@ -654,7 +654,7 @@ cgroup_name(A) ::= NK_ID(B).
...
@@ -654,7 +654,7 @@ cgroup_name(A) ::= NK_ID(B).
/************************************************ expression **********************************************************/
/************************************************ expression **********************************************************/
expr_or_subquery(A) ::= expression(B). { A = B; }
expr_or_subquery(A) ::= expression(B). { A = B; }
expr_or_subquery(A) ::= subquery(B). { A = B
; }
//expr_or_subquery(A) ::= subquery(B). { A = createTempTableNode(pCxt, releaseRawExprNode(pCxt, B), NULL)
; }
expression(A) ::= literal(B). { A = B; }
expression(A) ::= literal(B). { A = B; }
expression(A) ::= pseudo_column(B). { A = B; }
expression(A) ::= pseudo_column(B). { A = B; }
...
...
source/libs/parser/src/parCalcConst.c
浏览文件 @
f3d790c0
...
@@ -372,14 +372,42 @@ static bool isEmptyResultQuery(SNode* pStmt) {
...
@@ -372,14 +372,42 @@ static bool isEmptyResultQuery(SNode* pStmt) {
return
isEmptyResult
;
return
isEmptyResult
;
}
}
static
void
resetProjectNullTypeImpl
(
SNodeList
*
pProjects
)
{
SNode
*
pProj
=
NULL
;
FOREACH
(
pProj
,
pProjects
)
{
SExprNode
*
pExpr
=
(
SExprNode
*
)
pProj
;
if
(
TSDB_DATA_TYPE_NULL
==
pExpr
->
resType
.
type
)
{
pExpr
->
resType
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
pExpr
->
resType
.
bytes
=
0
;
}
}
}
static
void
resetProjectNullType
(
SNode
*
pStmt
)
{
switch
(
nodeType
(
pStmt
))
{
case
QUERY_NODE_SELECT_STMT
:
resetProjectNullTypeImpl
(((
SSelectStmt
*
)
pStmt
)
->
pProjectionList
);
break
;
case
QUERY_NODE_SET_OPERATOR
:
{
resetProjectNullTypeImpl
(((
SSetOperator
*
)
pStmt
)
->
pProjectionList
);
break
;
}
default:
break
;
}
}
int32_t
calculateConstant
(
SParseContext
*
pParseCxt
,
SQuery
*
pQuery
)
{
int32_t
calculateConstant
(
SParseContext
*
pParseCxt
,
SQuery
*
pQuery
)
{
SCalcConstContext
cxt
=
{.
pParseCxt
=
pParseCxt
,
SCalcConstContext
cxt
=
{.
pParseCxt
=
pParseCxt
,
.
msgBuf
.
buf
=
pParseCxt
->
pMsg
,
.
msgBuf
.
buf
=
pParseCxt
->
pMsg
,
.
msgBuf
.
len
=
pParseCxt
->
msgLen
,
.
msgBuf
.
len
=
pParseCxt
->
msgLen
,
.
code
=
TSDB_CODE_SUCCESS
};
.
code
=
TSDB_CODE_SUCCESS
};
int32_t
code
=
calcConstQuery
(
&
cxt
,
pQuery
->
pRoot
,
false
);
int32_t
code
=
calcConstQuery
(
&
cxt
,
pQuery
->
pRoot
,
false
);
if
(
TSDB_CODE_SUCCESS
==
code
&&
isEmptyResultQuery
(
pQuery
->
pRoot
))
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
pQuery
->
execMode
=
QUERY_EXEC_MODE_EMPTY_RESULT
;
resetProjectNullType
(
pQuery
->
pRoot
);
if
(
isEmptyResultQuery
(
pQuery
->
pRoot
))
{
pQuery
->
execMode
=
QUERY_EXEC_MODE_EMPTY_RESULT
;
}
}
}
return
code
;
return
code
;
}
}
source/libs/parser/src/sql.c
浏览文件 @
f3d790c0
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录