-
Notifications
You must be signed in to change notification settings - Fork 653
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
[SEDONA-383] Add RS_Band #1001
[SEDONA-383] Add RS_Band #1001
Conversation
common/src/main/java/org/apache/sedona/common/raster/RasterBandAccessors.java
Outdated
Show resolved
Hide resolved
...k/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/InferredExpression.scala
Show resolved
Hide resolved
.../src/main/scala/org/apache/spark/sql/sedona_sql/expressions/raster/RasterBandAccessors.scala
Outdated
Show resolved
Hide resolved
@@ -45,6 +52,28 @@ case class RS_SummaryStats(inputExpressions: Seq[Expression]) extends InferredEx | |||
} | |||
} | |||
|
|||
case class RS_Band(inputExpressions: Seq[Expression]) extends InferredExpression(RasterBandAccessors.getBand _) with SerdeAware with CodegenFallback { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add SerdeAware and CodgenFallback here as InferredExpression already has those.
double [][] bandData = new double[bandsDistinct.length][height * width]; | ||
for (int curBand: bandsDistinct) { | ||
RasterUtils.ensureBand(rasterGeom, curBand); | ||
bandData[curBand - 1] = MapAlgebra.bandAsArray(rasterGeom, curBand); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code here has a bug. It cannot handle cases such as 3, 3, 3
and will throw index out of bound error
@@ -45,6 +52,28 @@ case class RS_SummaryStats(inputExpressions: Seq[Expression]) extends InferredEx | |||
} | |||
} | |||
|
|||
case class RS_Band(inputExpressions: Seq[Expression]) extends InferredExpression(RasterBandAccessors.getBand _) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please optimize the imports and remove unnecessary imports.
Did you read the Contributor Guide?
Is this PR related to a JIRA ticket?
[SEDONA-XXX] my subject
.What changes were proposed in this PR?
How was this patch tested?
Did this PR include necessary documentation updates?