-
Notifications
You must be signed in to change notification settings - Fork 361
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
Don't constrain GridBounds size to IntMax x IntMax #2292
Conversation
def coords: Stream[(Int, Int)] = for { | ||
row <- Stream.range(0, height) | ||
col <- Stream.range(0, width) | ||
} yield (row, col) |
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.
I'd really love to salvage the ability to use Iterator
here.
The problem here of course is that this breaks the API. Such a minor break, but still breaks it. Client code like: val gb: GridBounds = ???
val gridSize = gb.size would be fine, but code like val gb: GridBounds = ???
val gridSize:Int = gb.size would fail. It might be the case that exactly 0 codebases have code that would break on this change. But then again, maybe a million codebases. Or like 2. Now that we switched to semver how do we handle this? Any thoughts from others? @hectcastro? @echeipesh? @metasim? |
Regarding appeasing the SemVer gods, I suppose we'd have to wait to merge until we're ready to push more 2.0 features through? |
The val gbs: GridBounds = ???
val coords: Array[(Int, Int)] = dbs.coords
println(coords(5)) // caution to the wind. Also a senseless operation. Open question: do we have a right to overlook API breaks when we have sufficient belief that a certain use case (like this one) would never occur in reality? More of me wants to say "no" than "yes", but the "yes" is there nonetheless. |
I'd be tempted to add: A cleaner version of above is to make a new class |
Luckily I wasn't suggesting that. Can you think of a reason someone would honestly index the Alarm bells going off regarding The |
I didn't not mean that as an accusation, just not an option. I would disagree that original Edit: And I agree there is totally no reason to index into array of coords, the discussion is purely around being good software carpenters as prescribed by semver. |
Yeah true. So if it blows, we say "told you so, here's the The Stream/Iterator issue is still outstanding though. |
1a886a0
to
49e5f63
Compare
def size = width * height | ||
def isEmpty = size == 0 | ||
|
||
def size: Int = width * height |
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.
I tried to use the @migration
annotation which is mentioned in the official Scaladoc docs, but it doesn't compile. There's no mention of it in the main scala
repo.
@@ -50,7 +50,7 @@ object CutTiles { | |||
val extent = inKey.extent | |||
logger.debug(s"Cutting $inKey of ${tile.dimensions} cells covering $extent") | |||
mapTransform(extent) | |||
.coords.toIterator |
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.
Naughty!
- The original `coords` has been marked deprecated, and will be switched with `coordsIter` in 2.0.
49e5f63
to
2ecceff
Compare
I agree with Eugene's instincts around
As far as the high level plan moving forward, I think the process would be:
|
I can add a deprecation warning to |
Figuring out test failures... |
3d987f2
to
d1b9b39
Compare
Issues
size
returning aLong
instead ofInt
is likely backwards incompatible.coords
return anIterator
instead of aStream
, but one single function (RDDKernelDensity.pointFeatureToSpatialKey
) in GT requires the output of afor
overcoords
to be a
Seq
, whichArray
can be cast to andIterator
cannot.Closes #2265 .