apache-iotdb 2.0.3__py3-none-any.whl → 2.0.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {apache_iotdb-2.0.3.dist-info → apache_iotdb-2.0.4.dist-info}/METADATA +4 -3
- {apache_iotdb-2.0.3.dist-info → apache_iotdb-2.0.4.dist-info}/RECORD +17 -17
- iotdb/Session.py +16 -2
- iotdb/SessionPool.py +3 -1
- iotdb/thrift/common/ttypes.py +3 -0
- iotdb/thrift/confignode/IConfigNodeRPCService.py +192 -2
- iotdb/thrift/confignode/ttypes.py +166 -6
- iotdb/utils/Field.py +26 -3
- iotdb/utils/SessionDataSet.py +15 -4
- iotdb/utils/iotdb_rpc_dataset.py +24 -14
- iotdb/utils/rpc_utils.py +41 -0
- tests/integration/tablet_performance_comparison.py +3 -1
- tests/integration/test_new_data_types.py +6 -6
- tests/integration/test_tablemodel_query.py +21 -1
- {apache_iotdb-2.0.3.dist-info → apache_iotdb-2.0.4.dist-info}/WHEEL +0 -0
- {apache_iotdb-2.0.3.dist-info → apache_iotdb-2.0.4.dist-info}/entry_points.txt +0 -0
- {apache_iotdb-2.0.3.dist-info → apache_iotdb-2.0.4.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apache-iotdb
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.4
|
|
4
4
|
Summary: Apache IoTDB client API
|
|
5
5
|
Author-email: Apache IoTDB <dev@iotdb.apache.org>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -18,6 +18,7 @@ Requires-Dist: pandas>=1.0.0
|
|
|
18
18
|
Requires-Dist: numpy>=1.0.0
|
|
19
19
|
Requires-Dist: sqlalchemy>=1.4
|
|
20
20
|
Requires-Dist: sqlalchemy-utils>=0.37.8
|
|
21
|
+
Requires-Dist: tzlocal>=4.0
|
|
21
22
|
|
|
22
23
|
<!--
|
|
23
24
|
|
|
@@ -94,7 +95,7 @@ session.close()
|
|
|
94
95
|
* Initialize a Session
|
|
95
96
|
|
|
96
97
|
```python
|
|
97
|
-
session = Session(ip, port_, username_, password_, fetch_size=1024, zone_id="
|
|
98
|
+
session = Session(ip, port_, username_, password_, fetch_size=1024, zone_id="Asia/Shanghai")
|
|
98
99
|
```
|
|
99
100
|
|
|
100
101
|
* Open a session, with a parameter to specify whether to enable RPC compression
|
|
@@ -396,7 +397,7 @@ ip = "127.0.0.1"
|
|
|
396
397
|
port_ = "6667"
|
|
397
398
|
username_ = "root"
|
|
398
399
|
password_ = "root"
|
|
399
|
-
conn = connect(ip, port_, username_, password_,fetch_size=1024,zone_id="
|
|
400
|
+
conn = connect(ip, port_, username_, password_,fetch_size=1024,zone_id="Asia/Shanghai",sqlalchemy_mode=False)
|
|
400
401
|
cursor = conn.cursor()
|
|
401
402
|
```
|
|
402
403
|
+ simple SQL statement execution
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
iotdb/Session.py,sha256=
|
|
2
|
-
iotdb/SessionPool.py,sha256
|
|
1
|
+
iotdb/Session.py,sha256=GkSe9xoMYg6g24AU--_oeYtRxHXK607Q0EM3xPxcGVg,102354
|
|
2
|
+
iotdb/SessionPool.py,sha256=vBy8vG7fmuDexGPzVqQhM8pWjKLrczN0na1OD-hFDnY,6674
|
|
3
3
|
iotdb/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
|
|
4
4
|
iotdb/table_session.py,sha256=Jav4TuvRl4PxOhNBaBqTvMGFWemu5YkAwRU_KXUy9wk,6173
|
|
5
5
|
iotdb/table_session_pool.py,sha256=sqhceeGbr1bsLjYj6aEF_p3qzqiVhtXKAEjV9CY4pWI,5329
|
|
@@ -20,11 +20,11 @@ iotdb/template/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,78
|
|
|
20
20
|
iotdb/thrift/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
21
|
iotdb/thrift/common/__init__.py,sha256=YFcZTT8Cm-6Y4oTiCaqq0DT1lw2W09WqoEc5_pTAwW0,34
|
|
22
22
|
iotdb/thrift/common/constants.py,sha256=IKRM8SpfhYWXERWBgUbUhbdFpn363hmZjXDhEYnVRbw,366
|
|
23
|
-
iotdb/thrift/common/ttypes.py,sha256=
|
|
24
|
-
iotdb/thrift/confignode/IConfigNodeRPCService.py,sha256=
|
|
23
|
+
iotdb/thrift/common/ttypes.py,sha256=a3ku19FQ7JomwGNxU0DzsGL3m-hV3JuX4ovFAluw-kg,117248
|
|
24
|
+
iotdb/thrift/confignode/IConfigNodeRPCService.py,sha256=i_4N2SRVes6CXLlfqTyACeWg1Ez8_zB0Letmc9DIJao,956734
|
|
25
25
|
iotdb/thrift/confignode/__init__.py,sha256=_SxvW-9GzGZcPWR-szpFI_VrvxJvSfjwu8HEieGWtik,59
|
|
26
26
|
iotdb/thrift/confignode/constants.py,sha256=IKRM8SpfhYWXERWBgUbUhbdFpn363hmZjXDhEYnVRbw,366
|
|
27
|
-
iotdb/thrift/confignode/ttypes.py,sha256=
|
|
27
|
+
iotdb/thrift/confignode/ttypes.py,sha256=6zrI__IUwMYl4putL77NJzqZJ774iuHDgQTN09C85ZY,699818
|
|
28
28
|
iotdb/thrift/datanode/IDataNodeRPCService.py,sha256=fQzCY_FJH1VVJW7KFGKU3RMBMvAQ_F_YcWyJMNMw7oM,601663
|
|
29
29
|
iotdb/thrift/datanode/MPPDataExchangeService.py,sha256=Pk3n-6JLTzf_SAVSC5cdUjgYUsi1fL4h2J5HIc_jPWU,35226
|
|
30
30
|
iotdb/thrift/datanode/__init__.py,sha256=J5dw3MYQMv2wUCQqOxUUdaNrCJP8j3Iy80Fv-PJ70S4,83
|
|
@@ -44,30 +44,30 @@ iotdb/tsfile/utils/pair.py,sha256=91ecijUAlEiMRLlH2hjRi_mT_xWp6Vm-R3n4Z4USFqQ,95
|
|
|
44
44
|
iotdb/tsfile/utils/read_write_io_utils.py,sha256=31CKH_1XWz8xc7DyInKaD-avkY-hVqNQILDb5PMucm4,2977
|
|
45
45
|
iotdb/tsfile/utils/tsblock_serde.py,sha256=t5PToZM8vLrdbObFtNQcXd7WRfHkGH5q4qn2mqx6qeE,8714
|
|
46
46
|
iotdb/utils/BitMap.py,sha256=dGvruuvDJlT4KH7pIrkprZWsY_AG-P8HXe6JHBKDOpI,1436
|
|
47
|
-
iotdb/utils/Field.py,sha256=
|
|
47
|
+
iotdb/utils/Field.py,sha256=irpHFsp4FrD2sk17uEOHLFglsE0wyFenJImY3yV6FKg,8240
|
|
48
48
|
iotdb/utils/IoTDBConstants.py,sha256=mOXYQvaOccFS0cOUEqSXgZ3qSjhe6K8_sIjTT9S6qaI,1950
|
|
49
49
|
iotdb/utils/NumpyTablet.py,sha256=qfRVenLhXnOlpgpfRCvvqfHbmcEkLaNP57tbe0JNb1o,7951
|
|
50
50
|
iotdb/utils/RowRecord.py,sha256=TIfQzMdi84GhGGIfVcZ-kvmm7aQwsDWge2kY00sf1lo,1690
|
|
51
|
-
iotdb/utils/SessionDataSet.py,sha256=
|
|
51
|
+
iotdb/utils/SessionDataSet.py,sha256=v6Tr8saagQLl1UhG1VqGq4lqhWtJkM96g9rY8VqwRKQ,5792
|
|
52
52
|
iotdb/utils/Tablet.py,sha256=HOYPSV1vyTB79T3e8rsHBN6ZiZJm_rFutEIOI8nDcDk,10198
|
|
53
53
|
iotdb/utils/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
|
|
54
54
|
iotdb/utils/exception.py,sha256=iCSzBE2Cy1q_OwC3nHdGH-OnGuwy0iPRY63VQvO8fcg,1834
|
|
55
|
-
iotdb/utils/iotdb_rpc_dataset.py,sha256=
|
|
56
|
-
iotdb/utils/rpc_utils.py,sha256=
|
|
55
|
+
iotdb/utils/iotdb_rpc_dataset.py,sha256=TdCslPx7zzd_vr2kSg7sAlhoJX4Kn4r3qZuQoDhx6To,16555
|
|
56
|
+
iotdb/utils/rpc_utils.py,sha256=4-pYb-0IFxq9QASYcqAo5hbRLlh7YJERwyU3R6L-VEg,3679
|
|
57
57
|
tests/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
|
|
58
58
|
tests/integration/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
|
|
59
59
|
tests/integration/iotdb_container.py,sha256=gmGMEzacytqvrpCXGn0xrm3ab4LDyToNCHPEFg82Mwg,2514
|
|
60
|
-
tests/integration/tablet_performance_comparison.py,sha256=
|
|
60
|
+
tests/integration/tablet_performance_comparison.py,sha256=9MonGs6tOLDBlKKwFG6RmzSgkNhhDJCP5wI84g49djI,10746
|
|
61
61
|
tests/integration/test_aligned_timeseries.py,sha256=W6GG08YzYDfmF5rlvKmF_iAHxNoZIc9ETaAslUTAWu4,9902
|
|
62
62
|
tests/integration/test_dataframe.py,sha256=6jnCqpvw-3uYLzCli9x9hnXTX8llnrLWdOzgOZ41OFA,2804
|
|
63
63
|
tests/integration/test_delete_data.py,sha256=7ZSVZYLFChM4V7oeBKWyZeilr_HBaLgQ8hk6H7TpwEY,5117
|
|
64
|
-
tests/integration/test_new_data_types.py,sha256=
|
|
64
|
+
tests/integration/test_new_data_types.py,sha256=6ip4YYLfoKV_2FPRvbCxUXNhWRNeE6DEATZgyKp4lR0,6427
|
|
65
65
|
tests/integration/test_one_device.py,sha256=6Wab6CzHvoLdlCHgYBdBD7woZqOqQ57j4AWcVFd2q4M,4730
|
|
66
66
|
tests/integration/test_relational_session.py,sha256=sZLZZj9IZSLVkGEPJGj2L_dmLmasm-kKwANERTPsnq8,4448
|
|
67
67
|
tests/integration/test_session.py,sha256=7ewSmo7eMte8J7WX7t7cu70DOv644rbwzJjC9ElDwFo,16510
|
|
68
68
|
tests/integration/test_session_pool.py,sha256=cldbmfO5NSK9XQipwiDgjjixpxuSoBTVYObhlFm-WRo,3887
|
|
69
69
|
tests/integration/test_tablemodel_insert.py,sha256=NMF4f-FzhAIDc8qLBxI8rZEtQjfs0pDPykMWx19cjwI,54634
|
|
70
|
-
tests/integration/test_tablemodel_query.py,sha256=
|
|
70
|
+
tests/integration/test_tablemodel_query.py,sha256=Z5ORRj9I_b5lRkacT_7ktf6THweFutK2S1aYBwsz8JM,16862
|
|
71
71
|
tests/integration/test_tablet.py,sha256=j6LQJKVAZ9elZdHrv8O-yeb3q9yNIXOdjCexJqlLE24,4434
|
|
72
72
|
tests/integration/test_todf.py,sha256=v4aF9SwU0gcKgIms161zFbMCCWzwGACfwZ16QPQLPb0,8124
|
|
73
73
|
tests/integration/test_treemodel_insert.py,sha256=Td1pThwzjxg2JKSKKeMXsi9WYibDGa_eY9GlPRGajJo,195607
|
|
@@ -78,8 +78,8 @@ tests/integration/sqlalchemy/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a
|
|
|
78
78
|
tests/integration/sqlalchemy/test_dialect.py,sha256=QvhZ3h-gbXQHRLQglbIeBM-YaJxWjd8NFwCCtRZDCQg,3478
|
|
79
79
|
tests/unit/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
|
|
80
80
|
tests/unit/test_numpy_tablet.py,sha256=w3lLK8Cft7lGsCj_6Z1Y7kDshltN0osSDJb-EESi6_Y,7235
|
|
81
|
-
apache_iotdb-2.0.
|
|
82
|
-
apache_iotdb-2.0.
|
|
83
|
-
apache_iotdb-2.0.
|
|
84
|
-
apache_iotdb-2.0.
|
|
85
|
-
apache_iotdb-2.0.
|
|
81
|
+
apache_iotdb-2.0.4.dist-info/METADATA,sha256=UhzW3PF2YTLd8dkGTkPKk4HarbGCKBiyfefFBSO5s0k,18767
|
|
82
|
+
apache_iotdb-2.0.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
83
|
+
apache_iotdb-2.0.4.dist-info/entry_points.txt,sha256=BmQWy6NHyWXorQcVm8-VWpt9MSqe46UFyV2hnsl4yok,73
|
|
84
|
+
apache_iotdb-2.0.4.dist-info/top_level.txt,sha256=B9jGGOaAAqF1WrWw2jX2K-naWAZn2nhyrL-6hM1qwyM,12
|
|
85
|
+
apache_iotdb-2.0.4.dist-info/RECORD,,
|
iotdb/Session.py
CHANGED
|
@@ -20,10 +20,10 @@ import logging
|
|
|
20
20
|
import random
|
|
21
21
|
import sys
|
|
22
22
|
import struct
|
|
23
|
-
import time
|
|
24
23
|
import warnings
|
|
25
24
|
from thrift.protocol import TBinaryProtocol, TCompactProtocol
|
|
26
25
|
from thrift.transport import TSocket, TTransport
|
|
26
|
+
from tzlocal import get_localzone_name
|
|
27
27
|
|
|
28
28
|
from iotdb.utils.SessionDataSet import SessionDataSet
|
|
29
29
|
from .template.Template import Template
|
|
@@ -71,7 +71,7 @@ class Session(object):
|
|
|
71
71
|
DEFAULT_FETCH_SIZE = 5000
|
|
72
72
|
DEFAULT_USER = "root"
|
|
73
73
|
DEFAULT_PASSWORD = "root"
|
|
74
|
-
DEFAULT_ZONE_ID =
|
|
74
|
+
DEFAULT_ZONE_ID = get_localzone_name()
|
|
75
75
|
RETRY_NUM = 3
|
|
76
76
|
SQL_DIALECT = "tree"
|
|
77
77
|
|
|
@@ -112,6 +112,7 @@ class Session(object):
|
|
|
112
112
|
self.__use_ssl = use_ssl
|
|
113
113
|
self.__ca_certs = ca_certs
|
|
114
114
|
self.__connection_timeout_in_ms = connection_timeout_in_ms
|
|
115
|
+
self.__time_precision = "ms"
|
|
115
116
|
|
|
116
117
|
@classmethod
|
|
117
118
|
def init_from_node_urls(
|
|
@@ -206,6 +207,11 @@ class Session(object):
|
|
|
206
207
|
try:
|
|
207
208
|
open_resp = client.openSession(open_req)
|
|
208
209
|
rpc_utils.verify_success(open_resp.status)
|
|
210
|
+
if open_resp.configuration is not None:
|
|
211
|
+
if "timestamp_precision" in open_resp.configuration:
|
|
212
|
+
self.__time_precision = open_resp.configuration[
|
|
213
|
+
"timestamp_precision"
|
|
214
|
+
]
|
|
209
215
|
|
|
210
216
|
if self.protocol_version != open_resp.serverProtocolVersion:
|
|
211
217
|
logger.exception(
|
|
@@ -1518,6 +1524,8 @@ class Session(object):
|
|
|
1518
1524
|
timeout,
|
|
1519
1525
|
resp.moreData,
|
|
1520
1526
|
self.__fetch_size,
|
|
1527
|
+
self.__zone_id,
|
|
1528
|
+
self.__time_precision,
|
|
1521
1529
|
resp.columnIndex2TsBlockColumnIndexList,
|
|
1522
1530
|
)
|
|
1523
1531
|
|
|
@@ -1587,6 +1595,8 @@ class Session(object):
|
|
|
1587
1595
|
timeout,
|
|
1588
1596
|
resp.moreData,
|
|
1589
1597
|
self.__fetch_size,
|
|
1598
|
+
self.__zone_id,
|
|
1599
|
+
self.__time_precision,
|
|
1590
1600
|
resp.columnIndex2TsBlockColumnIndexList,
|
|
1591
1601
|
)
|
|
1592
1602
|
else:
|
|
@@ -1748,6 +1758,8 @@ class Session(object):
|
|
|
1748
1758
|
0,
|
|
1749
1759
|
resp.moreData,
|
|
1750
1760
|
self.__fetch_size,
|
|
1761
|
+
self.__zone_id,
|
|
1762
|
+
self.__time_precision,
|
|
1751
1763
|
resp.columnIndex2TsBlockColumnIndexList,
|
|
1752
1764
|
)
|
|
1753
1765
|
|
|
@@ -1793,6 +1805,8 @@ class Session(object):
|
|
|
1793
1805
|
0,
|
|
1794
1806
|
resp.moreData,
|
|
1795
1807
|
self.__fetch_size,
|
|
1808
|
+
self.__zone_id,
|
|
1809
|
+
self.__time_precision,
|
|
1796
1810
|
resp.columnIndex2TsBlockColumnIndexList,
|
|
1797
1811
|
)
|
|
1798
1812
|
|
iotdb/SessionPool.py
CHANGED
|
@@ -21,12 +21,14 @@ import time
|
|
|
21
21
|
from queue import Queue
|
|
22
22
|
from threading import Lock
|
|
23
23
|
|
|
24
|
+
from tzlocal import get_localzone_name
|
|
25
|
+
|
|
24
26
|
from iotdb.Session import Session
|
|
25
27
|
|
|
26
28
|
DEFAULT_MULTIPIE = 5
|
|
27
29
|
DEFAULT_FETCH_SIZE = 5000
|
|
28
30
|
DEFAULT_MAX_RETRY = 3
|
|
29
|
-
DEFAULT_TIME_ZONE =
|
|
31
|
+
DEFAULT_TIME_ZONE = get_localzone_name()
|
|
30
32
|
SQL_DIALECT = "tree"
|
|
31
33
|
logger = logging.getLogger("IoTDB")
|
|
32
34
|
|
iotdb/thrift/common/ttypes.py
CHANGED
|
@@ -161,6 +161,7 @@ class TAggregationType(object):
|
|
|
161
161
|
MIN = 27
|
|
162
162
|
MAX = 28
|
|
163
163
|
COUNT_ALL = 29
|
|
164
|
+
APPROX_COUNT_DISTINCT = 30
|
|
164
165
|
|
|
165
166
|
_VALUES_TO_NAMES = {
|
|
166
167
|
0: "COUNT",
|
|
@@ -193,6 +194,7 @@ class TAggregationType(object):
|
|
|
193
194
|
27: "MIN",
|
|
194
195
|
28: "MAX",
|
|
195
196
|
29: "COUNT_ALL",
|
|
197
|
+
30: "APPROX_COUNT_DISTINCT",
|
|
196
198
|
}
|
|
197
199
|
|
|
198
200
|
_NAMES_TO_VALUES = {
|
|
@@ -226,6 +228,7 @@ class TAggregationType(object):
|
|
|
226
228
|
"MIN": 27,
|
|
227
229
|
"MAX": 28,
|
|
228
230
|
"COUNT_ALL": 29,
|
|
231
|
+
"APPROX_COUNT_DISTINCT": 30,
|
|
229
232
|
}
|
|
230
233
|
|
|
231
234
|
|
|
@@ -1245,7 +1245,17 @@ class Iface(object):
|
|
|
1245
1245
|
|
|
1246
1246
|
def dropSubscription(self, req):
|
|
1247
1247
|
"""
|
|
1248
|
-
Close subscription
|
|
1248
|
+
Close subscription by consumer
|
|
1249
|
+
|
|
1250
|
+
Parameters:
|
|
1251
|
+
- req
|
|
1252
|
+
|
|
1253
|
+
"""
|
|
1254
|
+
pass
|
|
1255
|
+
|
|
1256
|
+
def dropSubscriptionById(self, req):
|
|
1257
|
+
"""
|
|
1258
|
+
Close subscription by session
|
|
1249
1259
|
|
|
1250
1260
|
Parameters:
|
|
1251
1261
|
- req
|
|
@@ -5626,7 +5636,7 @@ class Client(Iface):
|
|
|
5626
5636
|
|
|
5627
5637
|
def dropSubscription(self, req):
|
|
5628
5638
|
"""
|
|
5629
|
-
Close subscription
|
|
5639
|
+
Close subscription by consumer
|
|
5630
5640
|
|
|
5631
5641
|
Parameters:
|
|
5632
5642
|
- req
|
|
@@ -5658,6 +5668,40 @@ class Client(Iface):
|
|
|
5658
5668
|
return result.success
|
|
5659
5669
|
raise TApplicationException(TApplicationException.MISSING_RESULT, "dropSubscription failed: unknown result")
|
|
5660
5670
|
|
|
5671
|
+
def dropSubscriptionById(self, req):
|
|
5672
|
+
"""
|
|
5673
|
+
Close subscription by session
|
|
5674
|
+
|
|
5675
|
+
Parameters:
|
|
5676
|
+
- req
|
|
5677
|
+
|
|
5678
|
+
"""
|
|
5679
|
+
self.send_dropSubscriptionById(req)
|
|
5680
|
+
return self.recv_dropSubscriptionById()
|
|
5681
|
+
|
|
5682
|
+
def send_dropSubscriptionById(self, req):
|
|
5683
|
+
self._oprot.writeMessageBegin('dropSubscriptionById', TMessageType.CALL, self._seqid)
|
|
5684
|
+
args = dropSubscriptionById_args()
|
|
5685
|
+
args.req = req
|
|
5686
|
+
args.write(self._oprot)
|
|
5687
|
+
self._oprot.writeMessageEnd()
|
|
5688
|
+
self._oprot.trans.flush()
|
|
5689
|
+
|
|
5690
|
+
def recv_dropSubscriptionById(self):
|
|
5691
|
+
iprot = self._iprot
|
|
5692
|
+
(fname, mtype, rseqid) = iprot.readMessageBegin()
|
|
5693
|
+
if mtype == TMessageType.EXCEPTION:
|
|
5694
|
+
x = TApplicationException()
|
|
5695
|
+
x.read(iprot)
|
|
5696
|
+
iprot.readMessageEnd()
|
|
5697
|
+
raise x
|
|
5698
|
+
result = dropSubscriptionById_result()
|
|
5699
|
+
result.read(iprot)
|
|
5700
|
+
iprot.readMessageEnd()
|
|
5701
|
+
if result.success is not None:
|
|
5702
|
+
return result.success
|
|
5703
|
+
raise TApplicationException(TApplicationException.MISSING_RESULT, "dropSubscriptionById failed: unknown result")
|
|
5704
|
+
|
|
5661
5705
|
def showSubscription(self, req):
|
|
5662
5706
|
"""
|
|
5663
5707
|
Show Subscription on topic name, if name is empty, show all subscriptions
|
|
@@ -6735,6 +6779,7 @@ class Processor(Iface, TProcessor):
|
|
|
6735
6779
|
self._processMap["closeConsumer"] = Processor.process_closeConsumer
|
|
6736
6780
|
self._processMap["createSubscription"] = Processor.process_createSubscription
|
|
6737
6781
|
self._processMap["dropSubscription"] = Processor.process_dropSubscription
|
|
6782
|
+
self._processMap["dropSubscriptionById"] = Processor.process_dropSubscriptionById
|
|
6738
6783
|
self._processMap["showSubscription"] = Processor.process_showSubscription
|
|
6739
6784
|
self._processMap["getAllSubscriptionInfo"] = Processor.process_getAllSubscriptionInfo
|
|
6740
6785
|
self._processMap["getRegionId"] = Processor.process_getRegionId
|
|
@@ -9592,6 +9637,29 @@ class Processor(Iface, TProcessor):
|
|
|
9592
9637
|
oprot.writeMessageEnd()
|
|
9593
9638
|
oprot.trans.flush()
|
|
9594
9639
|
|
|
9640
|
+
def process_dropSubscriptionById(self, seqid, iprot, oprot):
|
|
9641
|
+
args = dropSubscriptionById_args()
|
|
9642
|
+
args.read(iprot)
|
|
9643
|
+
iprot.readMessageEnd()
|
|
9644
|
+
result = dropSubscriptionById_result()
|
|
9645
|
+
try:
|
|
9646
|
+
result.success = self._handler.dropSubscriptionById(args.req)
|
|
9647
|
+
msg_type = TMessageType.REPLY
|
|
9648
|
+
except TTransport.TTransportException:
|
|
9649
|
+
raise
|
|
9650
|
+
except TApplicationException as ex:
|
|
9651
|
+
logging.exception('TApplication exception in handler')
|
|
9652
|
+
msg_type = TMessageType.EXCEPTION
|
|
9653
|
+
result = ex
|
|
9654
|
+
except Exception:
|
|
9655
|
+
logging.exception('Unexpected exception in handler')
|
|
9656
|
+
msg_type = TMessageType.EXCEPTION
|
|
9657
|
+
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
|
|
9658
|
+
oprot.writeMessageBegin("dropSubscriptionById", msg_type, seqid)
|
|
9659
|
+
result.write(oprot)
|
|
9660
|
+
oprot.writeMessageEnd()
|
|
9661
|
+
oprot.trans.flush()
|
|
9662
|
+
|
|
9595
9663
|
def process_showSubscription(self, seqid, iprot, oprot):
|
|
9596
9664
|
args = showSubscription_args()
|
|
9597
9665
|
args.read(iprot)
|
|
@@ -24798,6 +24866,128 @@ dropSubscription_result.thrift_spec = (
|
|
|
24798
24866
|
)
|
|
24799
24867
|
|
|
24800
24868
|
|
|
24869
|
+
class dropSubscriptionById_args(object):
|
|
24870
|
+
"""
|
|
24871
|
+
Attributes:
|
|
24872
|
+
- req
|
|
24873
|
+
|
|
24874
|
+
"""
|
|
24875
|
+
|
|
24876
|
+
|
|
24877
|
+
def __init__(self, req=None,):
|
|
24878
|
+
self.req = req
|
|
24879
|
+
|
|
24880
|
+
def read(self, iprot):
|
|
24881
|
+
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
24882
|
+
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
24883
|
+
return
|
|
24884
|
+
iprot.readStructBegin()
|
|
24885
|
+
while True:
|
|
24886
|
+
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
24887
|
+
if ftype == TType.STOP:
|
|
24888
|
+
break
|
|
24889
|
+
if fid == -1:
|
|
24890
|
+
if ftype == TType.STRUCT:
|
|
24891
|
+
self.req = TDropSubscriptionReq()
|
|
24892
|
+
self.req.read(iprot)
|
|
24893
|
+
else:
|
|
24894
|
+
iprot.skip(ftype)
|
|
24895
|
+
else:
|
|
24896
|
+
iprot.skip(ftype)
|
|
24897
|
+
iprot.readFieldEnd()
|
|
24898
|
+
iprot.readStructEnd()
|
|
24899
|
+
|
|
24900
|
+
def write(self, oprot):
|
|
24901
|
+
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
24902
|
+
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
24903
|
+
return
|
|
24904
|
+
oprot.writeStructBegin('dropSubscriptionById_args')
|
|
24905
|
+
if self.req is not None:
|
|
24906
|
+
oprot.writeFieldBegin('req', TType.STRUCT, -1)
|
|
24907
|
+
self.req.write(oprot)
|
|
24908
|
+
oprot.writeFieldEnd()
|
|
24909
|
+
oprot.writeFieldStop()
|
|
24910
|
+
oprot.writeStructEnd()
|
|
24911
|
+
|
|
24912
|
+
def validate(self):
|
|
24913
|
+
return
|
|
24914
|
+
|
|
24915
|
+
def __repr__(self):
|
|
24916
|
+
L = ['%s=%r' % (key, value)
|
|
24917
|
+
for key, value in self.__dict__.items()]
|
|
24918
|
+
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
24919
|
+
|
|
24920
|
+
def __eq__(self, other):
|
|
24921
|
+
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
24922
|
+
|
|
24923
|
+
def __ne__(self, other):
|
|
24924
|
+
return not (self == other)
|
|
24925
|
+
all_structs.append(dropSubscriptionById_args)
|
|
24926
|
+
dropSubscriptionById_args.thrift_spec = ()
|
|
24927
|
+
|
|
24928
|
+
|
|
24929
|
+
class dropSubscriptionById_result(object):
|
|
24930
|
+
"""
|
|
24931
|
+
Attributes:
|
|
24932
|
+
- success
|
|
24933
|
+
|
|
24934
|
+
"""
|
|
24935
|
+
|
|
24936
|
+
|
|
24937
|
+
def __init__(self, success=None,):
|
|
24938
|
+
self.success = success
|
|
24939
|
+
|
|
24940
|
+
def read(self, iprot):
|
|
24941
|
+
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
24942
|
+
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
24943
|
+
return
|
|
24944
|
+
iprot.readStructBegin()
|
|
24945
|
+
while True:
|
|
24946
|
+
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
24947
|
+
if ftype == TType.STOP:
|
|
24948
|
+
break
|
|
24949
|
+
if fid == 0:
|
|
24950
|
+
if ftype == TType.STRUCT:
|
|
24951
|
+
self.success = iotdb.thrift.common.ttypes.TSStatus()
|
|
24952
|
+
self.success.read(iprot)
|
|
24953
|
+
else:
|
|
24954
|
+
iprot.skip(ftype)
|
|
24955
|
+
else:
|
|
24956
|
+
iprot.skip(ftype)
|
|
24957
|
+
iprot.readFieldEnd()
|
|
24958
|
+
iprot.readStructEnd()
|
|
24959
|
+
|
|
24960
|
+
def write(self, oprot):
|
|
24961
|
+
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
24962
|
+
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
24963
|
+
return
|
|
24964
|
+
oprot.writeStructBegin('dropSubscriptionById_result')
|
|
24965
|
+
if self.success is not None:
|
|
24966
|
+
oprot.writeFieldBegin('success', TType.STRUCT, 0)
|
|
24967
|
+
self.success.write(oprot)
|
|
24968
|
+
oprot.writeFieldEnd()
|
|
24969
|
+
oprot.writeFieldStop()
|
|
24970
|
+
oprot.writeStructEnd()
|
|
24971
|
+
|
|
24972
|
+
def validate(self):
|
|
24973
|
+
return
|
|
24974
|
+
|
|
24975
|
+
def __repr__(self):
|
|
24976
|
+
L = ['%s=%r' % (key, value)
|
|
24977
|
+
for key, value in self.__dict__.items()]
|
|
24978
|
+
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
24979
|
+
|
|
24980
|
+
def __eq__(self, other):
|
|
24981
|
+
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
24982
|
+
|
|
24983
|
+
def __ne__(self, other):
|
|
24984
|
+
return not (self == other)
|
|
24985
|
+
all_structs.append(dropSubscriptionById_result)
|
|
24986
|
+
dropSubscriptionById_result.thrift_spec = (
|
|
24987
|
+
(0, TType.STRUCT, 'success', [iotdb.thrift.common.ttypes.TSStatus, None], None, ), # 0
|
|
24988
|
+
)
|
|
24989
|
+
|
|
24990
|
+
|
|
24801
24991
|
class showSubscription_args(object):
|
|
24802
24992
|
"""
|
|
24803
24993
|
Attributes:
|
|
@@ -11681,13 +11681,15 @@ class TDropTopicReq(object):
|
|
|
11681
11681
|
Attributes:
|
|
11682
11682
|
- topicName
|
|
11683
11683
|
- ifExistsCondition
|
|
11684
|
+
- isTableModel
|
|
11684
11685
|
|
|
11685
11686
|
"""
|
|
11686
11687
|
|
|
11687
11688
|
|
|
11688
|
-
def __init__(self, topicName=None, ifExistsCondition=None,):
|
|
11689
|
+
def __init__(self, topicName=None, ifExistsCondition=None, isTableModel=None,):
|
|
11689
11690
|
self.topicName = topicName
|
|
11690
11691
|
self.ifExistsCondition = ifExistsCondition
|
|
11692
|
+
self.isTableModel = isTableModel
|
|
11691
11693
|
|
|
11692
11694
|
def read(self, iprot):
|
|
11693
11695
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
@@ -11708,6 +11710,11 @@ class TDropTopicReq(object):
|
|
|
11708
11710
|
self.ifExistsCondition = iprot.readBool()
|
|
11709
11711
|
else:
|
|
11710
11712
|
iprot.skip(ftype)
|
|
11713
|
+
elif fid == 3:
|
|
11714
|
+
if ftype == TType.BOOL:
|
|
11715
|
+
self.isTableModel = iprot.readBool()
|
|
11716
|
+
else:
|
|
11717
|
+
iprot.skip(ftype)
|
|
11711
11718
|
else:
|
|
11712
11719
|
iprot.skip(ftype)
|
|
11713
11720
|
iprot.readFieldEnd()
|
|
@@ -11726,6 +11733,10 @@ class TDropTopicReq(object):
|
|
|
11726
11733
|
oprot.writeFieldBegin('ifExistsCondition', TType.BOOL, 2)
|
|
11727
11734
|
oprot.writeBool(self.ifExistsCondition)
|
|
11728
11735
|
oprot.writeFieldEnd()
|
|
11736
|
+
if self.isTableModel is not None:
|
|
11737
|
+
oprot.writeFieldBegin('isTableModel', TType.BOOL, 3)
|
|
11738
|
+
oprot.writeBool(self.isTableModel)
|
|
11739
|
+
oprot.writeFieldEnd()
|
|
11729
11740
|
oprot.writeFieldStop()
|
|
11730
11741
|
oprot.writeStructEnd()
|
|
11731
11742
|
|
|
@@ -11750,12 +11761,14 @@ class TShowTopicReq(object):
|
|
|
11750
11761
|
"""
|
|
11751
11762
|
Attributes:
|
|
11752
11763
|
- topicName
|
|
11764
|
+
- isTableModel
|
|
11753
11765
|
|
|
11754
11766
|
"""
|
|
11755
11767
|
|
|
11756
11768
|
|
|
11757
|
-
def __init__(self, topicName=None,):
|
|
11769
|
+
def __init__(self, topicName=None, isTableModel=None,):
|
|
11758
11770
|
self.topicName = topicName
|
|
11771
|
+
self.isTableModel = isTableModel
|
|
11759
11772
|
|
|
11760
11773
|
def read(self, iprot):
|
|
11761
11774
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
@@ -11771,6 +11784,11 @@ class TShowTopicReq(object):
|
|
|
11771
11784
|
self.topicName = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
|
|
11772
11785
|
else:
|
|
11773
11786
|
iprot.skip(ftype)
|
|
11787
|
+
elif fid == 2:
|
|
11788
|
+
if ftype == TType.BOOL:
|
|
11789
|
+
self.isTableModel = iprot.readBool()
|
|
11790
|
+
else:
|
|
11791
|
+
iprot.skip(ftype)
|
|
11774
11792
|
else:
|
|
11775
11793
|
iprot.skip(ftype)
|
|
11776
11794
|
iprot.readFieldEnd()
|
|
@@ -11785,6 +11803,10 @@ class TShowTopicReq(object):
|
|
|
11785
11803
|
oprot.writeFieldBegin('topicName', TType.STRING, 1)
|
|
11786
11804
|
oprot.writeString(self.topicName.encode('utf-8') if sys.version_info[0] == 2 else self.topicName)
|
|
11787
11805
|
oprot.writeFieldEnd()
|
|
11806
|
+
if self.isTableModel is not None:
|
|
11807
|
+
oprot.writeFieldBegin('isTableModel', TType.BOOL, 2)
|
|
11808
|
+
oprot.writeBool(self.isTableModel)
|
|
11809
|
+
oprot.writeFieldEnd()
|
|
11788
11810
|
oprot.writeFieldStop()
|
|
11789
11811
|
oprot.writeStructEnd()
|
|
11790
11812
|
|
|
@@ -12321,14 +12343,16 @@ class TSubscribeReq(object):
|
|
|
12321
12343
|
- consumerId
|
|
12322
12344
|
- consumerGroupId
|
|
12323
12345
|
- topicNames
|
|
12346
|
+
- isTableModel
|
|
12324
12347
|
|
|
12325
12348
|
"""
|
|
12326
12349
|
|
|
12327
12350
|
|
|
12328
|
-
def __init__(self, consumerId=None, consumerGroupId=None, topicNames=None,):
|
|
12351
|
+
def __init__(self, consumerId=None, consumerGroupId=None, topicNames=None, isTableModel=None,):
|
|
12329
12352
|
self.consumerId = consumerId
|
|
12330
12353
|
self.consumerGroupId = consumerGroupId
|
|
12331
12354
|
self.topicNames = topicNames
|
|
12355
|
+
self.isTableModel = isTableModel
|
|
12332
12356
|
|
|
12333
12357
|
def read(self, iprot):
|
|
12334
12358
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
@@ -12359,6 +12383,11 @@ class TSubscribeReq(object):
|
|
|
12359
12383
|
iprot.readSetEnd()
|
|
12360
12384
|
else:
|
|
12361
12385
|
iprot.skip(ftype)
|
|
12386
|
+
elif fid == 4:
|
|
12387
|
+
if ftype == TType.BOOL:
|
|
12388
|
+
self.isTableModel = iprot.readBool()
|
|
12389
|
+
else:
|
|
12390
|
+
iprot.skip(ftype)
|
|
12362
12391
|
else:
|
|
12363
12392
|
iprot.skip(ftype)
|
|
12364
12393
|
iprot.readFieldEnd()
|
|
@@ -12384,6 +12413,10 @@ class TSubscribeReq(object):
|
|
|
12384
12413
|
oprot.writeString(iter663.encode('utf-8') if sys.version_info[0] == 2 else iter663)
|
|
12385
12414
|
oprot.writeSetEnd()
|
|
12386
12415
|
oprot.writeFieldEnd()
|
|
12416
|
+
if self.isTableModel is not None:
|
|
12417
|
+
oprot.writeFieldBegin('isTableModel', TType.BOOL, 4)
|
|
12418
|
+
oprot.writeBool(self.isTableModel)
|
|
12419
|
+
oprot.writeFieldEnd()
|
|
12387
12420
|
oprot.writeFieldStop()
|
|
12388
12421
|
oprot.writeStructEnd()
|
|
12389
12422
|
|
|
@@ -12414,14 +12447,16 @@ class TUnsubscribeReq(object):
|
|
|
12414
12447
|
- consumerId
|
|
12415
12448
|
- consumerGroupId
|
|
12416
12449
|
- topicNames
|
|
12450
|
+
- isTableModel
|
|
12417
12451
|
|
|
12418
12452
|
"""
|
|
12419
12453
|
|
|
12420
12454
|
|
|
12421
|
-
def __init__(self, consumerId=None, consumerGroupId=None, topicNames=None,):
|
|
12455
|
+
def __init__(self, consumerId=None, consumerGroupId=None, topicNames=None, isTableModel=None,):
|
|
12422
12456
|
self.consumerId = consumerId
|
|
12423
12457
|
self.consumerGroupId = consumerGroupId
|
|
12424
12458
|
self.topicNames = topicNames
|
|
12459
|
+
self.isTableModel = isTableModel
|
|
12425
12460
|
|
|
12426
12461
|
def read(self, iprot):
|
|
12427
12462
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
@@ -12452,6 +12487,11 @@ class TUnsubscribeReq(object):
|
|
|
12452
12487
|
iprot.readSetEnd()
|
|
12453
12488
|
else:
|
|
12454
12489
|
iprot.skip(ftype)
|
|
12490
|
+
elif fid == 4:
|
|
12491
|
+
if ftype == TType.BOOL:
|
|
12492
|
+
self.isTableModel = iprot.readBool()
|
|
12493
|
+
else:
|
|
12494
|
+
iprot.skip(ftype)
|
|
12455
12495
|
else:
|
|
12456
12496
|
iprot.skip(ftype)
|
|
12457
12497
|
iprot.readFieldEnd()
|
|
@@ -12477,6 +12517,10 @@ class TUnsubscribeReq(object):
|
|
|
12477
12517
|
oprot.writeString(iter670.encode('utf-8') if sys.version_info[0] == 2 else iter670)
|
|
12478
12518
|
oprot.writeSetEnd()
|
|
12479
12519
|
oprot.writeFieldEnd()
|
|
12520
|
+
if self.isTableModel is not None:
|
|
12521
|
+
oprot.writeFieldBegin('isTableModel', TType.BOOL, 4)
|
|
12522
|
+
oprot.writeBool(self.isTableModel)
|
|
12523
|
+
oprot.writeFieldEnd()
|
|
12480
12524
|
oprot.writeFieldStop()
|
|
12481
12525
|
oprot.writeStructEnd()
|
|
12482
12526
|
|
|
@@ -12505,12 +12549,14 @@ class TShowSubscriptionReq(object):
|
|
|
12505
12549
|
"""
|
|
12506
12550
|
Attributes:
|
|
12507
12551
|
- topicName
|
|
12552
|
+
- isTableModel
|
|
12508
12553
|
|
|
12509
12554
|
"""
|
|
12510
12555
|
|
|
12511
12556
|
|
|
12512
|
-
def __init__(self, topicName=None,):
|
|
12557
|
+
def __init__(self, topicName=None, isTableModel=None,):
|
|
12513
12558
|
self.topicName = topicName
|
|
12559
|
+
self.isTableModel = isTableModel
|
|
12514
12560
|
|
|
12515
12561
|
def read(self, iprot):
|
|
12516
12562
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
@@ -12526,6 +12572,11 @@ class TShowSubscriptionReq(object):
|
|
|
12526
12572
|
self.topicName = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
|
|
12527
12573
|
else:
|
|
12528
12574
|
iprot.skip(ftype)
|
|
12575
|
+
elif fid == 2:
|
|
12576
|
+
if ftype == TType.BOOL:
|
|
12577
|
+
self.isTableModel = iprot.readBool()
|
|
12578
|
+
else:
|
|
12579
|
+
iprot.skip(ftype)
|
|
12529
12580
|
else:
|
|
12530
12581
|
iprot.skip(ftype)
|
|
12531
12582
|
iprot.readFieldEnd()
|
|
@@ -12540,6 +12591,10 @@ class TShowSubscriptionReq(object):
|
|
|
12540
12591
|
oprot.writeFieldBegin('topicName', TType.STRING, 1)
|
|
12541
12592
|
oprot.writeString(self.topicName.encode('utf-8') if sys.version_info[0] == 2 else self.topicName)
|
|
12542
12593
|
oprot.writeFieldEnd()
|
|
12594
|
+
if self.isTableModel is not None:
|
|
12595
|
+
oprot.writeFieldBegin('isTableModel', TType.BOOL, 2)
|
|
12596
|
+
oprot.writeBool(self.isTableModel)
|
|
12597
|
+
oprot.writeFieldEnd()
|
|
12543
12598
|
oprot.writeFieldStop()
|
|
12544
12599
|
oprot.writeStructEnd()
|
|
12545
12600
|
|
|
@@ -12644,14 +12699,16 @@ class TShowSubscriptionInfo(object):
|
|
|
12644
12699
|
- topicName
|
|
12645
12700
|
- consumerGroupId
|
|
12646
12701
|
- consumerIds
|
|
12702
|
+
- creationTime
|
|
12647
12703
|
|
|
12648
12704
|
"""
|
|
12649
12705
|
|
|
12650
12706
|
|
|
12651
|
-
def __init__(self, topicName=None, consumerGroupId=None, consumerIds=None,):
|
|
12707
|
+
def __init__(self, topicName=None, consumerGroupId=None, consumerIds=None, creationTime=None,):
|
|
12652
12708
|
self.topicName = topicName
|
|
12653
12709
|
self.consumerGroupId = consumerGroupId
|
|
12654
12710
|
self.consumerIds = consumerIds
|
|
12711
|
+
self.creationTime = creationTime
|
|
12655
12712
|
|
|
12656
12713
|
def read(self, iprot):
|
|
12657
12714
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
@@ -12682,6 +12739,11 @@ class TShowSubscriptionInfo(object):
|
|
|
12682
12739
|
iprot.readSetEnd()
|
|
12683
12740
|
else:
|
|
12684
12741
|
iprot.skip(ftype)
|
|
12742
|
+
elif fid == 4:
|
|
12743
|
+
if ftype == TType.I64:
|
|
12744
|
+
self.creationTime = iprot.readI64()
|
|
12745
|
+
else:
|
|
12746
|
+
iprot.skip(ftype)
|
|
12685
12747
|
else:
|
|
12686
12748
|
iprot.skip(ftype)
|
|
12687
12749
|
iprot.readFieldEnd()
|
|
@@ -12707,6 +12769,10 @@ class TShowSubscriptionInfo(object):
|
|
|
12707
12769
|
oprot.writeString(iter684.encode('utf-8') if sys.version_info[0] == 2 else iter684)
|
|
12708
12770
|
oprot.writeSetEnd()
|
|
12709
12771
|
oprot.writeFieldEnd()
|
|
12772
|
+
if self.creationTime is not None:
|
|
12773
|
+
oprot.writeFieldBegin('creationTime', TType.I64, 4)
|
|
12774
|
+
oprot.writeI64(self.creationTime)
|
|
12775
|
+
oprot.writeFieldEnd()
|
|
12710
12776
|
oprot.writeFieldStop()
|
|
12711
12777
|
oprot.writeStructEnd()
|
|
12712
12778
|
|
|
@@ -12731,6 +12797,87 @@ class TShowSubscriptionInfo(object):
|
|
|
12731
12797
|
return not (self == other)
|
|
12732
12798
|
|
|
12733
12799
|
|
|
12800
|
+
class TDropSubscriptionReq(object):
|
|
12801
|
+
"""
|
|
12802
|
+
Attributes:
|
|
12803
|
+
- subsciptionId
|
|
12804
|
+
- ifExistsCondition
|
|
12805
|
+
- isTableModel
|
|
12806
|
+
|
|
12807
|
+
"""
|
|
12808
|
+
|
|
12809
|
+
|
|
12810
|
+
def __init__(self, subsciptionId=None, ifExistsCondition=None, isTableModel=None,):
|
|
12811
|
+
self.subsciptionId = subsciptionId
|
|
12812
|
+
self.ifExistsCondition = ifExistsCondition
|
|
12813
|
+
self.isTableModel = isTableModel
|
|
12814
|
+
|
|
12815
|
+
def read(self, iprot):
|
|
12816
|
+
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
12817
|
+
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
12818
|
+
return
|
|
12819
|
+
iprot.readStructBegin()
|
|
12820
|
+
while True:
|
|
12821
|
+
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
12822
|
+
if ftype == TType.STOP:
|
|
12823
|
+
break
|
|
12824
|
+
if fid == 1:
|
|
12825
|
+
if ftype == TType.STRING:
|
|
12826
|
+
self.subsciptionId = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
|
|
12827
|
+
else:
|
|
12828
|
+
iprot.skip(ftype)
|
|
12829
|
+
elif fid == 2:
|
|
12830
|
+
if ftype == TType.BOOL:
|
|
12831
|
+
self.ifExistsCondition = iprot.readBool()
|
|
12832
|
+
else:
|
|
12833
|
+
iprot.skip(ftype)
|
|
12834
|
+
elif fid == 3:
|
|
12835
|
+
if ftype == TType.BOOL:
|
|
12836
|
+
self.isTableModel = iprot.readBool()
|
|
12837
|
+
else:
|
|
12838
|
+
iprot.skip(ftype)
|
|
12839
|
+
else:
|
|
12840
|
+
iprot.skip(ftype)
|
|
12841
|
+
iprot.readFieldEnd()
|
|
12842
|
+
iprot.readStructEnd()
|
|
12843
|
+
|
|
12844
|
+
def write(self, oprot):
|
|
12845
|
+
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
12846
|
+
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
12847
|
+
return
|
|
12848
|
+
oprot.writeStructBegin('TDropSubscriptionReq')
|
|
12849
|
+
if self.subsciptionId is not None:
|
|
12850
|
+
oprot.writeFieldBegin('subsciptionId', TType.STRING, 1)
|
|
12851
|
+
oprot.writeString(self.subsciptionId.encode('utf-8') if sys.version_info[0] == 2 else self.subsciptionId)
|
|
12852
|
+
oprot.writeFieldEnd()
|
|
12853
|
+
if self.ifExistsCondition is not None:
|
|
12854
|
+
oprot.writeFieldBegin('ifExistsCondition', TType.BOOL, 2)
|
|
12855
|
+
oprot.writeBool(self.ifExistsCondition)
|
|
12856
|
+
oprot.writeFieldEnd()
|
|
12857
|
+
if self.isTableModel is not None:
|
|
12858
|
+
oprot.writeFieldBegin('isTableModel', TType.BOOL, 3)
|
|
12859
|
+
oprot.writeBool(self.isTableModel)
|
|
12860
|
+
oprot.writeFieldEnd()
|
|
12861
|
+
oprot.writeFieldStop()
|
|
12862
|
+
oprot.writeStructEnd()
|
|
12863
|
+
|
|
12864
|
+
def validate(self):
|
|
12865
|
+
if self.subsciptionId is None:
|
|
12866
|
+
raise TProtocolException(message='Required field subsciptionId is unset!')
|
|
12867
|
+
return
|
|
12868
|
+
|
|
12869
|
+
def __repr__(self):
|
|
12870
|
+
L = ['%s=%r' % (key, value)
|
|
12871
|
+
for key, value in self.__dict__.items()]
|
|
12872
|
+
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
12873
|
+
|
|
12874
|
+
def __eq__(self, other):
|
|
12875
|
+
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
12876
|
+
|
|
12877
|
+
def __ne__(self, other):
|
|
12878
|
+
return not (self == other)
|
|
12879
|
+
|
|
12880
|
+
|
|
12734
12881
|
class TGetAllSubscriptionInfoResp(object):
|
|
12735
12882
|
"""
|
|
12736
12883
|
Attributes:
|
|
@@ -16912,11 +17059,13 @@ TDropTopicReq.thrift_spec = (
|
|
|
16912
17059
|
None, # 0
|
|
16913
17060
|
(1, TType.STRING, 'topicName', 'UTF8', None, ), # 1
|
|
16914
17061
|
(2, TType.BOOL, 'ifExistsCondition', None, None, ), # 2
|
|
17062
|
+
(3, TType.BOOL, 'isTableModel', None, None, ), # 3
|
|
16915
17063
|
)
|
|
16916
17064
|
all_structs.append(TShowTopicReq)
|
|
16917
17065
|
TShowTopicReq.thrift_spec = (
|
|
16918
17066
|
None, # 0
|
|
16919
17067
|
(1, TType.STRING, 'topicName', 'UTF8', None, ), # 1
|
|
17068
|
+
(2, TType.BOOL, 'isTableModel', None, None, ), # 2
|
|
16920
17069
|
)
|
|
16921
17070
|
all_structs.append(TShowTopicResp)
|
|
16922
17071
|
TShowTopicResp.thrift_spec = (
|
|
@@ -16963,6 +17112,7 @@ TSubscribeReq.thrift_spec = (
|
|
|
16963
17112
|
(1, TType.STRING, 'consumerId', 'UTF8', None, ), # 1
|
|
16964
17113
|
(2, TType.STRING, 'consumerGroupId', 'UTF8', None, ), # 2
|
|
16965
17114
|
(3, TType.SET, 'topicNames', (TType.STRING, 'UTF8', False), None, ), # 3
|
|
17115
|
+
(4, TType.BOOL, 'isTableModel', None, None, ), # 4
|
|
16966
17116
|
)
|
|
16967
17117
|
all_structs.append(TUnsubscribeReq)
|
|
16968
17118
|
TUnsubscribeReq.thrift_spec = (
|
|
@@ -16970,11 +17120,13 @@ TUnsubscribeReq.thrift_spec = (
|
|
|
16970
17120
|
(1, TType.STRING, 'consumerId', 'UTF8', None, ), # 1
|
|
16971
17121
|
(2, TType.STRING, 'consumerGroupId', 'UTF8', None, ), # 2
|
|
16972
17122
|
(3, TType.SET, 'topicNames', (TType.STRING, 'UTF8', False), None, ), # 3
|
|
17123
|
+
(4, TType.BOOL, 'isTableModel', None, None, ), # 4
|
|
16973
17124
|
)
|
|
16974
17125
|
all_structs.append(TShowSubscriptionReq)
|
|
16975
17126
|
TShowSubscriptionReq.thrift_spec = (
|
|
16976
17127
|
None, # 0
|
|
16977
17128
|
(1, TType.STRING, 'topicName', 'UTF8', None, ), # 1
|
|
17129
|
+
(2, TType.BOOL, 'isTableModel', None, None, ), # 2
|
|
16978
17130
|
)
|
|
16979
17131
|
all_structs.append(TShowSubscriptionResp)
|
|
16980
17132
|
TShowSubscriptionResp.thrift_spec = (
|
|
@@ -16988,6 +17140,14 @@ TShowSubscriptionInfo.thrift_spec = (
|
|
|
16988
17140
|
(1, TType.STRING, 'topicName', 'UTF8', None, ), # 1
|
|
16989
17141
|
(2, TType.STRING, 'consumerGroupId', 'UTF8', None, ), # 2
|
|
16990
17142
|
(3, TType.SET, 'consumerIds', (TType.STRING, 'UTF8', False), None, ), # 3
|
|
17143
|
+
(4, TType.I64, 'creationTime', None, None, ), # 4
|
|
17144
|
+
)
|
|
17145
|
+
all_structs.append(TDropSubscriptionReq)
|
|
17146
|
+
TDropSubscriptionReq.thrift_spec = (
|
|
17147
|
+
None, # 0
|
|
17148
|
+
(1, TType.STRING, 'subsciptionId', 'UTF8', None, ), # 1
|
|
17149
|
+
(2, TType.BOOL, 'ifExistsCondition', None, None, ), # 2
|
|
17150
|
+
(3, TType.BOOL, 'isTableModel', None, None, ), # 3
|
|
16991
17151
|
)
|
|
16992
17152
|
all_structs.append(TGetAllSubscriptionInfoResp)
|
|
16993
17153
|
TGetAllSubscriptionInfoResp.thrift_spec = (
|
iotdb/utils/Field.py
CHANGED
|
@@ -19,17 +19,20 @@
|
|
|
19
19
|
# for package
|
|
20
20
|
from iotdb.utils.IoTDBConstants import TSDataType
|
|
21
21
|
from iotdb.tsfile.utils.date_utils import parse_int_to_date
|
|
22
|
+
from iotdb.utils.rpc_utils import convert_to_timestamp, isoformat
|
|
22
23
|
import numpy as np
|
|
23
24
|
import pandas as pd
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
class Field(object):
|
|
27
|
-
def __init__(self, data_type, value=None):
|
|
28
|
+
def __init__(self, data_type, value=None, timezone=None, precision=None):
|
|
28
29
|
"""
|
|
29
30
|
:param data_type: TSDataType
|
|
30
31
|
"""
|
|
31
32
|
self.__data_type = data_type
|
|
32
33
|
self.value = value
|
|
34
|
+
self.__timezone = timezone
|
|
35
|
+
self.__precision = precision
|
|
33
36
|
|
|
34
37
|
@staticmethod
|
|
35
38
|
def copy(field):
|
|
@@ -157,6 +160,17 @@ class Field(object):
|
|
|
157
160
|
return None
|
|
158
161
|
return self.value
|
|
159
162
|
|
|
163
|
+
def get_timestamp_value(self):
|
|
164
|
+
if self.__data_type is None:
|
|
165
|
+
raise Exception("Null Field Exception!")
|
|
166
|
+
if (
|
|
167
|
+
self.__data_type != TSDataType.TIMESTAMP
|
|
168
|
+
or self.value is None
|
|
169
|
+
or self.value is pd.NA
|
|
170
|
+
):
|
|
171
|
+
return None
|
|
172
|
+
return convert_to_timestamp(self.value, self.__precision, self.__timezone)
|
|
173
|
+
|
|
160
174
|
def get_date_value(self):
|
|
161
175
|
if self.__data_type is None:
|
|
162
176
|
raise Exception("Null Field Exception!")
|
|
@@ -172,11 +186,18 @@ class Field(object):
|
|
|
172
186
|
if self.__data_type is None or self.value is None or self.value is pd.NA:
|
|
173
187
|
return "None"
|
|
174
188
|
# TEXT, STRING
|
|
175
|
-
|
|
189
|
+
if self.__data_type == 5 or self.__data_type == 11:
|
|
176
190
|
return self.value.decode("utf-8")
|
|
177
191
|
# BLOB
|
|
178
192
|
elif self.__data_type == 10:
|
|
179
193
|
return str(hex(int.from_bytes(self.value, byteorder="big")))
|
|
194
|
+
# TIMESTAMP
|
|
195
|
+
elif self.__data_type == 8:
|
|
196
|
+
return isoformat(
|
|
197
|
+
convert_to_timestamp(self.value, self.__precision, self.__timezone),
|
|
198
|
+
self.__precision,
|
|
199
|
+
)
|
|
200
|
+
# Others
|
|
180
201
|
else:
|
|
181
202
|
return str(self.get_object_value(self.__data_type))
|
|
182
203
|
|
|
@@ -193,12 +214,14 @@ class Field(object):
|
|
|
193
214
|
return bool(self.value)
|
|
194
215
|
elif data_type == 1:
|
|
195
216
|
return np.int32(self.value)
|
|
196
|
-
elif data_type == 2
|
|
217
|
+
elif data_type == 2:
|
|
197
218
|
return np.int64(self.value)
|
|
198
219
|
elif data_type == 3:
|
|
199
220
|
return np.float32(self.value)
|
|
200
221
|
elif data_type == 4:
|
|
201
222
|
return np.float64(self.value)
|
|
223
|
+
elif data_type == 8:
|
|
224
|
+
return convert_to_timestamp(self.value, self.__precision, self.__timezone)
|
|
202
225
|
elif data_type == 9:
|
|
203
226
|
return parse_int_to_date(self.value)
|
|
204
227
|
elif data_type == 5 or data_type == 11:
|
iotdb/utils/SessionDataSet.py
CHANGED
|
@@ -45,13 +45,14 @@ class SessionDataSet(object):
|
|
|
45
45
|
time_out,
|
|
46
46
|
more_data,
|
|
47
47
|
fetch_size,
|
|
48
|
+
zone_id,
|
|
49
|
+
time_precision,
|
|
48
50
|
column_index_2_tsblock_column_index_list,
|
|
49
51
|
):
|
|
50
52
|
self.iotdb_rpc_data_set = IoTDBRpcDataSet(
|
|
51
53
|
sql,
|
|
52
54
|
column_name_list,
|
|
53
55
|
column_type_list,
|
|
54
|
-
column_name_index,
|
|
55
56
|
ignore_timestamp,
|
|
56
57
|
more_data,
|
|
57
58
|
query_id,
|
|
@@ -61,16 +62,26 @@ class SessionDataSet(object):
|
|
|
61
62
|
query_result,
|
|
62
63
|
fetch_size,
|
|
63
64
|
time_out,
|
|
65
|
+
zone_id,
|
|
66
|
+
time_precision,
|
|
64
67
|
column_index_2_tsblock_column_index_list,
|
|
65
68
|
)
|
|
66
69
|
if ignore_timestamp:
|
|
67
70
|
self.__field_list = [
|
|
68
|
-
|
|
71
|
+
(
|
|
72
|
+
Field(data_type, timezone=zone_id, precision=time_precision)
|
|
73
|
+
if data_type == 8
|
|
74
|
+
else Field(data_type)
|
|
75
|
+
)
|
|
69
76
|
for data_type in self.iotdb_rpc_data_set.get_column_types()
|
|
70
77
|
]
|
|
71
78
|
else:
|
|
72
79
|
self.__field_list = [
|
|
73
|
-
|
|
80
|
+
(
|
|
81
|
+
Field(data_type, timezone=zone_id, precision=time_precision)
|
|
82
|
+
if data_type == 8
|
|
83
|
+
else Field(data_type)
|
|
84
|
+
)
|
|
74
85
|
for data_type in self.iotdb_rpc_data_set.get_column_types()[1:]
|
|
75
86
|
]
|
|
76
87
|
self.row_index = 0
|
|
@@ -155,7 +166,7 @@ def get_typed_point(field: Field, none_value=None):
|
|
|
155
166
|
TSDataType.INT32: lambda f: f.get_int_value(),
|
|
156
167
|
TSDataType.DOUBLE: lambda f: f.get_double_value(),
|
|
157
168
|
TSDataType.INT64: lambda f: f.get_long_value(),
|
|
158
|
-
TSDataType.TIMESTAMP: lambda f: f.
|
|
169
|
+
TSDataType.TIMESTAMP: lambda f: f.get_timestamp_value(),
|
|
159
170
|
TSDataType.STRING: lambda f: f.get_string_value(),
|
|
160
171
|
TSDataType.DATE: lambda f: f.get_date_value(),
|
|
161
172
|
TSDataType.BLOB: lambda f: f.get_binary_value(),
|
iotdb/utils/iotdb_rpc_dataset.py
CHANGED
|
@@ -28,7 +28,7 @@ from iotdb.tsfile.utils.date_utils import parse_int_to_date
|
|
|
28
28
|
from iotdb.tsfile.utils.tsblock_serde import deserialize
|
|
29
29
|
from iotdb.utils.exception import IoTDBConnectionException
|
|
30
30
|
from iotdb.utils.IoTDBConstants import TSDataType
|
|
31
|
-
from iotdb.utils.rpc_utils import verify_success
|
|
31
|
+
from iotdb.utils.rpc_utils import verify_success, convert_to_timestamp
|
|
32
32
|
|
|
33
33
|
logger = logging.getLogger("IoTDB")
|
|
34
34
|
TIMESTAMP_STR = "Time"
|
|
@@ -41,7 +41,6 @@ class IoTDBRpcDataSet(object):
|
|
|
41
41
|
sql,
|
|
42
42
|
column_name_list,
|
|
43
43
|
column_type_list,
|
|
44
|
-
column_name_index,
|
|
45
44
|
ignore_timestamp,
|
|
46
45
|
more_data,
|
|
47
46
|
query_id,
|
|
@@ -51,6 +50,8 @@ class IoTDBRpcDataSet(object):
|
|
|
51
50
|
query_result,
|
|
52
51
|
fetch_size,
|
|
53
52
|
time_out,
|
|
53
|
+
zone_id,
|
|
54
|
+
time_precision,
|
|
54
55
|
column_index_2_tsblock_column_index_list,
|
|
55
56
|
):
|
|
56
57
|
self.__statement_id = statement_id
|
|
@@ -117,6 +118,8 @@ class IoTDBRpcDataSet(object):
|
|
|
117
118
|
self.__empty_resultSet = False
|
|
118
119
|
self.has_cached_data_frame = False
|
|
119
120
|
self.data_frame = None
|
|
121
|
+
self.__zone_id = zone_id
|
|
122
|
+
self.__time_precision = time_precision
|
|
120
123
|
|
|
121
124
|
def close(self):
|
|
122
125
|
if self.__is_closed:
|
|
@@ -155,7 +158,7 @@ class IoTDBRpcDataSet(object):
|
|
|
155
158
|
|
|
156
159
|
def construct_one_data_frame(self):
|
|
157
160
|
if self.has_cached_data_frame or self.__query_result is None:
|
|
158
|
-
return
|
|
161
|
+
return
|
|
159
162
|
result = {}
|
|
160
163
|
has_pd_series = []
|
|
161
164
|
for i in range(len(self.__column_index_2_tsblock_column_index_list)):
|
|
@@ -264,8 +267,8 @@ class IoTDBRpcDataSet(object):
|
|
|
264
267
|
continue
|
|
265
268
|
data_type = self.__data_type_for_tsblock_column[location]
|
|
266
269
|
column_array = column_arrays[location]
|
|
267
|
-
# BOOLEAN, INT32, INT64, FLOAT, DOUBLE,
|
|
268
|
-
if data_type in (0, 1, 2, 3, 4,
|
|
270
|
+
# BOOLEAN, INT32, INT64, FLOAT, DOUBLE, BLOB
|
|
271
|
+
if data_type in (0, 1, 2, 3, 4, 10):
|
|
269
272
|
data_array = column_array
|
|
270
273
|
if (
|
|
271
274
|
data_type != 10
|
|
@@ -278,6 +281,17 @@ class IoTDBRpcDataSet(object):
|
|
|
278
281
|
# TEXT, STRING
|
|
279
282
|
elif data_type in (5, 11):
|
|
280
283
|
data_array = np.array([x.decode("utf-8") for x in column_array])
|
|
284
|
+
# TIMESTAMP
|
|
285
|
+
elif data_type == 8:
|
|
286
|
+
data_array = pd.Series(
|
|
287
|
+
[
|
|
288
|
+
convert_to_timestamp(
|
|
289
|
+
x, self.__time_precision, self.__zone_id
|
|
290
|
+
)
|
|
291
|
+
for x in column_array
|
|
292
|
+
],
|
|
293
|
+
dtype=object,
|
|
294
|
+
)
|
|
281
295
|
# DATE
|
|
282
296
|
elif data_type == 9:
|
|
283
297
|
data_array = pd.Series(column_array).apply(parse_int_to_date)
|
|
@@ -289,25 +303,21 @@ class IoTDBRpcDataSet(object):
|
|
|
289
303
|
data_type == 0 and null_indicator is not None
|
|
290
304
|
):
|
|
291
305
|
tmp_array = []
|
|
292
|
-
# BOOLEAN, INT32, INT64
|
|
293
|
-
if
|
|
294
|
-
data_type == 0
|
|
295
|
-
or data_type == 1
|
|
296
|
-
or data_type == 2
|
|
297
|
-
or data_type == 8
|
|
298
|
-
):
|
|
306
|
+
# BOOLEAN, INT32, INT64
|
|
307
|
+
if data_type == 0 or data_type == 1 or data_type == 2:
|
|
299
308
|
tmp_array = np.full(array_length, pd.NA, dtype=object)
|
|
300
309
|
# FLOAT, DOUBLE
|
|
301
310
|
elif data_type == 3 or data_type == 4:
|
|
302
311
|
tmp_array = np.full(
|
|
303
312
|
array_length, np.nan, dtype=data_type.np_dtype()
|
|
304
313
|
)
|
|
305
|
-
# TEXT, STRING, BLOB, DATE
|
|
314
|
+
# TEXT, STRING, BLOB, DATE, TIMESTAMP
|
|
306
315
|
elif (
|
|
307
316
|
data_type == 5
|
|
308
317
|
or data_type == 11
|
|
309
318
|
or data_type == 10
|
|
310
319
|
or data_type == 9
|
|
320
|
+
or data_type == 8
|
|
311
321
|
):
|
|
312
322
|
tmp_array = np.full(array_length, None, dtype=object)
|
|
313
323
|
|
|
@@ -320,7 +330,7 @@ class IoTDBRpcDataSet(object):
|
|
|
320
330
|
|
|
321
331
|
if data_type == 1:
|
|
322
332
|
tmp_array = pd.Series(tmp_array).astype("Int32")
|
|
323
|
-
elif data_type == 2
|
|
333
|
+
elif data_type == 2:
|
|
324
334
|
tmp_array = pd.Series(tmp_array).astype("Int64")
|
|
325
335
|
elif data_type == 0:
|
|
326
336
|
tmp_array = pd.Series(tmp_array).astype("boolean")
|
iotdb/utils/rpc_utils.py
CHANGED
|
@@ -15,9 +15,17 @@
|
|
|
15
15
|
# specific language governing permissions and limitations
|
|
16
16
|
# under the License.
|
|
17
17
|
#
|
|
18
|
+
import logging
|
|
19
|
+
|
|
20
|
+
import pandas as pd
|
|
21
|
+
from pandas._libs import OutOfBoundsDatetime
|
|
22
|
+
from tzlocal import get_localzone_name
|
|
23
|
+
|
|
18
24
|
from iotdb.thrift.common.ttypes import TSStatus
|
|
19
25
|
from iotdb.utils.exception import RedirectException, StatementExecutionException
|
|
20
26
|
|
|
27
|
+
logger = logging.getLogger("IoTDB")
|
|
28
|
+
|
|
21
29
|
SUCCESS_STATUS = 200
|
|
22
30
|
MULTIPLE_ERROR = 302
|
|
23
31
|
REDIRECTION_RECOMMEND = 400
|
|
@@ -67,3 +75,36 @@ def verify_success_with_redirection_for_multi_devices(status: TSStatus, devices:
|
|
|
67
75
|
if status.subStatus[i].redirectNode is not None:
|
|
68
76
|
device_to_endpoint[devices[i]] = status.subStatus[i].redirectNode
|
|
69
77
|
raise RedirectException(device_to_endpoint)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def convert_to_timestamp(time: int, precision: str, timezone: str):
|
|
81
|
+
try:
|
|
82
|
+
return pd.Timestamp(time, unit=precision, tz=timezone)
|
|
83
|
+
except OutOfBoundsDatetime:
|
|
84
|
+
return pd.Timestamp(time, unit=precision).tz_localize(timezone)
|
|
85
|
+
except ValueError:
|
|
86
|
+
logger.warning(
|
|
87
|
+
f"Timezone string '{timezone}' cannot be recognized by pandas. "
|
|
88
|
+
f"Falling back to local timezone: '{get_localzone_name()}'."
|
|
89
|
+
)
|
|
90
|
+
return pd.Timestamp(time, unit=precision, tz=get_localzone_name())
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
unit_map = {
|
|
94
|
+
"ms": "milliseconds",
|
|
95
|
+
"us": "microseconds",
|
|
96
|
+
"ns": "nanoseconds",
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def isoformat(ts: pd.Timestamp, unit: str):
|
|
101
|
+
if unit not in unit_map:
|
|
102
|
+
raise ValueError(f"Unsupported unit: {unit}")
|
|
103
|
+
try:
|
|
104
|
+
return ts.isoformat(timespec=unit_map[unit])
|
|
105
|
+
except ValueError:
|
|
106
|
+
logger.warning(
|
|
107
|
+
f"Timezone string '{unit_map[unit]}' cannot be recognized by old version pandas. "
|
|
108
|
+
f"Falling back to use auto timespec'."
|
|
109
|
+
)
|
|
110
|
+
return ts.isoformat()
|
|
@@ -113,7 +113,9 @@ def create_open_session():
|
|
|
113
113
|
port_ = "6667"
|
|
114
114
|
username_ = "root"
|
|
115
115
|
password_ = "root"
|
|
116
|
-
session = Session(
|
|
116
|
+
session = Session(
|
|
117
|
+
ip, port_, username_, password_, fetch_size=1024, zone_id="Asia/Shanghai"
|
|
118
|
+
)
|
|
117
119
|
session.open(False)
|
|
118
120
|
return session
|
|
119
121
|
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
from datetime import date
|
|
19
19
|
|
|
20
20
|
import numpy as np
|
|
21
|
+
import pandas as pd
|
|
22
|
+
from tzlocal import get_localzone_name
|
|
21
23
|
|
|
22
24
|
from iotdb.Session import Session
|
|
23
25
|
from iotdb.SessionPool import PoolConfig, create_session_pool
|
|
@@ -47,8 +49,7 @@ def session_test(use_session_pool=False):
|
|
|
47
49
|
"root",
|
|
48
50
|
None,
|
|
49
51
|
1024,
|
|
50
|
-
|
|
51
|
-
3,
|
|
52
|
+
max_retry=3,
|
|
52
53
|
)
|
|
53
54
|
session_pool = create_session_pool(pool_config, 1, 3000)
|
|
54
55
|
session = session_pool.get_session()
|
|
@@ -134,10 +135,9 @@ def session_test(use_session_pool=False):
|
|
|
134
135
|
assert row_record.get_fields()[0].get_date_value() == date(
|
|
135
136
|
2024, 1, timestamp
|
|
136
137
|
)
|
|
137
|
-
assert (
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
)
|
|
138
|
+
assert row_record.get_fields()[1].get_object_value(
|
|
139
|
+
TSDataType.TIMESTAMP
|
|
140
|
+
) == pd.Timestamp(timestamp, unit="ms", tz=get_localzone_name())
|
|
141
141
|
assert row_record.get_fields()[2].get_binary_value() == b"\x12\x34"
|
|
142
142
|
assert row_record.get_fields()[3].get_string_value() == "test0" + str(
|
|
143
143
|
timestamp
|
|
@@ -18,11 +18,14 @@
|
|
|
18
18
|
import math
|
|
19
19
|
|
|
20
20
|
import pandas as pd
|
|
21
|
+
from tzlocal import get_localzone_name
|
|
21
22
|
|
|
22
23
|
from iotdb.table_session import TableSession, TableSessionConfig
|
|
23
24
|
from iotdb.utils.IoTDBConstants import TSDataType
|
|
24
25
|
from iotdb.utils.Tablet import Tablet, ColumnType
|
|
25
26
|
from datetime import date
|
|
27
|
+
|
|
28
|
+
from iotdb.utils.rpc_utils import convert_to_timestamp
|
|
26
29
|
from .iotdb_container import IoTDBContainer
|
|
27
30
|
|
|
28
31
|
|
|
@@ -352,6 +355,15 @@ def test_query_data():
|
|
|
352
355
|
values[row][i],
|
|
353
356
|
rel_tol=1e-6,
|
|
354
357
|
)
|
|
358
|
+
elif data_types[i] == TSDataType.TIMESTAMP:
|
|
359
|
+
actual = row_record.get_fields()[i].get_timestamp_value()
|
|
360
|
+
expected = convert_to_timestamp(
|
|
361
|
+
values[row][i], "ms", get_localzone_name()
|
|
362
|
+
)
|
|
363
|
+
if pd.isnull(actual):
|
|
364
|
+
assert pd.isnull(expected)
|
|
365
|
+
else:
|
|
366
|
+
assert actual == expected
|
|
355
367
|
else:
|
|
356
368
|
assert (
|
|
357
369
|
row_record.get_fields()[i].get_object_value(data_types[i])
|
|
@@ -372,13 +384,21 @@ def test_query_data():
|
|
|
372
384
|
for i in range(rows):
|
|
373
385
|
for j in range(columns):
|
|
374
386
|
if pd.isna(df.iloc[i, j]):
|
|
375
|
-
|
|
387
|
+
continue
|
|
376
388
|
elif isinstance(values[i][j], float):
|
|
377
389
|
assert math.isclose(
|
|
378
390
|
df.iloc[i, j],
|
|
379
391
|
values[i][j],
|
|
380
392
|
rel_tol=1e-6,
|
|
381
393
|
)
|
|
394
|
+
elif isinstance(df.iloc[i, j], pd.Timestamp):
|
|
395
|
+
actual = df.iloc[i, j]
|
|
396
|
+
expected = pd.Series(
|
|
397
|
+
convert_to_timestamp(
|
|
398
|
+
values[i][j], "ms", get_localzone_name()
|
|
399
|
+
)
|
|
400
|
+
)[0]
|
|
401
|
+
assert actual == expected
|
|
382
402
|
else:
|
|
383
403
|
assert df.iloc[i, j] == values[i][j]
|
|
384
404
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|