Repository navigation
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.
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.sizewould be fine, but code like val gb: GridBounds = ???
val gridSize:Int = gb.sizewould 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.
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.
| val extent = inKey.extent | ||
| logger.debug(s"Cutting $inKey of ${tile.dimensions} cells covering $extent") | ||
| mapTransform(extent) | ||
| .coords.toIterator |
- 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
sizereturning aLonginstead ofIntis likely backwards incompatible.coordsreturn anIteratorinstead of aStream, but one single function (RDDKernelDensity.pointFeatureToSpatialKey) in GT requires the output of aforovercoordsto be a
Seq, whichArraycan be cast to andIteratorcannot.Closes #2265 .