Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
57f6b2be
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看板
提交
57f6b2be
编写于
1月 21, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into feature/TD-1925_new
上级
9ce66f4a
9167cf93
变更
24
显示空白变更内容
内联
并排
Showing
24 changed file
with
332 addition
and
206 deletion
+332
-206
cmake/install.inc
cmake/install.inc
+1
-1
documentation20/webdocs/markdowndocs/TAOS SQL-ch.md
documentation20/webdocs/markdowndocs/TAOS SQL-ch.md
+17
-20
packaging/docker/Dockerfile
packaging/docker/Dockerfile
+9
-7
packaging/docker/dockerManifest.sh
packaging/docker/dockerManifest.sh
+44
-0
packaging/docker/dockerbuild-aarch64.sh
packaging/docker/dockerbuild-aarch64.sh
+0
-5
packaging/docker/dockerbuild.sh
packaging/docker/dockerbuild.sh
+62
-4
packaging/docker/dockerbuildi.sh
packaging/docker/dockerbuildi.sh
+56
-0
src/connector/jdbc/CMakeLists.txt
src/connector/jdbc/CMakeLists.txt
+1
-1
src/connector/jdbc/deploy-pom.xml
src/connector/jdbc/deploy-pom.xml
+1
-1
src/connector/jdbc/pom.xml
src/connector/jdbc/pom.xml
+1
-1
src/connector/jdbc/src/main/java/com/taosdata/jdbc/CatalogResultSet.java
...dbc/src/main/java/com/taosdata/jdbc/CatalogResultSet.java
+0
-1
src/connector/jdbc/src/main/java/com/taosdata/jdbc/GetColumnsResultSet.java
.../src/main/java/com/taosdata/jdbc/GetColumnsResultSet.java
+0
-51
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java
...src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java
+2
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBParameterMetaData.java
...rc/main/java/com/taosdata/jdbc/TSDBParameterMetaData.java
+0
-75
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBSubscribeCallBack.java
...rc/main/java/com/taosdata/jdbc/TSDBSubscribeCallBack.java
+0
-19
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java
...dbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java
+2
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/util/HttpClientPoolUtil.java
...in/java/com/taosdata/jdbc/rs/util/HttpClientPoolUtil.java
+3
-4
src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBDatabaseMetaDataTest.java
...test/java/com/taosdata/jdbc/TSDBDatabaseMetaDataTest.java
+1
-0
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/AuthenticationTest.java
...rc/test/java/com/taosdata/jdbc/rs/AuthenticationTest.java
+66
-0
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulDriverTest.java
...src/test/java/com/taosdata/jdbc/rs/RestfulDriverTest.java
+6
-2
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulJDBCTest.java
...c/src/test/java/com/taosdata/jdbc/rs/RestfulJDBCTest.java
+2
-2
src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/SqlSyntaxValidatorTest.java
.../java/com/taosdata/jdbc/utils/SqlSyntaxValidatorTest.java
+1
-0
tests/examples/JDBC/taosdemo/pom.xml
tests/examples/JDBC/taosdemo/pom.xml
+3
-3
tests/pytest/concurrent_inquiry.py
tests/pytest/concurrent_inquiry.py
+54
-9
未找到文件。
cmake/install.inc
浏览文件 @
57f6b2be
...
@@ -32,7 +32,7 @@ ELSEIF (TD_WINDOWS)
...
@@ -32,7 +32,7 @@ ELSEIF (TD_WINDOWS)
#INSTALL(TARGETS taos RUNTIME DESTINATION driver)
#INSTALL(TARGETS taos RUNTIME DESTINATION driver)
#INSTALL(TARGETS shell RUNTIME DESTINATION .)
#INSTALL(TARGETS shell RUNTIME DESTINATION .)
IF
(
TD_MVN_INSTALLED
)
IF
(
TD_MVN_INSTALLED
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
-
jdbcdriver
-
2.0.1
6
-
dist
.
jar
DESTINATION
connector
/
jdbc
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
-
jdbcdriver
-
2.0.1
7
-
dist
.
jar
DESTINATION
connector
/
jdbc
)
ENDIF
()
ENDIF
()
ELSEIF
(
TD_DARWIN
)
ELSEIF
(
TD_DARWIN
)
SET
(
TD_MAKE_INSTALL_SH
"${TD_COMMUNITY_DIR}/packaging/tools/make_install.sh"
)
SET
(
TD_MAKE_INSTALL_SH
"${TD_COMMUNITY_DIR}/packaging/tools/make_install.sh"
)
...
...
documentation20/webdocs/markdowndocs/TAOS SQL-ch.md
浏览文件 @
57f6b2be
...
@@ -1125,11 +1125,8 @@ SELECT function_list FROM stb_name
...
@@ -1125,11 +1125,8 @@ SELECT function_list FROM stb_name
- WHERE语句可以指定查询的起止时间和其他过滤条件
- WHERE语句可以指定查询的起止时间和其他过滤条件
- FILL语句指定某一时间区间数据缺失的情况下的填充模式。填充模式包括以下几种:
- FILL语句指定某一时间区间数据缺失的情况下的填充模式。填充模式包括以下几种:
1. 不进行填充:NONE(默认填充模式)。
1. 不进行填充:NONE(默认填充模式)。
2. VALUE填充:固定值填充,此时需要指定填充的数值。例如:fill(value, 1.23)。
2. VALUE填充:固定值填充,此时需要指定填充的数值。例如:fill(value, 1.23)。
3. NULL填充:使用NULL填充数据。例如:fill(null)。
3. NULL填充:使用NULL填充数据。例如:fill(null)。
4. PREV填充:使用前一个非NULL值填充数据。例如:fill(prev)。
4. PREV填充:使用前一个非NULL值填充数据。例如:fill(prev)。
说明:
说明:
...
...
packaging/docker/Dockerfile
浏览文件 @
57f6b2be
FROM
ubuntu:
20
.04
FROM
ubuntu:
18
.04
WORKDIR
/root
WORKDIR
/root
ARG
version
ARG
pkgFile
RUN
echo
$version
ARG
dirName
COPY
tdengine.tar.gz /root/
RUN
echo
${
pkgFile
}
RUN
tar
-zxf
tdengine.tar.gz
RUN
echo
${
dirName
}
WORKDIR
/root/TDengine-server-$version/
RUN
/bin/bash install.sh
-e
no
COPY
${pkgFile} /root/
RUN
tar
-zxf
${
pkgFile
}
WORKDIR
/root/${dirName}/
RUN
/bin/bash install.sh
-e
no
ENV
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib"
ENV
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib"
ENV
LANG=en_US.UTF-8
ENV
LANG=en_US.UTF-8
...
...
packaging/docker/dockerManifest.sh
0 → 100755
浏览文件 @
57f6b2be
#!/bin/bash
set
-e
#set -x
# dockerbuild.sh
# -n [version number]
# -p [xxxx]
# set parameters by default value
verNumber
=
""
passWord
=
""
while
getopts
"hn:p:"
arg
do
case
$arg
in
n
)
#echo "verNumber=$OPTARG"
verNumber
=
$(
echo
$OPTARG
)
;;
p
)
#echo "passWord=$OPTARG"
passWord
=
$(
echo
$OPTARG
)
;;
h
)
echo
"Usage:
`
basename
$0
`
-n [version number] "
echo
" -p [password for docker hub] "
exit
0
;;
?
)
#unknow option
echo
"unkonw argument"
exit
1
;;
esac
done
echo
"verNumber=
${
verNumber
}
"
docker manifest create
-a
tdengine/tdengine:
${
verNumber
}
tdengine/tdengine-amd64:
${
verNumber
}
tdengine/tdengine-aarch64:
${
verNumber
}
tdengine/tdengine-aarch32:
${
verNumber
}
docker login
-u
tdengine
-p
${
passWord
}
#replace the docker registry username and password
docker manifest push tdengine/tdengine:
${
verNumber
}
# how set latest version ???
packaging/docker/dockerbuild-aarch64.sh
已删除
100755 → 0
浏览文件 @
9ce66f4a
#!/bin/bash
set
-x
docker build
--rm
-f
"Dockerfile"
-t
tdengine/tdengine-aarch64:
$1
"."
--build-arg
version
=
$1
docker login
-u
tdengine
-p
$2
#replace the docker registry username and password
docker push tdengine/tdengine-aarch64:
$1
packaging/docker/dockerbuild.sh
浏览文件 @
57f6b2be
#!/bin/bash
#!/bin/bash
set
-x
set
-e
docker build
--rm
-f
"Dockerfile"
-t
tdengine/tdengine:
$1
"."
--build-arg
version
=
$1
#set -x
docker login
-u
tdengine
-p
$2
#replace the docker registry username and password
docker push tdengine/tdengine:
$1
# dockerbuild.sh
# -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...]
# -f [pkg file]
# -n [version number]
# -p [password for docker hub]
# set parameters by default value
cpuType
=
amd64
verNumber
=
""
passWord
=
""
pkgFile
=
""
while
getopts
"hc:n:p:f:"
arg
do
case
$arg
in
c
)
#echo "cpuType=$OPTARG"
cpuType
=
$(
echo
$OPTARG
)
;;
n
)
#echo "verNumber=$OPTARG"
verNumber
=
$(
echo
$OPTARG
)
;;
p
)
#echo "passWord=$OPTARG"
passWord
=
$(
echo
$OPTARG
)
;;
f
)
#echo "pkgFile=$OPTARG"
pkgFile
=
$(
echo
$OPTARG
)
;;
h
)
echo
"Usage:
`
basename
$0
`
-c [aarch32 | aarch64 | amd64 | x86 | mips64 ...] "
echo
" -f [pkg file] "
echo
" -n [version number] "
echo
" -p [password for docker hub] "
exit
0
;;
?
)
#unknow option
echo
"unkonw argument"
exit
1
;;
esac
done
echo
"cpuType=
${
cpuType
}
verNumber=
${
verNumber
}
pkgFile=
${
pkgFile
}
"
echo
"
$(
pwd
)
"
echo
"====NOTES:
${
pkgFile
}
must be in the same directory as dockerbuild.sh===="
dirName
=
${
pkgFile
%-Linux*
}
#echo "dirName=${dirName}"
docker build
--rm
-f
"Dockerfile"
-t
tdengine/tdengine-
${
cpuType
}
:
${
verNumber
}
"."
--build-arg
pkgFile
=
${
pkgFile
}
--build-arg
dirName
=
${
dirName
}
docker login
-u
tdengine
-p
${
passWord
}
#replace the docker registry username and password
docker push tdengine/tdengine-
${
cpuType
}
:
${
verNumber
}
# set this version to latest version
docker tag tdengine/tdengine-
${
cpuType
}
:
${
verNumber
}
tdengine/tdengine-
${
cpuType
}
:latest
docker push tdengine/tdengine-
${
cpuType
}
:latest
packaging/docker/dockerbuildi.sh
0 → 100755
浏览文件 @
57f6b2be
#!/bin/bash
#
set
-e
#set -x
# dockerbuild.sh
# -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...]
# -n [version number]
# -p [password for docker hub]
# set parameters by default value
cpuType
=
aarch64
verNumber
=
""
passWord
=
""
while
getopts
"hc:n:p:f:"
arg
do
case
$arg
in
c
)
#echo "cpuType=$OPTARG"
cpuType
=
$(
echo
$OPTARG
)
;;
n
)
#echo "verNumber=$OPTARG"
verNumber
=
$(
echo
$OPTARG
)
;;
p
)
#echo "passWord=$OPTARG"
passWord
=
$(
echo
$OPTARG
)
;;
h
)
echo
"Usage:
`
basename
$0
`
-c [aarch32 | aarch64 | amd64 | x86 | mips64 ...] "
echo
" -n [version number] "
echo
" -p [password for docker hub] "
exit
0
;;
?
)
#unknow option
echo
"unkonw argument"
exit
1
;;
esac
done
pkgFile
=
TDengine-server-
${
verNumber
}
-Linux-
${
cpuType
}
.tar.gz
echo
"cpuType=
${
cpuType
}
verNumber=
${
verNumber
}
pkgFile=
${
pkgFile
}
"
scriptDir
=
`
pwd
`
pkgDir
=
$scriptDir
/../../release/
cp
-f
${
pkgDir
}
/
${
pkgFile
}
.
./dockerbuild.sh
-c
${
cpuType
}
-f
${
pkgFile
}
-n
${
verNumber
}
-p
${
passWord
}
rm
-f
${
pkgFile
}
src/connector/jdbc/CMakeLists.txt
浏览文件 @
57f6b2be
...
@@ -8,7 +8,7 @@ IF (TD_MVN_INSTALLED)
...
@@ -8,7 +8,7 @@ IF (TD_MVN_INSTALLED)
ADD_CUSTOM_COMMAND
(
OUTPUT
${
JDBC_CMD_NAME
}
ADD_CUSTOM_COMMAND
(
OUTPUT
${
JDBC_CMD_NAME
}
POST_BUILD
POST_BUILD
COMMAND mvn -Dmaven.test.skip=true install -f
${
CMAKE_CURRENT_SOURCE_DIR
}
/pom.xml
COMMAND mvn -Dmaven.test.skip=true install -f
${
CMAKE_CURRENT_SOURCE_DIR
}
/pom.xml
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
CMAKE_CURRENT_SOURCE_DIR
}
/target/taos-jdbcdriver-2.0.1
6
-dist.jar
${
LIBRARY_OUTPUT_PATH
}
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
CMAKE_CURRENT_SOURCE_DIR
}
/target/taos-jdbcdriver-2.0.1
7
-dist.jar
${
LIBRARY_OUTPUT_PATH
}
COMMAND mvn -Dmaven.test.skip=true clean -f
${
CMAKE_CURRENT_SOURCE_DIR
}
/pom.xml
COMMAND mvn -Dmaven.test.skip=true clean -f
${
CMAKE_CURRENT_SOURCE_DIR
}
/pom.xml
COMMENT
"build jdbc driver"
)
COMMENT
"build jdbc driver"
)
ADD_CUSTOM_TARGET
(
${
JDBC_TARGET_NAME
}
ALL WORKING_DIRECTORY
${
EXECUTABLE_OUTPUT_PATH
}
DEPENDS
${
JDBC_CMD_NAME
}
)
ADD_CUSTOM_TARGET
(
${
JDBC_TARGET_NAME
}
ALL WORKING_DIRECTORY
${
EXECUTABLE_OUTPUT_PATH
}
DEPENDS
${
JDBC_CMD_NAME
}
)
...
...
src/connector/jdbc/deploy-pom.xml
浏览文件 @
57f6b2be
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<groupId>
com.taosdata.jdbc
</groupId>
<groupId>
com.taosdata.jdbc
</groupId>
<artifactId>
taos-jdbcdriver
</artifactId>
<artifactId>
taos-jdbcdriver
</artifactId>
<version>
2.0.1
6
</version>
<version>
2.0.1
7
</version>
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
<name>
JDBCDriver
</name>
<name>
JDBCDriver
</name>
...
...
src/connector/jdbc/pom.xml
浏览文件 @
57f6b2be
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.taosdata.jdbc
</groupId>
<groupId>
com.taosdata.jdbc
</groupId>
<artifactId>
taos-jdbcdriver
</artifactId>
<artifactId>
taos-jdbcdriver
</artifactId>
<version>
2.0.1
6
</version>
<version>
2.0.1
7
</version>
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
<name>
JDBCDriver
</name>
<name>
JDBCDriver
</name>
<url>
https://github.com/taosdata/TDengine/tree/master/src/connector/jdbc
</url>
<url>
https://github.com/taosdata/TDengine/tree/master/src/connector/jdbc
</url>
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/CatalogResultSet.java
浏览文件 @
57f6b2be
...
@@ -24,7 +24,6 @@ import java.sql.SQLException;
...
@@ -24,7 +24,6 @@ import java.sql.SQLException;
*/
*/
public
class
CatalogResultSet
extends
TSDBResultSetWrapper
{
public
class
CatalogResultSet
extends
TSDBResultSetWrapper
{
public
CatalogResultSet
(
ResultSet
resultSet
)
{
public
CatalogResultSet
(
ResultSet
resultSet
)
{
super
.
setOriginalResultSet
(
resultSet
);
super
.
setOriginalResultSet
(
resultSet
);
}
}
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/GetColumnsResultSet.java
已删除
100644 → 0
浏览文件 @
9ce66f4a
/***************************************************************************
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* 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/>.
*****************************************************************************/
package
com.taosdata.jdbc
;
import
java.sql.ResultSet
;
/*
* TDengine only supports a subset of the standard SQL, thus this implemetation of the
* standard JDBC API contains more or less some adjustments customized for certain
* compatibility needs.
*/
public
class
GetColumnsResultSet
extends
TSDBResultSetWrapper
{
private
String
catalog
;
private
String
schemaPattern
;
private
String
tableNamePattern
;
private
String
columnNamePattern
;
public
GetColumnsResultSet
(
ResultSet
resultSet
,
String
catalog
,
String
schemaPattern
,
String
tableNamePattern
,
String
columnNamePattern
)
{
super
.
setOriginalResultSet
(
resultSet
);
this
.
catalog
=
catalog
;
this
.
schemaPattern
=
schemaPattern
;
this
.
tableNamePattern
=
tableNamePattern
;
this
.
columnNamePattern
=
columnNamePattern
;
}
@Override
public
String
getString
(
int
columnIndex
)
{
switch
(
columnIndex
)
{
case
1
:
return
catalog
;
case
2
:
return
null
;
case
3
:
return
tableNamePattern
;
default
:
return
null
;
}
}
}
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java
浏览文件 @
57f6b2be
...
@@ -620,6 +620,7 @@ public class TSDBDatabaseMetaData implements java.sql.DatabaseMetaData {
...
@@ -620,6 +620,7 @@ public class TSDBDatabaseMetaData implements java.sql.DatabaseMetaData {
ResultSet
tables
=
stmt
.
executeQuery
(
"show tables"
);
ResultSet
tables
=
stmt
.
executeQuery
(
"show tables"
);
while
(
tables
.
next
())
{
while
(
tables
.
next
())
{
TSDBResultSetRowData
rowData
=
new
TSDBResultSetRowData
(
10
);
TSDBResultSetRowData
rowData
=
new
TSDBResultSetRowData
(
10
);
rowData
.
setString
(
0
,
dbname
);
rowData
.
setString
(
2
,
tables
.
getString
(
"table_name"
));
rowData
.
setString
(
2
,
tables
.
getString
(
"table_name"
));
rowData
.
setString
(
3
,
"TABLE"
);
rowData
.
setString
(
3
,
"TABLE"
);
rowData
.
setString
(
4
,
""
);
rowData
.
setString
(
4
,
""
);
...
@@ -629,6 +630,7 @@ public class TSDBDatabaseMetaData implements java.sql.DatabaseMetaData {
...
@@ -629,6 +630,7 @@ public class TSDBDatabaseMetaData implements java.sql.DatabaseMetaData {
ResultSet
stables
=
stmt
.
executeQuery
(
"show stables"
);
ResultSet
stables
=
stmt
.
executeQuery
(
"show stables"
);
while
(
stables
.
next
())
{
while
(
stables
.
next
())
{
TSDBResultSetRowData
rowData
=
new
TSDBResultSetRowData
(
10
);
TSDBResultSetRowData
rowData
=
new
TSDBResultSetRowData
(
10
);
rowData
.
setString
(
0
,
dbname
);
rowData
.
setString
(
2
,
stables
.
getString
(
"name"
));
rowData
.
setString
(
2
,
stables
.
getString
(
"name"
));
rowData
.
setString
(
3
,
"TABLE"
);
rowData
.
setString
(
3
,
"TABLE"
);
rowData
.
setString
(
4
,
"STABLE"
);
rowData
.
setString
(
4
,
"STABLE"
);
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBParameterMetaData.java
已删除
100644 → 0
浏览文件 @
9ce66f4a
/***************************************************************************
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* 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/>.
*****************************************************************************/
package
com.taosdata.jdbc
;
import
java.sql.ParameterMetaData
;
import
java.sql.SQLException
;
public
class
TSDBParameterMetaData
implements
ParameterMetaData
{
@Override
public
int
getParameterCount
()
throws
SQLException
{
return
0
;
}
@Override
public
int
isNullable
(
int
param
)
throws
SQLException
{
return
0
;
}
@Override
public
boolean
isSigned
(
int
param
)
throws
SQLException
{
return
false
;
}
@Override
public
int
getPrecision
(
int
param
)
throws
SQLException
{
return
0
;
}
@Override
public
int
getScale
(
int
param
)
throws
SQLException
{
return
0
;
}
@Override
public
int
getParameterType
(
int
param
)
throws
SQLException
{
return
0
;
}
@Override
public
String
getParameterTypeName
(
int
param
)
throws
SQLException
{
return
null
;
}
@Override
public
String
getParameterClassName
(
int
param
)
throws
SQLException
{
return
null
;
}
@Override
public
int
getParameterMode
(
int
param
)
throws
SQLException
{
return
0
;
}
@Override
public
<
T
>
T
unwrap
(
Class
<
T
>
iface
)
throws
SQLException
{
return
null
;
}
@Override
public
boolean
isWrapperFor
(
Class
<?>
iface
)
throws
SQLException
{
return
false
;
}
}
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBSubscribeCallBack.java
已删除
100644 → 0
浏览文件 @
9ce66f4a
/***************************************************************************
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* 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/>.
*****************************************************************************/
package
com.taosdata.jdbc
;
public
interface
TSDBSubscribeCallBack
{
void
invoke
(
TSDBResultSet
resultSet
);
}
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java
浏览文件 @
57f6b2be
...
@@ -44,6 +44,8 @@ public class RestfulDriver extends AbstractTaosDriver {
...
@@ -44,6 +44,8 @@ public class RestfulDriver extends AbstractTaosDriver {
String
result
=
HttpClientPoolUtil
.
execute
(
loginUrl
);
String
result
=
HttpClientPoolUtil
.
execute
(
loginUrl
);
JSONObject
jsonResult
=
JSON
.
parseObject
(
result
);
JSONObject
jsonResult
=
JSON
.
parseObject
(
result
);
String
status
=
jsonResult
.
getString
(
"status"
);
String
status
=
jsonResult
.
getString
(
"status"
);
String
token
=
jsonResult
.
getString
(
"desc"
);
HttpClientPoolUtil
.
token
=
token
;
if
(!
status
.
equals
(
"succ"
))
{
if
(!
status
.
equals
(
"succ"
))
{
throw
new
SQLException
(
jsonResult
.
getString
(
"desc"
));
throw
new
SQLException
(
jsonResult
.
getString
(
"desc"
));
}
}
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/util/HttpClientPoolUtil.java
浏览文件 @
57f6b2be
...
@@ -23,6 +23,7 @@ import java.nio.charset.Charset;
...
@@ -23,6 +23,7 @@ import java.nio.charset.Charset;
public
class
HttpClientPoolUtil
{
public
class
HttpClientPoolUtil
{
public
static
PoolingHttpClientConnectionManager
cm
=
null
;
public
static
PoolingHttpClientConnectionManager
cm
=
null
;
public
static
CloseableHttpClient
httpClient
=
null
;
public
static
CloseableHttpClient
httpClient
=
null
;
public
static
String
token
=
"cm9vdDp0YW9zZGF0YQ=="
;
/**
/**
* 默认content 类型
* 默认content 类型
*/
*/
...
@@ -61,9 +62,7 @@ public class HttpClientPoolUtil {
...
@@ -61,9 +62,7 @@ public class HttpClientPoolUtil {
try
{
try
{
return
Long
.
parseLong
(
value
)
*
1000
;
return
Long
.
parseLong
(
value
)
*
1000
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
new
Exception
(
new
Exception
(
"format KeepAlive timeout exception, exception:"
+
e
.
toString
()).
printStackTrace
();
"format KeepAlive timeout exception, exception:"
+
e
.
toString
())
.
printStackTrace
();
}
}
}
}
}
}
...
@@ -96,7 +95,7 @@ public class HttpClientPoolUtil {
...
@@ -96,7 +95,7 @@ public class HttpClientPoolUtil {
initPools
();
initPools
();
}
}
method
=
(
HttpEntityEnclosingRequestBase
)
getRequest
(
uri
,
HttpPost
.
METHOD_NAME
,
DEFAULT_CONTENT_TYPE
,
0
);
method
=
(
HttpEntityEnclosingRequestBase
)
getRequest
(
uri
,
HttpPost
.
METHOD_NAME
,
DEFAULT_CONTENT_TYPE
,
0
);
method
.
setHeader
(
"Authorization"
,
"
Basic cm9vdDp0YW9zZGF0YQ=="
);
method
.
setHeader
(
"Authorization"
,
"
Taosd "
+
token
);
method
.
setHeader
(
"Content-Type"
,
"text/plain"
);
method
.
setHeader
(
"Content-Type"
,
"text/plain"
);
method
.
setEntity
(
new
StringEntity
(
data
,
Charset
.
forName
(
"UTF-8"
)));
method
.
setEntity
(
new
StringEntity
(
data
,
Charset
.
forName
(
"UTF-8"
)));
HttpContext
context
=
HttpClientContext
.
create
();
HttpContext
context
=
HttpClientContext
.
create
();
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBDatabaseMetaDataTest.java
浏览文件 @
57f6b2be
...
@@ -642,6 +642,7 @@ public class TSDBDatabaseMetaDataTest {
...
@@ -642,6 +642,7 @@ public class TSDBDatabaseMetaDataTest {
ResultSet
tables
=
metaData
.
getTables
(
"log"
,
""
,
null
,
null
);
ResultSet
tables
=
metaData
.
getTables
(
"log"
,
""
,
null
,
null
);
ResultSetMetaData
metaData
=
tables
.
getMetaData
();
ResultSetMetaData
metaData
=
tables
.
getMetaData
();
while
(
tables
.
next
())
{
while
(
tables
.
next
())
{
System
.
out
.
print
(
metaData
.
getColumnLabel
(
1
)
+
":"
+
tables
.
getString
(
1
)
+
"\t"
);
System
.
out
.
print
(
metaData
.
getColumnLabel
(
3
)
+
":"
+
tables
.
getString
(
3
)
+
"\t"
);
System
.
out
.
print
(
metaData
.
getColumnLabel
(
3
)
+
":"
+
tables
.
getString
(
3
)
+
"\t"
);
System
.
out
.
print
(
metaData
.
getColumnLabel
(
4
)
+
":"
+
tables
.
getString
(
4
)
+
"\t"
);
System
.
out
.
print
(
metaData
.
getColumnLabel
(
4
)
+
":"
+
tables
.
getString
(
4
)
+
"\t"
);
System
.
out
.
print
(
metaData
.
getColumnLabel
(
5
)
+
":"
+
tables
.
getString
(
5
)
+
"\n"
);
System
.
out
.
print
(
metaData
.
getColumnLabel
(
5
)
+
":"
+
tables
.
getString
(
5
)
+
"\n"
);
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/AuthenticationTest.java
0 → 100644
浏览文件 @
57f6b2be
package
com.taosdata.jdbc.rs
;
import
org.junit.Before
;
import
org.junit.Test
;
import
java.sql.*
;
public
class
AuthenticationTest
{
// private static final String host = "127.0.0.1";
private
static
final
String
host
=
"master"
;
private
static
final
String
user
=
"root"
;
private
static
final
String
password
=
"123456"
;
private
Connection
conn
;
@Test
public
void
test
()
{
// change password
try
{
conn
=
DriverManager
.
getConnection
(
"jdbc:TAOS-RS://"
+
host
+
":6041/restful_test?user="
+
user
+
"&password=taosdata"
);
Statement
stmt
=
conn
.
createStatement
();
stmt
.
execute
(
"alter user "
+
user
+
" pass '"
+
password
+
"'"
);
stmt
.
close
();
conn
.
close
();
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
// use new to login and execute query
try
{
conn
=
DriverManager
.
getConnection
(
"jdbc:TAOS-RS://"
+
host
+
":6041/restful_test?user="
+
user
+
"&password="
+
password
);
Statement
stmt
=
conn
.
createStatement
();
stmt
.
execute
(
"show databases"
);
ResultSet
rs
=
stmt
.
getResultSet
();
ResultSetMetaData
meta
=
rs
.
getMetaData
();
while
(
rs
.
next
())
{
for
(
int
i
=
1
;
i
<=
meta
.
getColumnCount
();
i
++)
{
System
.
out
.
print
(
meta
.
getColumnLabel
(
i
)
+
":"
+
rs
.
getString
(
i
)
+
"\t"
);
}
System
.
out
.
println
();
}
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
// change password back
try
{
conn
=
DriverManager
.
getConnection
(
"jdbc:TAOS-RS://"
+
host
+
":6041/restful_test?user="
+
user
+
"&password="
+
password
);
Statement
stmt
=
conn
.
createStatement
();
stmt
.
execute
(
"alter user "
+
user
+
" pass 'taosdata'"
);
stmt
.
close
();
conn
.
close
();
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
@Before
public
void
before
()
{
try
{
Class
.
forName
(
"com.taosdata.jdbc.rs.RestfulDriver"
);
}
catch
(
ClassNotFoundException
e
)
{
e
.
printStackTrace
();
}
}
}
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulDriverTest.java
浏览文件 @
57f6b2be
...
@@ -6,6 +6,7 @@ import org.junit.Test;
...
@@ -6,6 +6,7 @@ import org.junit.Test;
import
java.sql.*
;
import
java.sql.*
;
public
class
RestfulDriverTest
{
public
class
RestfulDriverTest
{
private
static
final
String
host
=
"master"
;
@Test
@Test
public
void
connect
()
{
public
void
connect
()
{
...
@@ -15,9 +16,9 @@ public class RestfulDriverTest {
...
@@ -15,9 +16,9 @@ public class RestfulDriverTest {
@Test
@Test
public
void
acceptsURL
()
throws
SQLException
{
public
void
acceptsURL
()
throws
SQLException
{
Driver
driver
=
new
RestfulDriver
();
Driver
driver
=
new
RestfulDriver
();
boolean
isAccept
=
driver
.
acceptsURL
(
"jdbc:TAOS-RS://
master
:6041"
);
boolean
isAccept
=
driver
.
acceptsURL
(
"jdbc:TAOS-RS://
"
+
host
+
"
:6041"
);
Assert
.
assertTrue
(
isAccept
);
Assert
.
assertTrue
(
isAccept
);
isAccept
=
driver
.
acceptsURL
(
"jdbc:TAOS://
master
:6041"
);
isAccept
=
driver
.
acceptsURL
(
"jdbc:TAOS://
"
+
host
+
"
:6041"
);
Assert
.
assertFalse
(
isAccept
);
Assert
.
assertFalse
(
isAccept
);
}
}
...
@@ -26,6 +27,9 @@ public class RestfulDriverTest {
...
@@ -26,6 +27,9 @@ public class RestfulDriverTest {
Driver
driver
=
new
RestfulDriver
();
Driver
driver
=
new
RestfulDriver
();
final
String
url
=
""
;
final
String
url
=
""
;
DriverPropertyInfo
[]
propertyInfo
=
driver
.
getPropertyInfo
(
url
,
null
);
DriverPropertyInfo
[]
propertyInfo
=
driver
.
getPropertyInfo
(
url
,
null
);
for
(
DriverPropertyInfo
prop
:
propertyInfo
)
{
System
.
out
.
println
(
prop
);
}
}
}
@Test
@Test
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulJDBCTest.java
浏览文件 @
57f6b2be
package
com.taosdata.jdbc.rs
;
package
com.taosdata.jdbc.rs
;
import
org.junit.*
;
import
org.junit.*
;
import
org.junit.runners.MethodSorters
;
import
org.junit.runners.MethodSorters
;
...
@@ -10,12 +9,13 @@ import java.util.Random;
...
@@ -10,12 +9,13 @@ import java.util.Random;
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
public
class
RestfulJDBCTest
{
public
class
RestfulJDBCTest
{
private
static
final
String
host
=
"master"
;
private
Connection
connection
;
private
Connection
connection
;
@Before
@Before
public
void
before
()
throws
ClassNotFoundException
,
SQLException
{
public
void
before
()
throws
ClassNotFoundException
,
SQLException
{
Class
.
forName
(
"com.taosdata.jdbc.rs.RestfulDriver"
);
Class
.
forName
(
"com.taosdata.jdbc.rs.RestfulDriver"
);
connection
=
DriverManager
.
getConnection
(
"jdbc:TAOS-RS://
master
:6041/restful_test?user=root&password=taosdata"
);
connection
=
DriverManager
.
getConnection
(
"jdbc:TAOS-RS://
"
+
host
+
"
:6041/restful_test?user=root&password=taosdata"
);
}
}
@After
@After
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/SqlSyntaxValidatorTest.java
浏览文件 @
57f6b2be
...
@@ -21,4 +21,5 @@ public class SqlSyntaxValidatorTest {
...
@@ -21,4 +21,5 @@ public class SqlSyntaxValidatorTest {
Assert
.
assertTrue
(
SqlSyntaxValidator
.
isUseSql
(
"drop database test"
));
Assert
.
assertTrue
(
SqlSyntaxValidator
.
isUseSql
(
"drop database test"
));
Assert
.
assertTrue
(
SqlSyntaxValidator
.
isUseSql
(
"drop database if exist test"
));
Assert
.
assertTrue
(
SqlSyntaxValidator
.
isUseSql
(
"drop database if exist test"
));
}
}
}
}
\ No newline at end of file
tests/examples/JDBC/taosdemo/pom.xml
浏览文件 @
57f6b2be
...
@@ -67,9 +67,9 @@
...
@@ -67,9 +67,9 @@
<dependency>
<dependency>
<groupId>
com.taosdata.jdbc
</groupId>
<groupId>
com.taosdata.jdbc
</groupId>
<artifactId>
taos-jdbcdriver
</artifactId>
<artifactId>
taos-jdbcdriver
</artifactId>
<version>
2.0.1
6
</version>
<version>
2.0.1
7
</version>
<!--
<scope>system</scope>-->
<!--
<scope>system</scope>-->
<!--
<systemPath>${project.basedir}/src/main/resources/lib/taos-jdbcdriver-2.0.15-dist.jar</systemPath>-->
<!--
<systemPath>${project.basedir}/src/main/resources/lib/taos-jdbcdriver-2.0.15-dist.jar</systemPath>-->
</dependency>
</dependency>
<!-- fastjson -->
<!-- fastjson -->
<dependency>
<dependency>
...
...
tests/pytest/concurrent_inquiry.py
浏览文件 @
57f6b2be
...
@@ -18,6 +18,8 @@ import time
...
@@ -18,6 +18,8 @@ import time
import
random
import
random
import
requests
import
requests
import
argparse
import
argparse
import
datetime
import
string
from
requests.auth
import
HTTPBasicAuth
from
requests.auth
import
HTTPBasicAuth
func_list
=
[
'avg'
,
'count'
,
'twa'
,
'sum'
,
'stddev'
,
'leastsquares'
,
'min'
,
func_list
=
[
'avg'
,
'count'
,
'twa'
,
'sum'
,
'stddev'
,
'leastsquares'
,
'min'
,
'max'
,
'first'
,
'last'
,
'top'
,
'bottom'
,
'percentile'
,
'apercentile'
,
'max'
,
'first'
,
'last'
,
'top'
,
'bottom'
,
'percentile'
,
'apercentile'
,
...
@@ -31,7 +33,7 @@ condition_list=[
...
@@ -31,7 +33,7 @@ condition_list=[
'fill(null)'
'fill(null)'
]
]
where_list
=
[
'_c0>now-10d'
,
' <50'
,
" like
\'
%a%
\'
"
]
where_list
=
[
'_c0>now-10d'
,
' <50'
,
'like'
,
' is null'
]
class
ConcurrentInquiry
:
class
ConcurrentInquiry
:
# def __init__(self,ts=1500000001000,host='127.0.0.1',user='root',password='taosdata',dbname='test',
# def __init__(self,ts=1500000001000,host='127.0.0.1',user='root',password='taosdata',dbname='test',
# stb_prefix='st',subtb_prefix='t',n_Therads=10,r_Therads=10,probabilities=0.05,loop=5,
# stb_prefix='st',subtb_prefix='t',n_Therads=10,r_Therads=10,probabilities=0.05,loop=5,
...
@@ -54,13 +56,15 @@ class ConcurrentInquiry:
...
@@ -54,13 +56,15 @@ class ConcurrentInquiry:
self
.
subtb_stru_list
=
[]
self
.
subtb_stru_list
=
[]
self
.
stb_tag_list
=
[]
self
.
stb_tag_list
=
[]
self
.
subtb_tag_list
=
[]
self
.
subtb_tag_list
=
[]
self
.
probabilities
=
[
probabilities
,
1
-
probabilities
]
self
.
probabilities
=
[
1
-
probabilities
,
probabilities
]
self
.
ifjoin
=
[
0
,
1
]
self
.
ifjoin
=
[
1
,
0
]
self
.
loop
=
loop
self
.
loop
=
loop
self
.
stableNum
=
stableNum
self
.
stableNum
=
stableNum
self
.
subtableNum
=
subtableNum
self
.
subtableNum
=
subtableNum
self
.
insertRows
=
insertRows
self
.
insertRows
=
insertRows
self
.
mix_table
=
mix_table
self
.
mix_table
=
mix_table
self
.
max_ts
=
datetime
.
datetime
.
now
()
self
.
min_ts
=
datetime
.
datetime
.
now
()
-
datetime
.
timedelta
(
days
=
5
)
def
SetThreadsNum
(
self
,
num
):
def
SetThreadsNum
(
self
,
num
):
self
.
numOfTherads
=
num
self
.
numOfTherads
=
num
...
@@ -103,6 +107,14 @@ class ConcurrentInquiry:
...
@@ -103,6 +107,14 @@ class ConcurrentInquiry:
self
.
subtb_stru_list
.
append
(
tb
)
self
.
subtb_stru_list
.
append
(
tb
)
self
.
subtb_tag_list
.
append
(
tag
)
self
.
subtb_tag_list
.
append
(
tag
)
def
get_timespan
(
self
,
cl
):
#获取时间跨度(仅第一个超级表)
sql
=
'select first(_c0),last(_c0) from '
+
self
.
dbname
+
'.'
+
self
.
stb_list
[
0
]
+
';'
print
(
sql
)
cl
.
execute
(
sql
)
for
data
in
cl
:
self
.
max_ts
=
data
[
1
]
self
.
min_ts
=
data
[
0
]
def
get_full
(
self
):
#获取所有的表、表结构
def
get_full
(
self
):
#获取所有的表、表结构
host
=
self
.
host
host
=
self
.
host
user
=
self
.
user
user
=
self
.
user
...
@@ -118,6 +130,7 @@ class ConcurrentInquiry:
...
@@ -118,6 +130,7 @@ class ConcurrentInquiry:
self
.
r_subtb_list
(
cl
,
i
)
self
.
r_subtb_list
(
cl
,
i
)
self
.
r_stb_stru
(
cl
)
self
.
r_stb_stru
(
cl
)
self
.
r_subtb_stru
(
cl
)
self
.
r_subtb_stru
(
cl
)
self
.
get_timespan
(
cl
)
cl
.
close
()
cl
.
close
()
conn
.
close
()
conn
.
close
()
...
@@ -127,9 +140,21 @@ class ConcurrentInquiry:
...
@@ -127,9 +140,21 @@ class ConcurrentInquiry:
for
i
in
range
(
random
.
randint
(
0
,
len
(
tlist
))):
for
i
in
range
(
random
.
randint
(
0
,
len
(
tlist
))):
c
=
random
.
choice
(
where_list
)
c
=
random
.
choice
(
where_list
)
if
c
==
'_c0>now-10d'
:
if
c
==
'_c0>now-10d'
:
l
.
append
(
c
)
rdate
=
self
.
min_ts
+
(
self
.
max_ts
-
self
.
min_ts
)
/
10
*
random
.
randint
(
-
11
,
11
)
conlist
=
' _c0 '
+
random
.
choice
([
'<'
,
'>'
,
'>='
,
'<='
,
'<>'
])
+
"'"
+
str
(
rdate
)
+
"'"
if
self
.
random_pick
():
l
.
append
(
conlist
)
else
:
l
.
append
(
c
)
elif
'<50'
in
c
:
conlist
=
' '
+
random
.
choice
(
tlist
)
+
random
.
choice
([
'<'
,
'>'
,
'>='
,
'<='
,
'<>'
])
+
str
(
random
.
randrange
(
-
100
,
100
))
l
.
append
(
conlist
)
elif
'is null'
in
c
:
conlist
=
' '
+
random
.
choice
(
tlist
)
+
random
.
choice
([
' is null'
,
' is not null'
])
l
.
append
(
conlist
)
else
:
else
:
l
.
append
(
random
.
choice
(
tlist
)
+
c
)
s_all
=
string
.
ascii_letters
conlist
=
' '
+
random
.
choice
(
tlist
)
+
" like
\'
%"
+
random
.
choice
(
s_all
)
+
"%
\'
"
l
.
append
(
conlist
)
return
'where '
+
random
.
choice
([
' and '
,
' or '
]).
join
(
l
)
return
'where '
+
random
.
choice
([
' and '
,
' or '
]).
join
(
l
)
def
con_interval
(
self
,
tlist
,
col_list
,
tag_list
):
def
con_interval
(
self
,
tlist
,
col_list
,
tag_list
):
...
@@ -195,7 +220,9 @@ class ConcurrentInquiry:
...
@@ -195,7 +220,9 @@ class ConcurrentInquiry:
if
bool
(
random
.
getrandbits
(
1
)):
if
bool
(
random
.
getrandbits
(
1
)):
pick_func
+=
alias
pick_func
+=
alias
sel_col_list
.
append
(
pick_func
)
sel_col_list
.
append
(
pick_func
)
if
col_rand
==
0
:
sql
=
sql
+
'*'
else
:
sql
=
sql
+
','
.
join
(
sel_col_list
)
#select col & func
sql
=
sql
+
','
.
join
(
sel_col_list
)
#select col & func
if
self
.
mix_table
==
0
:
if
self
.
mix_table
==
0
:
sql
=
sql
+
' from '
+
random
.
choice
(
self
.
stb_list
+
self
.
subtb_list
)
+
' '
sql
=
sql
+
' from '
+
random
.
choice
(
self
.
stb_list
+
self
.
subtb_list
)
+
' '
...
@@ -262,6 +289,25 @@ class ConcurrentInquiry:
...
@@ -262,6 +289,25 @@ class ConcurrentInquiry:
else
:
else
:
sel_col_tag
.
append
(
't1.'
+
str
(
random
.
choice
(
col_list
[
0
]
+
tag_list
[
0
])))
sel_col_tag
.
append
(
't1.'
+
str
(
random
.
choice
(
col_list
[
0
]
+
tag_list
[
0
])))
sel_col_tag
.
append
(
't2.'
+
str
(
random
.
choice
(
col_list
[
1
]
+
tag_list
[
1
])))
sel_col_tag
.
append
(
't2.'
+
str
(
random
.
choice
(
col_list
[
1
]
+
tag_list
[
1
])))
sel_col_list
=
[]
random
.
shuffle
(
func_list
)
if
self
.
random_pick
():
loop
=
0
for
i
,
j
in
zip
(
sel_col_tag
,
func_list
):
#决定每个被查询col的函数
alias
=
' as '
+
'taos%d '
%
loop
loop
+=
1
pick_func
=
''
if
j
==
'leastsquares'
:
pick_func
=
j
+
'('
+
i
+
',1,1)'
elif
j
==
'top'
or
j
==
'bottom'
or
j
==
'percentile'
or
j
==
'apercentile'
:
pick_func
=
j
+
'('
+
i
+
',1)'
else
:
pick_func
=
j
+
'('
+
i
+
')'
if
bool
(
random
.
getrandbits
(
1
)):
pick_func
+=
alias
sel_col_list
.
append
(
pick_func
)
sql
+=
','
.
join
(
sel_col_list
)
else
:
sql
+=
','
.
join
(
sel_col_tag
)
sql
+=
','
.
join
(
sel_col_tag
)
sql
=
sql
+
' from '
+
str
(
tbname
[
0
])
+
' t1,'
+
str
(
tbname
[
1
])
+
' t2 '
#select col & func
sql
=
sql
+
' from '
+
str
(
tbname
[
0
])
+
' t1,'
+
str
(
tbname
[
1
])
+
' t2 '
#select col & func
...
@@ -274,7 +320,6 @@ class ConcurrentInquiry:
...
@@ -274,7 +320,6 @@ class ConcurrentInquiry:
else
:
else
:
temp
=
random
.
choices
(
col_intersection
+
tag_intersection
)
temp
=
random
.
choices
(
col_intersection
+
tag_intersection
)
join_section
=
temp
.
pop
()
join_section
=
temp
.
pop
()
print
(
random
.
choices
(
col_intersection
))
sql
+=
'where t1._c0 = t2._c0 and '
+
't1.'
+
str
(
join_section
)
+
'=t2.'
+
str
(
join_section
)
sql
+=
'where t1._c0 = t2._c0 and '
+
't1.'
+
str
(
join_section
)
+
'=t2.'
+
str
(
join_section
)
return
sql
return
sql
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录