influxdata / influxdata/influxdb-java
Query with different time format does not work if database is not specified.
- 主要言語
- Java
- スター
- 1.2k
- フォーク
- 469
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
If you do not specify database in query (even thou you have specified database on the client level) method InfluxDBl#query(Query, TimeUnit) will not return any result because it will not send database information.
Steps to reproduce:
```java
InfluxDB influxDB = InfluxDBFactory.connect(host + ":" + port);
influxDB.setDatabase(database);
// queryResult will be empty.
QueryResult queryResult = influxDB.query(new Query("..."), TimeUnit.NANOSECONDS)
```
Quick fix:
```java
InfluxDB influxDB = InfluxDBFactory.connect(host + ":" + port);
influxDB.setDatabase(database);
// queryResult will be empty.
QueryResult queryResult = influxDB.query(new Query("...", "database"), TimeUnit.NANOSECONDS)
```
Permanent fix:
Change into "InfluxDBImpl#query(Query, TimeUnit)" into:
```java
public QueryResult query(final Query query, final TimeUnit timeUnit) {
String db = query.getDatabase();
if (db == null) {
db = this.database;
}
Call call = null;
if (query instanceof BoundParameterQuery) {
BoundParameterQuery boundParameterQuery = (BoundParameterQuery) query;
call = this.influxDBService.query(db,
TimeUtil.toTimePrecision(timeUnit), query.getCommandWithUrlEncoded(),
boundParameterQuery.getParameterJsonWithUrlEncoded());
} else {
call = this.influxDBService.query(db,
TimeUtil.toTimePrecision(timeUnit), query.getCommandWithUrlEncoded());
}
return executeQuery(call);
}
```
Here database information is taken from client level if not given in query object.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
InfluxDBImpl#query(Query, TimeUnit) から開始し、Query.getDatabase() とクライアントレベルで設定されたデータベースが influxDBService.query にどのように渡されるかを確認します。通常の Query と BoundParameterQuery の両方の動作を検証します。独自のデータベースを持たない query がクライアントに設定されたデータベースを使用し、要求された時間精度で結果を返せば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- database
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 48/100