Aggregation API and Geohash Aggregation implementation#1733
Aggregation API and Geohash Aggregation implementation#1733rfecher merged 1 commit intolocationtech:masterfrom
Conversation
|
I signed the ECA a while ago, how can I get confirmation of that? |
| @@ -0,0 +1,136 @@ | |||
| package org.locationtech.geowave.core.geotime.store.query.aggregate; | |||
There was a problem hiding this comment.
Missing copyright header.
There was a problem hiding this comment.
Should be resolved.
| } | ||
| } | ||
| // TODO: should this be 0, AKA 1 bin for all data? (if so make sure to fix tests!) | ||
| return 1; |
There was a problem hiding this comment.
I think it makes sense to always have some degree of binning, otherwise there would be no reason to use a binning strategy at all. However, if the max bins allowed is less than 32, I would suggest throwing an IlleagalArgumentException that states that at least 32 bins are required for this strategy.
There was a problem hiding this comment.
Should be resolved, I implemented this.
| /** | ||
| * Create a Binning Strategy based on GeoHashes. | ||
| * | ||
| * @param maxBinsAllowed TODO: explain how this invariant works, and how itll break for < 32. |
There was a problem hiding this comment.
See my next comment about throwing an exception.
There was a problem hiding this comment.
Should be resolved.
| @@ -0,0 +1,149 @@ | |||
| package org.locationtech.geowave.core.geotime.store.query.aggregate; | |||
There was a problem hiding this comment.
Missing copyright header.
There was a problem hiding this comment.
Should be resolved.
| * @param num The number to serialize as a {@link ByteBuffer} | ||
| * @return a byte array that represents the given BigDecimal. | ||
| */ | ||
| public static byte[] writeBigDecimal(final BigDecimal num) { |
There was a problem hiding this comment.
I am not sure these functions really fit in VarintUtils, This class is mostly used for encoding integers using as few bytes possible, but it doesn't look like there is any variable length encoding being used. There is another class that handles BigDecimal serialization at org.locationtech.geowave.core.store.data.field.base.BigDecimalSerializationProvider.
There was a problem hiding this comment.
Good idea, I just lifted the code I removed from the math-agg and used that instead of this stuff. However, I changed it slightly so it was a better ByteBuffer citizen (storing the array length, instead of using all of .remaining()
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| public class GeohashBinningExample { |
There was a problem hiding this comment.
We need to do a better job of explaining our examples, there should be a comment at the top of this class that explains what the example does.
There was a problem hiding this comment.
I added a bunch of comments, let me know if its better, or it should be explained more thoroughly.
| allResults.entrySet().stream().filter((e) -> e.getKey().length() == 6).toArray())); | ||
| } | ||
|
|
||
| private static Map<String, BigDecimal> executeBinningAggregation(int precision) { |
There was a problem hiding this comment.
This method should have fairly detailed comments, this will be used as a learning tool.
There was a problem hiding this comment.
Same as above.
| if (result == null) { | ||
| return new byte[0]; | ||
| } | ||
| final byte[] unscaled = result.unscaledValue().toByteArray(); |
There was a problem hiding this comment.
You can move this logic to the VarintUtils class since it is using Variable length encoding for each part of the BigDecimal.
There was a problem hiding this comment.
Talked about above, I moved this code over with some slight changes.
|
|
||
| @RunWith(GeoWaveITSuiteRunner.class) | ||
| @SuiteClasses({ | ||
| GeoWaveVisibilityIT.class, |
There was a problem hiding this comment.
already done, forgot to uncomment it.
| @@ -0,0 +1,133 @@ | |||
| package org.locationtech.geowave.test.basic; | |||
There was a problem hiding this comment.
Missing copyright header.
There was a problem hiding this comment.
Should be resolved.
|
@rfecher I noticed when reviewing this that most aggregations simply return |
| import com.google.common.collect.Lists; | ||
| import org.opengis.feature.simple.SimpleFeatureType; | ||
| import java.util.Date; | ||
| import java.util.List; |
There was a problem hiding this comment.
need to go thru the import reorganizations and change them back, they were fallout from a different formatter.
3ede8ae to
33c7262
Compare
@sinistersnare I wouldn't worry too much about it at this stage, when you complete the PR make sure you sign all your commits with the same email as the ECA and it should pass the ECA validation. |
@jdgarrett the "Result" and the "Params" are separate from the function itself and serialized separately. I actually would expect all Aggregations to be empty byte serializations (byte[0]), because the input to the function goes in params anyways. I think I had good reason to separate serialization of params and the actual function (there's definitely good reason to separate the result). It seems fairly clean and flexible considering the aggregation function is also responsible for serializing/deserializing result and computing the aggregation, there's no need to inherently tie a potentially heavy input parameter to its serialization. By far the most complicated aggregation at this point in the baseline is distributed rendering so making that make reasonable sense drove some of the design decisions (org.locationtech.geowave.adapter.vector.render.DistributedRenderAggregation). |
|
I have addressed most of the comments, still some work to be done. Me and JD had a talk on some different constructors for the GeohashBinningStrategy. Im not quite sure how I can implement them, and I made comments on that front. Aside from that, testing, and docs, this is looking better and better. |
24edbac to
e4ccf18
Compare
…ashes. Signed-off-by: Davis Silverman <davis.silverman@maxar.com>
e4ccf18 to
dc4e469
Compare
|
Signed my commit, rebased onto master (fixing that last TODO!), now we just wait for CI! Woo! |
Hi!
This partly goes towards #1703. After this is in, creating hex-bin aggregations should be easy enough, and that can be closed.
There are a few TODOs left in here, but mostly its done! Just wanted to see what you guys need from me to get this merged in. Also a code-review would be great.
Thanks!