Skip to content

Conversation

@mkraice1
Copy link

@mkraice1 mkraice1 commented Nov 7, 2024

No description provided.


// Begin by getting references to the column sources from the input table to process later.
this.timeSource = source.getColumnSource(timestampColumnName).reinterpret(long.class);
this.timeSource = ReinterpretUtils.instantToLongSource(source.getColumnSource(timestampColumnName));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong reinterpret here. Use timeToEpochLongSource instead. The source is probably, but not necessarily an Instant source, so you need to be more forgiving

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean zonedDateTimeToLongSource? That seems less generic I think?

* @return the Map of grouping keys to BookState
*/
final Map<Object, BookState> processInitBook(final Table t, String... groupings) {
final Map<Object, BookState> initStates = new HashMap<>();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll want to assert that t is not live, otherwise the calculation below will be suspect.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this do it?
assert !t.isRefreshing();

* @return a new table representing the current state of the book. This table will update as the source table updates.
*/
@SuppressWarnings("unused")
public static QueryTable build(@NotNull Table source,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are enough arguments here to warrant switching to a Builder pattern. We could use Immutables to generate the boilerplate builder itself and this method would simply take the result object.

Something like

    public static QueryTable of(@NotNull final BookConfig config)

and used like this

Pricebok.of(BookConfig.newBuilder()
    .thing1()
   .thing2()
   .build())

I realize that there are other factors at play so you might not have time to do this in this review, but we should definitely do this as a follow on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants