Hi,
Let me start with my use case, our device is the car,
each car contains 200+ signals, and each upload carries a GPSTime,
These signal items are uploaded after the terminal USES time alignment,
If the uncollected assignment is null or a predefined outlier.


After decoding, the data is generally encapsulated into an object. The main 
information includes: deviceID, time, lat,lon,speed,fuel...
And different models or brands of signal items are not the same, of course we 
can ignore these.


So let's imagine taking data from Kafka, one at a time, and copying it to a 
database.
```
ConsumerRecord<String, UserDefinedBean> records = consumer.poll(100);
for (ConsumerRecord<String, UserDefinedBean> record : records) {
UserDefinedBean bean = record.value();
iotDBsession.insert(bean.getDeviceId(), bean.getTime(), bean);
}
```


or


```
class Device{
long time;
Map<String, Object> measurementsKV;
}
ConsumerRecord<String, UserDefinedBean> records = consumer.poll(100);
Map<String,Device> batchDevices = new HashMap<>();
for (ConsumerRecord<String, UserDefinedBean> record : records) {
UserDefinedBean bean = record.value();
batchDevices.put(bean.getDeviceId(), convert2DeviceBean(bean));
}
iotDBsession.insertBatch(batchDevices);
```


So I don't know how to align and why align it.


Thanks
---
Dawei Liu



On 04/18/2020 16:12,Jialin Qiao<qiaojia...@apache.org> wrote:
Hi,

There are mainly four interfaces in Session.

(1) insert(String deviceId, long time, List<String> measurements,
List<String> values)
insert some measurements of a device at a timestamp
(2) insertInBatch(List<String> deviceIds, List<Long> times,
List<List<String>> measurementsList, List<List<String>> valuesList)
multiple independent "insert"
(3) insertBatch(RowBatch rowBatch)
insert some data of one device
(4) insertMultipleDeviceBatch(Map<String, RowBatch> rowBatchMap)
multiple independent "insertBatch"


InsertDevice()
InsertMutiDevice() or InsertBatch()

Could you tell the relationship between these two naming with the existing
four?

Thanks,
—————————————————
Jialin Qiao
School of Software, Tsinghua University

乔嘉林
清华大学 软件学院


Dawei Liu <atoi...@163.com> 于2020年4月18日周六 下午3:58写道:

hi,
I don’t like AlignXX , the device and signal items should be intuitively
considered in the user's mind


So I think the method name should be:
InsertDevice()
InsertMutiDevice() or InsertBatch()


Thanks
———
Dawei Liu
On 04/18/2020 15:24, Xiangdong Huang wrote:
Hi,

Then, RowBatch is renamed to AlignedColumns?

A little better than SeriesBatch and ColumnBatch.

Best,
-----------------------------------
Xiangdong Huang
School of Software, Tsinghua University

黄向东
清华大学 软件学院


Jialin Qiao <qiaojia...@apache.org> 于2020年4月18日周六 下午3:13写道:

Hi,

insertAlignedColumns is fine to me.

Then, RowBatch is renamed to AlignedColumns?

Thanks,
—————————————————
Jialin Qiao
School of Software, Tsinghua University

乔嘉林
清华大学 软件学院


Xiangdong Huang <saint...@gmail.com> 于2020年4月18日周六 下午3:09写道:

Hi,

If you call the batch insertion of Data 1 as insertRows(),
why not call the batch insertion of Data 2 as  insertColumns()? or,
insertAlignedColumns();

RowBatch -> SeriesBatch or ColumnBatch

I think the name is not clear. Is there better suggestion?

Data 1:
row1: time, device1, s1, s2
row2: time, device2, s3, s4

Data 2:
device1
time, s1, s2, s3
1       1     2    3
2       1     2    3
3       1     2    3

Best,
-----------------------------------
Xiangdong Huang
School of Software, Tsinghua University

黄向东
清华大学 软件学院


Haonan Hou <hhao...@outlook.com> 于2020年4月18日周六 下午1:39写道:

Hi,

+1. The new way of naming seems more straight forward.

Thanks,
Haonan


On Apr 18, 2020, at 1:29 PM, Jialin Qiao <qiaojia...@apache.org>
wrote:

Hi,

The native API Session provides many methods. However, their names
are
confusing. For example, insertBatch and insertInBatch.

(1) insertBatch actually receives a RowBatch structure, which
contains
data
of multiple measurements of a device, these measurements data share
the
same time column.

If we treat it as a table, the table name is deviceId, the columns
are
Timestamp, measurements name.  This table should not contain null
value.

For example
device1
time, s1, s2, s3
1       1     2    3
2       1     2    3
3       1     2    3

(2) insertInBatch insert multiple rows, each row contains a
timestamp,
a
deviceID and arbitrary measurements with values. Each row is
independent.

For example,
row1: time, device1, s1, s2
row2: time, device2, s3, s4

So I plan to rename these methods.

RowBatch -> SeriesBatch or ColumnBatch
insertBatch -> insertSeriesBatch or ColumnBatch
insertInBatch -> insertRows

Does this look good to you?

Thanks,
—————————————————
Jialin Qiao
School of Software, Tsinghua University

乔嘉林
清华大学 软件学院





Reply via email to