apache / apache/iotdb

[Bug] 多设备查询最新值报错

Offen
#9,359 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Java
Sterne
6.4k
Forks
1.2k
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
115

Beschreibung

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/iotdb/issues) and found nothing similar.

### Version

1.0.1

### Describe the bug and provide the minimal reproduce step

查询多设备最新值

select last 进水COD, `11`, CO2, 水管流速, 膜产水状态, 功能码, TJCTSB1_Manual_start, TJCTSB1_Manual_stop, JCS_In_TN from root.ln_1.tb_6340, root.ln_1.tb_0014, root.ln_1.tb_6141

### What did you expect to see?

正确结果

### What did you see instead?

Msg: 301: null
2023-03-17 16:05:46,526 [Query-Worker-Thread-11$20230317_080546_52613_1.1.0] WARN o.a.i.d.m.e.s.AbstractDriverThread:80 - [ExecuteFailed]
java.lang.NullPointerException: null
at org.apache.iotdb.db.mpp.execution.operator.process.last.LastQueryUtil.appendLastValue(LastQueryUtil.java:108)
at org.apache.iotdb.db.mpp.execution.operator.process.last.LastQueryMergeOperator.next(LastQueryMergeOperator.java:171)
at org.apache.iotdb.db.mpp.execution.driver.Driver.processInternal(Driver.java:193)
at org.apache.iotdb.db.mpp.execution.driver.Driver.lambda$processFor$1(Driver.java:131)
at org.apache.iotdb.db.mpp.execution.driver.Driver.tryWithLock(Driver.java:277)
at org.apache.iotdb.db.mpp.execution.driver.Driver.processFor(Driver.java:112)
at org.apache.iotdb.db.mpp.execution.schedule.DriverTaskThread.execute(DriverTaskThread.java:64)
at org.apache.iotdb.db.mpp.execution.schedule.AbstractDriverThread.run(AbstractDriverThread.java:74)
2023-03-17 16:05:46,527 [pool-30-IoTDB-ClientRPC-Processor-6] WARN o.a.i.d.u.ErrorHandlingUtils:90 - Status code: 301, Query Statement: "select last 进水COD, CO2, 水管流速, 膜产水状态, 功能码, TJCTSB1_Manual_start, TJCTSB1_Manual_stop, JCS_In_TN from root.ln_1.tb_6340, root.ln_1.tb_0014, root.ln_1.tb_6141". executeStatement failed
org.apache.iotdb.commons.exception.IoTDBException: java.lang.NullPointerException
at org.apache.iotdb.db.mpp.plan.execution.QueryExecution.dealWithException(QueryExecution.java:428)
at org.apache.iotdb.db.mpp.plan.execution.QueryExecution.getResult(QueryExecution.java:411)
at org.apache.iotdb.db.mpp.plan.execution.QueryExecution.getByteBufferBatchResult(QueryExecution.java:446)
at org.apache.iotdb.db.utils.QueryDataSetUtils.convertQueryResultByFetchSize(QueryDataSetUtils.java:387)
at org.apache.iotdb.db.service.thrift.impl.ClientRPCServiceImpl.lambda$static$0(ClientRPCServiceImpl.java:162)
at org.apache.iotdb.db.service.thrift.impl.ClientRPCServiceImpl.executeStatementInternal(ClientRPCServiceImpl.java:240)
at org.apache.iotdb.db.service.thrift.impl.ClientRPCServiceImpl.executeStatementV2(ClientRPCServiceImpl.java:398)
at org.apache.iotdb.service.rpc.thrift.IClientRPCService$Processor$executeStatementV2.getResult(IClientRPCService.java:3509)
at org.apache.iotdb.service.rpc.thrift.IClientRPCService$Processor$executeStatementV2.getResult(IClientRPCService.java:3489)
at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:38)
at org.apache.iotdb.db.service.thrift.ProcessorWithMetrics.process(ProcessorWithMetrics.java:64)
at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:248)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException: null
at org.apache.iotdb.db.mpp.execution.operator.process.last.LastQueryUtil.appendLastValue(LastQueryUtil.java:108)
at org.apache.iotdb.db.mpp.execution.operator.process.last.LastQueryMergeOperator.next(LastQueryMergeOperator.java:171)
at org.apache.iotdb.db.mpp.execution.driver.Driver.processInternal(Driver.java:193)
at org.apache.iotdb.db.mpp.execution.driver.Driver.lambda$processFor$1(Driver.java:131)
at org.apache.iotdb.db.mpp.execution.driver.Driver.tryWithLock(Driver.java:277)
at org.apache.iotdb.db.mpp.execution.driver.Driver.processFor(Driver.java:112)
at org.apache.iotdb.db.mpp.execution.schedule.DriverTaskThread.execute(DriverTaskThread.java:64)
at org.apache.iotdb.db.mpp.execution.schedule.AbstractDriverThread.run(AbstractDriverThread.java:74)

### Anything else?

_No response_

### Are you willing to submit a PR?

- [ ] I'm willing to submit a PR!

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne bei LastQueryUtil.java in Zeile 108 und verfolge, wie LastQueryMergeOperator.java in Zeile 171 die LAST-Abfrage für mehrere Geräte verarbeitet. Reproduziere das gemeldete SQL mit IoTDB 1.0.1 oder einer gleichwertigen Umgebung und überprüfe anschließend, dass die Abfrage die korrekten neuesten Werte ohne eine NullPointerException zurückgibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java, sql
Bereich
databases
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.