You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2021/10/08 08:49:37 UTC
[GitHub] [iotdb] jun0315 opened a new pull request #4090: [IOTDB-1810]Compatibility of Apache IoTDB with InfluxDB - Compatibility scheme
jun0315 opened a new pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090
complete compatibility scheme
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] jun0315 commented on pull request #4090: [IOTDB-1810]Compatibility of Apache IoTDB with InfluxDB - Compatibility scheme
Posted by GitBox <gi...@apache.org>.
jun0315 commented on pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#issuecomment-942313131
@noorall Thanks for your review. I have fixed it~
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] zcy1010 commented on a change in pull request #4090: [IOTDB-1810]Compatibility of Apache IoTDB with InfluxDB - Compatibility scheme
Posted by GitBox <gi...@apache.org>.
zcy1010 commented on a change in pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#discussion_r728007772
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,128 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+适配器是一个继承至InfluxDB基类的子类,实现了InfluxDB接口的所有方法,从而使InfluxDB原有的操作函数没有改变,但是会以IoTDB的协议写入IoTDB数据库中。
+
+
+
+
+
+
+### 2.2 数据格式转换
+
+#### 2.2.1 InfluxDB数据格式
+
+1. database: 数据库名。
+2. measurement: 测量指标名。
+3. tags : 各种有索引的属性。
+4. fields : 各种记录值(没有索引的属性)。
+
+
+
+#### 2.2.2 IoTDB数据格式
+
+1. storage group: 存储组。
+2. path(time series ID):存储路径。
+3. measurement: 物理量。
+
+
+
+#### 2.2.3 两者映射关系
+
+1. InfluxDB中的database和measurement可以看做IoTDB中的storage group。
+2. InfluxDB中的tags可以看做IoTDB中的path。
+3. InfluxDB中的fields可以看做IoTDB中measurement。
+
+
+
+#### 2.2.4 转换中的问题
+1. 问题:InfluxDB中Tag的顺序不敏感,而在IoTDB中是敏感的。
+2. 关键点:需要记录每个tag对应的顺序,确保InfluxDB中label顺序不同的同一条时序对应到IoTDB中也是一条时序。
+3. 需要解决的事情:
+ 1. 怎样映射tag key和它对应的order
Review comment:
1. 怎样把tag key映射到和它对应的order
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,128 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+适配器是一个继承至InfluxDB基类的子类,实现了InfluxDB接口的所有方法,从而使InfluxDB原有的操作函数没有改变,但是会以IoTDB的协议写入IoTDB数据库中。
+
+
+
+
+
+
+### 2.2 数据格式转换
+
+#### 2.2.1 InfluxDB数据格式
+
+1. database: 数据库名。
+2. measurement: 测量指标名。
+3. tags : 各种有索引的属性。
+4. fields : 各种记录值(没有索引的属性)。
+
+
+
+#### 2.2.2 IoTDB数据格式
+
+1. storage group: 存储组。
+2. path(time series ID):存储路径。
+3. measurement: 物理量。
+
+
+
+#### 2.2.3 两者映射关系
+
+1. InfluxDB中的database和measurement可以看做IoTDB中的storage group。
+2. InfluxDB中的tags可以看做IoTDB中的path。
+3. InfluxDB中的fields可以看做IoTDB中measurement。
+
+
+
+#### 2.2.4 转换中的问题
+1. 问题:InfluxDB中Tag的顺序不敏感,而在IoTDB中是敏感的。
+2. 关键点:需要记录每个tag对应的顺序,确保InfluxDB中label顺序不同的同一条时序对应到IoTDB中也是一条时序。
+3. 需要解决的事情:
+ 1. 怎样映射tag key和它对应的order
+ 2. 在不知道所有的label key的情况下,怎么维护他们之间的顺序
+
+### 2.3 解决方案
+
+#### 2.3.1 主要思想
+
+1. 内存中Map <Measurement, Map <Tag Key, Order> > table结构维护Tag之间的顺序
Review comment:
不太理解`table结构维护Tag之间的顺序`
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,128 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+适配器是一个继承至InfluxDB基类的子类,实现了InfluxDB接口的所有方法,从而使InfluxDB原有的操作函数没有改变,但是会以IoTDB的协议写入IoTDB数据库中。
Review comment:
该适配器的实现为一个继承了InfluxDB基类的子类, 这个子类实现了InfluxDB的所有接口,并没有改变InfluxDB原有的操作函数,最终以IoTDB的协议写入loTDB数据库中。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] jun0315 commented on pull request #4090: [IOTDB-1810] Compatibility of Apache IoTDB with InfluxDB - Compatibility Scheme
Posted by GitBox <gi...@apache.org>.
jun0315 commented on pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#issuecomment-944954244
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] noorall commented on a change in pull request #4090: [IOTDB-1810]Compatibility of Apache IoTDB with InfluxDB - Compatibility scheme
Posted by GitBox <gi...@apache.org>.
noorall commented on a change in pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#discussion_r728039347
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,128 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+适配器是一个继承至InfluxDB基类的子类,实现了InfluxDB接口的所有方法,从而使InfluxDB原有的操作函数没有改变,但是会以IoTDB的协议写入IoTDB数据库中。
+
+
+
+
+
+
+### 2.2 数据格式转换
+
+#### 2.2.1 InfluxDB数据格式
+
+1. database: 数据库名。
+2. measurement: 测量指标名。
+3. tags : 各种有索引的属性。
+4. fields : 各种记录值(没有索引的属性)。
+
+
+
+#### 2.2.2 IoTDB数据格式
+
+1. storage group: 存储组。
+2. path(time series ID):存储路径。
+3. measurement: 物理量。
+
+
+
+#### 2.2.3 两者映射关系
+
+1. InfluxDB中的database和measurement可以看做IoTDB中的storage group。
+2. InfluxDB中的tags可以看做IoTDB中的path。
+3. InfluxDB中的fields可以看做IoTDB中measurement。
+
+
+
+#### 2.2.4 转换中的问题
+1. 问题:InfluxDB中Tag的顺序不敏感,而在IoTDB中是敏感的。
+2. 关键点:需要记录每个tag对应的顺序,确保InfluxDB中label顺序不同的同一条时序对应到IoTDB中也是一条时序。
+3. 需要解决的事情:
+ 1. 怎样映射tag key和它对应的order
+ 2. 在不知道所有的label key的情况下,怎么维护他们之间的顺序
+
+### 2.3 解决方案
+
+#### 2.3.1 主要思想
+
+1. 内存中Map <Measurement, Map <Tag Key, Order> > table结构维护Tag之间的顺序
+2. InfluxDB中时序根据label顺序对应到IoTDB
+
+ | `root.TAG_INFO.database_name` | `root.TAG_INFO.measurement_name` | `root.TAG_INFO.tag_name` | `root.TAG_INFO.tag_order` |
+ | :---------------------------- | :------------------------------- | :----------------------- | :------------------------ |
+ | database | student | name | 0 |
+ | database | student | phone | 1 |
+ | database | student | sex | 2 |
+ | database | student | address | 3 |
+
+#### 2.3.2 实例
+
+a. 插入数据
+
+1. InfluxDB时序(database=database):
+
+ (1)student tags:{name=A,phone=B,sex=C} fields:{score=99}
+
+ (2)student tags:{address=D} fields:{score=98}
+
+ (3))student tags:{name=A,phone=B,sex=C,address=D} fields:{score=97}
+
+2. 简单对上述InfluxDB的时序进行解释,database是database;measurement是student;tag分别是name,phone、sex和address;field是score。
+
+对应的InfluxDB的实际存储为:
+
+
+
+
+
+
+3. (1)IoTDB对应的记录tag顺序的table为
+
+ | database | measurement | tag_key | Order |
+ | -------- | ----------- | ------- | ----- |
+ | database | student | name | 0 |
+ | database | student | phone | 1 |
+ | database | student | sex | 2 |
+
+ (2)IoTDB对应的记录tag顺序的table为
+
+ | database | measurement | tag_key | order |
+ | -------- | ----------- | ------- | ----- |
+ | database | student | name | 0 |
+ | database | student | phone | 1 |
+ | database | student | sex | 2 |
+ | database | student | address | 3 |
+
+ (3)IoTDB对应的记录tag顺序的table为
+
+ | database | measurement | tag_key | order |
+ | -------- | ----------- | ------- | ----- |
+ | database | student | name | 0 |
+ | database | student | phone | 1 |
+ | database | student | sex | 2 |
+ | database | student | address | 3 |
+
+4. (1)第一条插入数据对应IoTDB时序为root.database.student.A.B.C
+
+ (2)第二条插入数据对应IoTDB时序为root.database.student.ph.ph.ph.D(其中ph表示占位符)
+
+ (3)第三条插入数据对应IoTDB时序为root.database.student.A.B.C.D
+
+ 对应的IoTDB的实际存储为:
+
+| Time | root.database.student.A.B.C.score | root.database.student.PH.PH.PH.D.score | root.database.student.A.B.C.D.score |
+| ---- | --------------------------------- | -------------------------------------- | ----------------------------------- |
+| 1 | 99 | null | Null |
+| 2 | Null | 98 | Null |
+| 3 | null | null | 97 |
+
+b. 查询数据
+
+1. 查询student中phone=B的数据。在database->student中phone的顺序为1,order最大值是3,对应到IoTDB的查询为:select * from root.database.student.*.B
+2. 查询student中phone=B且存储的score>97的数据,对应到IoTDB的查询为:select * from root.database.student.*.B where score>98
+3. 查询student中phone=B且存储的score>97且时间在最近七天内的的数据,对应到IoTDB的查询为:select * from root.database.student.*.B where score>98 and time > now()-7d
Review comment:
查询语句用code标签另起一行
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] SteveYurongSu merged pull request #4090: [IOTDB-1810] Compatibility of Apache IoTDB with InfluxDB - Compatibility Scheme
Posted by GitBox <gi...@apache.org>.
SteveYurongSu merged pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] noorall commented on a change in pull request #4090: [IOTDB-1810]Compatibility of Apache IoTDB with InfluxDB - Compatibility scheme
Posted by GitBox <gi...@apache.org>.
noorall commented on a change in pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#discussion_r728030185
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,128 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+适配器是一个继承至InfluxDB基类的子类,实现了InfluxDB接口的所有方法,从而使InfluxDB原有的操作函数没有改变,但是会以IoTDB的协议写入IoTDB数据库中。
+
+
+
+
+
+
+### 2.2 数据格式转换
+
+#### 2.2.1 InfluxDB数据格式
+
+1. database: 数据库名。
+2. measurement: 测量指标名。
+3. tags : 各种有索引的属性。
+4. fields : 各种记录值(没有索引的属性)。
+
+
+
+#### 2.2.2 IoTDB数据格式
+
+1. storage group: 存储组。
+2. path(time series ID):存储路径。
+3. measurement: 物理量。
+
+
+
+#### 2.2.3 两者映射关系
+
+1. InfluxDB中的database和measurement可以看做IoTDB中的storage group。
+2. InfluxDB中的tags可以看做IoTDB中的path。
+3. InfluxDB中的fields可以看做IoTDB中measurement。
+
+
+
+#### 2.2.4 转换中的问题
+1. 问题:InfluxDB中Tag的顺序不敏感,而在IoTDB中是敏感的。
+2. 关键点:需要记录每个tag对应的顺序,确保InfluxDB中label顺序不同的同一条时序对应到IoTDB中也是一条时序。
+3. 需要解决的事情:
+ 1. 怎样映射tag key和它对应的order
+ 2. 在不知道所有的label key的情况下,怎么维护他们之间的顺序
+
+### 2.3 解决方案
+
+#### 2.3.1 主要思想
+
+1. 内存中Map <Measurement, Map <Tag Key, Order> > table结构维护Tag之间的顺序
+2. InfluxDB中时序根据label顺序对应到IoTDB
+
+ | `root.TAG_INFO.database_name` | `root.TAG_INFO.measurement_name` | `root.TAG_INFO.tag_name` | `root.TAG_INFO.tag_order` |
+ | :---------------------------- | :------------------------------- | :----------------------- | :------------------------ |
+ | database | student | name | 0 |
+ | database | student | phone | 1 |
+ | database | student | sex | 2 |
+ | database | student | address | 3 |
+
+#### 2.3.2 实例
+
+a. 插入数据
+
+1. InfluxDB时序(database=database):
+
+ (1)student tags:{name=A,phone=B,sex=C} fields:{score=99}
+
+ (2)student tags:{address=D} fields:{score=98}
+
+ (3))student tags:{name=A,phone=B,sex=C,address=D} fields:{score=97}
+
+2. 简单对上述InfluxDB的时序进行解释,database是database;measurement是student;tag分别是name,phone、sex和address;field是score。
Review comment:
databse=database可以换一下数据库的名称,例如database=xxx,不然后面的解释dattabase是database有点拗口
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,128 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+适配器是一个继承至InfluxDB基类的子类,实现了InfluxDB接口的所有方法,从而使InfluxDB原有的操作函数没有改变,但是会以IoTDB的协议写入IoTDB数据库中。
+
+
+
+
+
+
+### 2.2 数据格式转换
Review comment:
介绍一下数据格式转换主要是为了实现两者数据格式的映射,然后说一下思想。
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,128 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+适配器是一个继承至InfluxDB基类的子类,实现了InfluxDB接口的所有方法,从而使InfluxDB原有的操作函数没有改变,但是会以IoTDB的协议写入IoTDB数据库中。
+
+
+
+
+
+
+### 2.2 数据格式转换
+
+#### 2.2.1 InfluxDB数据格式
+
+1. database: 数据库名。
+2. measurement: 测量指标名。
+3. tags : 各种有索引的属性。
+4. fields : 各种记录值(没有索引的属性)。
+
+
+
+#### 2.2.2 IoTDB数据格式
+
+1. storage group: 存储组。
+2. path(time series ID):存储路径。
+3. measurement: 物理量。
+
+
+
+#### 2.2.3 两者映射关系
+
+1. InfluxDB中的database和measurement可以看做IoTDB中的storage group。
+2. InfluxDB中的tags可以看做IoTDB中的path。
+3. InfluxDB中的fields可以看做IoTDB中measurement。
+
+
+
+#### 2.2.4 转换中的问题
+1. 问题:InfluxDB中Tag的顺序不敏感,而在IoTDB中是敏感的。
+2. 关键点:需要记录每个tag对应的顺序,确保InfluxDB中label顺序不同的同一条时序对应到IoTDB中也是一条时序。
+3. 需要解决的事情:
+ 1. 怎样映射tag key和它对应的order
+ 2. 在不知道所有的label key的情况下,怎么维护他们之间的顺序
+
+### 2.3 解决方案
+
+#### 2.3.1 主要思想
+
+1. 内存中Map <Measurement, Map <Tag Key, Order> > table结构维护Tag之间的顺序
+2. InfluxDB中时序根据label顺序对应到IoTDB
+
+ | `root.TAG_INFO.database_name` | `root.TAG_INFO.measurement_name` | `root.TAG_INFO.tag_name` | `root.TAG_INFO.tag_order` |
+ | :---------------------------- | :------------------------------- | :----------------------- | :------------------------ |
+ | database | student | name | 0 |
+ | database | student | phone | 1 |
+ | database | student | sex | 2 |
+ | database | student | address | 3 |
+
+#### 2.3.2 实例
+
+a. 插入数据
+
+1. InfluxDB时序(database=database):
+
+ (1)student tags:{name=A,phone=B,sex=C} fields:{score=99}
+
+ (2)student tags:{address=D} fields:{score=98}
+
+ (3))student tags:{name=A,phone=B,sex=C,address=D} fields:{score=97}
+
+2. 简单对上述InfluxDB的时序进行解释,database是database;measurement是student;tag分别是name,phone、sex和address;field是score。
+
+对应的InfluxDB的实际存储为:
+
+
+
+
+
+
+3. (1)IoTDB对应的记录tag顺序的table为
+
+ | database | measurement | tag_key | Order |
+ | -------- | ----------- | ------- | ----- |
+ | database | student | name | 0 |
+ | database | student | phone | 1 |
+ | database | student | sex | 2 |
+
+ (2)IoTDB对应的记录tag顺序的table为
+
+ | database | measurement | tag_key | order |
+ | -------- | ----------- | ------- | ----- |
+ | database | student | name | 0 |
+ | database | student | phone | 1 |
+ | database | student | sex | 2 |
+ | database | student | address | 3 |
+
+ (3)IoTDB对应的记录tag顺序的table为
+
+ | database | measurement | tag_key | order |
+ | -------- | ----------- | ------- | ----- |
+ | database | student | name | 0 |
+ | database | student | phone | 1 |
+ | database | student | sex | 2 |
+ | database | student | address | 3 |
+
+4. (1)第一条插入数据对应IoTDB时序为root.database.student.A.B.C
+
+ (2)第二条插入数据对应IoTDB时序为root.database.student.ph.ph.ph.D(其中ph表示占位符)
+
+ (3)第三条插入数据对应IoTDB时序为root.database.student.A.B.C.D
+
+ 对应的IoTDB的实际存储为:
+
+| Time | root.database.student.A.B.C.score | root.database.student.PH.PH.PH.D.score | root.database.student.A.B.C.D.score |
+| ---- | --------------------------------- | -------------------------------------- | ----------------------------------- |
+| 1 | 99 | null | Null |
+| 2 | Null | 98 | Null |
+| 3 | null | null | 97 |
+
+b. 查询数据
+
+1. 查询student中phone=B的数据。在database->student中phone的顺序为1,order最大值是3,对应到IoTDB的查询为:select * from root.database.student.*.B
+2. 查询student中phone=B且存储的score>97的数据,对应到IoTDB的查询为:select * from root.database.student.*.B where score>98
+3. 查询student中phone=B且存储的score>97且时间在最近七天内的的数据,对应到IoTDB的查询为:select * from root.database.student.*.B where score>98 and time > now()-7d
Review comment:
查询语句用code标签另起一行
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] noorall commented on a change in pull request #4090: [IOTDB-1810]Compatibility of Apache IoTDB with InfluxDB - Compatibility scheme
Posted by GitBox <gi...@apache.org>.
noorall commented on a change in pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#discussion_r728030185
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,128 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+适配器是一个继承至InfluxDB基类的子类,实现了InfluxDB接口的所有方法,从而使InfluxDB原有的操作函数没有改变,但是会以IoTDB的协议写入IoTDB数据库中。
+
+
+
+
+
+
+### 2.2 数据格式转换
+
+#### 2.2.1 InfluxDB数据格式
+
+1. database: 数据库名。
+2. measurement: 测量指标名。
+3. tags : 各种有索引的属性。
+4. fields : 各种记录值(没有索引的属性)。
+
+
+
+#### 2.2.2 IoTDB数据格式
+
+1. storage group: 存储组。
+2. path(time series ID):存储路径。
+3. measurement: 物理量。
+
+
+
+#### 2.2.3 两者映射关系
+
+1. InfluxDB中的database和measurement可以看做IoTDB中的storage group。
+2. InfluxDB中的tags可以看做IoTDB中的path。
+3. InfluxDB中的fields可以看做IoTDB中measurement。
+
+
+
+#### 2.2.4 转换中的问题
+1. 问题:InfluxDB中Tag的顺序不敏感,而在IoTDB中是敏感的。
+2. 关键点:需要记录每个tag对应的顺序,确保InfluxDB中label顺序不同的同一条时序对应到IoTDB中也是一条时序。
+3. 需要解决的事情:
+ 1. 怎样映射tag key和它对应的order
+ 2. 在不知道所有的label key的情况下,怎么维护他们之间的顺序
+
+### 2.3 解决方案
+
+#### 2.3.1 主要思想
+
+1. 内存中Map <Measurement, Map <Tag Key, Order> > table结构维护Tag之间的顺序
+2. InfluxDB中时序根据label顺序对应到IoTDB
+
+ | `root.TAG_INFO.database_name` | `root.TAG_INFO.measurement_name` | `root.TAG_INFO.tag_name` | `root.TAG_INFO.tag_order` |
+ | :---------------------------- | :------------------------------- | :----------------------- | :------------------------ |
+ | database | student | name | 0 |
+ | database | student | phone | 1 |
+ | database | student | sex | 2 |
+ | database | student | address | 3 |
+
+#### 2.3.2 实例
+
+a. 插入数据
+
+1. InfluxDB时序(database=database):
+
+ (1)student tags:{name=A,phone=B,sex=C} fields:{score=99}
+
+ (2)student tags:{address=D} fields:{score=98}
+
+ (3))student tags:{name=A,phone=B,sex=C,address=D} fields:{score=97}
+
+2. 简单对上述InfluxDB的时序进行解释,database是database;measurement是student;tag分别是name,phone、sex和address;field是score。
Review comment:
databse=database可以换一下数据库的名称,例如database=xxx,不然后面的解释dattabase是database有点拗口
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] noorall commented on a change in pull request #4090: [IOTDB-1810]Compatibility of Apache IoTDB with InfluxDB - Compatibility scheme
Posted by GitBox <gi...@apache.org>.
noorall commented on a change in pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#discussion_r728037647
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,128 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+适配器是一个继承至InfluxDB基类的子类,实现了InfluxDB接口的所有方法,从而使InfluxDB原有的操作函数没有改变,但是会以IoTDB的协议写入IoTDB数据库中。
+
+
+
+
+
+
+### 2.2 数据格式转换
Review comment:
介绍一下数据格式转换主要是为了实现两者数据格式的映射,然后说一下思想。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] wang-lucy commented on pull request #4090: [IOTDB-1810]Compatibility of Apache IoTDB with InfluxDB - Compatibility scheme
Posted by GitBox <gi...@apache.org>.
wang-lucy commented on pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#issuecomment-943172539
LGTM
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] SteveYurongSu commented on a change in pull request #4090: [IOTDB-1810] Compatibility of Apache IoTDB with InfluxDB - Compatibility Scheme
Posted by GitBox <gi...@apache.org>.
SteveYurongSu commented on a change in pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#discussion_r729884144
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,217 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+该适配器以 IoTDB Java Session 接口为底层基础,实现了 InfluxDB 的 Java 接口 `interface InfluxDB`,对用户提供了所有 InfluxDB 的接口方法,最终用户可以无感知地使用 InfluxDB 协议向 IoTDB 发起写入和读取请求。
+
+
+
+
+
+
+### 2.2 元数据格式转换
+
+InfluxDB 的元数据是 tag-field 模型,IoTDB 的元数据是树形模型。为了使适配器能够兼容 InfluxDB 协议,需要把 InfluxDB 的元数据模型转换成 IoTDB 的元数据模型。
+
+#### 2.2.1 InfluxDB 元数据
+
+1. database: 数据库名。
+2. measurement: 测量指标名。
+3. tags : 各种有索引的属性。
+4. fields : 各种记录值(没有索引的属性)。
+
+
+
+#### 2.2.2 IoTDB 元数据
+
+1. storage group: 存储组。
+2. path(time series ID):存储路径。
+3. measurement: 物理量。
+
+
+
+#### 2.2.3 两者映射关系
+
+InfluxDB 元数据和 IoTDB 元数据有着如下的映射关系:
+1. InfluxDB 中的 database 和 measurement 组合起来作为 IoTDB 中的 storage group。
+2. InfluxDB 中的 field key 作为 IoTDB 中 measurement 路径,InfluxDB 中的 field value 即是该路径下记录的测点值。
+3. InfluxDB 中的 tag 在 IoTDB 中使用 storage group 和 measurement 之间的路径表达。InfluxDB 的 tag key 由 storage group 和 measurement 之间路径的顺序隐式表达,tag value 记录为对应顺序的路径的名称。
+
+InfluxDB 元数据向 IoTDB 元数据的转换关系可以由下面的公示表示:
+
+`root.{database}.{measurement}.{tag value 1}.{tag value 2}...{tag value N-1}.{tag value N}.{field key}`
+
+
+
+如上图所示,可以看出:
+
+我们在 IoTDB 中使用 storage group 和 measurement 之间的路径来表达 InfluxDB tag 的概念,也就是图中右侧绿色方框的部分。
+
+storage group 和 measurement 之间的每一层都代表一个 tag。如果 tag key 的数量为 N,那么 storage group 和 measurement 之间的路径的层数就是 N。我们对 storage group 和 measurement 之间的每一层进行顺序编号,每一个序号都和一个 tag key 一一对应。同时,我们使用 storage group 和 measurement 之间每一层 **路径的名字** 来记 tag value,tag key 可以通过自身的序号找到对应路径层级下的 tag value.
+
+#### 2.2.4 关键问题
+
+在InfluxDB中,Tag的顺序不同并不会影响实际的结果。
+
+eg:
+`insert factory,workshop=A1,production=B1 tempture=16.9`和`insert factory,production=B1,workshop=A1 tempture=16.9`两条数据表达的含义相等。
+
+但在IoTDB中,一个path由多个部分组成,比如`root.monitor.factory.A1.B1`是由一个存储组`root.monitor.factory`和两个节点`A1`和`B1`组成的。
+
+那么节点的顺序就是需要考虑的,因为`root.monitor.factory.A1.B1`和`root.monitor.factory.B1.A1`是两条不同的序列,因此可以认为IoTDB中对Tag对顺序是敏感的。
+
+所以需要记录InfluxDB每个Tag对应的顺序,确保在InfluxDB中,即使Tag不同的同一条时序对应到IoTDB中也是同一条时序。
+
+因此这时需要考虑的一个问题是InfluxDB的tag key及对应顺序关系如何持久化到IoTDB数据库中里,这样才不会丢失相关信息。
Review comment:
```suggestion
在 InfluxDB 的 SQL 语句中,tag 顺序的不同并不会影响实际的结果。
例如:
`insert factory, workshop=A1, production=B1, temperature=16.9` 和 `insert factory, production=B1, workshop=A1, temperature=16.9` 两条 SQL 的含义相等。
但在 IoTDB 中,上述插入的数据点可以存储在 `root.monitor.factory.A1.B1.temperature` 下,也可以存储在 `root.monitor.factory.B1.A1.temperature` 下。因此,IoTDB 路径中储存的 InfluxDB
的 tag 的顺序就是需要考虑的,因为 `root.monitor.factory.A1.B1.temperature` 和
`root.monitor.factory.B1.A1.temperature` 是两条不同的序列。我们也可以认为,IoTDB 对 tag 的顺序是“敏感”的。
因此,我们还需要在 IoTDB 中记录 InfluxDB 每个 tag 对应在 IoTDB 路径中的层级顺序,确保在执行 InfluxDB SQL 时,即使 tag 不同的同一条时序对应到IoTDB中也是同一条时序。
这里还需要考虑的一个问题是:InfluxDB的tag key及对应顺序关系如何持久化到IoTDB数据库中里,这样才不会丢失相关信息。
```
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,217 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+该适配器以 IoTDB Java Session 接口为底层基础,实现了 InfluxDB 的 Java 接口 `interface InfluxDB`,对用户提供了所有 InfluxDB 的接口方法,最终用户可以无感知地使用 InfluxDB 协议向 IoTDB 发起写入和读取请求。
+
+
+
+
+
+
+### 2.2 元数据格式转换
+
+InfluxDB 的元数据是 tag-field 模型,IoTDB 的元数据是树形模型。为了使适配器能够兼容 InfluxDB 协议,需要把 InfluxDB 的元数据模型转换成 IoTDB 的元数据模型。
+
+#### 2.2.1 InfluxDB 元数据
+
+1. database: 数据库名。
+2. measurement: 测量指标名。
+3. tags : 各种有索引的属性。
+4. fields : 各种记录值(没有索引的属性)。
+
+
+
+#### 2.2.2 IoTDB 元数据
+
+1. storage group: 存储组。
+2. path(time series ID):存储路径。
+3. measurement: 物理量。
+
+
+
+#### 2.2.3 两者映射关系
+
+InfluxDB 元数据和 IoTDB 元数据有着如下的映射关系:
+1. InfluxDB 中的 database 和 measurement 组合起来作为 IoTDB 中的 storage group。
+2. InfluxDB 中的 field key 作为 IoTDB 中 measurement 路径,InfluxDB 中的 field value 即是该路径下记录的测点值。
+3. InfluxDB 中的 tag 在 IoTDB 中使用 storage group 和 measurement 之间的路径表达。InfluxDB 的 tag key 由 storage group 和 measurement 之间路径的顺序隐式表达,tag value 记录为对应顺序的路径的名称。
+
+InfluxDB 元数据向 IoTDB 元数据的转换关系可以由下面的公示表示:
+
+`root.{database}.{measurement}.{tag value 1}.{tag value 2}...{tag value N-1}.{tag value N}.{field key}`
+
+
+
+如上图所示,可以看出:
+
+我们在 IoTDB 中使用 storage group 和 measurement 之间的路径来表达 InfluxDB tag 的概念,也就是图中右侧绿色方框的部分。
+
+storage group 和 measurement 之间的每一层都代表一个 tag。如果 tag key 的数量为 N,那么 storage group 和 measurement 之间的路径的层数就是 N。我们对 storage group 和 measurement 之间的每一层进行顺序编号,每一个序号都和一个 tag key 一一对应。同时,我们使用 storage group 和 measurement 之间每一层 **路径的名字** 来记 tag value,tag key 可以通过自身的序号找到对应路径层级下的 tag value.
+
+#### 2.2.4 关键问题
+
+在 InfluxDB 的 SQL 语句中,tag 顺序的不同并不会影响实际的结果。
+
+例如:
+`insert factory, workshop=A1, production=B1, temperature=16.9` 和 `insert factory, production=B1, workshop=A1, temperature=16.9` 两条 SQL 的含义相等。
+
+但在 IoTDB 中,上述插入的数据点可以存储在 `root.monitor.factory.A1.B1.temperature` 下,也可以存储在 `root.monitor.factory.B1.A1.temperature` 下。因此,IoTDB 路径中储存的 InfluxDB
+ 的 tag 的顺序就是需要考虑的,因为 `root.monitor.factory.A1.B1.temperature` 和
+`root.monitor.factory.B1.A1.temperature` 是两条不同的序列。我们也可以认为,IoTDB 对 tag 的顺序是“敏感”的。
+
+因此,我们还需要在 IoTDB 中记录 InfluxDB 每个 tag 对应在 IoTDB 路径中的层级顺序,确保在执行 InfluxDB SQL 时,即使 tag 不同的同一条时序对应到IoTDB中也是同一条时序。
+
+这里还需要考虑的一个问题是:InfluxDB的tag key及对应顺序关系如何持久化到IoTDB数据库中里,这样才不会丢失相关信息。
Review comment:
```suggestion
在 InfluxDB 的 SQL 语句中,tag 出现的顺序的不同并不会影响实际的执行结果。
例如:
`insert factory, workshop=A1, production=B1, temperature=16.9` 和 `insert factory, production=B1, workshop=A1, temperature=16.9` 两条 InfluxDB SQL 的含义(以及执行结果)相等。
但在 IoTDB 中,上述插入的数据点可以存储在 `root.monitor.factory.A1.B1.temperature` 下,也可以存储在 `root.monitor.factory.B1.A1.temperature` 下。因此,IoTDB 路径中储存的 InfluxDB 的 tag 的顺序是需要被特别考虑的,因为 `root.monitor.factory.A1.B1.temperature` 和
`root.monitor.factory.B1.A1.temperature` 是两条不同的序列。我们可以认为,IoTDB 元数据模型对 tag 顺序的处理是“敏感”的。
基于上述的考虑,我们还需要在 IoTDB 中记录 InfluxDB 每个 tag 对应在 IoTDB 路径中的层级顺序,以确保在执行 InfluxDB SQL 时,不论 InfluxDB SQL 中 tag 出现的顺序如何,只要该 SQL 表达的是对同一个时间序列上的操作,那么适配器都可以唯一对应到 IoTDB 中的一条时间序列上进行操作。
这里还需要考虑的另一个问题是:InfluxDB 的 tag key 及对应顺序关系应该如何持久化到 IoTDB 数据库中,以确保不会丢失相关信息。
```
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,217 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+该适配器以 IoTDB Java Session 接口为底层基础,实现了 InfluxDB 的 Java 接口 `interface InfluxDB`,对用户提供了所有 InfluxDB 的接口方法,最终用户可以无感知地使用 InfluxDB 协议向 IoTDB 发起写入和读取请求。
+
+
+
+
+
+
+### 2.2 元数据格式转换
+
+InfluxDB 的元数据是 tag-field 模型,IoTDB 的元数据是树形模型。为了使适配器能够兼容 InfluxDB 协议,需要把 InfluxDB 的元数据模型转换成 IoTDB 的元数据模型。
+
+#### 2.2.1 InfluxDB 元数据
+
+1. database: 数据库名。
+2. measurement: 测量指标名。
+3. tags : 各种有索引的属性。
+4. fields : 各种记录值(没有索引的属性)。
+
+
+
+#### 2.2.2 IoTDB 元数据
+
+1. storage group: 存储组。
+2. path(time series ID):存储路径。
+3. measurement: 物理量。
+
+
+
+#### 2.2.3 两者映射关系
+
+InfluxDB 元数据和 IoTDB 元数据有着如下的映射关系:
+1. InfluxDB 中的 database 和 measurement 组合起来作为 IoTDB 中的 storage group。
+2. InfluxDB 中的 field key 作为 IoTDB 中 measurement 路径,InfluxDB 中的 field value 即是该路径下记录的测点值。
+3. InfluxDB 中的 tag 在 IoTDB 中使用 storage group 和 measurement 之间的路径表达。InfluxDB 的 tag key 由 storage group 和 measurement 之间路径的顺序隐式表达,tag value 记录为对应顺序的路径的名称。
+
+InfluxDB 元数据向 IoTDB 元数据的转换关系可以由下面的公示表示:
+
+`root.{database}.{measurement}.{tag value 1}.{tag value 2}...{tag value N-1}.{tag value N}.{field key}`
+
+
+
+如上图所示,可以看出:
+
+我们在 IoTDB 中使用 storage group 和 measurement 之间的路径来表达 InfluxDB tag 的概念,也就是图中右侧绿色方框的部分。
+
+storage group 和 measurement 之间的每一层都代表一个 tag。如果 tag key 的数量为 N,那么 storage group 和 measurement 之间的路径的层数就是 N。我们对 storage group 和 measurement 之间的每一层进行顺序编号,每一个序号都和一个 tag key 一一对应。同时,我们使用 storage group 和 measurement 之间每一层 **路径的名字** 来记 tag value,tag key 可以通过自身的序号找到对应路径层级下的 tag value.
+
+#### 2.2.4 关键问题
+
+在 InfluxDB 的 SQL 语句中,tag 顺序的不同并不会影响实际的结果。
+
+例如:
+`insert factory, workshop=A1, production=B1, temperature=16.9` 和 `insert factory, production=B1, workshop=A1, temperature=16.9` 两条 SQL 的含义相等。
+
+但在 IoTDB 中,上述插入的数据点可以存储在 `root.monitor.factory.A1.B1.temperature` 下,也可以存储在 `root.monitor.factory.B1.A1.temperature` 下。因此,IoTDB 路径中储存的 InfluxDB
+ 的 tag 的顺序就是需要考虑的,因为 `root.monitor.factory.A1.B1.temperature` 和
+`root.monitor.factory.B1.A1.temperature` 是两条不同的序列。我们也可以认为,IoTDB 对 tag 的顺序是“敏感”的。
+
+因此,我们还需要在 IoTDB 中记录 InfluxDB 每个 tag 对应在 IoTDB 路径中的层级顺序,确保在执行 InfluxDB SQL 时,即使 tag 不同的同一条时序对应到IoTDB中也是同一条时序。
+
+这里还需要考虑的一个问题是:InfluxDB的tag key及对应顺序关系如何持久化到IoTDB数据库中里,这样才不会丢失相关信息。
+
+需要解决的事情:
+ 1. 怎样把InfluxDB中tag key映射到IoTDB中path中的节点顺序。
+ 2. 在不知道InfluxDB中可能会出现所有tag key的情况下,怎么维护它们之间的顺序。
+ 3. InfluxDB的tag key及对应顺序关系如何持久化到IoTDB数据库中。
Review comment:
```suggestion
```
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,217 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+该适配器以 IoTDB Java Session 接口为底层基础,实现了 InfluxDB 的 Java 接口 `interface InfluxDB`,对用户提供了所有 InfluxDB 的接口方法,最终用户可以无感知地使用 InfluxDB 协议向 IoTDB 发起写入和读取请求。
+
+
+
+
+
+
+### 2.2 元数据格式转换
+
+InfluxDB 的元数据是 tag-field 模型,IoTDB 的元数据是树形模型。为了使适配器能够兼容 InfluxDB 协议,需要把 InfluxDB 的元数据模型转换成 IoTDB 的元数据模型。
+
+#### 2.2.1 InfluxDB 元数据
+
+1. database: 数据库名。
+2. measurement: 测量指标名。
+3. tags : 各种有索引的属性。
+4. fields : 各种记录值(没有索引的属性)。
+
+
+
+#### 2.2.2 IoTDB 元数据
+
+1. storage group: 存储组。
+2. path(time series ID):存储路径。
+3. measurement: 物理量。
+
+
+
+#### 2.2.3 两者映射关系
+
+InfluxDB 元数据和 IoTDB 元数据有着如下的映射关系:
+1. InfluxDB 中的 database 和 measurement 组合起来作为 IoTDB 中的 storage group。
+2. InfluxDB 中的 field key 作为 IoTDB 中 measurement 路径,InfluxDB 中的 field value 即是该路径下记录的测点值。
+3. InfluxDB 中的 tag 在 IoTDB 中使用 storage group 和 measurement 之间的路径表达。InfluxDB 的 tag key 由 storage group 和 measurement 之间路径的顺序隐式表达,tag value 记录为对应顺序的路径的名称。
+
+InfluxDB 元数据向 IoTDB 元数据的转换关系可以由下面的公示表示:
+
+`root.{database}.{measurement}.{tag value 1}.{tag value 2}...{tag value N-1}.{tag value N}.{field key}`
+
+
+
+如上图所示,可以看出:
+
+我们在 IoTDB 中使用 storage group 和 measurement 之间的路径来表达 InfluxDB tag 的概念,也就是图中右侧绿色方框的部分。
+
+storage group 和 measurement 之间的每一层都代表一个 tag。如果 tag key 的数量为 N,那么 storage group 和 measurement 之间的路径的层数就是 N。我们对 storage group 和 measurement 之间的每一层进行顺序编号,每一个序号都和一个 tag key 一一对应。同时,我们使用 storage group 和 measurement 之间每一层 **路径的名字** 来记 tag value,tag key 可以通过自身的序号找到对应路径层级下的 tag value.
+
+#### 2.2.4 关键问题
+
+在 InfluxDB 的 SQL 语句中,tag 顺序的不同并不会影响实际的结果。
+
+例如:
+`insert factory, workshop=A1, production=B1, temperature=16.9` 和 `insert factory, production=B1, workshop=A1, temperature=16.9` 两条 SQL 的含义相等。
+
+但在 IoTDB 中,上述插入的数据点可以存储在 `root.monitor.factory.A1.B1.temperature` 下,也可以存储在 `root.monitor.factory.B1.A1.temperature` 下。因此,IoTDB 路径中储存的 InfluxDB
+ 的 tag 的顺序就是需要考虑的,因为 `root.monitor.factory.A1.B1.temperature` 和
+`root.monitor.factory.B1.A1.temperature` 是两条不同的序列。我们也可以认为,IoTDB 对 tag 的顺序是“敏感”的。
+
+因此,我们还需要在 IoTDB 中记录 InfluxDB 每个 tag 对应在 IoTDB 路径中的层级顺序,确保在执行 InfluxDB SQL 时,即使 tag 不同的同一条时序对应到IoTDB中也是同一条时序。
+
+这里还需要考虑的一个问题是:InfluxDB的tag key及对应顺序关系如何持久化到IoTDB数据库中里,这样才不会丢失相关信息。
+
+需要解决的事情:
+ 1. 怎样把InfluxDB中tag key映射到IoTDB中path中的节点顺序。
+ 2. 在不知道InfluxDB中可能会出现所有tag key的情况下,怎么维护它们之间的顺序。
+ 3. InfluxDB的tag key及对应顺序关系如何持久化到IoTDB数据库中。
+
+解决方案:
+1. 通过利用内存中的Map <Measurement, Map <Tag Key, Order> > Map结构,来维护Tag之间的顺序。
+
+ ```java
+ Map<String, Map<String, Integer>> measurementTagOrder
+ ```
+ 可以看出Map是一个两层的,第一层的Key是String类型的Measurement,第一层的Value是一个<String,Integer>的Map。
+
+ 第二层的Key是String类型的Tag Key,第二层的Value是Integer类型的Tag Order,也就是Tag对应的实际顺序。
+
+ 这样就可以先通过measurement定位,再通过tag key定位,最后就可以获得Tag对应的顺序了。
+
+3. 除了在内存中维护InfluxDB的Tag顺序外,还需要进行持久化操作,将InfluxDB的Tag顺序持久化到IoTDB数据库中里。
+ 存储组为`root.TAG_INFO`,分别以`database_name`,`measurement_name`,`tag_name`和`tag_order`来存储节点来记录数据。
Review comment:
```suggestion
**解决方案:**
通过利用内存中的`Map<Measurement, Map<Tag Key, Order>>` 这样一个 Map 结构,来维护 tag 在 IoTDB 路径层级上的顺序。
```java
Map<String, Map<String, Integer>> measurementTagOrder
```
可以看出 Map 是一个两层的结构。
第一层的 Key 是 String 类型的 InfluxDB measurement,第一层的 Value 是一个 <String, Integer> 结构的 Map。
第二层的 Key 是 String 类型的 InfluxDB tag key,第二层的 Value 是 Integer 类型的 tag order,也就是 tag 在 IoTDB 路径层级上的顺序。
使用时,就可以先通过 InfluxDB measurement 定位,再通过 InfluxDB tag key 定位,最后就可以获得 tag 在 IoTDB 路径层级上的顺序了。
除了在内存中维护 InfluxDB 的 tag 顺序外,还需要对该顺序信息进行持久化操作,即将 InfluxDB tag 在 IoTDB 路径层级上的顺序持久化到 IoTDB 数据库中。
存储方案如下:
存储组为`root.TAG_INFO`,分别用存储组下的 `database_name`, `measurement_name`, `tag_name` 和 `tag_order` 测点来存储节点来记录数据。
```
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,217 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+该适配器以 IoTDB Java Session 接口为底层基础,实现了 InfluxDB 的 Java 接口 `interface InfluxDB`,对用户提供了所有 InfluxDB 的接口方法,最终用户可以无感知地使用 InfluxDB 协议向 IoTDB 发起写入和读取请求。
+
+
+
+
+
+
+### 2.2 元数据格式转换
+
+InfluxDB 的元数据是 tag-field 模型,IoTDB 的元数据是树形模型。为了使适配器能够兼容 InfluxDB 协议,需要把 InfluxDB 的元数据模型转换成 IoTDB 的元数据模型。
+
+#### 2.2.1 InfluxDB 元数据
+
+1. database: 数据库名。
+2. measurement: 测量指标名。
+3. tags : 各种有索引的属性。
+4. fields : 各种记录值(没有索引的属性)。
+
+
+
+#### 2.2.2 IoTDB 元数据
+
+1. storage group: 存储组。
+2. path(time series ID):存储路径。
+3. measurement: 物理量。
+
+
+
+#### 2.2.3 两者映射关系
+
+InfluxDB 元数据和 IoTDB 元数据有着如下的映射关系:
+1. InfluxDB 中的 database 和 measurement 组合起来作为 IoTDB 中的 storage group。
+2. InfluxDB 中的 field key 作为 IoTDB 中 measurement 路径,InfluxDB 中的 field value 即是该路径下记录的测点值。
+3. InfluxDB 中的 tag 在 IoTDB 中使用 storage group 和 measurement 之间的路径表达。InfluxDB 的 tag key 由 storage group 和 measurement 之间路径的顺序隐式表达,tag value 记录为对应顺序的路径的名称。
+
+InfluxDB 元数据向 IoTDB 元数据的转换关系可以由下面的公示表示:
+
+`root.{database}.{measurement}.{tag value 1}.{tag value 2}...{tag value N-1}.{tag value N}.{field key}`
+
+
+
+如上图所示,可以看出:
+
+我们在 IoTDB 中使用 storage group 和 measurement 之间的路径来表达 InfluxDB tag 的概念,也就是图中右侧绿色方框的部分。
+
+storage group 和 measurement 之间的每一层都代表一个 tag。如果 tag key 的数量为 N,那么 storage group 和 measurement 之间的路径的层数就是 N。我们对 storage group 和 measurement 之间的每一层进行顺序编号,每一个序号都和一个 tag key 一一对应。同时,我们使用 storage group 和 measurement 之间每一层 **路径的名字** 来记 tag value,tag key 可以通过自身的序号找到对应路径层级下的 tag value.
+
+#### 2.2.4 关键问题
+
+在 InfluxDB 的 SQL 语句中,tag 顺序的不同并不会影响实际的结果。
+
+例如:
+`insert factory, workshop=A1, production=B1, temperature=16.9` 和 `insert factory, production=B1, workshop=A1, temperature=16.9` 两条 SQL 的含义相等。
+
+但在 IoTDB 中,上述插入的数据点可以存储在 `root.monitor.factory.A1.B1.temperature` 下,也可以存储在 `root.monitor.factory.B1.A1.temperature` 下。因此,IoTDB 路径中储存的 InfluxDB
+ 的 tag 的顺序就是需要考虑的,因为 `root.monitor.factory.A1.B1.temperature` 和
+`root.monitor.factory.B1.A1.temperature` 是两条不同的序列。我们也可以认为,IoTDB 对 tag 的顺序是“敏感”的。
+
+因此,我们还需要在 IoTDB 中记录 InfluxDB 每个 tag 对应在 IoTDB 路径中的层级顺序,确保在执行 InfluxDB SQL 时,即使 tag 不同的同一条时序对应到IoTDB中也是同一条时序。
+
+这里还需要考虑的一个问题是:InfluxDB的tag key及对应顺序关系如何持久化到IoTDB数据库中里,这样才不会丢失相关信息。
+
+需要解决的事情:
+ 1. 怎样把InfluxDB中tag key映射到IoTDB中path中的节点顺序。
+ 2. 在不知道InfluxDB中可能会出现所有tag key的情况下,怎么维护它们之间的顺序。
+ 3. InfluxDB的tag key及对应顺序关系如何持久化到IoTDB数据库中。
+
+解决方案:
+1. 通过利用内存中的Map <Measurement, Map <Tag Key, Order> > Map结构,来维护Tag之间的顺序。
+
+ ```java
+ Map<String, Map<String, Integer>> measurementTagOrder
+ ```
+ 可以看出Map是一个两层的,第一层的Key是String类型的Measurement,第一层的Value是一个<String,Integer>的Map。
+
+ 第二层的Key是String类型的Tag Key,第二层的Value是Integer类型的Tag Order,也就是Tag对应的实际顺序。
+
+ 这样就可以先通过measurement定位,再通过tag key定位,最后就可以获得Tag对应的顺序了。
+
+3. 除了在内存中维护InfluxDB的Tag顺序外,还需要进行持久化操作,将InfluxDB的Tag顺序持久化到IoTDB数据库中里。
+ 存储组为`root.TAG_INFO`,分别以`database_name`,`measurement_name`,`tag_name`和`tag_order`来存储节点来记录数据。
Review comment:
```suggestion
**解决方案:**
通过利用内存中的`Map<Measurement, Map<Tag Key, Order>>` 这样一个 Map 结构,来维护 tag 在 IoTDB 路径层级上的顺序。
```java
Map<String, Map<String, Integer>> measurementTagOrder
```
可以看出 Map 是一个两层的结构。
第一层的 Key 是 String 类型的 InfluxDB measurement,第一层的 Value 是一个 <String, Integer> 结构的 Map。
第二层的 Key 是 String 类型的 InfluxDB tag key,第二层的 Value 是 Integer 类型的 tag order,也就是 tag 在 IoTDB 路径层级上的顺序。
使用时,就可以先通过 InfluxDB measurement 定位,再通过 InfluxDB tag key 定位,最后就可以获得 tag 在 IoTDB 路径层级上的顺序了。
除了在内存中维护 InfluxDB 的 tag 顺序外,还需要对该顺序信息进行持久化操作,即将 InfluxDB tag 在 IoTDB 路径层级上的顺序持久化到 IoTDB 数据库中。
存储方案如下:
存储组为`root.TAG_INFO`,分别用存储组下的 `database_name`, `measurement_name`, `tag_name` 和 `tag_order` 测点来存储节点来记录数据。
```
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,217 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+该适配器以 IoTDB Java Session 接口为底层基础,实现了 InfluxDB 的 Java 接口 `interface InfluxDB`,对用户提供了所有 InfluxDB 的接口方法,最终用户可以无感知地使用 InfluxDB 协议向 IoTDB 发起写入和读取请求。
+
+
+
+
+
+
+### 2.2 元数据格式转换
+
+InfluxDB 的元数据是 tag-field 模型,IoTDB 的元数据是树形模型。为了使适配器能够兼容 InfluxDB 协议,需要把 InfluxDB 的元数据模型转换成 IoTDB 的元数据模型。
+
+#### 2.2.1 InfluxDB 元数据
+
+1. database: 数据库名。
+2. measurement: 测量指标名。
+3. tags : 各种有索引的属性。
+4. fields : 各种记录值(没有索引的属性)。
+
+
+
+#### 2.2.2 IoTDB 元数据
+
+1. storage group: 存储组。
+2. path(time series ID):存储路径。
+3. measurement: 物理量。
+
+
+
+#### 2.2.3 两者映射关系
+
+InfluxDB 元数据和 IoTDB 元数据有着如下的映射关系:
+1. InfluxDB 中的 database 和 measurement 组合起来作为 IoTDB 中的 storage group。
+2. InfluxDB 中的 field key 作为 IoTDB 中 measurement 路径,InfluxDB 中的 field value 即是该路径下记录的测点值。
+3. InfluxDB 中的 tag 在 IoTDB 中使用 storage group 和 measurement 之间的路径表达。InfluxDB 的 tag key 由 storage group 和 measurement 之间路径的顺序隐式表达,tag value 记录为对应顺序的路径的名称。
+
+InfluxDB 元数据向 IoTDB 元数据的转换关系可以由下面的公示表示:
+
+`root.{database}.{measurement}.{tag value 1}.{tag value 2}...{tag value N-1}.{tag value N}.{field key}`
+
+
+
+如上图所示,可以看出:
+
+我们在 IoTDB 中使用 storage group 和 measurement 之间的路径来表达 InfluxDB tag 的概念,也就是图中右侧绿色方框的部分。
+
+storage group 和 measurement 之间的每一层都代表一个 tag。如果 tag key 的数量为 N,那么 storage group 和 measurement 之间的路径的层数就是 N。我们对 storage group 和 measurement 之间的每一层进行顺序编号,每一个序号都和一个 tag key 一一对应。同时,我们使用 storage group 和 measurement 之间每一层 **路径的名字** 来记 tag value,tag key 可以通过自身的序号找到对应路径层级下的 tag value.
+
+#### 2.2.4 关键问题
+
+在 InfluxDB 的 SQL 语句中,tag 顺序的不同并不会影响实际的结果。
+
+例如:
+`insert factory, workshop=A1, production=B1, temperature=16.9` 和 `insert factory, production=B1, workshop=A1, temperature=16.9` 两条 SQL 的含义相等。
+
+但在 IoTDB 中,上述插入的数据点可以存储在 `root.monitor.factory.A1.B1.temperature` 下,也可以存储在 `root.monitor.factory.B1.A1.temperature` 下。因此,IoTDB 路径中储存的 InfluxDB
+ 的 tag 的顺序就是需要考虑的,因为 `root.monitor.factory.A1.B1.temperature` 和
+`root.monitor.factory.B1.A1.temperature` 是两条不同的序列。我们也可以认为,IoTDB 对 tag 的顺序是“敏感”的。
+
+因此,我们还需要在 IoTDB 中记录 InfluxDB 每个 tag 对应在 IoTDB 路径中的层级顺序,确保在执行 InfluxDB SQL 时,即使 tag 不同的同一条时序对应到IoTDB中也是同一条时序。
+
+这里还需要考虑的一个问题是:InfluxDB的tag key及对应顺序关系如何持久化到IoTDB数据库中里,这样才不会丢失相关信息。
+
+需要解决的事情:
+ 1. 怎样把InfluxDB中tag key映射到IoTDB中path中的节点顺序。
+ 2. 在不知道InfluxDB中可能会出现所有tag key的情况下,怎么维护它们之间的顺序。
+ 3. InfluxDB的tag key及对应顺序关系如何持久化到IoTDB数据库中。
+
+解决方案:
+1. 通过利用内存中的Map <Measurement, Map <Tag Key, Order> > Map结构,来维护Tag之间的顺序。
+
+ ```java
+ Map<String, Map<String, Integer>> measurementTagOrder
+ ```
+ 可以看出Map是一个两层的,第一层的Key是String类型的Measurement,第一层的Value是一个<String,Integer>的Map。
+
+ 第二层的Key是String类型的Tag Key,第二层的Value是Integer类型的Tag Order,也就是Tag对应的实际顺序。
+
+ 这样就可以先通过measurement定位,再通过tag key定位,最后就可以获得Tag对应的顺序了。
+
+3. 除了在内存中维护InfluxDB的Tag顺序外,还需要进行持久化操作,将InfluxDB的Tag顺序持久化到IoTDB数据库中里。
+ 存储组为`root.TAG_INFO`,分别以`database_name`,`measurement_name`,`tag_name`和`tag_order`来存储节点来记录数据。
Review comment:
```suggestion
**解决方案:**
通过利用内存中的`Map<Measurement, Map<Tag Key, Order>>` 这样一个 Map 结构,来维护 tag 在 IoTDB 路径层级上的顺序。
```java
Map<String, Map<String, Integer>> measurementTagOrder
```
可以看出 Map 是一个两层的结构。
第一层的 Key 是 String 类型的 InfluxDB measurement,第一层的 Value 是一个 <String, Integer> 结构的 Map。
第二层的 Key 是 String 类型的 InfluxDB tag key,第二层的 Value 是 Integer 类型的 tag order,也就是 tag 在 IoTDB 路径层级上的顺序。
使用时,就可以先通过 InfluxDB measurement 定位,再通过 InfluxDB tag key 定位,最后就可以获得 tag 在 IoTDB 路径层级上的顺序了。
除了在内存中维护 InfluxDB 的 tag 顺序外,还需要对该顺序信息进行持久化操作,即将 InfluxDB tag 在 IoTDB 路径层级上的顺序持久化到 IoTDB 数据库中。
**存储方案如下:**
存储组为`root.TAG_INFO`,分别用存储组下的 `database_name`, `measurement_name`, `tag_name` 和 `tag_order` 测点来存储节点来记录数据。
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] Plutooooooo commented on pull request #4090: [IOTDB-1810]Compatibility of Apache IoTDB with InfluxDB - Compatibility scheme
Posted by GitBox <gi...@apache.org>.
Plutooooooo commented on pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#issuecomment-943361727
读上一版的时候觉得influxDB到ioTDB tag的映射关系那一部分比较晦涩,需要多看几遍才能明白,现在这一版讲得非常清楚。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] FrankenstainT commented on pull request #4090: [IOTDB-1810]Compatibility of Apache IoTDB with InfluxDB - Compatibility scheme
Posted by GitBox <gi...@apache.org>.
FrankenstainT commented on pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#issuecomment-943002506
LGTM:)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] Plutooooooo commented on pull request #4090: [IOTDB-1810]Compatibility of Apache IoTDB with InfluxDB - Compatibility scheme
Posted by GitBox <gi...@apache.org>.
Plutooooooo commented on pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#issuecomment-943364441
btw 2.2.3 两者映射关系中解决方案的第一行应该是map <Measurement, Map <Tag Key, Order> > ,似乎漏写成了ap
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] jun0315 commented on pull request #4090: [IOTDB-1810]Compatibility of Apache IoTDB with InfluxDB - Compatibility scheme
Posted by GitBox <gi...@apache.org>.
jun0315 commented on pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#issuecomment-942283726
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] jun0315 commented on pull request #4090: [IOTDB-1810]Compatibility of Apache IoTDB with InfluxDB - Compatibility scheme
Posted by GitBox <gi...@apache.org>.
jun0315 commented on pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#issuecomment-943456206
> btw 2.2.3 两者映射关系中解决方案的第一行应该是map <Measurement, Map <Tag Key, Order> > ,似乎漏写成了ap
Thanks for your review. I have fixed it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] Plutooooooo removed a comment on pull request #4090: [IOTDB-1810] Compatibility of Apache IoTDB with InfluxDB - Compatibility Scheme
Posted by GitBox <gi...@apache.org>.
Plutooooooo removed a comment on pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#issuecomment-944839440
关于2.3.1.5中“但是这样实际并不会影响查询的正确性,因为一旦Influxdb的Tag顺序确定之后,查询也会按照这个顺序表记录的顺序进行Tag值过滤。所以并不会影响查询的正确性。”由于我之前没有详细看过ioTDB查询语言的语法,我会有这种疑问:我在写查询语句的时候是否需要知道tag所处的层级呢?在2.3.2.5的例子"查询student中(name=A或phone=B或sex=C)且score>97"的查询语句如下:
select * from root.monitor.student.A where score>97
select * from root.monitor.student.*.B where score>97
select * from root.monitor.student.*.*.C where score>97
看上去是需要知道name的order是0,phone的order是1,sex的order是2,所以才会写出这样的查询语句。如果需要知道tag所处的层级,我觉得在用户文档里可以加上如何查找tag层级的说明,比如查询root.TAG_INFO。如果不需要的话应该是我理解错了......
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] SteveYurongSu commented on a change in pull request #4090: [IOTDB-1810]Compatibility of Apache IoTDB with InfluxDB - Compatibility scheme
Posted by GitBox <gi...@apache.org>.
SteveYurongSu commented on a change in pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#discussion_r728583451
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,144 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+该适配器的实现为一个继承了InfluxDB基类的子类, 这个子类实现了InfluxDB的所有接口,并没有改变InfluxDB原有的操作函数,最终以IoTDB的协议在IoTDB数据库中写入和读取。
Review comment:
```suggestion
该适配器以 IoTDB Java Session 接口为底层基础,实现了 InfluxDB 的 Java 接口 `interface InfluxDB`,对用户提供了所有 InfluxDB 的接口方法,最终用户可以无感知地使用 InfluxDB 协议向 IoTDB 发起写入和读取请求。
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] zcy1010 commented on a change in pull request #4090: [IOTDB-1810]Compatibility of Apache IoTDB with InfluxDB - Compatibility scheme
Posted by GitBox <gi...@apache.org>.
zcy1010 commented on a change in pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#discussion_r728007772
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,128 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+适配器是一个继承至InfluxDB基类的子类,实现了InfluxDB接口的所有方法,从而使InfluxDB原有的操作函数没有改变,但是会以IoTDB的协议写入IoTDB数据库中。
+
+
+
+
+
+
+### 2.2 数据格式转换
+
+#### 2.2.1 InfluxDB数据格式
+
+1. database: 数据库名。
+2. measurement: 测量指标名。
+3. tags : 各种有索引的属性。
+4. fields : 各种记录值(没有索引的属性)。
+
+
+
+#### 2.2.2 IoTDB数据格式
+
+1. storage group: 存储组。
+2. path(time series ID):存储路径。
+3. measurement: 物理量。
+
+
+
+#### 2.2.3 两者映射关系
+
+1. InfluxDB中的database和measurement可以看做IoTDB中的storage group。
+2. InfluxDB中的tags可以看做IoTDB中的path。
+3. InfluxDB中的fields可以看做IoTDB中measurement。
+
+
+
+#### 2.2.4 转换中的问题
+1. 问题:InfluxDB中Tag的顺序不敏感,而在IoTDB中是敏感的。
+2. 关键点:需要记录每个tag对应的顺序,确保InfluxDB中label顺序不同的同一条时序对应到IoTDB中也是一条时序。
+3. 需要解决的事情:
+ 1. 怎样映射tag key和它对应的order
Review comment:
1. 怎样把tag key映射到和它对应的order
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,128 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+适配器是一个继承至InfluxDB基类的子类,实现了InfluxDB接口的所有方法,从而使InfluxDB原有的操作函数没有改变,但是会以IoTDB的协议写入IoTDB数据库中。
+
+
+
+
+
+
+### 2.2 数据格式转换
+
+#### 2.2.1 InfluxDB数据格式
+
+1. database: 数据库名。
+2. measurement: 测量指标名。
+3. tags : 各种有索引的属性。
+4. fields : 各种记录值(没有索引的属性)。
+
+
+
+#### 2.2.2 IoTDB数据格式
+
+1. storage group: 存储组。
+2. path(time series ID):存储路径。
+3. measurement: 物理量。
+
+
+
+#### 2.2.3 两者映射关系
+
+1. InfluxDB中的database和measurement可以看做IoTDB中的storage group。
+2. InfluxDB中的tags可以看做IoTDB中的path。
+3. InfluxDB中的fields可以看做IoTDB中measurement。
+
+
+
+#### 2.2.4 转换中的问题
+1. 问题:InfluxDB中Tag的顺序不敏感,而在IoTDB中是敏感的。
+2. 关键点:需要记录每个tag对应的顺序,确保InfluxDB中label顺序不同的同一条时序对应到IoTDB中也是一条时序。
+3. 需要解决的事情:
+ 1. 怎样映射tag key和它对应的order
+ 2. 在不知道所有的label key的情况下,怎么维护他们之间的顺序
+
+### 2.3 解决方案
+
+#### 2.3.1 主要思想
+
+1. 内存中Map <Measurement, Map <Tag Key, Order> > table结构维护Tag之间的顺序
Review comment:
不太理解`table结构维护Tag之间的顺序`
##########
File path: docs/zh/UserGuide/API/InfluxDB-Protocol.md
##########
@@ -33,3 +33,128 @@ InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```
+## 2.方案设计
+
+### 2.1 InfluxDB-Protocol适配器
+
+适配器是一个继承至InfluxDB基类的子类,实现了InfluxDB接口的所有方法,从而使InfluxDB原有的操作函数没有改变,但是会以IoTDB的协议写入IoTDB数据库中。
Review comment:
该适配器的实现为一个继承了InfluxDB基类的子类, 这个子类实现了InfluxDB的所有接口,并没有改变InfluxDB原有的操作函数,最终以IoTDB的协议写入loTDB数据库中。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] Plutooooooo commented on pull request #4090: [IOTDB-1810] Compatibility of Apache IoTDB with InfluxDB - Compatibility Scheme
Posted by GitBox <gi...@apache.org>.
Plutooooooo commented on pull request #4090:
URL: https://github.com/apache/iotdb/pull/4090#issuecomment-944839321
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org