Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
31529614
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看板
未验证
提交
31529614
编写于
4月 21, 2021
作者:
H
haojun Liao
提交者:
GitHub
4月 21, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5855 from taosdata/feature/qrefactor
Feature/qrefactor
上级
e663bc6f
64d0f679
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
107 addition
and
49 deletion
+107
-49
src/client/jni/com_taosdata_jdbc_TSDBJNIConnector.h
src/client/jni/com_taosdata_jdbc_TSDBJNIConnector.h
+8
-0
src/client/src/TSDBJNIConnector.c
src/client/src/TSDBJNIConnector.c
+17
-0
src/common/src/tvariant.c
src/common/src/tvariant.c
+16
-6
src/query/src/qExtbuffer.c
src/query/src/qExtbuffer.c
+11
-38
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+3
-2
src/util/src/tcompare.c
src/util/src/tcompare.c
+4
-0
tests/script/general/parser/first_last_query.sim
tests/script/general/parser/first_last_query.sim
+47
-1
tests/script/general/parser/select_with_tags.sim
tests/script/general/parser/select_with_tags.sim
+1
-1
tests/tsim/src/simSystem.c
tests/tsim/src/simSystem.c
+0
-1
未找到文件。
src/client/jni/com_taosdata_jdbc_TSDBJNIConnector.h
浏览文件 @
31529614
...
...
@@ -49,6 +49,14 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setOptions
JNIEXPORT
jstring
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_getTsCharset
(
JNIEnv
*
,
jclass
);
/*
* Class: com_taosdata_jdbc_TSDBJNIConnector
* Method: getResultTimePrecision
* Signature: (J)J
*/
JNIEXPORT
jint
JNICALL
Java_com_taosdata_jdbc_TDDBJNIConnector_getResultTimePrecision
(
JNIEnv
*
,
jobject
,
jlong
,
jlong
);
/*
* Class: com_taosdata_jdbc_TSDBJNIConnector
* Method: connectImp
...
...
src/client/src/TSDBJNIConnector.c
浏览文件 @
31529614
...
...
@@ -671,3 +671,20 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_validateCreateTab
JNIEXPORT
jstring
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_getTsCharset
(
JNIEnv
*
env
,
jobject
jobj
)
{
return
(
*
env
)
->
NewStringUTF
(
env
,
(
const
char
*
)
tsCharset
);
}
JNIEXPORT
jint
JNICALL
Java_com_taosdata_jdbc_TDDBJNIConnector_getResultTimePrecision
(
JNIEnv
*
env
,
jobject
jobj
,
jlong
con
,
jlong
res
)
{
TAOS
*
tscon
=
(
TAOS
*
)
con
;
if
(
tscon
==
NULL
)
{
jniError
(
"jobj:%p, connection is closed"
,
jobj
);
return
JNI_CONNECTION_NULL
;
}
TAOS_RES
*
result
=
(
TAOS_RES
*
)
res
;
if
(
result
==
NULL
)
{
jniError
(
"jobj:%p, conn:%p, resultset is null"
,
jobj
,
tscon
);
return
JNI_RESULT_SET_NULL
;
}
return
taos_result_precision
(
result
);
}
\ No newline at end of file
src/common/src/tvariant.c
浏览文件 @
31529614
...
...
@@ -48,8 +48,12 @@ void tVariantCreate(tVariant *pVar, SStrToken *token) {
case
TSDB_DATA_TYPE_INT
:{
ret
=
tStrToInteger
(
token
->
z
,
token
->
type
,
token
->
n
,
&
pVar
->
i64
,
true
);
if
(
ret
!=
0
)
{
pVar
->
nType
=
-
1
;
// -1 means error type
return
;
// data overflow, try unsigned parse the input number
ret
=
tStrToInteger
(
token
->
z
,
token
->
type
,
token
->
n
,
&
pVar
->
i64
,
false
);
if
(
ret
!=
0
)
{
pVar
->
nType
=
-
1
;
// -1 means error type
return
;
}
}
break
;
...
...
@@ -525,6 +529,8 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
}
bool
code
=
false
;
uint64_t
ui
=
0
;
switch
(
type
)
{
case
TSDB_DATA_TYPE_TINYINT
:
code
=
IS_VALID_TINYINT
(
*
result
);
break
;
...
...
@@ -535,13 +541,17 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
case
TSDB_DATA_TYPE_BIGINT
:
code
=
IS_VALID_BIGINT
(
*
result
);
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
code
=
IS_VALID_UTINYINT
(
*
result
);
break
;
ui
=
*
result
;
code
=
IS_VALID_UTINYINT
(
ui
);
break
;
case
TSDB_DATA_TYPE_USMALLINT
:
code
=
IS_VALID_USMALLINT
(
*
result
);
break
;
ui
=
*
result
;
code
=
IS_VALID_USMALLINT
(
ui
);
break
;
case
TSDB_DATA_TYPE_UINT
:
code
=
IS_VALID_UINT
(
*
result
);
break
;
ui
=
*
result
;
code
=
IS_VALID_UINT
(
ui
);
break
;
case
TSDB_DATA_TYPE_UBIGINT
:
code
=
IS_VALID_UBIGINT
(
*
result
);
break
;
ui
=
*
result
;
code
=
IS_VALID_UBIGINT
(
ui
);
break
;
}
return
code
?
0
:-
1
;
...
...
src/query/src/qExtbuffer.c
浏览文件 @
31529614
...
...
@@ -354,45 +354,14 @@ static FORCE_INLINE int32_t primaryKeyComparator(int64_t f1, int64_t f2, int32_t
static
FORCE_INLINE
int32_t
columnValueAscendingComparator
(
char
*
f1
,
char
*
f2
,
int32_t
type
,
int32_t
bytes
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_INT
:
{
int32_t
first
=
*
(
int32_t
*
)
f1
;
int32_t
second
=
*
(
int32_t
*
)
f2
;
if
(
first
==
second
)
{
return
0
;
}
return
(
first
<
second
)
?
-
1
:
1
;
};
case
TSDB_DATA_TYPE_DOUBLE
:
{
DEFAULT_DOUBLE_COMP
(
GET_DOUBLE_VAL
(
f1
),
GET_DOUBLE_VAL
(
f2
));
};
case
TSDB_DATA_TYPE_FLOAT
:
{
DEFAULT_FLOAT_COMP
(
GET_FLOAT_VAL
(
f1
),
GET_FLOAT_VAL
(
f2
));
};
case
TSDB_DATA_TYPE_BIGINT
:
{
int64_t
first
=
*
(
int64_t
*
)
f1
;
int64_t
second
=
*
(
int64_t
*
)
f2
;
if
(
first
==
second
)
{
return
0
;
}
return
(
first
<
second
)
?
-
1
:
1
;
};
case
TSDB_DATA_TYPE_SMALLINT
:
{
int16_t
first
=
*
(
int16_t
*
)
f1
;
int16_t
second
=
*
(
int16_t
*
)
f2
;
if
(
first
==
second
)
{
return
0
;
}
return
(
first
<
second
)
?
-
1
:
1
;
};
case
TSDB_DATA_TYPE_INT
:
DEFAULT_COMP
(
GET_INT32_VAL
(
f1
),
GET_INT32_VAL
(
f2
));
case
TSDB_DATA_TYPE_DOUBLE
:
DEFAULT_DOUBLE_COMP
(
GET_DOUBLE_VAL
(
f1
),
GET_DOUBLE_VAL
(
f2
));
case
TSDB_DATA_TYPE_FLOAT
:
DEFAULT_FLOAT_COMP
(
GET_FLOAT_VAL
(
f1
),
GET_FLOAT_VAL
(
f2
));
case
TSDB_DATA_TYPE_BIGINT
:
DEFAULT_COMP
(
GET_INT64_VAL
(
f1
),
GET_INT64_VAL
(
f2
));
case
TSDB_DATA_TYPE_SMALLINT
:
DEFAULT_COMP
(
GET_INT16_VAL
(
f1
),
GET_INT16_VAL
(
f2
));
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_TINYINT
:
{
int8_t
first
=
*
(
int8_t
*
)
f1
;
int8_t
second
=
*
(
int8_t
*
)
f2
;
if
(
first
==
second
)
{
return
0
;
}
return
(
first
<
second
)
?
-
1
:
1
;
};
case
TSDB_DATA_TYPE_TINYINT
:
DEFAULT_COMP
(
GET_INT8_VAL
(
f1
),
GET_INT8_VAL
(
f2
));
case
TSDB_DATA_TYPE_BINARY
:
{
int32_t
len1
=
varDataLen
(
f1
);
int32_t
len2
=
varDataLen
(
f2
);
...
...
@@ -415,6 +384,10 @@ static FORCE_INLINE int32_t columnValueAscendingComparator(char *f1, char *f2, i
}
return
(
ret
<
0
)
?
-
1
:
1
;
};
case
TSDB_DATA_TYPE_UTINYINT
:
DEFAULT_COMP
(
GET_UINT8_VAL
(
f1
),
GET_UINT8_VAL
(
f2
));
case
TSDB_DATA_TYPE_USMALLINT
:
DEFAULT_COMP
(
GET_UINT16_VAL
(
f1
),
GET_UINT16_VAL
(
f2
));
case
TSDB_DATA_TYPE_UINT
:
DEFAULT_COMP
(
GET_UINT32_VAL
(
f1
),
GET_UINT32_VAL
(
f2
));
case
TSDB_DATA_TYPE_UBIGINT
:
DEFAULT_COMP
(
GET_UINT64_VAL
(
f1
),
GET_UINT64_VAL
(
f2
));
}
return
0
;
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
31529614
...
...
@@ -3210,9 +3210,10 @@ int32_t tsdbQuerySTableByTagCond(STsdbRepo* tsdb, uint64_t uid, TSKEY skey, cons
pGroupInfo
->
numOfTables
=
(
uint32_t
)
taosArrayGetSize
(
res
);
pGroupInfo
->
pGroupList
=
createTableGroup
(
res
,
pTagSchema
,
pColIndex
,
numOfCols
,
skey
);
tsdbDebug
(
"%p no table name/tag condition, all tables
belong to one group, numOfTables:%u"
,
tsdb
,
pGroupInfo
->
numOfTables
);
taosArrayDestroy
(
res
);
tsdbDebug
(
"%p no table name/tag condition, all tables
qualified, numOfTables:%u, group:%zu"
,
tsdb
,
pGroupInfo
->
numOfTables
,
taosArrayGetSize
(
pGroupInfo
->
pGroupList
)
);
taosArrayDestroy
(
res
);
if
(
tsdbUnlockRepoMeta
(
tsdb
)
<
0
)
goto
_error
;
return
ret
;
}
...
...
src/util/src/tcompare.c
浏览文件 @
31529614
...
...
@@ -398,6 +398,10 @@ int32_t doCompare(const char* f1, const char* f2, int32_t type, size_t size) {
case
TSDB_DATA_TYPE_SMALLINT
:
DEFAULT_COMP
(
GET_INT16_VAL
(
f1
),
GET_INT16_VAL
(
f2
));
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_BOOL
:
DEFAULT_COMP
(
GET_INT8_VAL
(
f1
),
GET_INT8_VAL
(
f2
));
case
TSDB_DATA_TYPE_UTINYINT
:
DEFAULT_COMP
(
GET_UINT8_VAL
(
f1
),
GET_UINT8_VAL
(
f2
));
case
TSDB_DATA_TYPE_USMALLINT
:
DEFAULT_COMP
(
GET_UINT16_VAL
(
f1
),
GET_UINT16_VAL
(
f2
));
case
TSDB_DATA_TYPE_UINT
:
DEFAULT_COMP
(
GET_UINT32_VAL
(
f1
),
GET_UINT32_VAL
(
f2
));
case
TSDB_DATA_TYPE_UBIGINT
:
DEFAULT_COMP
(
GET_UINT64_VAL
(
f1
),
GET_UINT64_VAL
(
f2
));
case
TSDB_DATA_TYPE_NCHAR
:
{
tstr
*
t1
=
(
tstr
*
)
f1
;
tstr
*
t2
=
(
tstr
*
)
f2
;
...
...
tests/script/general/parser/first_last_query.sim
浏览文件 @
31529614
...
...
@@ -269,4 +269,50 @@ if $data14 != @test2@ then
return -1
endi
sql drop table stest
\ No newline at end of file
sql drop table stest
print ===================>td-3779
sql create table m1(ts timestamp, k int) tags(a int);
sql create table tm0 using m1 tags(1);
sql create table tm1 using m1 tags(2);
sql insert into tm0 values('2020-3-1 1:1:1', 112);
sql insert into tm1 values('2020-1-1 1:1:1', 1)('2020-3-1 0:1:1', 421);
system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 1000
system sh/exec.sh -n dnode1 -s start
print ================== server restart completed
sleep 1000
sql connect
sql use first_db0;
sql select last(*) from m1 group by tbname;
if $rows != 2 then
return -1
endi
if $data00 != @20-03-01 01:01:01.000@ then
return -1
endi
if $data01 != 112 then
return -1
endi
if $data02 != @tm0@ then
return -1
endi
if $data10 != @20-03-01 00:01:01.000@ then
return -1
endi
if $data11 != 421 then
return -1
endi
if $data12 != @tm1@ then
return -1
endi
sql drop table m1
\ No newline at end of file
tests/script/general/parser/select_with_tags.sim
浏览文件 @
31529614
...
...
@@ -160,7 +160,7 @@ if $data03 != @abc15@ then
endi
sql select top(c6, 3) from select_tags_mt0 interval(10a)
sql select top(c3,10) from select_tags_mt0 interval(10a) group by tbname
sql select top(c3,10) from select_tags_mt0 interval(10a) group by tbname
,t1,t2
sql select top(c6, 3) from select_tags_mt0 interval(10a) group by tbname;
sql select top(c6, 10) from select_tags_mt0 interval(10a);
...
...
tests/tsim/src/simSystem.c
浏览文件 @
31529614
...
...
@@ -164,7 +164,6 @@ void *simExecuteScript(void *inputScript) {
}
if
(
script
->
killed
||
script
->
linePos
>=
script
->
numOfLines
)
{
printf
(
"killed ---------------------->
\n
"
);
script
=
simProcessCallOver
(
script
);
if
(
script
==
NULL
)
{
printf
(
"abort now!
\n
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录