Skip to content

Commit 4589fe1

Browse files
committed
Remove incorrect Expression and SQL registry
Signed-off-by: Jason T. Brown <jason@astraea.earth>
1 parent 2c244aa commit 4589fe1

4 files changed

Lines changed: 2 additions & 39 deletions

File tree

core/src/main/scala/org/locationtech/rasterframes/expressions/aggregates/ApproxCellQuantilesAggregate.scala

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ package org.locationtech.rasterframes.expressions.aggregates
2323

2424
import geotrellis.raster.{Tile, isNoData}
2525
import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder
26-
import org.apache.spark.sql.catalyst.expressions.aggregate.{AggregateExpression, AggregateFunction, AggregateMode, Complete}
27-
import org.apache.spark.sql.catalyst.expressions.{ExprId, Expression, ExpressionDescription, NamedExpression}
2826
import org.apache.spark.sql.catalyst.util.QuantileSummaries
29-
import org.apache.spark.sql.execution.aggregate.ScalaUDAF
3027
import org.apache.spark.sql.expressions.{MutableAggregationBuffer, UserDefinedAggregateFunction}
3128
import org.apache.spark.sql.{Column, Encoder, Row, TypedColumn, types}
3229
import org.apache.spark.sql.types.{DataTypes, StructField, StructType}
@@ -88,29 +85,4 @@ object ApproxCellQuantilesAggregate {
8885
.as(s"rf_agg_approx_quantiles")
8986
.as[Seq[Double]]
9087
}
91-
92-
/** Adapter hack to allow UserDefinedAggregateFunction to be referenced as an expression. */
93-
@ExpressionDescription(
94-
usage = "_FUNC_(tile, probabilities, relativeError) - Compute aggregate cell histogram over a tile column.",
95-
arguments = """
96-
Arguments:
97-
* tile - tile column to analyze
98-
* probabilities - array of double values in [0, 1] at which to compute quantiles
99-
* relativeError - non-negative error tolerance""",
100-
examples = """
101-
Examples:
102-
> SELECT _FUNC_(tile, array(0.1, 0.25, 0.5, 0.75, 0.9), 0.001);
103-
..."""
104-
)
105-
class ApproxCellQuantilesUDAF(aggregateFunction: AggregateFunction, mode: AggregateMode, isDistinct: Boolean, resultId: ExprId)
106-
extends AggregateExpression(aggregateFunction, mode, isDistinct, resultId) {
107-
def this(child: Expression, probabilities: Seq[Double], relativeError: Double) =
108-
this(ScalaUDAF(Seq(ExtractTile(child)), new ApproxCellQuantilesAggregate(probabilities, relativeError)), Complete, false, NamedExpression.newExprId)
109-
override def nodeName: String = "rf_agg_approx_quantiles"
110-
}
111-
112-
object ApproxCellQuantilesUDAF {
113-
def apply(child: Expression, probabilities: Seq[Double], relativeError: Double): ApproxCellQuantilesUDAF = new ApproxCellQuantilesUDAF(child, probabilities, relativeError)
114-
def apply(child: Expression, probabilities: Seq[Double]): ApproxCellQuantilesUDAF = new ApproxCellQuantilesUDAF(child, probabilities, 0.00001)
115-
}
11688
}

core/src/main/scala/org/locationtech/rasterframes/expressions/package.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ package object expressions {
117117
registry.registerExpression[CellCountAggregate.NoDataCells]("rf_agg_no_data_cells")
118118
registry.registerExpression[CellStatsAggregate.CellStatsAggregateUDAF]("rf_agg_stats")
119119
registry.registerExpression[HistogramAggregate.HistogramAggregateUDAF]("rf_agg_approx_histogram")
120-
registry.registerExpression[ApproxCellQuantilesAggregate.ApproxCellQuantilesUDAF]("rf_agg_approx_quantiles")
121120
registry.registerExpression[LocalStatsAggregate.LocalStatsAggregateUDAF]("rf_agg_local_stats")
122121
registry.registerExpression[LocalTileOpAggregate.LocalMinUDAF]("rf_agg_local_min")
123122
registry.registerExpression[LocalTileOpAggregate.LocalMaxUDAF]("rf_agg_local_max")

core/src/test/scala/org/locationtech/rasterframes/RasterFramesStatsSpec.scala

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,6 @@ class RasterFramesStatsSpec extends TestEnvironment with TestData {
7272
result should contain inOrderOnly(7963.0, 10068.0, 12160.0)
7373
}
7474

75-
it("should compute approx percentiles with SQL") {
76-
val result = df.selectExpr("rf_agg_approx_quantiles(tile, array(0.1, 0.5, 0.9), 0.00001) as iles")
77-
.first()
78-
.getSeq[Double](0)
79-
80-
result.length should be (3)
81-
82-
// computing externally with numpy we arrive at 7963, 10068, 12160 for these quantiles
83-
result should contain inOrderOnly(7963.0, 10068.0, 12160.0)
84-
}
8575
}
8676
}
8777

docs/src/main/paradox/reference.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,8 @@ Aggregates over all of the rows in DataFrame of `tile` and returns a count of ea
632632

633633
Array[Double] rf_agg_approx_quantiles(Tile tile, List[float] probabilities, float relative_error)
634634

635+
__Not supported in SQL.__
636+
635637
Calculates the approximate quantiles of a tile column of a DataFrame. `probabilities` is a list of float values at which to compute the quantiles. These must belong to [0, 1]. For example 0 is the minimum, 0.5 is the median, 1 is the maximum. Returns an array of values approximately at the specified `probabilities`.
636638

637639
## Tile Local Aggregate Statistics

0 commit comments

Comments
 (0)