This is an automated email from the ASF dual-hosted git repository. xuekaifeng pushed a commit to branch new_doc_xkf in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit c0d6ae64c740a22fcbf387b092ed3d9a95a8fe3a Author: 151250176 <[email protected]> AuthorDate: Thu Mar 25 11:11:51 2021 +0800 add thrift doc --- docs/zh/UserGuide/Client/Programming - Thrift.md | 155 +++++++++++++++++++++ .../Ecosystem Integration/Spark TsFile.md | 1 + 2 files changed, 156 insertions(+) diff --git a/docs/zh/UserGuide/Client/Programming - Thrift.md b/docs/zh/UserGuide/Client/Programming - Thrift.md new file mode 100644 index 0000000..b77c317 --- /dev/null +++ b/docs/zh/UserGuide/Client/Programming - Thrift.md @@ -0,0 +1,155 @@ +<!-- + + 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. + +--> + +# thrift rpc 接口 + +## 简介 + +Thrift是一个远程方法调用软件框架,用来进行可扩展且跨语言的服务的开发。 +它结合了功能强大的软件堆栈和代码生成引擎, +以构建在 C++, Java, Go,Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, and OCaml 这些编程语言间无缝结合的、高效的服务。 + +IoTDB服务端和客户端之间使用thrift进行通信,实际使用中建议使用IoTDB提供的原生客户端封装: +Session或Session Pool。如有特殊需要,您也可以直接针对RPC接口进行编程 + +默认IoTDB服务端使用6667端口作为RPC通信端口,可修改配置项中的 +``` +rpc_port=6667 +``` +更改默认接口 + + +## rpc接口 + +``` +// 打开一个 session +TSOpenSessionResp openSession(1:TSOpenSessionReq req); + +// 关闭一个 session +TSStatus closeSession(1:TSCloseSessionReq req); + +// 执行一条 SQL 语句 +TSExecuteStatementResp executeStatement(1:TSExecuteStatementReq req); + +// 批量执行 SQL 语句 +TSStatus executeBatchStatement(1:TSExecuteBatchStatementReq req); + +// 执行查询 SQL 语句 +TSExecuteStatementResp executeQueryStatement(1:TSExecuteStatementReq req); + +// 执行插入、删除 SQL 语句 +TSExecuteStatementResp executeUpdateStatement(1:TSExecuteStatementReq req); + +// 向服务器取下一批查询结果 +TSFetchResultsResp fetchResults(1:TSFetchResultsReq req) + +// 获取元数据 +TSFetchMetadataResp fetchMetadata(1:TSFetchMetadataReq req) + +// 取消某次查询操作 +TSStatus cancelOperation(1:TSCancelOperationReq req); + +// 关闭查询操作数据集,释放资源 +TSStatus closeOperation(1:TSCloseOperationReq req); + +// 获取时区信息 +TSGetTimeZoneResp getTimeZone(1:i64 sessionId); + +// 设置时区 +TSStatus setTimeZone(1:TSSetTimeZoneReq req); + +// 获取服务端配置 +ServerProperties getProperties(); + +// 设置存储组 +TSStatus setStorageGroup(1:i64 sessionId, 2:string storageGroup); + +// 创建时间序列 +TSStatus createTimeseries(1:TSCreateTimeseriesReq req); + +// 创建多条时间序列 +TSStatus createMultiTimeseries(1:TSCreateMultiTimeseriesReq req); + +// 删除时间序列 +TSStatus deleteTimeseries(1:i64 sessionId, 2:list<string> path) + +// 删除存储组 +TSStatus deleteStorageGroups(1:i64 sessionId, 2:list<string> storageGroup); + +// 按行插入数据 +TSStatus insertRecord(1:TSInsertRecordReq req); + +// 按String格式插入一条数据 +TSStatus insertStringRecord(1:TSInsertStringRecordReq req); + +// 按列插入数据 +TSStatus insertTablet(1:TSInsertTabletReq req); + +// 按列批量插入数据 +TSStatus insertTablets(1:TSInsertTabletsReq req); + +// 按行批量插入数据 +TSStatus insertRecords(1:TSInsertRecordsReq req); + +// 按行批量插入同属于某个设备的数据 +TSStatus insertRecordsOfOneDevice(1:TSInsertRecordsOfOneDeviceReq req); + +// 按String格式批量按行插入数据 +TSStatus insertStringRecords(1:TSInsertStringRecordsReq req); + +// 测试按列插入数据的延迟,注意:该接口不真实插入数据,只用来测试网络延迟 +TSStatus testInsertTablet(1:TSInsertTabletReq req); + +// 测试批量按列插入数据的延迟,注意:该接口不真实插入数据,只用来测试网络延迟 +TSStatus testInsertTablets(1:TSInsertTabletsReq req); + +// 测试按行插入数据的延迟,注意:该接口不真实插入数据,只用来测试网络延迟 +TSStatus testInsertRecord(1:TSInsertRecordReq req); + +// 测试按String格式按行插入数据的延迟,注意:该接口不真实插入数据,只用来测试网络延迟 +TSStatus testInsertStringRecord(1:TSInsertStringRecordReq req); + +// 测试按行插入数据的延迟,注意:该接口不真实插入数据,只用来测试网络延迟 +TSStatus testInsertRecords(1:TSInsertRecordsReq req); + +// 测试按行批量插入同属于某个设备的数据的延迟,注意:该接口不真实插入数据,只用来测试网络延迟 +TSStatus testInsertRecordsOfOneDevice(1:TSInsertRecordsOfOneDeviceReq req); + +// 测试按String格式批量按行插入数据的延迟,注意:该接口不真实插入数据,只用来测试网络延迟 +TSStatus testInsertStringRecords(1:TSInsertStringRecordsReq req); + +// 删除数据 +TSStatus deleteData(1:TSDeleteDataReq req); + +// 执行原始数据查询 +TSExecuteStatementResp executeRawDataQuery(1:TSRawDataQueryReq req); + +// 向服务器申请一个查询语句ID +i64 requestStatementId(1:i64 sessionId); +``` + +### IDL定义文件位置 +IDL定义文件的路径是thrift/src/main/thrift/rpc.thrift,其中包括了结构体定义与函数定义、 + +### 生成文件位置 +在mvn编译过程中,会调用thrift编译IDL文件,生成最终的.class文件 +生成的文件夹路径为thrift/target/classes/org/apache/iotdb/service/rpc/thrift + diff --git a/docs/zh/UserGuide/Ecosystem Integration/Spark TsFile.md b/docs/zh/UserGuide/Ecosystem Integration/Spark TsFile.md index 353c999..63d129d 100644 --- a/docs/zh/UserGuide/Ecosystem Integration/Spark TsFile.md +++ b/docs/zh/UserGuide/Ecosystem Integration/Spark TsFile.md @@ -38,6 +38,7 @@ TsFile-Spark-Connector对Tsfile类型的外部数据源实现Spark的支持。 | `2.4.3` | `2.11.8` | `1.8` | `0.10.0` | > 注意:有关如何下载和使用TsFile的更多信息,请参见以下链接:https://github.com/apache/iotdb/tree/master/tsfile +> 注意:spark版本目前仅支持2.4.3, 其他版本可能存在不适配的问题, 目前已知2.4.7的版本存在不适配的问题 ### 快速开始
