Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Iotdb
提交
275918e5
I
Iotdb
项目概览
apache
/
Iotdb
大约 1 年 前同步成功
通知
25
Star
3344
Fork
916
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
Iotdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
275918e5
编写于
5月 31, 2021
作者:
H
Haimei Guo
提交者:
GitHub
5月 31, 2021
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
jdbc - get col type bug (#3220)
上级
5ea3c2e5
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
55 addition
and
16 deletion
+55
-16
jdbc/src/main/java/org/apache/iotdb/jdbc/AbstractIoTDBJDBCResultSet.java
...ava/org/apache/iotdb/jdbc/AbstractIoTDBJDBCResultSet.java
+3
-1
jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBNonAlignJDBCResultSet.java
...ava/org/apache/iotdb/jdbc/IoTDBNonAlignJDBCResultSet.java
+3
-0
jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBResultMetadata.java
.../main/java/org/apache/iotdb/jdbc/IoTDBResultMetadata.java
+2
-6
jdbc/src/test/java/org/apache/iotdb/jdbc/IoTDBResultMetadataTest.java
...t/java/org/apache/iotdb/jdbc/IoTDBResultMetadataTest.java
+1
-1
server/src/test/java/org/apache/iotdb/db/integration/IoTDBSimpleQueryIT.java
...a/org/apache/iotdb/db/integration/IoTDBSimpleQueryIT.java
+39
-0
service-rpc/src/main/java/org/apache/iotdb/rpc/IoTDBRpcDataSet.java
...c/src/main/java/org/apache/iotdb/rpc/IoTDBRpcDataSet.java
+4
-4
session/src/main/java/org/apache/iotdb/session/SessionDataSet.java
...rc/main/java/org/apache/iotdb/session/SessionDataSet.java
+1
-1
session/src/main/java/org/apache/iotdb/session/pool/SessionDataSetWrapper.java
.../org/apache/iotdb/session/pool/SessionDataSetWrapper.java
+1
-2
session/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
...t/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
+1
-1
未找到文件。
jdbc/src/main/java/org/apache/iotdb/jdbc/AbstractIoTDBJDBCResultSet.java
浏览文件 @
275918e5
...
...
@@ -399,7 +399,9 @@ public abstract class AbstractIoTDBJDBCResultSet implements ResultSet {
@Override
public
ResultSetMetaData
getMetaData
()
{
return
new
IoTDBResultMetadata
(
ioTDBRpcDataSet
.
columnNameList
,
columnTypeList
,
ioTDBRpcDataSet
.
ignoreTimeStamp
);
ioTDBRpcDataSet
.
columnNameList
,
ioTDBRpcDataSet
.
columnTypeList
,
ioTDBRpcDataSet
.
ignoreTimeStamp
);
}
@Override
...
...
jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBNonAlignJDBCResultSet.java
浏览文件 @
275918e5
...
...
@@ -81,6 +81,7 @@ public class IoTDBNonAlignJDBCResultSet extends AbstractIoTDBJDBCResultSet {
times
=
new
byte
[
columnNameList
.
size
()][
Long
.
BYTES
];
ioTDBRpcDataSet
.
columnNameList
=
new
ArrayList
<>();
ioTDBRpcDataSet
.
columnTypeList
=
new
ArrayList
<>();
// deduplicate and map
ioTDBRpcDataSet
.
columnOrdinalMap
=
new
HashMap
<>();
ioTDBRpcDataSet
.
columnOrdinalMap
.
put
(
TIMESTAMP_STR
,
1
);
...
...
@@ -93,6 +94,8 @@ public class IoTDBNonAlignJDBCResultSet extends AbstractIoTDBJDBCResultSet {
String
name
=
columnNameList
.
get
(
i
);
ioTDBRpcDataSet
.
columnNameList
.
add
(
TIMESTAMP_STR
+
name
);
ioTDBRpcDataSet
.
columnNameList
.
add
(
name
);
ioTDBRpcDataSet
.
columnTypeList
.
add
(
String
.
valueOf
(
TSDataType
.
INT64
));
ioTDBRpcDataSet
.
columnTypeList
.
add
(
columnTypeList
.
get
(
i
));
if
(!
ioTDBRpcDataSet
.
columnOrdinalMap
.
containsKey
(
name
))
{
int
index
=
columnNameIndex
.
get
(
name
);
ioTDBRpcDataSet
.
columnOrdinalMap
.
put
(
name
,
index
+
START_INDEX
);
...
...
jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBResultMetadata.java
浏览文件 @
275918e5
...
...
@@ -115,12 +115,8 @@ public class IoTDBResultMetadata implements ResultSetMetaData {
return
Types
.
TIMESTAMP
;
}
// BOOLEAN, INT32, INT64, FLOAT, DOUBLE, TEXT,
String
columnType
;
if
(!
ignoreTimestamp
)
{
columnType
=
columnTypeList
.
get
(
column
-
2
);
}
else
{
columnType
=
columnTypeList
.
get
(
column
-
1
);
}
String
columnType
=
columnTypeList
.
get
(
column
-
1
);
switch
(
columnType
.
toUpperCase
())
{
case
"BOOLEAN"
:
return
Types
.
BOOLEAN
;
...
...
jdbc/src/test/java/org/apache/iotdb/jdbc/IoTDBResultMetadataTest.java
浏览文件 @
275918e5
...
...
@@ -143,7 +143,7 @@ public class IoTDBResultMetadataTest {
"root.a.b.double"
,
"root.a.b.text"
};
String
[]
typesString
=
{
"BOOLEAN"
,
"INT32"
,
"INT64"
,
"FLOAT"
,
"DOUBLE"
,
"TEXT"
};
String
[]
typesString
=
{
"
TIMESTAMP"
,
"
BOOLEAN"
,
"INT32"
,
"INT64"
,
"FLOAT"
,
"DOUBLE"
,
"TEXT"
};
int
[]
types
=
{
Types
.
BOOLEAN
,
Types
.
INTEGER
,
Types
.
BIGINT
,
Types
.
FLOAT
,
Types
.
DOUBLE
,
Types
.
VARCHAR
};
...
...
server/src/test/java/org/apache/iotdb/db/integration/IoTDBSimpleQueryIT.java
浏览文件 @
275918e5
...
...
@@ -38,6 +38,7 @@ import java.sql.ResultSet;
import
java.sql.ResultSetMetaData
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Types
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
...
...
@@ -1280,4 +1281,42 @@ public class IoTDBSimpleQueryIT {
fail
();
}
}
@Test
public
void
testDisableAlign
()
throws
Exception
{
Class
.
forName
(
Config
.
JDBC_DRIVER_NAME
);
try
(
Connection
connection
=
DriverManager
.
getConnection
(
Config
.
IOTDB_URL_PREFIX
+
"127.0.0.1:6667/"
,
"root"
,
"root"
);
Statement
statement
=
connection
.
createStatement
())
{
statement
.
execute
(
"CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32"
);
statement
.
execute
(
"CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=BOOLEAN"
);
ResultSet
resultSet
=
statement
.
executeQuery
(
"select s1, s2 from root.sg1.d1 disable align"
);
ResultSetMetaData
metaData
=
resultSet
.
getMetaData
();
int
[]
types
=
{
Types
.
TIMESTAMP
,
Types
.
INTEGER
,
Types
.
BIGINT
,
Types
.
BOOLEAN
};
int
columnCount
=
metaData
.
getColumnCount
();
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
Assert
.
assertEquals
(
types
[
i
],
metaData
.
getColumnType
(
i
+
1
));
}
}
}
@Test
public
void
testEnableAlign
()
throws
Exception
{
Class
.
forName
(
Config
.
JDBC_DRIVER_NAME
);
try
(
Connection
connection
=
DriverManager
.
getConnection
(
Config
.
IOTDB_URL_PREFIX
+
"127.0.0.1:6667/"
,
"root"
,
"root"
);
Statement
statement
=
connection
.
createStatement
())
{
statement
.
execute
(
"CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32"
);
statement
.
execute
(
"CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=BOOLEAN"
);
ResultSet
resultSet
=
statement
.
executeQuery
(
"select s1, s2 from root.sg1.d1"
);
ResultSetMetaData
metaData
=
resultSet
.
getMetaData
();
int
[]
types
=
{
Types
.
TIMESTAMP
,
Types
.
INTEGER
,
Types
.
BOOLEAN
};
int
columnCount
=
metaData
.
getColumnCount
();
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
Assert
.
assertEquals
(
types
[
i
],
metaData
.
getColumnType
(
i
+
1
));
}
}
}
}
service-rpc/src/main/java/org/apache/iotdb/rpc/IoTDBRpcDataSet.java
浏览文件 @
275918e5
...
...
@@ -50,7 +50,7 @@ public class IoTDBRpcDataSet {
public
boolean
isClosed
=
false
;
public
TSIService
.
Iface
client
;
public
List
<
String
>
columnNameList
;
// no deduplication
public
List
<
TSDataType
>
columnTypeList
;
// no deduplication
public
List
<
String
>
columnTypeList
;
// no deduplication
public
Map
<
String
,
Integer
>
columnOrdinalMap
;
// used because the server returns deduplicated columns
public
List
<
TSDataType
>
columnTypeDeduplicatedList
;
// deduplicated from columnTypeList
...
...
@@ -105,7 +105,7 @@ public class IoTDBRpcDataSet {
this
.
columnTypeList
=
new
ArrayList
<>();
if
(!
ignoreTimeStamp
)
{
this
.
columnNameList
.
add
(
TIMESTAMP_STR
);
this
.
columnTypeList
.
add
(
TSDataType
.
INT64
);
this
.
columnTypeList
.
add
(
String
.
valueOf
(
TSDataType
.
INT64
)
);
}
// deduplicate and map
this
.
columnOrdinalMap
=
new
HashMap
<>();
...
...
@@ -122,7 +122,7 @@ public class IoTDBRpcDataSet {
for
(
int
i
=
0
;
i
<
columnNameList
.
size
();
i
++)
{
String
name
=
columnNameList
.
get
(
i
);
this
.
columnNameList
.
add
(
name
);
this
.
columnTypeList
.
add
(
TSDataType
.
valueOf
(
columnTypeList
.
get
(
i
)
));
this
.
columnTypeList
.
add
(
columnTypeList
.
get
(
i
));
if
(!
columnOrdinalMap
.
containsKey
(
name
))
{
int
index
=
columnNameIndex
.
get
(
name
);
columnOrdinalMap
.
put
(
name
,
index
+
START_INDEX
);
...
...
@@ -135,7 +135,7 @@ public class IoTDBRpcDataSet {
for
(
int
i
=
0
;
i
<
columnNameList
.
size
();
i
++)
{
String
name
=
columnNameList
.
get
(
i
);
this
.
columnNameList
.
add
(
name
);
this
.
columnTypeList
.
add
(
TSDataType
.
valueOf
(
columnTypeList
.
get
(
i
)
));
this
.
columnTypeList
.
add
(
columnTypeList
.
get
(
i
));
if
(!
columnOrdinalMap
.
containsKey
(
name
))
{
columnOrdinalMap
.
put
(
name
,
index
++);
columnTypeDeduplicatedList
.
add
(
TSDataType
.
valueOf
(
columnTypeList
.
get
(
i
)));
...
...
session/src/main/java/org/apache/iotdb/session/SessionDataSet.java
浏览文件 @
275918e5
...
...
@@ -110,7 +110,7 @@ public class SessionDataSet {
return
new
ArrayList
<>(
ioTDBRpcDataSet
.
columnNameList
);
}
public
List
<
TSDataType
>
getColumnTypes
()
{
public
List
<
String
>
getColumnTypes
()
{
return
new
ArrayList
<>(
ioTDBRpcDataSet
.
columnTypeList
);
}
...
...
session/src/main/java/org/apache/iotdb/session/pool/SessionDataSetWrapper.java
浏览文件 @
275918e5
...
...
@@ -23,7 +23,6 @@ import org.apache.iotdb.rpc.StatementExecutionException;
import
org.apache.iotdb.session.Session
;
import
org.apache.iotdb.session.SessionDataSet
;
import
org.apache.iotdb.session.SessionDataSet.DataIterator
;
import
org.apache.iotdb.tsfile.file.metadata.enums.TSDataType
;
import
org.apache.iotdb.tsfile.read.common.RowRecord
;
import
java.util.List
;
...
...
@@ -88,7 +87,7 @@ public class SessionDataSetWrapper implements AutoCloseable {
return
sessionDataSet
.
getColumnNames
();
}
public
List
<
TSDataType
>
getColumnTypes
()
{
public
List
<
String
>
getColumnTypes
()
{
return
sessionDataSet
.
getColumnTypes
();
}
...
...
session/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
浏览文件 @
275918e5
...
...
@@ -746,7 +746,7 @@ public class IoTDBSessionSimpleIT {
"root.sg.d1.s2"
});
Assert
.
assertArrayEquals
(
dataSet
.
getColumnTypes
().
toArray
(
new
TSDataType
[
0
]),
dataSet
.
getColumnTypes
().
toArray
(
new
String
[
0
]),
new
TSDataType
[]
{
TSDataType
.
INT64
,
TSDataType
.
INT64
,
...
...
GitCode官方
@csdn_codechina
mentioned in commit
c0b2c8be
·
7月 10, 2021
mentioned in commit
c0b2c8be
mentioned in commit c0b2c8bef5733dbec2c7408db66a84ed663ddc0d
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录