Skip to content
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

Add support for creating Time Series collection. #3732

Closed
wants to merge 2 commits into from

Conversation

christophstrobl
Copy link
Member

Introduce time series to CollectionOptions and add dedicated @TimeSeries annotation to derive values from.

@TimeSeries(collection="weather", timeField = "timestamp")
public class Measurement {
    String id;
    Instant timestamp;
    // ...
}

template.createCollection(Measurement.class);

Introduce time series to CollectionOptions and add dedicated TimeSeries annotation to derive values from.
@christophstrobl christophstrobl requested a review from gregturn July 15, 2021 14:04
@christophstrobl christophstrobl linked an issue Jul 15, 2021 that may be closed by this pull request
*
* @return never {@literal null}.
*/
String timeField();
Copy link
Member

Choose a reason for hiding this comment

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

time field vs. time property?

Copy link
Member Author

Choose a reason for hiding this comment

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

Staying close to the MongoDB terminology for Time Series collections seemed to be a valid choice here.

*
* @return empty {@link String} by default.
*/
String metaField() default "";
Copy link
Member

Choose a reason for hiding this comment

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

how about just meta or meta property?

Copy link
Member Author

Choose a reason for hiding this comment

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

Staying close to the MongoDB terminology for Time Series collections seemed to be a valid choice here. Simply meta does IMO not express that this is a field reference rather than a proved meta object/value.

@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
@Document
public @interface TimeSeries {
Copy link
Member

Choose a reason for hiding this comment

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

Alternatively, we could have annotations for the timeseries field and the meta field, similar to text-indexed language for consistency.

Copy link
Member Author

Choose a reason for hiding this comment

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

The @Language field allows to override the defaults defined via @Document so I do not think this is a good fit here since you may not override any of those fields on a per document basis for Time Series collections where it's rather a fixed value at collection creation time.

mp911de pushed a commit that referenced this pull request Jul 16, 2021
Introduce time series to CollectionOptions and add dedicated TimeSeries annotation to derive values from.

Closes #3731
Original pull request: #3732.
mp911de added a commit that referenced this pull request Jul 16, 2021
Rename Granularities/Granularity to Granularity and GranularityDefinition to proivide a more natural wording towards using predefined granularities.

Validate presence of referenced properties through the TimeSeries annotation.

Tweak Javadoc, reformat code, add unit tests.

See #3731
Original pull request: #3732.
@mp911de mp911de added the type: enhancement A general enhancement label Jul 16, 2021
@mp911de mp911de added this to the 3.3 M1 (2021.1.0) milestone Jul 16, 2021
@mp911de
Copy link
Member

mp911de commented Jul 16, 2021

That's merged and polished now.

@mp911de mp911de closed this Jul 16, 2021
@mp911de mp911de deleted the issue/3731 branch July 16, 2021 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for creating time series collection.
2 participants