Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c6d23aa8
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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,发现更多精彩内容 >>
提交
c6d23aa8
编写于
10月 06, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-10529]
上级
a00f4d67
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
216 addition
and
1 deletion
+216
-1
include/libs/transport/transport.h
include/libs/transport/transport.h
+18
-0
include/os/os.h
include/os/os.h
+1
-0
source/libs/catalog/CMakeLists.txt
source/libs/catalog/CMakeLists.txt
+5
-0
source/libs/parser/CMakeLists.txt
source/libs/parser/CMakeLists.txt
+12
-0
source/libs/parser/inc/parserInt.h
source/libs/parser/inc/parserInt.h
+175
-0
source/libs/parser/src/parser.c
source/libs/parser/src/parser.c
+5
-1
未找到文件。
include/libs/transport/transport.h
浏览文件 @
c6d23aa8
...
...
@@ -20,6 +20,24 @@
extern
"C"
{
#endif
typedef
void
*
SEpSet
;
typedef
struct
SEpAddr
{
char
fqdn
[
TSDB_FQDN_LEN
];
uint16_t
port
;
}
SEpAddr
;
typedef
struct
SVgroup
{
int32_t
vgId
;
int8_t
numOfEps
;
SEpAddr
epAddr
[
TSDB_MAX_REPLICA
];
}
SVgroup
;
typedef
struct
SVgroupsInfo
{
int32_t
numOfVgroups
;
SVgroup
vgroups
[];
}
SVgroupsInfo
;
#ifdef __cplusplus
}
#endif
...
...
include/os/os.h
浏览文件 @
c6d23aa8
...
...
@@ -27,6 +27,7 @@ extern "C" {
#include <stdlib.h>
#include <string.h>
#include <sched.h>
#include <ctype.h>
#include "osAtomic.h"
#include "osDef.h"
...
...
source/libs/catalog/CMakeLists.txt
浏览文件 @
c6d23aa8
...
...
@@ -5,3 +5,8 @@ target_include_directories(
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/libs/catalog"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
target_link_libraries
(
catalog
PRIVATE os util common transport
)
\ No newline at end of file
source/libs/parser/CMakeLists.txt
浏览文件 @
c6d23aa8
aux_source_directory
(
src PARSER_SRC
)
add_library
(
parser
${
PARSER_SRC
}
)
target_include_directories
(
parser
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/libs/parser"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
target_link_libraries
(
parser
PRIVATE os util common catalog transport
)
\ No newline at end of file
source/libs/parser/inc/parserInt.h
浏览文件 @
c6d23aa8
...
...
@@ -20,6 +20,181 @@
extern
"C"
{
#endif
#include "catalog.h"
#include "parser.h"
#include "tname.h"
#include "astGen.h"
typedef
struct
SField
{
char
name
[
TSDB_COL_NAME_LEN
];
uint8_t
type
;
int16_t
bytes
;
}
SField
;
typedef
struct
SInterval
{
int32_t
tz
;
// query client timezone
char
intervalUnit
;
char
slidingUnit
;
char
offsetUnit
;
int64_t
interval
;
int64_t
sliding
;
int64_t
offset
;
}
SInterval
;
typedef
struct
SSessionWindow
{
int64_t
gap
;
// gap between two session window(in microseconds)
int32_t
primaryColId
;
// primary timestamp column
}
SSessionWindow
;
typedef
struct
SGroupbyExpr
{
int16_t
tableIndex
;
SArray
*
columnInfo
;
// SArray<SColIndex>, group by columns information
int16_t
numOfGroupCols
;
// todo remove it
int16_t
orderIndex
;
// order by column index
int16_t
orderType
;
// order by type: asc/desc
}
SGroupbyExpr
;
typedef
struct
SFieldInfo
{
int16_t
numOfOutput
;
// number of column in result
SField
*
final
;
SArray
*
internalField
;
// SArray<SInternalField>
}
SFieldInfo
;
typedef
struct
SLimitVal
{
int64_t
limit
;
int64_t
offset
;
}
SLimitVal
;
typedef
struct
SOrderVal
{
uint32_t
order
;
int32_t
orderColId
;
}
SOrderVal
;
typedef
struct
SCond
{
uint64_t
uid
;
int32_t
len
;
// length of tag query condition data
char
*
cond
;
}
SCond
;
typedef
struct
SJoinNode
{
uint64_t
uid
;
int16_t
tagColId
;
SArray
*
tsJoin
;
SArray
*
tagJoin
;
}
SJoinNode
;
typedef
struct
SJoinInfo
{
bool
hasJoin
;
SJoinNode
*
joinTables
[
TSDB_MAX_JOIN_TABLE_NUM
];
}
SJoinInfo
;
typedef
struct
STagCond
{
int16_t
relType
;
// relation between tbname list and query condition, including : TK_AND or TK_OR
SCond
tbnameCond
;
// tbname query condition, only support tbname query condition on one table
SJoinInfo
joinInfo
;
// join condition, only support two tables join currently
SArray
*
pCond
;
// for different table, the query condition must be seperated
}
STagCond
;
typedef
struct
STableMetaInfo
{
STableMeta
*
pTableMeta
;
// table meta, cached in client side and acquired by name
uint32_t
tableMetaSize
;
size_t
tableMetaCapacity
;
SVgroupsInfo
*
vgroupList
;
SArray
*
pVgroupTables
;
// SArray<SVgroupTableInfo>
/*
* 1. keep the vgroup index during the multi-vnode super table projection query
* 2. keep the vgroup index for multi-vnode insertion
*/
int32_t
vgroupIndex
;
SName
name
;
char
aliasName
[
TSDB_TABLE_NAME_LEN
];
// alias name of table specified in query sql
SArray
*
tagColList
;
// SArray<SColumn*>, involved tag columns
}
STableMetaInfo
;
typedef
struct
SInsertStmtInfo
{
SHashObj
*
pTableBlockHashList
;
// data block for each table
SArray
*
pDataBlocks
;
// SArray<STableDataBlocks*>. Merged submit block for each vgroup
int8_t
schemaAttached
;
// denote if submit block is built with table schema or not
uint8_t
payloadType
;
// EPayloadType. 0: K-V payload for non-prepare insert, 1: rawPayload for prepare insert
uint32_t
insertType
;
// insert data from [file|sql statement| bound statement]
char
*
sql
;
// current sql statement position
}
SInsertStmtInfo
;
typedef
struct
SQueryStmtInfo
{
int16_t
command
;
// the command may be different for each subclause, so keep it seperately.
uint32_t
type
;
// query/insert type
STimeWindow
window
;
// the whole query time window
SInterval
interval
;
// tumble time window
SSessionWindow
sessionWindow
;
// session time window
SGroupbyExpr
groupbyExpr
;
// groupby tags info
SArray
*
colList
;
// SArray<SColumn*>
SFieldInfo
fieldsInfo
;
SArray
*
exprList
;
// SArray<SExprInfo*>
SArray
*
exprList1
;
// final exprlist in case of arithmetic expression exists
SLimitVal
limit
;
SLimitVal
slimit
;
STagCond
tagCond
;
SArray
*
colCond
;
SOrderVal
order
;
int16_t
numOfTables
;
int16_t
curTableIdx
;
STableMetaInfo
**
pTableMetaInfo
;
struct
STSBuf
*
tsBuf
;
int16_t
fillType
;
// final result fill type
int64_t
*
fillVal
;
// default value for fill
int32_t
numOfFillVal
;
// fill value size
char
*
msg
;
// pointer to the pCmd->payload to keep error message temporarily
int64_t
clauseLimit
;
// limit for current sub clause
int64_t
prjOffset
;
// offset value in the original sql expression, only applied at client side
int64_t
vgroupLimit
;
// table limit in case of super table projection query + global order + limit
int32_t
udColumnId
;
// current user-defined constant output field column id, monotonically decreases from TSDB_UD_COLUMN_INDEX
bool
distinct
;
// distinct tag or not
bool
onlyHasTagCond
;
int32_t
bufLen
;
char
*
buf
;
SArray
*
pUdfInfo
;
struct
SQueryStmtInfo
*
sibling
;
// sibling
SArray
*
pUpstream
;
// SArray<struct SQueryStmtInfo>
struct
SQueryStmtInfo
*
pDownstream
;
int32_t
havingFieldNum
;
bool
stableQuery
;
bool
groupbyColumn
;
bool
simpleAgg
;
bool
arithmeticOnAgg
;
bool
projectionQuery
;
bool
hasFilter
;
bool
onlyTagQuery
;
bool
orderProjectQuery
;
bool
stateWindow
;
bool
globalMerge
;
bool
multigroupResult
;
}
SQueryStmtInfo
;
/**
* validate the AST by pNode
* @param pNode
* @return SQueryNode a bounded AST with essential meta data from local buffer or mgmt node
*/
int32_t
qParserValidateSqlNode
(
struct
SCatalog
*
pCatalog
,
const
SSqlNode
*
pNode
,
SQueryStmtInfo
*
pQueryInfo
);
/**
*
* @param pSqlNode
* @param pMetaInfo
* @return
*/
int32_t
qParserExtractRequestedMetaInfo
(
const
SSqlNode
*
pSqlNode
,
SMetaReq
*
pMetaInfo
);
#ifdef __cplusplus
}
#endif
...
...
source/libs/parser/src/parser.c
浏览文件 @
c6d23aa8
...
...
@@ -12,3 +12,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "parserInt.h"
#include "astGen.h"
#include "ttoken.h"
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录