You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/07/21 03:13:28 UTC
[incubator-iotdb] 02/02: added Apache licenses to Python files.
This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
commit 4dddddb370e65ee3e38f73edd6472c2b17130b9d
Author: Zekun Li <lz...@gmail.com>
AuthorDate: Sat Jul 18 22:54:10 2020 +0800
added Apache licenses to Python files.
---
client-py/src/Session.py | 31 ++++++++++++++++++++++---------
client-py/src/SessionExample.py | 17 +++++++++++++++++
client-py/src/utils/Field.py | 18 ++++++++++++++++++
client-py/src/utils/IoTDBConstants.py | 17 +++++++++++++++++
client-py/src/utils/IoTDBRpcDataSet.py | 34 +++++++++++++++++++++++++---------
client-py/src/utils/RowRecord.py | 18 ++++++++++++++++++
client-py/src/utils/SessionDataSet.py | 18 ++++++++++++++++++
client-py/src/utils/Tablet.py | 17 +++++++++++++++++
client-py/src/utils/__init__.py | 18 ++++++++++++++++++
9 files changed, 170 insertions(+), 18 deletions(-)
diff --git a/client-py/src/Session.py b/client-py/src/Session.py
index d3a7858..00b3bf5 100644
--- a/client-py/src/Session.py
+++ b/client-py/src/Session.py
@@ -1,13 +1,26 @@
-# Not yet supported:
-# 1. only supports ASCII in insertion
-# 2. Multi-thread safety
-# 3. Input checks (assumed users know what to do)
-# 4. exception capture
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
import sys
import struct
-sys.path.append("../target")
+# sys.path.append("../target")
+sys.path.append("../../thrift/target/generated-sources-python")
sys.path.append("./utils")
from IoTDBConstants import *
@@ -17,8 +30,8 @@ from thrift.protocol import TBinaryProtocol, TCompactProtocol
from thrift.transport import TSocket, TTransport
from iotdb.rpc.TSIService import Client, TSCreateTimeseriesReq, TSInsertRecordReq, TSInsertTabletReq, \
- TSExecuteStatementReq, TSOpenSessionReq, TSInsertRecordsReq, TSCreateMultiTimeseriesReq, TSCloseSessionReq, \
- TSInsertTabletsReq
+ TSExecuteStatementReq, TSOpenSessionReq, TSQueryDataSet, TSFetchResultsReq, TSCloseOperationReq, \
+ TSCreateMultiTimeseriesReq, TSCloseSessionReq, TSInsertTabletsReq, TSInsertRecordsReq
from iotdb.rpc.ttypes import TSDeleteDataReq, TSProtocolVersion, TSSetTimeZoneReq
@@ -186,7 +199,7 @@ class Session(object):
except TTransport.TException as e:
print("data deletion fails because: ", e)
- def insert_record(self, device_id, timestamp, measurements, string_values):
+ def insert_str_record(self, device_id, timestamp, measurements, string_values):
""" special case for inserting one row of String (TEXT) value """
data_types = [TSDataType.TEXT.value for _ in string_values]
request = self.gen_insert_record_req(device_id, timestamp, measurements, data_types, string_values)
diff --git a/client-py/src/SessionExample.py b/client-py/src/SessionExample.py
index c53bf22..2aac6e9 100644
--- a/client-py/src/SessionExample.py
+++ b/client-py/src/SessionExample.py
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
import sys
sys.path.append("./utils")
diff --git a/client-py/src/utils/Field.py b/client-py/src/utils/Field.py
index f1d5b35..7b5fea5 100644
--- a/client-py/src/utils/Field.py
+++ b/client-py/src/utils/Field.py
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
from IoTDBConstants import TSDataType
diff --git a/client-py/src/utils/IoTDBConstants.py b/client-py/src/utils/IoTDBConstants.py
index cc69e79..7e31262 100644
--- a/client-py/src/utils/IoTDBConstants.py
+++ b/client-py/src/utils/IoTDBConstants.py
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
from enum import Enum, unique
diff --git a/client-py/src/utils/IoTDBRpcDataSet.py b/client-py/src/utils/IoTDBRpcDataSet.py
index 2707a28..f712c98 100644
--- a/client-py/src/utils/IoTDBRpcDataSet.py
+++ b/client-py/src/utils/IoTDBRpcDataSet.py
@@ -1,18 +1,30 @@
-import sys
-from IoTDBConstants import *
-sys.path.append("../../target")
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
-from thrift.transport import TSocket, TTransport
+from IoTDBConstants import *
-from iotdb.rpc.TSIService import Client, TSCreateTimeseriesReq, TSInsertRecordReq, TSInsertTabletReq, \
- TSExecuteStatementReq, TSOpenSessionReq, TSQueryDataSet, TSFetchResultsReq, TSCloseOperationReq, \
- TSCreateMultiTimeseriesReq, TSCloseSessionReq, TSInsertTabletsReq
-from iotdb.rpc.ttypes import TSFetchMetadataReq, TSProtocolVersion
+from thrift.transport import TTransport
+from iotdb.rpc.TSIService import TSFetchResultsReq, TSCloseOperationReq
class IoTDBRpcDataSet(object):
TIMESTAMP_STR = "Time"
- VALUE_IS_NULL = "The value got by %s (column name) is NULL."
+ # VALUE_IS_NULL = "The value got by %s (column name) is NULL."
START_INDEX = 2
FLAG = 0x80
@@ -94,10 +106,13 @@ class IoTDBRpcDataSet(object):
return (self.__query_data_set is not None) and (len(self.__query_data_set.time) != 0)
def construct_one_row(self):
+ # simulating buffer, read 8 bytes from data set and discard first 8 bytes which have been read.
self.__time_bytes = self.__query_data_set.time[:8]
self.__query_data_set.time = self.__query_data_set.time[8:]
for i in range(len(self.__query_data_set.bitmapList)):
bitmap_buffer = self.__query_data_set.bitmapList[i]
+
+ # another 8 new rows, should move the bitmap buffer position to next byte
if self.__rows_index % 8 == 0:
self.__current_bitmap[i] = bitmap_buffer[0]
self.__query_data_set.bitmapList[i] = bitmap_buffer[1:]
@@ -105,6 +120,7 @@ class IoTDBRpcDataSet(object):
value_buffer = self.__query_data_set.valueList[i]
data_type = self.__column_type_deduplicated_list[i]
+ # simulating buffer
if data_type == TSDataType.BOOLEAN:
self.__value[i] = value_buffer[:1]
self.__query_data_set.valueList[i] = value_buffer[1:]
diff --git a/client-py/src/utils/RowRecord.py b/client-py/src/utils/RowRecord.py
index d22884e..78e0362 100644
--- a/client-py/src/utils/RowRecord.py
+++ b/client-py/src/utils/RowRecord.py
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
from IoTDBConstants import TSDataType
from Field import Field
diff --git a/client-py/src/utils/SessionDataSet.py b/client-py/src/utils/SessionDataSet.py
index e312cbd..92662cc 100644
--- a/client-py/src/utils/SessionDataSet.py
+++ b/client-py/src/utils/SessionDataSet.py
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
from IoTDBConstants import TSDataType
from IoTDBRpcDataSet import IoTDBRpcDataSet
from Field import Field
diff --git a/client-py/src/utils/Tablet.py b/client-py/src/utils/Tablet.py
index ab8a5af..51798a4 100644
--- a/client-py/src/utils/Tablet.py
+++ b/client-py/src/utils/Tablet.py
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
from IoTDBConstants import *
import struct
diff --git a/client-py/src/utils/__init__.py b/client-py/src/utils/__init__.py
index e69de29..a4797b6 100644
--- a/client-py/src/utils/__init__.py
+++ b/client-py/src/utils/__init__.py
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+