mirror of https://github.com/apache/druid.git
Catalog table should not need explicit segment granularity set (#16278)
* * fix * * fix * * address review comments * * fix * * simplify tests * * fix complex type nullability issue * * fix and update test * * address review comments * * address test review comments * * fix checkstyle * * fix checkstyle * * fix failing test
This commit is contained in:
parent
aa230642dd
commit
3f2dd46ede
|
@ -327,24 +327,21 @@ public class EditorTest
|
|||
// 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"
|
||||
);
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.apache.druid.catalog.model.table;
|
|||
|
||||
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;
|
||||
|
@ -83,9 +82,6 @@ public class DatasourceDefn extends TableDefn
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,13 +112,7 @@ public class DatasourceTableTest
|
|||
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue