iotdb
iotdb copied to clipboard
当java接口insertRecord() measurement含"." 时 将无法使用sql指定查询该measurement的数据
例如 先插入
private static Session session = new Session("127.0.0.1",6667,"root","root");
public static void insertRecord(String driveId,long time,List<String> measurements,List<String> values) throws IoTDBConnectionException, StatementExecutionException {
session.open();
session.insertRecord(driveId,time,measurements,values);
session.close();
}
public static void main(String[] args) throws Exception {
while (true) {
List<String> measurements = new ArrayList<>();
List<String> values = new ArrayList<>();
Map<String, String> data = new HashMap<>();
Random random = new Random();
data.put("TL_JS06.R_50NeckTemp2", String.valueOf(10 * random.nextFloat()));
data.put("R_50NeckTemp3", String.valueOf(10 * random.nextFloat()));
for (String tag : data.keySet()) {
measurements.add(tag);
values.add(data.get(tag));
}
IotDbSessionUtils.insertRecord("root.test.SD-T-JS006", new Date().getTime(), measurements, values);
Thread.sleep(100);
}
}
后查询 1 无数据, 2 有数据
select count(TL_JS06.R_50NeckTemp2),LAST_VALUE(TL_JS06.R_50NeckTemp2) from root.test.SD-T-JS006 group by ([2021-11-22 17:45:00, 2021-11-22 17:47:00), 2400ms)
select count(R_50NeckTemp3),LAST_VALUE(R_50NeckTemp3) from root.test.SD-T-JS006 group by ([2021-11-22 17:45:00, 2021-11-22 17:47:00), 2400ms)
但使用select * from root.test.SD-T-JS006 即可查到数据
Hi, this is your first issue in IoTDB project. Thanks for your report. Welcome to join the community!
You must point out which version you are using.
from v0.12 (I checked v0.12.2 and v0.12.3) on, iotdb will check the value of measurements and reject such requests:
Exception in thread "main" org.apache.iotdb.rpc.StatementExecutionException: 313: failed to insert measurements [TL_JS06.R_50NeckTemp2] caused by TL_JS06.R_50NeckTemp2 is an illegal measurementId
at org.apache.iotdb.rpc.RpcUtils.verifySuccess(RpcUtils.java:85)
at org.apache.iotdb.rpc.RpcUtils.verifySuccessWithRedirection(RpcUtils.java:91)
at org.apache.iotdb.session.SessionConnection.insertRecord(SessionConnection.java:485)
at org.apache.iotdb.session.Session.insertRecord(Session.java:754)
at org.apache.iotdb.session.Session.insertRecord(Session.java:937)
at org.apache.iotdb.SessionExample.insertRecord(SessionExample.java:41)
at org.apache.iotdb.SessionExample.main(SessionExample.java:57)
But the server-side has too detailed log, and this case will be fixed in https://issues.apache.org/jira/browse/IOTDB-2055