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

Catalog table should not need explicit segment granularity set #16278

Merged
merged 19 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -327,24 +327,21 @@ public void testUpdateProperties() throws CatalogException
// properties.

// Remove a required property
Map<String, Object> updates1 = new HashMap<>();
updates1.put(DatasourceDefn.SEGMENT_GRANULARITY_PROPERTY, null);
assertThrows(
CatalogException.class,
() -> new TableEditor(
catalog,
table.id(),
new UpdateProperties(updates1)
)
.go()
Map<String, Object> updates = new HashMap<>();
updates.put(DatasourceDefn.SEGMENT_GRANULARITY_PROPERTY, null);
cmd = new UpdateProperties(updates);
Map<String, Object> expected = ImmutableMap.of();
assertEquals(
expected,
doEdit(tableName, cmd).spec().properties()
);

// Add and update properties
Map<String, Object> updates = new HashMap<>();
updates = new HashMap<>();
updates.put(DatasourceDefn.SEGMENT_GRANULARITY_PROPERTY, "PT1H");
updates.put("foo", "bar");
cmd = new UpdateProperties(updates);
Map<String, Object> expected = ImmutableMap.of(
expected = ImmutableMap.of(
DatasourceDefn.SEGMENT_GRANULARITY_PROPERTY, "PT1H",
"foo", "bar"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Strings;
import org.apache.druid.catalog.model.CatalogUtils;
import org.apache.druid.catalog.model.ColumnSpec;
import org.apache.druid.catalog.model.Columns;
Expand Down Expand Up @@ -83,9 +82,6 @@ public SegmentGranularityFieldDefn()
public void validate(Object value, ObjectMapper jsonMapper)
{
String gran = decode(value, jsonMapper);
if (Strings.isNullOrEmpty(gran)) {
throw new IAE("Segment granularity is required.");
}
CatalogUtils.validateGranularity(gran);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,7 @@ public void testEmptySpec()

{
TableSpec spec = new TableSpec(DatasourceDefn.TABLE_TYPE, ImmutableMap.of(), null);
ResolvedTable table = registry.resolve(spec);
expectValidationFails(table);
}

{
TableSpec spec = new TableSpec(DatasourceDefn.TABLE_TYPE, ImmutableMap.of(), null);
expectValidationFails(spec);
expectValidationSucceeds(spec);
}
}

Expand Down
Loading