You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hx...@apache.org on 2020/06/29 06:09:36 UTC

[incubator-iotdb] branch update_rpc_protocol created (now cabd625)

This is an automated email from the ASF dual-hosted git repository.

hxd pushed a change to branch update_rpc_protocol
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git.


      at cabd625  fix insertRecord serialize in Python example

This branch includes the following new commits:

     new cabd625  fix insertRecord serialize in Python example

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-iotdb] 01/01: fix insertRecord serialize in Python example

Posted by hx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hxd pushed a commit to branch update_rpc_protocol
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit cabd625b26afde06a38c05a109d9cd68040a7920
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Mon Jun 29 14:09:15 2020 +0800

    fix insertRecord serialize in Python example
---
 client-py/src/client_example.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/client-py/src/client_example.py b/client-py/src/client_example.py
index b20f372..9f27a2c 100755
--- a/client-py/src/client_example.py
+++ b/client-py/src/client_example.py
@@ -239,10 +239,10 @@ if __name__ == '__main__':
 
     # insert a single row
     values = [1, 11, 1.1, 11.1, True, "\'text0\'"]
-    dataTypes = [TSDataType['INT32'], TSDataType['INT32'], TSDataType['FLOAT'],
+    dataTypes = [TSDataType['INT64'], TSDataType['INT32'], TSDataType['DOUBLE'],
                  TSDataType['FLOAT'], TSDataType['BOOLEAN'], TSDataType['TEXT']]
     
-    value_pack_str = '>5ififibi7s'
+    value_pack_str = '>hqhihdhfh?hi' + str(len(values[5])) + 's'
     encoding = 'utf-8'
     valueByte = bytearray()
     
@@ -251,7 +251,7 @@ if __name__ == '__main__':
                                              dataTypes[2], values[2],
                                              dataTypes[3], values[3],
                                              dataTypes[4], values[4],
-                                             dataTypes[5], bytes(values[5], encoding)))
+                                             dataTypes[5], len(values[5]), bytes(values[5], encoding)))
     timestamp = 1
     
     status = client.insertRecord(TSInsertRecordReq(sessionId, deviceId, measurements, valueByte, timestamp))
@@ -262,8 +262,7 @@ if __name__ == '__main__':
     times = bytearray()
 
     rowCnt = 3
-    dataTypes = [TSDataType['INT64'], TSDataType['INT32'], TSDataType['DOUBLE'],
-                 TSDataType['FLOAT'], TSDataType['BOOLEAN'], TSDataType['TEXT']]
+
     # the first 3 belong to 's1', the second 3 belong to 's2'... the last 3
     # belong to 's6'
     # to transfer a string, you must first send its length and then its bytes