Skip to content

Commit cffa289

Browse files
committed
Merge branch 'develop' into feature/xz2
* develop: Fixed image link in README.md PR feedback. Removed `GeoTiffCollectionRelation` due to usage limitation and overlap with `RasterSourceDataSource` functionality. Bump pytest to 4.x series In rf_ipython, honor users pandas max_colwidth on Geometry objects Additional python version wrangling. merge pyspark-notebook:spark-2.3.4-hadoop-2.7 Dockerfile into this one Dropping pandas version requirement. Updated requirements.txt for Spark. Fixes to `UserDefinedAggregateFunction` implementations so they run in the Databricks environment. Not sure what the cause is, but this change set seems to fix it. Added shading of Typesafe config. Upgraded to Spark 2.4.4 Bumped dev version. Set release version. Reworking of logging usage to fix #293 Eyecandy for index page. Bumping pytest version. Added liblzma-dev to build environment.
2 parents e799a03 + 1ec7e9e commit cffa289

File tree

58 files changed

+510
-990
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+510
-990
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<img src="docs/src/main/paradox/_template/images/RasterFramesLogo.png" width="300px"/><sup style="vertical-align: top;">&reg;</sup>
1+
<img src="docs/src/main/paradox/_template/assets/images/RasterFramesLogo.png" width="300px"/><sup style="vertical-align: top;">&reg;</sup>
22

33
[![Join the chat at https://gitter.im/locationtech/rasterframes](https://badges.gitter.im/locationtech/rasterframes.svg)](https://gitter.im/locationtech/rasterframes?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
44

bench/src/main/scala/org/locationtech/rasterframes/bench/TileExplodeBench.scala

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@ package org.locationtech.rasterframes.bench
2222

2323
import java.util.concurrent.TimeUnit
2424

25-
import org.apache.spark.sql.catalyst.InternalRow
26-
import org.apache.spark.sql.catalyst.expressions.BoundReference
27-
import org.apache.spark.sql.rf.TileUDT
2825
import org.locationtech.rasterframes._
29-
import org.locationtech.rasterframes.expressions.generators.ExplodeTiles
26+
import org.apache.spark.sql._
27+
import org.apache.spark.sql.functions._
3028
import org.openjdk.jmh.annotations._
29+
3130
/**
3231
*
3332
* @author sfitch
@@ -37,32 +36,33 @@ import org.openjdk.jmh.annotations._
3736
@State(Scope.Benchmark)
3837
@OutputTimeUnit(TimeUnit.MILLISECONDS)
3938
class TileExplodeBench extends SparkEnv {
39+
import spark.implicits._
4040

41-
//@Param(Array("uint8", "uint16ud255", "float32", "float64"))
42-
@Param(Array("uint16ud255"))
41+
@Param(Array("uint8", "uint16ud255", "float32", "float64"))
4342
var cellTypeName: String = _
4443

4544
@Param(Array("256"))
4645
var tileSize: Int = _
4746

48-
@Param(Array("2000"))
47+
@Param(Array("100"))
4948
var numTiles: Int = _
5049

5150
@transient
52-
var tiles: Array[InternalRow] = _
53-
54-
var exploder: ExplodeTiles = _
51+
var tiles: DataFrame = _
5552

5653
@Setup(Level.Trial)
5754
def setupData(): Unit = {
58-
tiles = Array.fill(numTiles)(randomTile(tileSize, tileSize, cellTypeName))
59-
.map(t => InternalRow(TileUDT.tileSerializer.toInternalRow(t)))
60-
val expr = BoundReference(0, TileType, true)
61-
exploder = new ExplodeTiles(1.0, None, Seq(expr))
55+
tiles = Seq.fill(numTiles)(randomTile(tileSize, tileSize, cellTypeName))
56+
.toDF("tile").repartition(10)
57+
}
58+
59+
@Benchmark
60+
def arrayExplode() = {
61+
tiles.select(posexplode(rf_tile_to_array_double($"tile"))).count()
6262
}
63+
6364
@Benchmark
6465
def tileExplode() = {
65-
for(t <- tiles)
66-
exploder.eval(t)
66+
tiles.select(rf_explode_tiles($"tile")).count()
6767
}
6868
}

build.sbt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ lazy val root = project
3232
.withId("RasterFrames")
3333
.aggregate(core, datasource, pyrasterframes, experimental)
3434
.enablePlugins(RFReleasePlugin)
35-
.settings(publish / skip := true)
35+
.settings(
36+
publish / skip := true,
37+
clean := clean.dependsOn(`rf-notebook`/clean).value
38+
)
3639

3740
lazy val `rf-notebook` = project
3841
.dependsOn(pyrasterframes)

build/circleci/Dockerfile

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ RUN sudo apt-get update && \
1414
pandoc \
1515
wget \
1616
gcc g++ build-essential \
17-
libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev \
18-
libcurl4-gnutls-dev \
19-
libproj-dev \
20-
libgeos-dev \
21-
libhdf4-alt-dev \
22-
bash-completion \
23-
cmake \
24-
imagemagick \
25-
libpng-dev \
26-
libffi-dev \
17+
libreadline-gplv2-dev libncursesw5-dev \
18+
libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev \
19+
liblzma-dev \
20+
libcurl4-gnutls-dev \
21+
libproj-dev \
22+
libgeos-dev \
23+
libhdf4-alt-dev \
24+
bash-completion \
25+
cmake \
26+
imagemagick \
27+
libpng-dev \
28+
libffi-dev \
2729
&& sudo apt autoremove \
2830
&& sudo apt-get clean all
2931
# && sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
@@ -73,8 +75,7 @@ RUN cd /tmp && \
7375
--with-threads \
7476
--without-jp2mrsid \
7577
--without-netcdf \
76-
--without-ecw \
77-
&& \
78+
--without-ecw && \
7879
make -j 8 && \
7980
sudo make install && \
8081
sudo ldconfig && \

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,22 @@
2121

2222
package org.locationtech.rasterframes.expressions
2323

24-
import org.locationtech.rasterframes.encoders.CatalystSerializer._
25-
import org.locationtech.rasterframes.expressions.DynamicExtractors._
26-
import com.typesafe.scalalogging.LazyLogging
24+
import com.typesafe.scalalogging.Logger
2725
import geotrellis.raster.Tile
2826
import org.apache.spark.sql.catalyst.analysis.TypeCheckResult
2927
import org.apache.spark.sql.catalyst.analysis.TypeCheckResult.{TypeCheckFailure, TypeCheckSuccess}
3028
import org.apache.spark.sql.catalyst.expressions.BinaryExpression
3129
import org.apache.spark.sql.rf.TileUDT
3230
import org.apache.spark.sql.types.DataType
31+
import org.locationtech.rasterframes.encoders.CatalystSerializer._
32+
import org.locationtech.rasterframes.expressions.DynamicExtractors._
33+
import org.slf4j.LoggerFactory
3334

3435
/** Operation combining two tiles or a tile and a scalar into a new tile. */
35-
trait BinaryLocalRasterOp extends BinaryExpression with LazyLogging {
36+
trait BinaryLocalRasterOp extends BinaryExpression {
37+
38+
@transient protected lazy val logger = Logger(LoggerFactory.getLogger(getClass.getName))
39+
3640

3741
override def dataType: DataType = left.dataType
3842

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,20 @@
2121

2222
package org.locationtech.rasterframes.expressions
2323

24-
import org.locationtech.rasterframes.expressions.DynamicExtractors.tileExtractor
25-
import org.locationtech.rasterframes.encoders.CatalystSerializer._
26-
import com.typesafe.scalalogging.LazyLogging
24+
import com.typesafe.scalalogging.Logger
2725
import geotrellis.raster.Tile
2826
import org.apache.spark.sql.catalyst.analysis.TypeCheckResult
2927
import org.apache.spark.sql.catalyst.analysis.TypeCheckResult.{TypeCheckFailure, TypeCheckSuccess}
3028
import org.apache.spark.sql.catalyst.expressions.BinaryExpression
3129
import org.apache.spark.sql.rf.TileUDT
3230
import org.apache.spark.sql.types.DataType
31+
import org.locationtech.rasterframes.encoders.CatalystSerializer._
32+
import org.locationtech.rasterframes.expressions.DynamicExtractors.tileExtractor
33+
import org.slf4j.LoggerFactory
3334

3435
/** Operation combining two tiles into a new tile. */
35-
trait BinaryRasterOp extends BinaryExpression with LazyLogging {
36+
trait BinaryRasterOp extends BinaryExpression {
37+
@transient protected lazy val logger = Logger(LoggerFactory.getLogger(getClass.getName))
3638

3739
override def dataType: DataType = left.dataType
3840

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,20 @@
2121

2222
package org.locationtech.rasterframes.expressions
2323

24-
import org.locationtech.rasterframes.encoders.CatalystSerializer._
25-
import org.locationtech.rasterframes.expressions.DynamicExtractors._
26-
import com.typesafe.scalalogging.LazyLogging
24+
import com.typesafe.scalalogging.Logger
2725
import geotrellis.raster.Tile
2826
import org.apache.spark.sql.catalyst.analysis.TypeCheckResult
2927
import org.apache.spark.sql.catalyst.analysis.TypeCheckResult.{TypeCheckFailure, TypeCheckSuccess}
3028
import org.apache.spark.sql.catalyst.expressions.UnaryExpression
3129
import org.apache.spark.sql.rf.TileUDT
3230
import org.apache.spark.sql.types.DataType
31+
import org.locationtech.rasterframes.encoders.CatalystSerializer._
32+
import org.locationtech.rasterframes.expressions.DynamicExtractors._
33+
import org.slf4j.LoggerFactory
3334

3435
/** Operation on a tile returning a tile. */
35-
trait UnaryLocalRasterOp extends UnaryExpression with LazyLogging {
36+
trait UnaryLocalRasterOp extends UnaryExpression {
37+
@transient protected lazy val logger = Logger(LoggerFactory.getLogger(getClass.getName))
3638

3739
override def dataType: DataType = child.dataType
3840

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ object CellStatsAggregate {
123123
import org.locationtech.rasterframes.encoders.StandardEncoders.cellStatsEncoder
124124

125125
def apply(col: Column): TypedColumn[Any, CellStatistics] =
126-
new Column(new CellStatsAggregateUDAF(col.expr))
127-
.as(s"rf_agg_stats($col)") // node renaming in class doesn't seem to propogate
126+
new CellStatsAggregate()(ExtractTile(col))
127+
.as(s"rf_agg_stats($col)")
128128
.as[CellStatistics]
129129

130130
/** Adapter hack to allow UserDefinedAggregateFunction to be referenced as an expression. */

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ object HistogramAggregate {
9898
import org.locationtech.rasterframes.encoders.StandardEncoders.cellHistEncoder
9999

100100
def apply(col: Column): TypedColumn[Any, CellHistogram] =
101-
new Column(new HistogramAggregateUDAF(col.expr))
102-
.as(s"rf_agg_approx_histogram($col)") // node renaming in class doesn't seem to propogate
101+
new HistogramAggregate()(ExtractTile(col))
102+
.as(s"rf_agg_approx_histogram($col)")
103103
.as[CellHistogram]
104104

105105
/** Adapter hack to allow UserDefinedAggregateFunction to be referenced as an expression. */

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ object LocalCountAggregate {
9292
object LocalDataCellsUDAF {
9393
def apply(child: Expression): LocalDataCellsUDAF = new LocalDataCellsUDAF(child)
9494
def apply(tile: Column): TypedColumn[Any, Tile] =
95-
new Column(new LocalDataCellsUDAF(tile.expr))
95+
new LocalCountAggregate(true)(ExtractTile(tile))
9696
.as(s"rf_agg_local_data_cells($tile)")
9797
.as[Tile]
9898
}
@@ -107,7 +107,7 @@ object LocalCountAggregate {
107107
object LocalNoDataCellsUDAF {
108108
def apply(child: Expression): LocalNoDataCellsUDAF = new LocalNoDataCellsUDAF(child)
109109
def apply(tile: Column): TypedColumn[Any, Tile] =
110-
new Column(new LocalNoDataCellsUDAF(tile.expr))
110+
new LocalCountAggregate(false)(ExtractTile(tile))
111111
.as(s"rf_agg_local_no_data_cells($tile)")
112112
.as[Tile]
113113
}

0 commit comments

Comments
 (0)