Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a209bb9b
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a209bb9b
编写于
11月 02, 2021
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix user-specified constant value selection with join query
上级
89fb2c1e
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
12 addition
and
13 deletion
+12
-13
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+1
-3
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+5
-5
src/query/inc/qAggMain.h
src/query/inc/qAggMain.h
+1
-0
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+1
-2
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+4
-3
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
a209bb9b
...
...
@@ -2254,9 +2254,7 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
SExprInfo
*
pExpr
=
tscAddFuncInSelectClause
(
pQueryInfo
,
startPos
,
TSDB_FUNC_PRJ
,
&
index
,
&
colSchema
,
TSDB_COL_UDC
,
getNewResColId
(
pCmd
));
// NOTE: the first parameter is reserved for the tag column id during join query process.
pExpr
->
base
.
numOfParams
=
2
;
tVariantAssign
(
&
pExpr
->
base
.
param
[
1
],
&
pItem
->
pNode
->
value
);
tVariantAssign
(
&
pExpr
->
base
.
param
[
pExpr
->
base
.
numOfParams
++
],
&
pItem
->
pNode
->
value
);
}
else
if
(
tokenId
==
TK_ID
||
tokenId
==
TK_ARROW
)
{
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
...
...
src/client/src/tscUtil.c
浏览文件 @
a209bb9b
...
...
@@ -664,22 +664,22 @@ int32_t tscCreateResPointerInfo(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
static
void
setResRawPtrImpl
(
SSqlRes
*
pRes
,
SInternalField
*
pInfo
,
int32_t
i
,
bool
convertNchar
)
{
// generated the user-defined column result
if
(
pInfo
->
pExpr
->
pExpr
==
NULL
&&
TSDB_COL_IS_UD_COL
(
pInfo
->
pExpr
->
base
.
colInfo
.
flag
))
{
if
(
pInfo
->
pExpr
->
base
.
param
[
1
].
nType
==
TSDB_DATA_TYPE_NULL
)
{
if
(
pInfo
->
pExpr
->
base
.
param
[
0
].
nType
==
TSDB_DATA_TYPE_NULL
)
{
setNullN
(
pRes
->
urow
[
i
],
pInfo
->
field
.
type
,
pInfo
->
field
.
bytes
,
(
int32_t
)
pRes
->
numOfRows
);
}
else
{
if
(
pInfo
->
field
.
type
==
TSDB_DATA_TYPE_NCHAR
||
pInfo
->
field
.
type
==
TSDB_DATA_TYPE_BINARY
)
{
assert
(
pInfo
->
pExpr
->
base
.
param
[
1
].
nLen
<=
pInfo
->
field
.
bytes
);
assert
(
pInfo
->
pExpr
->
base
.
param
[
0
].
nLen
<=
pInfo
->
field
.
bytes
);
for
(
int32_t
k
=
0
;
k
<
pRes
->
numOfRows
;
++
k
)
{
char
*
p
=
((
char
**
)
pRes
->
urow
)[
i
]
+
k
*
pInfo
->
field
.
bytes
;
memcpy
(
varDataVal
(
p
),
pInfo
->
pExpr
->
base
.
param
[
1
].
pz
,
pInfo
->
pExpr
->
base
.
param
[
1
].
nLen
);
varDataSetLen
(
p
,
pInfo
->
pExpr
->
base
.
param
[
1
].
nLen
);
memcpy
(
varDataVal
(
p
),
pInfo
->
pExpr
->
base
.
param
[
0
].
pz
,
pInfo
->
pExpr
->
base
.
param
[
0
].
nLen
);
varDataSetLen
(
p
,
pInfo
->
pExpr
->
base
.
param
[
0
].
nLen
);
}
}
else
{
for
(
int32_t
k
=
0
;
k
<
pRes
->
numOfRows
;
++
k
)
{
char
*
p
=
((
char
**
)
pRes
->
urow
)[
i
]
+
k
*
pInfo
->
field
.
bytes
;
memcpy
(
p
,
&
pInfo
->
pExpr
->
base
.
param
[
1
].
i64
,
pInfo
->
field
.
bytes
);
memcpy
(
p
,
&
pInfo
->
pExpr
->
base
.
param
[
0
].
i64
,
pInfo
->
field
.
bytes
);
}
}
}
...
...
src/query/inc/qAggMain.h
浏览文件 @
a209bb9b
...
...
@@ -172,6 +172,7 @@ typedef struct SQLFunctionCtx {
uint32_t
order
;
// asc|desc
int16_t
inputType
;
int16_t
inputBytes
;
int16_t
colId
;
// used for user-specified constant value
int16_t
outputType
;
int16_t
outputBytes
;
// size of results, determined by function and input column data type
...
...
src/query/src/qAggMain.c
浏览文件 @
a209bb9b
...
...
@@ -2706,8 +2706,7 @@ static void date_col_output_function(SQLFunctionCtx *pCtx) {
}
static
void
col_project_function
(
SQLFunctionCtx
*
pCtx
)
{
// the number of output rows should not affect the final number of rows, so set it to be 0
if
(
pCtx
->
numOfParams
==
2
)
{
if
(
pCtx
->
colId
<=
TSDB_UD_COLUMN_INDEX
)
{
// user-specified constant value
return
;
}
...
...
src/query/src/qExecutor.c
浏览文件 @
a209bb9b
...
...
@@ -1278,7 +1278,7 @@ static void doSetInputDataBlock(SOperatorInfo* pOperator, SQLFunctionCtx* pCtx,
assert
(
p
->
info
.
colId
==
pColIndex
->
colId
&&
pCtx
[
i
].
inputType
==
p
->
info
.
type
);
for
(
int32_t
j
=
0
;
j
<
pBlock
->
info
.
rows
;
++
j
)
{
char
*
dst
=
p
->
pData
+
j
*
p
->
info
.
bytes
;
tVariantDump
(
&
pOperator
->
pExpr
[
i
].
base
.
param
[
1
],
dst
,
p
->
info
.
type
,
true
);
tVariantDump
(
&
pOperator
->
pExpr
[
i
].
base
.
param
[
0
],
dst
,
p
->
info
.
type
,
true
);
}
}
}
...
...
@@ -2042,6 +2042,7 @@ static SQLFunctionCtx* createSQLFunctionCtx(SQueryRuntimeEnv* pRuntimeEnv, SExpr
pCtx
->
ptsOutputBuf
=
NULL
;
pCtx
->
colId
=
pIndex
->
colId
;
pCtx
->
outputBytes
=
pSqlExpr
->
resBytes
;
pCtx
->
outputType
=
pSqlExpr
->
resType
;
...
...
@@ -4062,7 +4063,7 @@ int32_t setTimestampListJoinInfo(SQueryRuntimeEnv* pRuntimeEnv, tVariant* pTag,
// Keep the cursor info of current table
pTableQueryInfo
->
cur
=
tsBufGetCursor
(
pRuntimeEnv
->
pTsBuf
);
if
(
pTag
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pTag
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pTag
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pTag
->
nType
==
TSDB_DATA_TYPE_NCHAR
||
pTag
->
nType
==
TSDB_DATA_TYPE_JSON
)
{
qDebug
(
"QInfo:0x%"
PRIx64
" find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d"
,
GET_QID
(
pRuntimeEnv
),
pTag
->
pz
,
pTableQueryInfo
->
cur
.
blockIndex
,
pTableQueryInfo
->
cur
.
tsIndex
);
}
else
{
qDebug
(
"QInfo:0x%"
PRIx64
" find tag:%"
PRId64
" start pos in ts_comp, blockIndex:%d, tsIndex:%d"
,
GET_QID
(
pRuntimeEnv
),
pTag
->
i64
,
pTableQueryInfo
->
cur
.
blockIndex
,
pTableQueryInfo
->
cur
.
tsIndex
);
...
...
@@ -4070,7 +4071,7 @@ int32_t setTimestampListJoinInfo(SQueryRuntimeEnv* pRuntimeEnv, tVariant* pTag,
}
else
{
tsBufSetCursor
(
pRuntimeEnv
->
pTsBuf
,
&
pTableQueryInfo
->
cur
);
if
(
pTag
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pTag
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pTag
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pTag
->
nType
==
TSDB_DATA_TYPE_NCHAR
||
pTag
->
nType
==
TSDB_DATA_TYPE_JSON
)
{
qDebug
(
"QInfo:0x%"
PRIx64
" find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d"
,
GET_QID
(
pRuntimeEnv
),
pTag
->
pz
,
pTableQueryInfo
->
cur
.
blockIndex
,
pTableQueryInfo
->
cur
.
tsIndex
);
}
else
{
qDebug
(
"QInfo:0x%"
PRIx64
" find tag:%"
PRId64
" start pos in ts_comp, blockIndex:%d, tsIndex:%d"
,
GET_QID
(
pRuntimeEnv
),
pTag
->
i64
,
pTableQueryInfo
->
cur
.
blockIndex
,
pTableQueryInfo
->
cur
.
tsIndex
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录