public String getPrettyName() { if (isArray()) { return "ARRAY<" + getArrayElementType().toString() + ">"; } if (isMap()) { return "MAP<STRING, " + getMapValueType().toString() + ">"; } return toString(); } }
@Override public String collection() { return event.collection(); }
public String process(String project, Supplier<User> user, SendEventAction sendEventAction) { new Event(project, sendEventAction.collection, null, null, null); return null; }
private boolean check(String project, String collection, SchemaField existing, SchemaField moduleField) { if (existing.getName().equals(moduleField.getName())) { if (!existing.getType().equals(moduleField.getType())) { throw new IllegalStateException(format("Module field '%s' type does not match existing field in event of project %s.%s. Existing type: %s, Module field type: %s. \n" + "Please change the schema manually of disable the module.", existing.getName(), project, collection, existing.getType(), moduleField.getType())); } return true; } return false; } }
private String getPartitionKey(Event event) { Object user = event.getAttribute("_user"); return event.project() + "|" + (user == null ? event.collection() : user.toString()); }
@Override public void addFieldDependency(FieldDependencyBuilder builder) { builder.addFields("_user_agent", ImmutableList.of( new SchemaField("_user_agent_family", FieldType.STRING), new SchemaField("_user_agent_version", FieldType.STRING), new SchemaField("_os", FieldType.STRING), new SchemaField("_os_version", FieldType.STRING), new SchemaField("_device_family", FieldType.STRING) )); }
@Test(expectedExceptions = IllegalStateException.class) public void testInvalidDuplicateFieldNames() throws Exception { getMetastore().createProject(PROJECT_NAME); getMetastore().getOrCreateCollectionFields(PROJECT_NAME, "testcollection", ImmutableSet.of(new SchemaField("test", STRING), new SchemaField("test", LONG))); }
@Override public Object get(String attr) { return event.getAttribute(attr); }
public boolean isMap() { return ordinal() > 19; }
public static EventContext apiKey(String apiKey) { return new EventContext(apiKey, null, null, null, null, null); }
@Override public int hashCode() { int result = name.hashCode(); result = 31 * result + type.hashCode(); return result; } }
public void addFields(List<SchemaField> fields) { checkFields(fields); constantFields.addAll(fields); }
@Override public void addFieldDependency(FieldDependencyBuilder builder) { builder.addFields("_referrer", ImmutableList.of( new SchemaField("_referrer_medium", STRING), new SchemaField("_referrer_source", STRING), new SchemaField("_referrer_term", STRING), new SchemaField("_referrer_domain", STRING), new SchemaField("_referrer_path", STRING) )); } }
@Override public void addFieldDependency(FieldDependencyBuilder builder) { builder.addFields(of(new SchemaField(projectConfig.getTimeColumn(), FieldType.TIMESTAMP))); }