Skip to content

Commit aca951a

Browse files
authored
refactor: rename percentile to quantile (#390)
1 parent 382c2f3 commit aca951a

5 files changed

Lines changed: 109 additions & 167 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
## 6.5.0 [unreleased]
22

3+
### Breaking Changes
4+
5+
#### FluxDSL
6+
The `percentile()` function renamed to `quantile()`.
7+
38
### Features
49
1. [#366](https://github.com/influxdata/influxdb-client-java/pull/356): Added an endpoint to query with InfluxQL (v1) for more info see [README.md](./client).
510

11+
### Bug Fixes
12+
1. [#390](https://github.com/influxdata/influxdb-client-java/pull/390): Rename `percentile()` function renamed to `quantile()` [FluxDSL]
13+
614
### Dependencies
715
Update dependencies:
816

flux-dsl/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -519,26 +519,26 @@ Flux flux = Flux
519519
.min();
520520
```
521521

522-
### percentile
523-
Percentile is both an aggregate operation and a selector operation depending on selected options.
524-
In the aggregate methods, it outputs the value that represents the specified percentile of the non null record as a float [[doc](http://bit.ly/flux-spec#percentile-aggregate)].
525-
- `columns` - specifies a list of columns to aggregate. Defaults to `_value`. [array of strings]
526-
- `percentile` - value between 0 and 1 indicating the desired percentile. [float]
527-
- `method` - percentile provides 3 methods for computation:
528-
- `estimate_tdigest` - an aggregate result that uses a tdigest data structure to compute an accurate percentile estimate on large data sources.
529-
- `exact_mean` - an aggregate result that takes the average of the two points closest to the percentile value.
530-
- `exact_selector` - Percentile
522+
### quantile
523+
quantile is both an aggregate operation and a selector operation depending on selected options.
524+
In the aggregate methods, it outputs the value that represents the specified quantile of the non null record as a float [[doc](http://bit.ly/flux-spec#quantile-aggregate)].
525+
- `column` - specifies a column to aggregate. Defaults to `_value`. [array of strings]
526+
- `quantile` - value between 0 and 1 indicating the desired quantile. [float]
527+
- `method` - quantile provides 3 methods for computation:
528+
- `estimate_tdigest` - an aggregate result that uses a tdigest data structure to compute an accurate quantile estimate on large data sources.
529+
- `exact_mean` - an aggregate result that takes the average of the two points closest to the quantile value.
530+
- `exact_selector` - Quantile
531531
- `compression` - Compression indicates how many centroids to use when compressing the dataset. A larger number produces a more accurate result at the cost of increased memory requirements. Defaults to `1000`. [float]
532532
```java
533533
Flux flux = Flux
534534
.from("telegraf")
535-
.percentile(0.80F);
535+
.quantile(0.80F);
536536

537537
Flux flux = Flux
538538
.from("telegraf")
539-
.percentile()
540-
.withColumns(new String[]{"value2"})
541-
.withPercentile(0.75F)
539+
.quantile()
540+
.withColumn("value2")
541+
.withQuantile(0.75F)
542542
.withMethod(MethodType.EXACT_MEAN)
543543
.withCompression(2_000F);
544544
```

flux-dsl/src/main/java/com/influxdb/query/dsl/Flux.java

Lines changed: 49 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@
6262
import com.influxdb.query.dsl.functions.MaxFlux;
6363
import com.influxdb.query.dsl.functions.MeanFlux;
6464
import com.influxdb.query.dsl.functions.MinFlux;
65-
import com.influxdb.query.dsl.functions.PercentileFlux;
6665
import com.influxdb.query.dsl.functions.PivotFlux;
66+
import com.influxdb.query.dsl.functions.QuantileFlux;
6767
import com.influxdb.query.dsl.functions.RangeFlux;
6868
import com.influxdb.query.dsl.functions.ReduceFlux;
6969
import com.influxdb.query.dsl.functions.RenameFlux;
@@ -122,7 +122,7 @@
122122
* <li>{@link MaxFlux}</li>
123123
* <li>{@link MeanFlux}</li>
124124
* <li>{@link MinFlux}</li>
125-
* <li>{@link PercentileFlux}</li>
125+
* <li>{@link QuantileFlux}</li>
126126
* <li>{@link PivotFlux}</li>
127127
* <li>{@link RangeFlux}</li>
128128
* <li>{@link RenameFlux}</li>
@@ -1214,118 +1214,95 @@ public final MinFlux min(@Nonnull final String column) {
12141214
}
12151215

12161216
/**
1217-
* Percentile is both an aggregate operation and a selector operation depending on selected options.
1217+
* Quantile is both an aggregate operation and a selector operation depending on selected options.
12181218
*
12191219
* <h3>The parameters had to be defined by:</h3>
12201220
* <ul>
1221-
* <li>{@link PercentileFlux#withColumns(String[])}</li>
1222-
* <li>{@link PercentileFlux#withColumns(Collection)}</li>
1223-
* <li>{@link PercentileFlux#withPercentile(Float)}</li>
1224-
* <li>{@link PercentileFlux#withCompression(Float)}</li>
1225-
* <li>{@link PercentileFlux#withMethod(String)}</li>
1226-
* <li>{@link PercentileFlux#withMethod(PercentileFlux.MethodType)}</li>
1227-
* <li>{@link PercentileFlux#withPropertyNamed(String)}</li>
1228-
* <li>{@link PercentileFlux#withPropertyNamed(String, String)}</li>
1229-
* <li>{@link PercentileFlux#withPropertyValueEscaped(String, String)}</li>
1230-
* <li>{@link PercentileFlux#withFunction(String, Object)}</li>
1231-
* <li>{@link PercentileFlux#withFunctionNamed(String, String)}</li>
1221+
* <li>{@link QuantileFlux#withColumn(String)}</li>
1222+
* <li>{@link QuantileFlux#withQuantile(Float)}</li>
1223+
* <li>{@link QuantileFlux#withCompression(Float)}</li>
1224+
* <li>{@link QuantileFlux#withMethod(String)}</li>
1225+
* <li>{@link QuantileFlux#withMethod(QuantileFlux.MethodType)}</li>
1226+
* <li>{@link QuantileFlux#withPropertyNamed(String)}</li>
1227+
* <li>{@link QuantileFlux#withPropertyNamed(String, String)}</li>
1228+
* <li>{@link QuantileFlux#withPropertyValueEscaped(String, String)}</li>
1229+
* <li>{@link QuantileFlux#withFunction(String, Object)}</li>
1230+
* <li>{@link QuantileFlux#withFunctionNamed(String, String)}</li>
12321231
* </ul>
12331232
*
1234-
* @return {@link PivotFlux}
1233+
* @return {@link QuantileFlux}
12351234
*/
12361235
@Nonnull
1237-
public final PercentileFlux percentile() {
1238-
return new PercentileFlux(this);
1236+
public final QuantileFlux quantile() {
1237+
return new QuantileFlux(this);
12391238
}
12401239

12411240
/**
1242-
* Percentile is both an aggregate operation and a selector operation depending on selected options.
1241+
* Quantile is both an aggregate operation and a selector operation depending on selected options.
12431242
*
1244-
* @param percentile value between 0 and 1 indicating the desired percentile
1245-
* @return {@link PivotFlux}
1243+
* @param quantile value between 0 and 1 indicating the desired quantile
1244+
* @return {@link QuantileFlux}
12461245
*/
12471246
@Nonnull
1248-
public final PercentileFlux percentile(@Nonnull final Float percentile) {
1247+
public final QuantileFlux quantile(@Nonnull final Float quantile) {
12491248

1250-
return new PercentileFlux(this)
1251-
.withPercentile(percentile);
1249+
return new QuantileFlux(this)
1250+
.withQuantile(quantile);
12521251
}
12531252

12541253
/**
1255-
* Percentile is both an aggregate operation and a selector operation depending on selected options.
1254+
* Quantile is both an aggregate operation and a selector operation depending on selected options.
12561255
*
1257-
* @param percentile value between 0 and 1 indicating the desired percentile
1258-
* @param method method to aggregate
1259-
* @return {@link PivotFlux}
1256+
* @param quantile value between 0 and 1 indicating the desired quantile
1257+
* @param method method to aggregate
1258+
* @return {@link QuantileFlux}
12601259
*/
12611260
@Nonnull
1262-
public final PercentileFlux percentile(@Nonnull final Float percentile,
1263-
@Nonnull final PercentileFlux.MethodType method) {
1261+
public final QuantileFlux quantile(@Nonnull final Float quantile,
1262+
@Nonnull final QuantileFlux.MethodType method) {
12641263

1265-
return new PercentileFlux(this)
1266-
.withPercentile(percentile)
1264+
return new QuantileFlux(this)
1265+
.withQuantile(quantile)
12671266
.withMethod(method);
12681267
}
12691268

12701269
/**
1271-
* Percentile is both an aggregate operation and a selector operation depending on selected options.
1270+
* Quantile is both an aggregate operation and a selector operation depending on selected options.
12721271
*
1273-
* @param percentile value between 0 and 1 indicating the desired percentile
1272+
* @param quantile value between 0 and 1 indicating the desired quantile
12741273
* @param method method to aggregate
12751274
* @param compression indicates how many centroids to use when compressing the dataset
1276-
* @return {@link PivotFlux}
1275+
* @return {@link QuantileFlux}
12771276
*/
12781277
@Nonnull
1279-
public final PercentileFlux percentile(@Nonnull final Float percentile,
1280-
@Nonnull final PercentileFlux.MethodType method,
1281-
@Nonnull final Float compression) {
1278+
public final QuantileFlux quantile(@Nonnull final Float quantile,
1279+
@Nonnull final QuantileFlux.MethodType method,
1280+
@Nonnull final Float compression) {
12821281

1283-
return new PercentileFlux(this)
1284-
.withPercentile(percentile)
1282+
return new QuantileFlux(this)
1283+
.withQuantile(quantile)
12851284
.withMethod(method)
12861285
.withCompression(compression);
12871286
}
12881287

12891288
/**
1290-
* Percentile is both an aggregate operation and a selector operation depending on selected options.
1289+
* Quantile is both an aggregate operation and a selector operation depending on selected options.
12911290
*
1292-
* @param columns specifies a list of columns to aggregate
1293-
* @param percentile value between 0 and 1 indicating the desired percentile
1291+
* @param column specifies a column to aggregate
1292+
* @param quantile value between 0 and 1 indicating the desired quantile
12941293
* @param method method to aggregate
12951294
* @param compression indicates how many centroids to use when compressing the dataset.
1296-
* @return {@link PivotFlux}
1295+
* @return {@link QuantileFlux}
12971296
*/
12981297
@Nonnull
1299-
public final PercentileFlux percentile(@Nonnull final String[] columns,
1300-
@Nonnull final Float percentile,
1301-
@Nonnull final PercentileFlux.MethodType method,
1302-
@Nonnull final Float compression) {
1303-
1304-
return new PercentileFlux(this)
1305-
.withColumns(columns)
1306-
.withPercentile(percentile)
1307-
.withMethod(method)
1308-
.withCompression(compression);
1309-
}
1298+
public final QuantileFlux quantile(@Nonnull final String column,
1299+
@Nonnull final Float quantile,
1300+
@Nonnull final QuantileFlux.MethodType method,
1301+
@Nonnull final Float compression) {
13101302

1311-
/**
1312-
* Percentile is both an aggregate operation and a selector operation depending on selected options.
1313-
*
1314-
* @param columns specifies a list of columns to aggregate
1315-
* @param percentile value between 0 and 1 indicating the desired percentile
1316-
* @param method method to aggregate
1317-
* @param compression indicates how many centroids to use when compressing the dataset.
1318-
* @return {@link PivotFlux}
1319-
*/
1320-
@Nonnull
1321-
public final PercentileFlux percentile(@Nonnull final Collection<String> columns,
1322-
@Nonnull final Float percentile,
1323-
@Nonnull final PercentileFlux.MethodType method,
1324-
@Nonnull final Float compression) {
1325-
1326-
return new PercentileFlux(this)
1327-
.withColumns(columns)
1328-
.withPercentile(percentile)
1303+
return new QuantileFlux(this)
1304+
.withColumn(column)
1305+
.withQuantile(quantile)
13291306
.withMethod(method)
13301307
.withCompression(compression);
13311308
}

0 commit comments

Comments
 (0)