-
Notifications
You must be signed in to change notification settings - Fork 48
Spark 3.2 #587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Spark 3.2 #587
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
30e7004
bumped dev version
metasim 0b4309e
CI fix.
metasim 80e6992
Dependency updates.
metasim d0e5bd5
Spark 3.1.3
metasim ff00b41
bumped dev version
metasim 7f5e078
withNewChildrenInternal
echeipesh 160f351
Try Aggregator implemtnation
echeipesh eb8ccb9
more explicit
echeipesh a92ee4e
Fix UDF style Aggregates
echeipesh 8da8bd7
Bring in the Kryo setup
echeipesh ef2f4ee
Register functions directly
echeipesh d12ace5
Bump versions
echeipesh aab5486
Landsat PDS is gone :(
echeipesh a3ac4cf
Fix Resample and ResampleNearest
echeipesh 0214fa2
fix masking functions
echeipesh 285e03d
Fix test: 6900 bit at position 4 is 1 -- expect NODATA after mask
echeipesh 725c9d5
TileRasterizerAggregate expects column in rf_raster_proj order
echeipesh 91468b4
Use spark-testing-base - core tests green
echeipesh 72a76a0
Update StacApiDataSourceTest.scala
echeipesh ae3acc4
disable GeoTrellisDataSourceSpec
echeipesh 460971a
Shade caffeine
echeipesh b937a70
Merge branch 'develop' into spark-3.2
echeipesh 43e8d3d
boop
echeipesh d1cfb99
Expressions constructors toSeq conversion
pomadchin b28a10b
Downgrade scaffeine to 4.1.0 for JDK 8 support in caffeine 2.9
echeipesh 15b420c
pyspark version 3.2.1
echeipesh 05b4c44
why exclude log4j ? tests need it
echeipesh ec3c5f4
GitHub actions build.
metasim 3a7b90f
Fix formatting
echeipesh 4f24ad5
Fix Expressions arity issue
pomadchin 9be3cb6
Add .jvmopts
pomadchin 61081b7
Fix: Mask operations preserver the target tile cell type
echeipesh b14adaa
Pin GitHub Actions to ubuntu-20.04
echeipesh df552b8
Implement withNewChildrenInternal directly
echeipesh c5cf70c
Remove python build from CI
echeipesh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...rc/main/scala/org/locationtech/rasterframes/expressions/transformers/MaskExpression.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| /* | ||
| * This software is licensed under the Apache 2 license, quoted below. | ||
| * | ||
| * Copyright 2019 Astraea, Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
| * use this file except in compliance with the License. You may obtain a copy of | ||
| * the License at | ||
| * | ||
| * [http://www.apache.org/licenses/LICENSE-2.0] | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| * License for the specific language governing permissions and limitations under | ||
| * the License. | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| */ | ||
|
|
||
| package org.locationtech.rasterframes.expressions.transformers | ||
|
|
||
| import geotrellis.raster.Tile | ||
| import org.apache.spark.sql.catalyst.analysis.TypeCheckResult | ||
| import org.apache.spark.sql.catalyst.analysis.TypeCheckResult.{TypeCheckFailure, TypeCheckSuccess} | ||
| import org.apache.spark.sql.catalyst.expressions.Expression | ||
| import org.apache.spark.sql.types.DataType | ||
| import org.locationtech.rasterframes.expressions.DynamicExtractors.tileExtractor | ||
|
|
||
| import spire.syntax.cfor._ | ||
|
|
||
| trait MaskExpression { self: Expression => | ||
|
|
||
| def targetTile: Expression | ||
| def maskTile: Expression | ||
|
|
||
| def dataType: DataType = targetTile.dataType | ||
|
|
||
| protected lazy val targetTileExtractor = tileExtractor(targetTile.dataType) | ||
| protected lazy val maskTileExtractor = tileExtractor(maskTile.dataType) | ||
|
|
||
| def checkTileDataTypes(): TypeCheckResult = { | ||
| if (!tileExtractor.isDefinedAt(targetTile.dataType)) { | ||
| TypeCheckFailure(s"Input type '${targetTile.dataType}' does not conform to a raster type.") | ||
| } else if (!tileExtractor.isDefinedAt(maskTile.dataType)) { | ||
| TypeCheckFailure(s"Input type '${maskTile.dataType}' does not conform to a raster type.") | ||
| } else TypeCheckSuccess | ||
| } | ||
|
|
||
| def maskEval(targetTile: Tile, maskTile: Tile, maskInt: (Int, Int) => Int, maskDouble: (Double, Int) => Double): Tile = { | ||
| val result = targetTile.mutable | ||
|
|
||
| if (targetTile.cellType.isFloatingPoint) { | ||
| cfor(0)(_ < targetTile.rows, _ + 1) { row => | ||
| cfor(0)(_ < targetTile.cols, _ + 1) { col => | ||
| val v = targetTile.getDouble(col, row) | ||
| val m = maskTile.get(col, row) | ||
| result.setDouble(col, row, maskDouble(v, m)) | ||
| } | ||
| } | ||
| } else { | ||
| cfor(0)(_ < targetTile.rows, _ + 1) { row => | ||
| cfor(0)(_ < targetTile.cols, _ + 1) { col => | ||
| val v = targetTile.get(col, row) | ||
| val m = maskTile.get(col, row) | ||
| result.set(col, row, maskInt(v, m)) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| result | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.