apache-iotdb 2.0.11__py3-none-any.whl → 2.0.12__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.11.dist-info → apache_iotdb-2.0.12.dist-info}/METADATA +1 -1
- {apache_iotdb-2.0.11.dist-info → apache_iotdb-2.0.12.dist-info}/RECORD +19 -15
- {apache_iotdb-2.0.11.dist-info → apache_iotdb-2.0.12.dist-info}/WHEEL +1 -1
- iotdb/Session.py +134 -53
- iotdb/thrift/common/ttypes.py +232 -67
- iotdb/thrift/confignode/IConfigNodeRPCService.py +56 -56
- iotdb/thrift/confignode/ttypes.py +688 -279
- iotdb/thrift/datanode/IDataNodeRPCService.py +167 -6
- iotdb/thrift/datanode/MPPDataExchangeService.py +397 -0
- iotdb/thrift/datanode/ttypes.py +774 -468
- iotdb/utils/BitMap.py +39 -0
- iotdb/utils/SessionUtils.py +128 -0
- iotdb/utils/Tablet.py +6 -0
- iotdb/utils/rpc_utils.py +7 -4
- tests/unit/test_rpc_utils.py +56 -0
- tests/unit/test_session_node_url.py +85 -0
- tests/unit/test_session_utils.py +160 -0
- {apache_iotdb-2.0.11.dist-info → apache_iotdb-2.0.12.dist-info}/entry_points.txt +0 -0
- {apache_iotdb-2.0.11.dist-info → apache_iotdb-2.0.12.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
iotdb/Session.py,sha256=
|
|
1
|
+
iotdb/Session.py,sha256=uTfPey1dUefmX_C6s-3zN4QVa9K_7shnvrvF41fp-qE,106381
|
|
2
2
|
iotdb/SessionPool.py,sha256=bF4_xv-rBvWVlkHEwh3nqHA8Dqlduduyl0HM5FOT8V0,7051
|
|
3
3
|
iotdb/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
|
|
4
4
|
iotdb/table_session.py,sha256=MbPOI80uqkewLrjU1WM1Eg9ykgU4dt4mTwAEBJMwUes,6436
|
|
@@ -20,16 +20,16 @@ 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=J1z6mszd_3klwrgFDNrNEiMClInMP87lx5NVK017ckk,388
|
|
23
|
-
iotdb/thrift/common/ttypes.py,sha256=
|
|
24
|
-
iotdb/thrift/confignode/IConfigNodeRPCService.py,sha256=
|
|
23
|
+
iotdb/thrift/common/ttypes.py,sha256=x1x2pfSL8LoX2hOAgHiAzMqfeOdgGBgsS5wHiamKocM,145989
|
|
24
|
+
iotdb/thrift/confignode/IConfigNodeRPCService.py,sha256=_jbA8_IKl_tQnDXzizDWekIkKaUddFPObxLduIc3wfk,1064170
|
|
25
25
|
iotdb/thrift/confignode/__init__.py,sha256=_SxvW-9GzGZcPWR-szpFI_VrvxJvSfjwu8HEieGWtik,59
|
|
26
26
|
iotdb/thrift/confignode/constants.py,sha256=J1z6mszd_3klwrgFDNrNEiMClInMP87lx5NVK017ckk,388
|
|
27
|
-
iotdb/thrift/confignode/ttypes.py,sha256=
|
|
28
|
-
iotdb/thrift/datanode/IDataNodeRPCService.py,sha256=
|
|
29
|
-
iotdb/thrift/datanode/MPPDataExchangeService.py,sha256=
|
|
27
|
+
iotdb/thrift/confignode/ttypes.py,sha256=fwwRvgVQXVLW8ZUWiVPqw5IdHaAcZyUOgkF_GG8SfA8,780180
|
|
28
|
+
iotdb/thrift/datanode/IDataNodeRPCService.py,sha256=SoKoCuNPLwTafYeokBs-jbYCerZ9p5Dsb6TASY9pTPE,725380
|
|
29
|
+
iotdb/thrift/datanode/MPPDataExchangeService.py,sha256=C5sAIRBNTYzpFJUvIclOfFTQSF9odRMuNOS-DpLlssg,49845
|
|
30
30
|
iotdb/thrift/datanode/__init__.py,sha256=J5dw3MYQMv2wUCQqOxUUdaNrCJP8j3Iy80Fv-PJ70S4,83
|
|
31
31
|
iotdb/thrift/datanode/constants.py,sha256=J1z6mszd_3klwrgFDNrNEiMClInMP87lx5NVK017ckk,388
|
|
32
|
-
iotdb/thrift/datanode/ttypes.py,sha256=
|
|
32
|
+
iotdb/thrift/datanode/ttypes.py,sha256=r30Gp93OA0311ghyhpsrMJ8gEyiJ7_bGzorwtQVvQjQ,542556
|
|
33
33
|
iotdb/thrift/rpc/IClientRPCService.py,sha256=grGLFvdVqy2KZ0k944kLRSolBSnfcuZNNvCwoHxdHQ4,442270
|
|
34
34
|
iotdb/thrift/rpc/__init__.py,sha256=69gRO2XxQu71SDeCRxiZFjK6Xw_61hdl5MdWceI-e1A,55
|
|
35
35
|
iotdb/thrift/rpc/constants.py,sha256=J1z6mszd_3klwrgFDNrNEiMClInMP87lx5NVK017ckk,388
|
|
@@ -43,17 +43,18 @@ iotdb/tsfile/utils/date_utils.py,sha256=Z31FexAA_pR72X2PDLT6pVJOFRWguIAEUjOyAwji
|
|
|
43
43
|
iotdb/tsfile/utils/pair.py,sha256=91ecijUAlEiMRLlH2hjRi_mT_xWp6Vm-R3n4Z4USFqQ,952
|
|
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=V8Lcr_umGL7wL3-6-NScUfcRiRCVGTJX2bNiUQSCAq0,8749
|
|
46
|
-
iotdb/utils/BitMap.py,sha256=
|
|
46
|
+
iotdb/utils/BitMap.py,sha256=zOlV3ffFsu7kvlUa4ezME8slO9VhhIEu3JVZEwwOsZw,2806
|
|
47
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
51
|
iotdb/utils/SessionDataSet.py,sha256=wU2fa4xlU8T5NSRPNLeRn5z9df8A5DCru4IO_CmqzXg,6573
|
|
52
|
-
iotdb/utils/
|
|
52
|
+
iotdb/utils/SessionUtils.py,sha256=UVAs-8QiMAB_cb1bhm-lfhNbzD2bfadfRUwi11aSdSo,4224
|
|
53
|
+
iotdb/utils/Tablet.py,sha256=bi6f6pc_I4Tu8PCXj5Khfkh5FYf-vBkGeLcNJ6bwvMg,10318
|
|
53
54
|
iotdb/utils/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
|
|
54
55
|
iotdb/utils/exception.py,sha256=iCSzBE2Cy1q_OwC3nHdGH-OnGuwy0iPRY63VQvO8fcg,1834
|
|
55
56
|
iotdb/utils/iotdb_rpc_dataset.py,sha256=SyzpddGVTQTaFb_OMmf3xWN6ojv_rcBoFwe5wUZvbKM,19165
|
|
56
|
-
iotdb/utils/rpc_utils.py,sha256=
|
|
57
|
+
iotdb/utils/rpc_utils.py,sha256=XfKhoEv6jJ4e-eeuIxCMwFwP8cSTPS6bQY3mYi5gRbg,6112
|
|
57
58
|
tests/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
|
|
58
59
|
tests/integration/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
|
|
59
60
|
tests/integration/iotdb_container.py,sha256=nDBwiFwTETVisgVAOpjhECdHdgSfO8i_4k0wOrFmIU0,2551
|
|
@@ -78,10 +79,13 @@ tests/integration/sqlalchemy/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a
|
|
|
78
79
|
tests/integration/sqlalchemy/test_dialect.py,sha256=HF2lJuV19l4Kfi7u3ZQ5vCFtu-xd3U8EFkgjXvJTi9o,3767
|
|
79
80
|
tests/unit/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
|
|
80
81
|
tests/unit/test_numpy_tablet.py,sha256=w3lLK8Cft7lGsCj_6Z1Y7kDshltN0osSDJb-EESi6_Y,7235
|
|
82
|
+
tests/unit/test_rpc_utils.py,sha256=JxIzKEyFHNA9KftCTgVPQGrIdsxNYQZl4pZXxb37Lf4,2359
|
|
81
83
|
tests/unit/test_session_connection.py,sha256=W6anKyz30bhdeN8JqrEtPUIbQAlTTdQumr4NU54RBv0,3576
|
|
84
|
+
tests/unit/test_session_node_url.py,sha256=x06jAMj1qZScJSQyY_2TOQNMtHm8umZu0RNWORqNjyY,2254
|
|
82
85
|
tests/unit/test_session_ssl.py,sha256=sGYz-9HxDNuJh2gfms58ASFYC7I54qAGj5vYFKyLdOQ,4764
|
|
83
|
-
|
|
84
|
-
apache_iotdb-2.0.
|
|
85
|
-
apache_iotdb-2.0.
|
|
86
|
-
apache_iotdb-2.0.
|
|
87
|
-
apache_iotdb-2.0.
|
|
86
|
+
tests/unit/test_session_utils.py,sha256=Se7kvPwzpiA4tX_6ygCGMqJdsiVC9yNPMHIqbKSabrk,5072
|
|
87
|
+
apache_iotdb-2.0.12.dist-info/METADATA,sha256=YHDLiFolJOf8HpMGdPce_4QURygfpDRiWoSZGpdqkSM,19628
|
|
88
|
+
apache_iotdb-2.0.12.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
89
|
+
apache_iotdb-2.0.12.dist-info/entry_points.txt,sha256=BmQWy6NHyWXorQcVm8-VWpt9MSqe46UFyV2hnsl4yok,73
|
|
90
|
+
apache_iotdb-2.0.12.dist-info/top_level.txt,sha256=B9jGGOaAAqF1WrWw2jX2K-naWAZn2nhyrL-6hM1qwyM,12
|
|
91
|
+
apache_iotdb-2.0.12.dist-info/RECORD,,
|
iotdb/Session.py
CHANGED
|
@@ -16,48 +16,51 @@
|
|
|
16
16
|
# under the License.
|
|
17
17
|
#
|
|
18
18
|
|
|
19
|
+
import ipaddress
|
|
19
20
|
import logging
|
|
20
21
|
import random
|
|
21
|
-
import sys
|
|
22
22
|
import struct
|
|
23
|
+
import sys
|
|
23
24
|
import warnings
|
|
25
|
+
|
|
26
|
+
from iotdb.utils.SessionDataSet import SessionDataSet
|
|
27
|
+
from iotdb.utils.SessionUtils import filter_null_columns
|
|
24
28
|
from thrift.protocol import TBinaryProtocol, TCompactProtocol
|
|
25
29
|
from thrift.transport import TSocket, TTransport
|
|
26
30
|
from tzlocal import get_localzone_name
|
|
27
31
|
|
|
28
|
-
from iotdb.utils.SessionDataSet import SessionDataSet
|
|
29
32
|
from .template.Template import Template
|
|
30
33
|
from .template.TemplateQueryType import TemplateQueryType
|
|
31
34
|
from .thrift.common.ttypes import TEndPoint
|
|
32
35
|
from .thrift.rpc.IClientRPCService import (
|
|
33
36
|
Client,
|
|
34
|
-
|
|
37
|
+
TSAppendSchemaTemplateReq,
|
|
38
|
+
TSCloseSessionReq,
|
|
35
39
|
TSCreateAlignedTimeseriesReq,
|
|
40
|
+
TSCreateMultiTimeseriesReq,
|
|
41
|
+
TSCreateSchemaTemplateReq,
|
|
42
|
+
TSCreateTimeseriesReq,
|
|
43
|
+
TSDropSchemaTemplateReq,
|
|
44
|
+
TSExecuteStatementReq,
|
|
36
45
|
TSInsertRecordReq,
|
|
46
|
+
TSInsertRecordsOfOneDeviceReq,
|
|
47
|
+
TSInsertRecordsReq,
|
|
37
48
|
TSInsertStringRecordReq,
|
|
38
49
|
TSInsertTabletReq,
|
|
39
|
-
TSExecuteStatementReq,
|
|
40
|
-
TSOpenSessionReq,
|
|
41
|
-
TSCreateMultiTimeseriesReq,
|
|
42
|
-
TSCloseSessionReq,
|
|
43
50
|
TSInsertTabletsReq,
|
|
44
|
-
|
|
45
|
-
TSInsertRecordsOfOneDeviceReq,
|
|
46
|
-
TSCreateSchemaTemplateReq,
|
|
47
|
-
TSDropSchemaTemplateReq,
|
|
48
|
-
TSAppendSchemaTemplateReq,
|
|
51
|
+
TSOpenSessionReq,
|
|
49
52
|
TSPruneSchemaTemplateReq,
|
|
53
|
+
TSQueryTemplateReq,
|
|
50
54
|
TSSetSchemaTemplateReq,
|
|
51
55
|
TSUnsetSchemaTemplateReq,
|
|
52
|
-
TSQueryTemplateReq,
|
|
53
56
|
)
|
|
54
57
|
from .thrift.rpc.ttypes import (
|
|
55
58
|
TSDeleteDataReq,
|
|
59
|
+
TSInsertStringRecordsOfOneDeviceReq,
|
|
60
|
+
TSLastDataQueryReq,
|
|
56
61
|
TSProtocolVersion,
|
|
57
|
-
TSSetTimeZoneReq,
|
|
58
62
|
TSRawDataQueryReq,
|
|
59
|
-
|
|
60
|
-
TSInsertStringRecordsOfOneDeviceReq,
|
|
63
|
+
TSSetTimeZoneReq,
|
|
61
64
|
)
|
|
62
65
|
from .tsfile.utils.date_utils import parse_date_to_int
|
|
63
66
|
from .utils import rpc_utils
|
|
@@ -67,6 +70,48 @@ logger = logging.getLogger("IoTDB")
|
|
|
67
70
|
warnings.simplefilter("always", DeprecationWarning)
|
|
68
71
|
|
|
69
72
|
|
|
73
|
+
def _parse_endpoint_url(endpoint_url):
|
|
74
|
+
if endpoint_url.startswith("["):
|
|
75
|
+
end_index = endpoint_url.find("]")
|
|
76
|
+
if end_index <= 1 or end_index + 1 >= len(endpoint_url):
|
|
77
|
+
raise RuntimeError("invalid node url: {}".format(endpoint_url))
|
|
78
|
+
if endpoint_url[end_index + 1] != ":":
|
|
79
|
+
raise RuntimeError("invalid node url: {}".format(endpoint_url))
|
|
80
|
+
return endpoint_url[1:end_index], _parse_endpoint_port(
|
|
81
|
+
endpoint_url, endpoint_url[end_index + 2 :]
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
if "[" in endpoint_url or "]" in endpoint_url:
|
|
85
|
+
raise RuntimeError("invalid node url: {}".format(endpoint_url))
|
|
86
|
+
split = endpoint_url.rsplit(":", 1)
|
|
87
|
+
if len(split) != 2:
|
|
88
|
+
raise RuntimeError("invalid node url: {}".format(endpoint_url))
|
|
89
|
+
return split[0], _parse_endpoint_port(endpoint_url, split[1])
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _parse_endpoint_port(endpoint_url, port):
|
|
93
|
+
try:
|
|
94
|
+
return int(port)
|
|
95
|
+
except ValueError as e:
|
|
96
|
+
raise RuntimeError("invalid node url: {}".format(endpoint_url)) from e
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def _is_wildcard_address(host):
|
|
100
|
+
if host is None:
|
|
101
|
+
return False
|
|
102
|
+
normalized_host = host
|
|
103
|
+
if normalized_host.startswith("[") and normalized_host.endswith("]"):
|
|
104
|
+
normalized_host = normalized_host[1:-1]
|
|
105
|
+
if normalized_host == "0.0.0.0":
|
|
106
|
+
return True
|
|
107
|
+
if ":" not in normalized_host:
|
|
108
|
+
return False
|
|
109
|
+
try:
|
|
110
|
+
return ipaddress.ip_address(normalized_host).is_unspecified
|
|
111
|
+
except ValueError:
|
|
112
|
+
return False
|
|
113
|
+
|
|
114
|
+
|
|
70
115
|
class Session(object):
|
|
71
116
|
DEFAULT_FETCH_SIZE = 5000
|
|
72
117
|
DEFAULT_USER = "root"
|
|
@@ -158,9 +203,9 @@ class Session(object):
|
|
|
158
203
|
session.__hosts = []
|
|
159
204
|
session.__ports = []
|
|
160
205
|
for node_url in node_urls:
|
|
161
|
-
|
|
162
|
-
session.__hosts.append(
|
|
163
|
-
session.__ports.append(
|
|
206
|
+
host, port = _parse_endpoint_url(node_url)
|
|
207
|
+
session.__hosts.append(host)
|
|
208
|
+
session.__ports.append(port)
|
|
164
209
|
session.__host = session.__hosts[0]
|
|
165
210
|
session.__port = session.__ports[0]
|
|
166
211
|
session.__default_endpoint = TEndPoint(session.__host, session.__port)
|
|
@@ -262,6 +307,7 @@ class Session(object):
|
|
|
262
307
|
def __get_transport(self, endpoint):
|
|
263
308
|
if self.__use_ssl:
|
|
264
309
|
import ssl
|
|
310
|
+
|
|
265
311
|
from thrift.transport import TSSLSocket
|
|
266
312
|
|
|
267
313
|
if sys.version_info >= (3, 10):
|
|
@@ -1050,6 +1096,8 @@ class Session(object):
|
|
|
1050
1096
|
:param tablet: a tablet specified above
|
|
1051
1097
|
"""
|
|
1052
1098
|
request = self.gen_insert_tablet_req(tablet)
|
|
1099
|
+
if request is None:
|
|
1100
|
+
return
|
|
1053
1101
|
try:
|
|
1054
1102
|
connection = self.get_connection(tablet.get_insert_target_name())
|
|
1055
1103
|
request.sessionId = connection.session_id
|
|
@@ -1078,19 +1126,24 @@ class Session(object):
|
|
|
1078
1126
|
if self.__enable_redirection:
|
|
1079
1127
|
request_group = {}
|
|
1080
1128
|
for i in range(len(tablet_lst)):
|
|
1081
|
-
|
|
1129
|
+
filtered = filter_null_columns(tablet_lst[i])
|
|
1130
|
+
if filtered is None:
|
|
1131
|
+
continue
|
|
1132
|
+
connection = self.get_connection(filtered.get_insert_target_name())
|
|
1082
1133
|
request = request_group.setdefault(
|
|
1083
1134
|
connection.client,
|
|
1084
1135
|
TSInsertTabletsReq(
|
|
1085
1136
|
connection.session_id, [], [], [], [], [], [], False
|
|
1086
1137
|
),
|
|
1087
1138
|
)
|
|
1088
|
-
request.prefixPaths.append(
|
|
1089
|
-
request.timestampsList.append(
|
|
1090
|
-
request.measurementsList.append(
|
|
1091
|
-
request.valuesList.append(
|
|
1092
|
-
request.sizeList.append(
|
|
1093
|
-
request.typesList.append(
|
|
1139
|
+
request.prefixPaths.append(filtered.get_insert_target_name())
|
|
1140
|
+
request.timestampsList.append(filtered.get_binary_timestamps())
|
|
1141
|
+
request.measurementsList.append(filtered.get_measurements())
|
|
1142
|
+
request.valuesList.append(filtered.get_binary_values())
|
|
1143
|
+
request.sizeList.append(filtered.get_row_number())
|
|
1144
|
+
request.typesList.append(filtered.get_data_types())
|
|
1145
|
+
if not request_group:
|
|
1146
|
+
return 0
|
|
1094
1147
|
for client, request in request_group.items():
|
|
1095
1148
|
try:
|
|
1096
1149
|
rpc_utils.verify_success_with_redirection_for_multi_devices(
|
|
@@ -1116,6 +1169,8 @@ class Session(object):
|
|
|
1116
1169
|
return 0
|
|
1117
1170
|
else:
|
|
1118
1171
|
request = self.gen_insert_tablets_req(tablet_lst)
|
|
1172
|
+
if request is None:
|
|
1173
|
+
return 0
|
|
1119
1174
|
try:
|
|
1120
1175
|
return rpc_utils.verify_success(self.__client.insertTablets(request))
|
|
1121
1176
|
except TTransport.TException as e:
|
|
@@ -1145,6 +1200,8 @@ class Session(object):
|
|
|
1145
1200
|
:param tablet: a tablet specified above
|
|
1146
1201
|
"""
|
|
1147
1202
|
request = self.gen_insert_tablet_req(tablet, True)
|
|
1203
|
+
if request is None:
|
|
1204
|
+
return
|
|
1148
1205
|
try:
|
|
1149
1206
|
connection = self.get_connection(tablet.get_insert_target_name())
|
|
1150
1207
|
request.sessionId = connection.session_id
|
|
@@ -1173,19 +1230,24 @@ class Session(object):
|
|
|
1173
1230
|
if self.__enable_redirection:
|
|
1174
1231
|
request_group = {}
|
|
1175
1232
|
for i in range(len(tablet_lst)):
|
|
1176
|
-
|
|
1233
|
+
filtered = filter_null_columns(tablet_lst[i])
|
|
1234
|
+
if filtered is None:
|
|
1235
|
+
continue
|
|
1236
|
+
connection = self.get_connection(filtered.get_insert_target_name())
|
|
1177
1237
|
request = request_group.setdefault(
|
|
1178
1238
|
connection.client,
|
|
1179
1239
|
TSInsertTabletsReq(
|
|
1180
1240
|
connection.session_id, [], [], [], [], [], [], True
|
|
1181
1241
|
),
|
|
1182
1242
|
)
|
|
1183
|
-
request.prefixPaths.append(
|
|
1184
|
-
request.timestampsList.append(
|
|
1185
|
-
request.measurementsList.append(
|
|
1186
|
-
request.valuesList.append(
|
|
1187
|
-
request.sizeList.append(
|
|
1188
|
-
request.typesList.append(
|
|
1243
|
+
request.prefixPaths.append(filtered.get_insert_target_name())
|
|
1244
|
+
request.timestampsList.append(filtered.get_binary_timestamps())
|
|
1245
|
+
request.measurementsList.append(filtered.get_measurements())
|
|
1246
|
+
request.valuesList.append(filtered.get_binary_values())
|
|
1247
|
+
request.sizeList.append(filtered.get_row_number())
|
|
1248
|
+
request.typesList.append(filtered.get_data_types())
|
|
1249
|
+
if not request_group:
|
|
1250
|
+
return 0
|
|
1189
1251
|
for client, request in request_group.items():
|
|
1190
1252
|
try:
|
|
1191
1253
|
rpc_utils.verify_success_with_redirection_for_multi_devices(
|
|
@@ -1211,6 +1273,8 @@ class Session(object):
|
|
|
1211
1273
|
return 0
|
|
1212
1274
|
else:
|
|
1213
1275
|
request = self.gen_insert_tablets_req(tablet_lst, True)
|
|
1276
|
+
if request is None:
|
|
1277
|
+
return 0
|
|
1214
1278
|
try:
|
|
1215
1279
|
return rpc_utils.verify_success(self.__client.insertTablets(request))
|
|
1216
1280
|
except TTransport.TException as e:
|
|
@@ -1237,6 +1301,8 @@ class Session(object):
|
|
|
1237
1301
|
:param tablet: a tablet specified above
|
|
1238
1302
|
"""
|
|
1239
1303
|
request = self.gen_insert_relational_tablet_req(tablet)
|
|
1304
|
+
if request is None:
|
|
1305
|
+
return
|
|
1240
1306
|
try:
|
|
1241
1307
|
connection = self.get_connection(tablet.get_insert_target_name())
|
|
1242
1308
|
request.sessionId = connection.session_id
|
|
@@ -1435,6 +1501,8 @@ class Session(object):
|
|
|
1435
1501
|
:param tablet: a tablet of data
|
|
1436
1502
|
"""
|
|
1437
1503
|
request = self.gen_insert_tablet_req(tablet)
|
|
1504
|
+
if request is None:
|
|
1505
|
+
return
|
|
1438
1506
|
try:
|
|
1439
1507
|
return rpc_utils.verify_success(self.__client.testInsertTablet(request))
|
|
1440
1508
|
except TTransport.TException as e:
|
|
@@ -1456,6 +1524,8 @@ class Session(object):
|
|
|
1456
1524
|
:param tablet_list: List of tablets
|
|
1457
1525
|
"""
|
|
1458
1526
|
request = self.gen_insert_tablets_req(tablet_list)
|
|
1527
|
+
if request is None:
|
|
1528
|
+
return
|
|
1459
1529
|
try:
|
|
1460
1530
|
return rpc_utils.verify_success(self.__client.testInsertTablets(request))
|
|
1461
1531
|
except TTransport.TException as e:
|
|
@@ -1471,29 +1541,35 @@ class Session(object):
|
|
|
1471
1541
|
raise IoTDBConnectionException(self.connection_error_msg()) from None
|
|
1472
1542
|
|
|
1473
1543
|
def gen_insert_tablet_req(self, tablet, is_aligned=False):
|
|
1544
|
+
filtered = filter_null_columns(tablet)
|
|
1545
|
+
if filtered is None:
|
|
1546
|
+
return None
|
|
1474
1547
|
return TSInsertTabletReq(
|
|
1475
1548
|
self.__session_id,
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1549
|
+
filtered.get_insert_target_name(),
|
|
1550
|
+
filtered.get_measurements(),
|
|
1551
|
+
filtered.get_binary_values(),
|
|
1552
|
+
filtered.get_binary_timestamps(),
|
|
1553
|
+
filtered.get_data_types(),
|
|
1554
|
+
filtered.get_row_number(),
|
|
1482
1555
|
is_aligned,
|
|
1483
1556
|
)
|
|
1484
1557
|
|
|
1485
1558
|
def gen_insert_relational_tablet_req(self, tablet, is_aligned=False):
|
|
1559
|
+
filtered = filter_null_columns(tablet)
|
|
1560
|
+
if filtered is None:
|
|
1561
|
+
return None
|
|
1486
1562
|
return TSInsertTabletReq(
|
|
1487
1563
|
self.__session_id,
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1564
|
+
filtered.get_insert_target_name(),
|
|
1565
|
+
filtered.get_measurements(),
|
|
1566
|
+
filtered.get_binary_values(),
|
|
1567
|
+
filtered.get_binary_timestamps(),
|
|
1568
|
+
filtered.get_data_types(),
|
|
1569
|
+
filtered.get_row_number(),
|
|
1494
1570
|
is_aligned,
|
|
1495
1571
|
True,
|
|
1496
|
-
|
|
1572
|
+
filtered.get_column_categories(),
|
|
1497
1573
|
)
|
|
1498
1574
|
|
|
1499
1575
|
def gen_insert_tablets_req(self, tablet_lst, is_aligned=False):
|
|
@@ -1504,12 +1580,17 @@ class Session(object):
|
|
|
1504
1580
|
type_lst = []
|
|
1505
1581
|
size_lst = []
|
|
1506
1582
|
for tablet in tablet_lst:
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1583
|
+
filtered = filter_null_columns(tablet)
|
|
1584
|
+
if filtered is None:
|
|
1585
|
+
continue
|
|
1586
|
+
device_id_lst.append(filtered.get_insert_target_name())
|
|
1587
|
+
measurements_lst.append(filtered.get_measurements())
|
|
1588
|
+
values_lst.append(filtered.get_binary_values())
|
|
1589
|
+
timestamps_lst.append(filtered.get_binary_timestamps())
|
|
1590
|
+
type_lst.append(filtered.get_data_types())
|
|
1591
|
+
size_lst.append(filtered.get_row_number())
|
|
1592
|
+
if not device_id_lst:
|
|
1593
|
+
return None
|
|
1513
1594
|
return TSInsertTabletsReq(
|
|
1514
1595
|
self.__session_id,
|
|
1515
1596
|
device_id_lst,
|
|
@@ -1989,7 +2070,7 @@ class Session(object):
|
|
|
1989
2070
|
|
|
1990
2071
|
def handle_redirection(self, device_id, endpoint: TEndPoint):
|
|
1991
2072
|
if self.__enable_redirection:
|
|
1992
|
-
if endpoint.ip
|
|
2073
|
+
if _is_wildcard_address(endpoint.ip):
|
|
1993
2074
|
return 0
|
|
1994
2075
|
if (
|
|
1995
2076
|
device_id not in self.__device_id_to_endpoint
|