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

[OPIK-622] Remove deprecated dataset item fields #1003

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

BorisTkachenko
Copy link
Contributor

Details

Remove deprecated dataset item fields

Testing

Covered by existing integration tests

@BorisTkachenko BorisTkachenko self-assigned this Jan 8, 2025
@BorisTkachenko BorisTkachenko requested a review from a team as a code owner January 8, 2025 14:15
Borys Tkachenko and others added 2 commits January 8, 2025 16:46
Copy link
Collaborator

@andrescrz andrescrz left a comment

Choose a reason for hiding this comment

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

For the implementation part, we should keep removing a few more related things that become unused.

Please review the tests carefully. Filtering might still be legitimate on those fields, but as dynamic fields within data. Also, tests related to the migration or the deprecated fields might go away entirely. But please double check that my guidance and assumptions here are correct.

@@ -9,12 +9,12 @@ public class DatasetItemInputValidator implements ConstraintValidator<DatasetIte

@Override
public boolean isValid(DatasetItem datasetItem, ConstraintValidatorContext context) {
boolean result = datasetItem.input() != null || MapUtils.isNotEmpty(datasetItem.data());
boolean result = MapUtils.isNotEmpty(datasetItem.data());
Copy link
Collaborator

@andrescrz andrescrz Jan 9, 2025

Choose a reason for hiding this comment

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

I believe this whole class doesn't make sense anymore. You should completely remove it, along with the related annotation and then simply add a @NotEmpty annotation to the data field of DatasetItem, which works with collections (null or not empty on the map).

Please make sure there's a test covering that this works fine.


getItemAndAssert(item, TEST_WORKSPACE, API_KEY);
}

@Test
@DisplayName("when input is null but data is present, the accept the request")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please review the display name of the test and everything else.

Comment on lines -4140 to -4145
arguments(new ExperimentsComparisonFilter("output",
FieldType.STRING, Operator.CONTAINS, null, "sql_cost")),
arguments(new ExperimentsComparisonFilter("expected_output",
FieldType.DICTIONARY, Operator.CONTAINS, "output", "sql_cost")),
arguments(new ExperimentsComparisonFilter("metadata",
FieldType.DICTIONARY, Operator.EQUAL, "sql_cost", "10")),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe you shouldn't remove these tests, as it's still legitimate to filter on those fields, but within data field.

Comment on lines -4200 to -4201
.input(item.input())
.output(item.expectedOutput())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Related: legitimate payload in the trace, but should come from data.

Comment on lines -4217 to -4222
.input(JsonUtils
.getJsonNodeFromString(JsonUtils.writeValueAsString(Map.of("input", "sql_cost"))))
.expectedOutput(JsonUtils
.getJsonNodeFromString(JsonUtils.writeValueAsString(Map.of("output", "sql_cost"))))
.metadata(JsonUtils
.getJsonNodeFromString(JsonUtils.writeValueAsString(Map.of("sql_cost", 10))))
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems legitimate, but within data.

Comment on lines -4760 to -4762
.bind("input", datasetItem.input().toString())
.bind("expected_output", datasetItem.expectedOutput().toString())
.bind("metadata", datasetItem.metadata().toString())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably the whole TestNoMigratedDatasetItemRetrieval doesn't make sense anymore, as we're removing the deprecated fields.

Comment on lines -4802 to -4806
columns.add(Column.builder().name("input").types(Set.of(ColumnType.OBJECT)).filterFieldPrefix("data").build());
columns.add(Column.builder().name("expected_output").types(Set.of(ColumnType.OBJECT)).filterFieldPrefix("data")
.build());
columns.add(
Column.builder().name("metadata").types(Set.of(ColumnType.OBJECT)).filterFieldPrefix("data").build());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably the whole addDeprecatedFields doesn't make sense anymore, as we're removing the deprecated fields entirely.

Comment on lines -108 to -110
JsonNode input = getJsonNode(row, data, "input");
JsonNode expectedOutput = getJsonNode(row, data, "expected_output");
JsonNode metadata = getJsonNode(row, data, "metadata");
Copy link
Collaborator

Choose a reason for hiding this comment

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

The getJsonNode method is no longer used. Please clean up all unused methods in this class.

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