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
[AERIE-2145] Gaps in external profiles #397
Conversation
I'm not sure what you mean here. The Here is a custom parser (no combinators) that I think should work. I haven't tested this, and I'm not confident that my return new JsonParser<>() {
@Override
public JsonObject getSchema(final SchemaCache anchors) {
return Json.createObjectBuilder()
.add("any", Json.createArrayBuilder()
.add(JsonValue.NULL)
.add(parser.getSchema()))
.build();
}
@Override
public JsonParseResult<Optional<T>> parse(final JsonValue json) {
if (json.getValueType() == JsonValue.ValueType.NULL) return JsonParseResult.success(Optional.empty());
return parser.parse(json).mapSuccess(Optional::of);
}
@Override
public JsonValue unparse(final Optional<T> value) {
return value.map(parser::unparse).orElse(JsonValue.NULL);
}
}; |
@Twisol When unparsing |
6da5ada
to
cd1f393
Compare
Right. Because The individual parsers ought to be total and lossless, so chooseP is not a good combinator to use to decompose this problem with. |
I really want a proper sumP akin to productP but with Either instead of Pair. Unfortunately there are serious ergonomics issues with the design I've tried up to this point. And I don't think it would help in this particular situation (since it uses a tag field to disambiguate). |
1801fa6
to
24fa340
Compare
24fa340
to
d57569a
Compare
d57569a
to
3338057
Compare
3338057
to
8a83c9d
Compare
@Twisol just for the sake of getting something working, I reworked it to add |
Did you have a chance to evaluate my alternative solution from before? |
Wow. That there the whole time? I completely missed it. Please hold |
8a83c9d
to
2dc8c3a
Compare
That'll do it 🤦 . Thanks! |
Glad to be of assistance :) |
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.
Key:
🔻 Issues to address before merge
🔶 Requests that should not block merge, but should at least be discussed
🔵 Recommendations that can be ignored if desired
...c/main/java/gov/nasa/jpl/aerie/merlin/server/remotes/postgres/PostProfileSegmentsAction.java
Outdated
Show resolved
Hide resolved
...rc/main/java/gov/nasa/jpl/aerie/merlin/server/remotes/postgres/GetProfileSegmentsAction.java
Show resolved
Hide resolved
bb0ecae
to
a63d716
Compare
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.
Nice work! Sounds like e2e tests will be added to this PR prior to merge.
Uncovered a problem while testing, somewhere along the way it makes an assumption that the external dataset starts at plan start. Will fix. |
a63d716
to
4318e40
Compare
4318e40
to
c01bb13
Compare
|
...rver/src/main/java/gov/nasa/jpl/aerie/merlin/server/remotes/postgres/PreparedStatements.java
Outdated
Show resolved
Hide resolved
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.
Re-reviewing after the recent fixes, documentation, and e2e tests. Looks good to me!
c01bb13
to
ac73b4a
Compare
ac73b4a
to
7c4582f
Compare
Description
by commit:
nullableP
parser currently cannot unparse nulls because it throws aNoSuchElementException
when unwrapping. The workaround is to throw aClassCastException
which thechooseP
parser will catch try the next option. @Twisol was this the intended pattern? I don't see another way to do it, but throwing for control flow on the happy path seems iffy.ProfileSet
s to be Optional. This allows external dataset profiles to have gaps, but also requires all segments of simulated profiles to be wrapped inOptional.of()
. Also, thePost/GetProfileSegmentsAction
s were updated to write to the newis_gap
column of theprofile_segment
table.Verification
I'm in progress writing an e2e test(s) for this.
Documentation
I have added tutorial docs for uploading external datasets and using them in constraints. I will add a page for scheduling when we enable that.
Future work