Skip to content

Commit

Permalink
More renaming & build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-rogers committed Jun 16, 2022
1 parent e6f0866 commit 6374b80
Show file tree
Hide file tree
Showing 17 changed files with 126 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.apache.druid.data.input;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
Expand Down Expand Up @@ -60,6 +61,7 @@ public interface InputSource
* Returns true if this inputSource can be processed in parallel using ParallelIndexSupervisorTask. It must be
* castable to SplittableInputSource and the various SplittableInputSource methods must work as documented.
*/
@JsonIgnore
boolean isSplittable();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.apache.druid.data.input.impl;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Preconditions;
import org.apache.druid.data.input.AbstractInputSource;
Expand Down Expand Up @@ -51,6 +52,7 @@ public String getData()
}

@Override
@JsonIgnore
public boolean isSplittable()
{
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
package org.apache.druid.catalog;

import org.apache.druid.catalog.MetadataCatalog.CatalogListener;
import org.apache.druid.catalog.SchemaRegistry.SchemaDefn;
import org.apache.druid.catalog.SchemaRegistry.SchemaSpec;

import javax.inject.Inject;

Expand Down Expand Up @@ -60,7 +60,7 @@ private static class TableEntry
{
private final TableMetadata table;

protected TableEntry(SchemaDefn schema, TableMetadata table)
protected TableEntry(SchemaSpec schema, TableMetadata table)
{
this.table = table;
}
Expand All @@ -73,11 +73,11 @@ protected long version()

private class SchemaEntry
{
private final SchemaDefn schema;
private final SchemaSpec schema;
private long version = NOT_FETCHED;
private final ConcurrentHashMap<String, TableEntry> cache = new ConcurrentHashMap<>();

protected SchemaEntry(SchemaDefn schema)
protected SchemaEntry(SchemaSpec schema)
{
this.schema = schema;
}
Expand Down Expand Up @@ -205,7 +205,7 @@ private SchemaEntry entryFor(String schemaName)
return schemaCache.computeIfAbsent(
schemaName,
k -> {
SchemaDefn schema = schemaRegistry.schema(k);
SchemaSpec schema = schemaRegistry.schema(k);
return schema == null ? null : new SchemaEntry(schema);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

package org.apache.druid.catalog;

import org.apache.druid.catalog.SchemaRegistry.SchemaDefn;
import org.apache.druid.catalog.SchemaRegistry.SchemaSpec;
import org.apache.druid.server.security.Access;
import org.apache.druid.server.security.Action;
import org.apache.druid.server.security.AuthorizationUtils;
Expand Down Expand Up @@ -50,7 +50,7 @@ public AuthorizerMapper mapper()
return authorizerMapper;
}

public void authorizeTable(SchemaDefn schema, String name, Action action, HttpServletRequest request)
public void authorizeTable(SchemaSpec schema, String name, Action action, HttpServletRequest request)
{
if (action == Action.WRITE && !schema.writable()) {
throw new ForbiddenException(
Expand Down Expand Up @@ -82,7 +82,7 @@ public Access authorizeAccess(String resource, String key, Action action, HttpSe
);
}

public ResourceAction resourceAction(SchemaDefn schema, String name, Action action)
public ResourceAction resourceAction(SchemaSpec schema, String name, Action action)
{
return new ResourceAction(new Resource(name, schema.securityResource()), action);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.druid.catalog.MetadataCatalog.CatalogListener;
import org.apache.druid.catalog.MetadataCatalog.CatalogSource;
import org.apache.druid.catalog.MetadataCatalog.CatalogUpdateProvider;
import org.apache.druid.catalog.SchemaRegistry.SchemaDefn;
import org.apache.druid.catalog.SchemaRegistry.SchemaSpec;
import org.apache.druid.metadata.catalog.CatalogManager;
import org.apache.druid.server.security.AuthorizerMapper;

Expand Down Expand Up @@ -94,7 +94,7 @@ public SchemaRegistry schemaRegistry()
return schemaRegistry;
}

public SchemaDefn resolveSchema(String dbSchema)
public SchemaSpec resolveSchema(String dbSchema)
{
return schemaRegistry.schema(dbSchema);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
*/
public interface SchemaRegistry
{
interface SchemaDefn
interface SchemaSpec
{
String name();
String securityResource();
boolean writable();
boolean accepts(TableSpec defn);
boolean accepts(TableSpec spec);
TableType tableType();
}

SchemaDefn schema(String name);
SchemaSpec schema(String name);
Set<String> names();
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class SchemaRegistryImpl implements SchemaRegistry
// TODO: Change this when ExternalOperatorConvertion changes
private String EXTERNAL_RESOURCE = "EXTERNAL";

public static class SchemaDefnImpl implements SchemaDefn
public static class SchemaDefnImpl implements SchemaSpec
{
private final String name;
private final String resource;
Expand Down Expand Up @@ -76,15 +76,15 @@ public boolean writable()
}

@Override
public boolean accepts(TableSpec defn)
public boolean accepts(TableSpec spec)
{
if (acceptedClass == null) {
return false;
}
if (defn == null) {
if (spec == null) {
return false;
}
return acceptedClass.isAssignableFrom(defn.getClass());
return acceptedClass.isAssignableFrom(spec.getClass());
}

@Override
Expand All @@ -94,7 +94,7 @@ public TableType tableType()
}
}

private final Map<String, SchemaDefn> builtIns;
private final Map<String, SchemaSpec> builtIns;

public SchemaRegistryImpl()
{
Expand Down Expand Up @@ -131,13 +131,13 @@ public SchemaRegistryImpl()
null)); // TODO
}

private void register(SchemaDefn schemaDefn)
private void register(SchemaSpec schemaDefn)
{
builtIns.put(schemaDefn.name(), schemaDefn);
}

@Override
public SchemaDefn schema(String name)
public SchemaSpec schema(String name)
{
return builtIns.get(name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public long updateTime()
}

@JsonProperty("defn")
public TableSpec defn()
public TableSpec spec()
{
return defn;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ interface Listener
* Update a table definition, but only if the database entry is at
* the given {@code oldVersion}.
*/
long updateDefn(TableId id, TableSpec defn, long oldVersion) throws OutOfDateException;
long updateSpec(TableId id, TableSpec defn, long oldVersion) throws OutOfDateException;

/**
* Update a table definition, overwriting any current content.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public Long withHandle(Handle handle) throws DuplicateKeyException
.bind("creationTime", updateTime)
.bind("updateTime", updateTime)
.bind("state", TableState.ACTIVE.code())
.bind("payload", table.defn().toBytes(jsonMapper));
.bind("payload", table.spec().toBytes(jsonMapper));
try {
stmt.execute();
}
Expand Down Expand Up @@ -225,7 +225,7 @@ public TableMetadata withHandle(Handle handle)
}

@Override
public long updateDefn(TableId id, TableSpec defn, long oldVersion) throws OutOfDateException
public long updateSpec(TableId id, TableSpec defn, long oldVersion) throws OutOfDateException
{
try {
return dbi.withHandle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public Response syncTable(
catch (IOException e) {
return Response.serverError().entity(e.getMessage()).build();
}
TableSpec defn = tableSpec.defn();
TableSpec defn = tableSpec.spec();
if (defn instanceof TableSpec.Tombstone) {
listener.deleted(tableSpec.id());
} else {
Expand Down
Loading

0 comments on commit 6374b80

Please sign in to comment.