Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
27c481c8
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
27c481c8
编写于
5月 07, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225]
上级
c455c698
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
36 deletion
+19
-36
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-1
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+11
-11
src/client/src/tscServer.c
src/client/src/tscServer.c
+0
-19
src/client/src/tscSub.c
src/client/src/tscSub.c
+1
-1
src/query/src/queryExecutor.c
src/query/src/queryExecutor.c
+6
-4
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
27c481c8
...
...
@@ -195,7 +195,7 @@ typedef struct SDataBlockList { // todo remove
typedef
struct
SQueryInfo
{
int16_t
command
;
// the command may be different for each subclause, so keep it seperately.
uint
16
_t
type
;
// query/insert/import type
uint
32
_t
type
;
// query/insert/import type
char
slidingTimeUnit
;
STimeWindow
window
;
...
...
src/client/src/tscSQLParser.c
浏览文件 @
27c481c8
...
...
@@ -1117,7 +1117,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel
// if the name of column is quoted, remove it and set the right information for later process
extractColumnNameFromString
(
pItem
);
pQueryInfo
->
type
|=
TSDB_QUERY_TYPE_PROJECTION_QUERY
;
TSDB_QUERY_SET_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_PROJECTION_QUERY
)
;
// select table_name1.field_name1, table_name2.field_name2 from table_name1, table_name2
if
(
addProjectionExprAndResultField
(
pQueryInfo
,
pItem
)
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -1238,7 +1238,6 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel
}
if
(
isSTable
)
{
pQueryInfo
->
type
|=
TSDB_QUERY_TYPE_STABLE_QUERY
;
/*
* transfer sql functions that need secondary merge into another format
* in dealing with metric queries such as: count/first/last
...
...
@@ -1289,10 +1288,8 @@ SSqlExpr* doAddProjectCol(SQueryInfo* pQueryInfo, int32_t outputIndex, int32_t c
index
.
columnIndex
=
colIndex
-
tscGetNumOfColumns
(
pTableMeta
);
tscColumnListInsert
(
pTableMetaInfo
->
tagColList
,
&
index
);
pQueryInfo
->
type
=
TSDB_QUERY_TYPE_STABLE_QUERY
;
}
else
{
index
.
columnIndex
=
colIndex
;
pQueryInfo
->
type
|=
TSDB_QUERY_TYPE_PROJECTION_QUERY
;
}
return
tscSqlExprAppend
(
pQueryInfo
,
functionId
,
&
index
,
pSchema
->
type
,
pSchema
->
bytes
,
...
...
@@ -1377,7 +1374,7 @@ static int32_t doAddProjectionExprAndResultFields(SQueryInfo* pQueryInfo, SColum
int32_t
addProjectionExprAndResultField
(
SQueryInfo
*
pQueryInfo
,
tSQLExprItem
*
pItem
)
{
const
char
*
msg0
=
"invalid column name"
;
const
char
*
msg1
=
"tag for table query is not allowed"
;
const
char
*
msg1
=
"tag for
normal
table query is not allowed"
;
int32_t
startPos
=
tscSqlExprNumOfExprs
(
pQueryInfo
);
...
...
@@ -1414,7 +1411,7 @@ int32_t addProjectionExprAndResultField(SQueryInfo* pQueryInfo, tSQLExprItem* pI
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
index
.
tableIndex
);
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
if
(
index
.
columnIndex
>=
tscGetNumOfColumns
(
pTableMeta
)
&&
UTIL_TABLE_IS_NOMRAL
_TABLE
(
pTableMetaInfo
))
{
if
(
index
.
columnIndex
>=
tscGetNumOfColumns
(
pTableMeta
)
&&
!
UTIL_TABLE_IS_CHILD
_TABLE
(
pTableMetaInfo
))
{
return
invalidSqlErrMsg
(
pQueryInfo
->
msg
,
msg1
);
}
...
...
@@ -5716,12 +5713,16 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) {
}
assert
(
pQueryInfo
->
numOfTables
==
pQuerySql
->
from
->
nExpr
);
bool
isSTable
=
false
;
if
(
UTIL_TABLE_IS_SUPERTABLE
(
pTableMetaInfo
))
{
code
=
tscGetSTableVgroupInfo
(
pSql
,
index
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
isSTable
=
true
;
code
=
tscGetSTableVgroupInfo
(
pSql
,
index
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
TSDB_QUERY_SET_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_STABLE_QUERY
);
}
else
{
TSDB_QUERY_SET_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_TABLE_QUERY
);
}
...
...
@@ -5731,7 +5732,6 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) {
return
TSDB_CODE_INVALID_SQL
;
}
bool
isSTable
=
UTIL_TABLE_IS_SUPERTABLE
(
pTableMetaInfo
);
if
(
parseSelectClause
(
pCmd
,
index
,
pQuerySql
->
pSelection
,
isSTable
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_INVALID_SQL
;
}
...
...
src/client/src/tscServer.c
浏览文件 @
27c481c8
...
...
@@ -439,25 +439,6 @@ int tscProcessSql(SSqlObj *pSql) {
}
else
{
// local handler
return
(
*
tscProcessMsgRsp
[
pCmd
->
command
])(
pSql
);
}
// if (QUERY_IS_JOIN_QUERY(type)) {
// if ((pQueryInfo->type & TSDB_QUERY_TYPE_SUBQUERY) == 0) {
// return tscHandleMasterJoinQuery(pSql);
// } else {
// // for first stage sub query, iterate all vnodes to get all timestamp
// if ((pQueryInfo->type & TSDB_QUERY_TYPE_JOIN_SEC_STAGE) != TSDB_QUERY_TYPE_JOIN_SEC_STAGE) {
// return doProcessSql(pSql);
// }
// }
// }
//
// if (tscIsTwoStageSTableQuery(pQueryInfo, 0)) { // super table query
// tscHandleMasterSTableQuery(pSql);
// return pRes->code;
// } else if (pSql->fp == (void(*)())tscHandleMultivnodeInsert) { // multi-vnodes insertion
// tscHandleMultivnodeInsert(pSql);
// return pRes->code;
// }
return
doProcessSql
(
pSql
);
}
...
...
src/client/src/tscSub.c
浏览文件 @
27c481c8
...
...
@@ -374,7 +374,7 @@ TAOS_RES *taos_consume(TAOS_SUB *tsub) {
}
else
{
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
uint
16
_t
type
=
pQueryInfo
->
type
;
uint
32
_t
type
=
pQueryInfo
->
type
;
taos_free_result_imp
(
pSql
,
1
);
pRes
->
numOfRows
=
1
;
pRes
->
numOfTotal
=
0
;
...
...
src/query/src/queryExecutor.c
浏览文件 @
27c481c8
...
...
@@ -4233,10 +4233,12 @@ int32_t doInitQInfo(SQInfo *pQInfo, void *param, void *tsdb, int32_t vgId, bool
// normal query setup the queryhandle here
if
(
isFirstLastRowQuery
(
pQuery
)
&&
!
isSTableQuery
)
{
// in case of last_row query, invoke a different API.
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryLastRow
(
tsdb
,
&
cond
,
&
pQInfo
->
tableIdGroupInfo
);
}
else
if
(
!
isSTableQuery
||
isIntervalQuery
(
pQuery
)
||
isFixedOutputQuery
(
pQuery
))
{
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryTables
(
tsdb
,
&
cond
,
&
pQInfo
->
tableIdGroupInfo
);
if
(
!
onlyQueryTags
(
pQuery
))
{
if
(
!
isSTableQuery
&&
isFirstLastRowQuery
(
pQuery
))
{
// in case of last_row query, invoke a different API.
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryLastRow
(
tsdb
,
&
cond
,
&
pQInfo
->
tableIdGroupInfo
);
}
else
if
(
!
isSTableQuery
||
isIntervalQuery
(
pQuery
)
||
isFixedOutputQuery
(
pQuery
))
{
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryTables
(
tsdb
,
&
cond
,
&
pQInfo
->
tableIdGroupInfo
);
}
}
pQInfo
->
tsdb
=
tsdb
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录