Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
909ca7ed
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
909ca7ed
编写于
11月 09, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-225]
上级
9487c1b9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
35 addition
and
16 deletion
+35
-16
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+4
-3
src/query/inc/sql.y
src/query/inc/sql.y
+5
-5
src/query/src/qFill.c
src/query/src/qFill.c
+10
-2
src/query/src/sql.c
src/query/src/sql.c
+12
-6
src/util/src/tarray.c
src/util/src/tarray.c
+4
-0
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
909ca7ed
...
...
@@ -6060,19 +6060,20 @@ int32_t doCheckForCreateTable(SSqlObj* pSql, int32_t subClauseIndex, SSqlInfo* p
size_t
numOfFields
=
taosArrayGetSize
(
pFieldList
);
for
(;
col
<
numOfFields
;
++
col
)
{
TAOS_FIELD
*
p
=
taosArrayGet
(
p
Tag
List
,
col
);
TAOS_FIELD
*
p
=
taosArrayGet
(
p
Field
List
,
col
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
p
);
}
pCmd
->
numOfCols
=
(
int16_t
)
numOfFields
;
if
(
pTagList
!=
NULL
)
{
// create super table[optional]
for
(
int32_t
i
=
0
;
i
<
numOfFields
;
++
i
)
{
size_t
numOfTags
=
taosArrayGetSize
(
pTagList
);
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
TAOS_FIELD
*
p
=
taosArrayGet
(
pTagList
,
i
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
p
);
}
pCmd
->
count
=
numOf
Field
s
;
pCmd
->
count
=
numOf
Tag
s
;
}
return
TSDB_CODE_SUCCESS
;
...
...
src/query/inc/sql.y
浏览文件 @
909ca7ed
...
...
@@ -326,7 +326,7 @@ create_table_args(A) ::= AS select(S). {
%type column{TAOS_FIELD}
%type columnlist{SArray*}
%destructor columnlist {taosArrayDestroy($$);}
columnlist(A) ::= columnlist(X) COMMA column(Y). {
A = taosArrayPush(X, &Y);
}
columnlist(A) ::= columnlist(X) COMMA column(Y). {
taosArrayPush(X, &Y); A = X;
}
columnlist(A) ::= column(X). {A = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(A, &X);}
// The information used for a column is the name and type of column:
...
...
@@ -481,7 +481,7 @@ fill_opt(N) ::= FILL LP ID(Y) COMMA tagitemlist(X) RP. {
toTSDBType(Y.type);
tVariantCreate(&A, &Y);
t
aosArrayPush(X, &A
);
t
VariantListInsert(X, &A, -1, 0
);
N = X;
}
...
...
@@ -553,11 +553,11 @@ having_opt(A) ::= HAVING expr(X). {A = X;}
//limit-offset subclause
%type limit_opt {SLimitVal}
limit_opt(A) ::= . {A.limit = -1; A.offset = 0;}
limit_opt(A) ::= LIMIT signed(X). {A.limit = X; A.offset = 0;}
limit_opt(A) ::= LIMIT signed(X). {
printf("aa1, %d\n", X);
A.limit = X; A.offset = 0;}
limit_opt(A) ::= LIMIT signed(X) OFFSET signed(Y).
{A.limit = X; A.offset = Y;}
{
printf("aa2\n, %d\n", X);
A.limit = X; A.offset = Y;}
limit_opt(A) ::= LIMIT signed(X) COMMA signed(Y).
{A.limit = Y; A.offset = X;}
{
printf("aa3\n, %d\n", X);
A.limit = Y; A.offset = X;}
%type slimit_opt {SLimitVal}
slimit_opt(A) ::= . {A.limit = -1; A.offset = 0;}
...
...
src/query/src/qFill.c
浏览文件 @
909ca7ed
...
...
@@ -37,26 +37,34 @@ static int32_t setTagColumnInfo(SFillInfo* pFillInfo, int32_t numOfCols, int32_t
if
(
TSDB_COL_IS_TAG
(
pColInfo
->
flag
))
{
bool
exists
=
false
;
int32_t
index
=
-
1
;
for
(
int32_t
j
=
0
;
j
<
k
;
++
j
)
{
if
(
pFillInfo
->
pTags
[
j
].
col
.
colId
==
pColInfo
->
col
.
colId
)
{
exists
=
true
;
index
=
j
;
break
;
}
}
if
(
!
exists
)
{
pFillInfo
->
pTags
[
k
].
col
.
colId
=
pColInfo
->
col
.
colId
;
SSchema
*
pSchema
=
&
pFillInfo
->
pTags
[
k
].
col
;
pSchema
->
colId
=
pColInfo
->
col
.
colId
;
pSchema
->
type
=
pColInfo
->
col
.
type
;
pSchema
->
bytes
=
pColInfo
->
col
.
bytes
;
pFillInfo
->
pTags
[
k
].
tagVal
=
calloc
(
1
,
pColInfo
->
col
.
bytes
);
pColInfo
->
tagIndex
=
k
;
k
+=
1
;
}
else
{
pColInfo
->
tagIndex
=
index
;
}
}
rowsize
+=
pColInfo
->
col
.
bytes
;
}
assert
(
k
<
pFillInfo
->
numOfTags
);
assert
(
k
<
=
pFillInfo
->
numOfTags
);
return
rowsize
;
}
...
...
src/query/src/sql.c
浏览文件 @
909ca7ed
...
...
@@ -2365,7 +2365,7 @@ static void yy_reduce(
}
break
;
case
117
:
/* columnlist ::= columnlist COMMA column */
{
yylhsminor
.
yy347
=
taosArrayPush
(
yymsp
[
-
2
].
minor
.
yy347
,
&
yymsp
[
0
].
minor
.
yy181
);
}
{
taosArrayPush
(
yymsp
[
-
2
].
minor
.
yy347
,
&
yymsp
[
0
].
minor
.
yy181
);
yylhsminor
.
yy347
=
yymsp
[
-
2
].
minor
.
yy347
;
}
yymsp
[
-
2
].
minor
.
yy347
=
yylhsminor
.
yy347
;
break
;
case
118
:
/* columnlist ::= column */
...
...
@@ -2612,15 +2612,21 @@ static void yy_reduce(
{
yymsp
[
1
].
minor
.
yy188
.
limit
=
-
1
;
yymsp
[
1
].
minor
.
yy188
.
offset
=
0
;}
break
;
case
174
:
/* limit_opt ::= LIMIT signed */
case
178
:
/* slimit_opt ::= SLIMIT signed */
yytestcase
(
yyruleno
==
178
);
{
yymsp
[
-
1
].
minor
.
yy188
.
limit
=
yymsp
[
0
].
minor
.
yy271
;
yymsp
[
-
1
].
minor
.
yy188
.
offset
=
0
;}
{
printf
(
"aa1, %d
\n
"
,
yymsp
[
0
].
minor
.
yy271
);
yymsp
[
-
1
].
minor
.
yy188
.
limit
=
yymsp
[
0
].
minor
.
yy271
;
yymsp
[
-
1
].
minor
.
yy188
.
offset
=
0
;}
break
;
case
175
:
/* limit_opt ::= LIMIT signed OFFSET signed */
case
179
:
/* slimit_opt ::= SLIMIT signed SOFFSET signed */
yytestcase
(
yyruleno
==
179
);
{
yymsp
[
-
3
].
minor
.
yy188
.
limit
=
yymsp
[
-
2
].
minor
.
yy271
;
yymsp
[
-
3
].
minor
.
yy188
.
offset
=
yymsp
[
0
].
minor
.
yy271
;}
{
printf
(
"aa2
\n
, %d
\n
"
,
yymsp
[
-
2
].
minor
.
yy271
);
yymsp
[
-
3
].
minor
.
yy188
.
limit
=
yymsp
[
-
2
].
minor
.
yy271
;
yymsp
[
-
3
].
minor
.
yy188
.
offset
=
yymsp
[
0
].
minor
.
yy271
;}
break
;
case
176
:
/* limit_opt ::= LIMIT signed COMMA signed */
case
180
:
/* slimit_opt ::= SLIMIT signed COMMA signed */
yytestcase
(
yyruleno
==
180
);
{
printf
(
"aa3
\n
, %d
\n
"
,
yymsp
[
-
2
].
minor
.
yy271
);
yymsp
[
-
3
].
minor
.
yy188
.
limit
=
yymsp
[
0
].
minor
.
yy271
;
yymsp
[
-
3
].
minor
.
yy188
.
offset
=
yymsp
[
-
2
].
minor
.
yy271
;}
break
;
case
178
:
/* slimit_opt ::= SLIMIT signed */
{
yymsp
[
-
1
].
minor
.
yy188
.
limit
=
yymsp
[
0
].
minor
.
yy271
;
yymsp
[
-
1
].
minor
.
yy188
.
offset
=
0
;}
break
;
case
179
:
/* slimit_opt ::= SLIMIT signed SOFFSET signed */
{
yymsp
[
-
3
].
minor
.
yy188
.
limit
=
yymsp
[
-
2
].
minor
.
yy271
;
yymsp
[
-
3
].
minor
.
yy188
.
offset
=
yymsp
[
0
].
minor
.
yy271
;}
break
;
case
180
:
/* slimit_opt ::= SLIMIT signed COMMA signed */
{
yymsp
[
-
3
].
minor
.
yy188
.
limit
=
yymsp
[
0
].
minor
.
yy271
;
yymsp
[
-
3
].
minor
.
yy188
.
offset
=
yymsp
[
-
2
].
minor
.
yy271
;}
break
;
case
183
:
/* expr ::= LP expr RP */
...
...
src/util/src/tarray.c
浏览文件 @
909ca7ed
...
...
@@ -194,6 +194,10 @@ void taosArrayDestroy(SArray* pArray) {
}
void
taosArrayDestroyEx
(
SArray
*
pArray
,
void
(
*
fp
)(
void
*
))
{
if
(
pArray
==
NULL
)
{
return
;
}
if
(
fp
==
NULL
)
{
return
taosArrayDestroy
(
pArray
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录