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 limit to geojson upload API #218

Merged
merged 1 commit into from
Feb 15, 2023

Conversation

VijayanB
Copy link
Member

@VijayanB VijayanB commented Feb 9, 2023

Description

Upload API will limit number of features to be uploaded to 10_000. Since custom vector map will allow 10K documents to
be fetched, we will add same constraint while upload for consistency .

Signed-off-by: Vijayan Balasubramanian [email protected]

Issues Resolved

opensearch-project/dashboards-maps#220

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@VijayanB VijayanB requested a review from a team February 9, 2023 01:52
@VijayanB VijayanB self-assigned this Feb 9, 2023
@VijayanB VijayanB added backport 2.x Backport PR to 2.x branch v2.6.0 labels Feb 9, 2023
@@ -61,9 +64,28 @@ public static UploadGeoJSONRequestContent create(Map<String, Object> input) {
geoJSONData + " is not an instance of List, but of type [ " + geoJSONData.getClass().getName() + " ]"
);
}
final long featureCount = getFeatureCount(geoJSONData);
if (featureCount > MAX_SUPPORTED_GEOJSON_FEATURE_COUNT) {
Copy link
Member

@naveentatikonda naveentatikonda Feb 9, 2023

Choose a reason for hiding this comment

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

Do you want to add a comment here that why we are setting the max limit to 10_000?

Copy link
Member Author

Choose a reason for hiding this comment

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

i added comment close to constant

@@ -61,9 +64,28 @@ public static UploadGeoJSONRequestContent create(Map<String, Object> input) {
geoJSONData + " is not an instance of List, but of type [ " + geoJSONData.getClass().getName() + " ]"
);
}
final long featureCount = getFeatureCount(geoJSONData);
if (featureCount > MAX_SUPPORTED_GEOJSON_FEATURE_COUNT) {
Copy link
Member

Choose a reason for hiding this comment

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

Also, can we break this down into a separate method like validateFeatureCount(geoJSONData) { ....} ?

Copy link
Member Author

Choose a reason for hiding this comment

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

created new method

Will limit upto 10_000 features to upload.

Signed-off-by: Vijayan Balasubramanian <[email protected]>
@VijayanB VijayanB force-pushed the add-limit-to-upload branch from ed87490 to d7656cf Compare February 9, 2023 06:54
@VijayanB VijayanB merged commit 0d5763f into opensearch-project:main Feb 15, 2023
@VijayanB VijayanB deleted the add-limit-to-upload branch February 15, 2023 17:59
@VijayanB VijayanB added enhancement New feature or request feature labels Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport PR to 2.x branch enhancement New feature or request feature v2.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants