protected AccumuloElementValueLoader(final String group, final Key key, final Value value, final AccumuloElementConverter elementConverter, final Schema schema) { this.group = group; this.key = key; this.value = value; this.elementConverter = elementConverter; this.schema = schema; this.timestampProperty = schema.getConfig(AccumuloStoreConstants.TIMESTAMP_PROPERTY); }
public Builder addSchema(final Schema schemaModule) { if (null != schemaModule) { if (null != schema) { schema = new Schema.Builder() .merge(schema) .merge(schemaModule) .build(); } else { schema = schemaModule; } } return this; }
public AggregateGafferElements(final Schema gafferSchema) { jsonGafferSchema = gafferSchema.toCompactJson(); }
private Set<String> getGroupsThatHaveProperty(final String property) { final Set<String> groups = new HashSet<>(); for (final String entityGroup : schema.getEntityGroups()) { if (schema.getEntity(entityGroup).getProperties().contains(property)) { groups.add(entityGroup); } } for (final String edgeGroup : schema.getEdgeGroups()) { if (schema.getEdge(edgeGroup).getProperties().contains(property)) { groups.add(edgeGroup); } } return groups; }
public static Schema createSchema(final Long timeToLive) { final Schema.Builder builder = new Schema.Builder() .json(StreamUtil.openStreams(GafferResultCacheUtil.class, "gafferResultCache/schema")); if (null != timeToLive) { builder.merge(new Schema.Builder() .type("timestamp", new TypeDefinition.Builder() .validateFunctions(new AgeOff(timeToLive)) .build()) .build()); } return builder.build(); } }
@Override public Element call(final Element v1, final Element v2) { if (null == gafferSchema) { gafferSchema = Schema.fromJson(jsonGafferSchema); } final ElementAggregator aggregator = gafferSchema.getElement(v2.getGroup()).getIngestAggregator(); return aggregator.apply(v1, v2); } }
private static View createView(final Schema schema) { return new View.Builder() .entities(schema.getEntityGroups()) .edges(schema.getEdgeGroups()) .build(); } }
private Element addNonAggElement(final Element element, final Schema schema, final MapImpl mapImpl) { final Element elementClone = element.emptyClone(); // Copy properties that exist in the schema final SchemaElementDefinition elementDef = schema.getElement(element.getGroup()); for (final String property : elementDef.getProperties()) { elementClone.putProperty(property, element.getProperty(property)); } mapImpl.addNonAggElement(elementClone); return elementClone; }
public Set<String> getEdgeGroups() { return gafferSchema.getEdgeGroups(); }
public Set<String> getEntityGroups() { return gafferSchema.getEntityGroups(); }
public Set<String> getGroups() { return gafferSchema.getGroups(); }
protected boolean isStoredInValue(final String propertyName, final SchemaElementDefinition elementDef) { return !elementDef.getGroupBy().contains(propertyName) && !propertyName.equals(schema.getVisibilityProperty()) && !propertyName.equals(timestampProperty); }
private SchemaElementDefinition getSchemaElementDefinition(final String group) { final SchemaElementDefinition elementDefinition = schema.getElement(group); if (null == elementDefinition) { throw new AccumuloElementConversionException("No SchemaElementDefinition found for group " + group + ", is this group in your schema or do your table iterators need updating?"); } return elementDefinition; }
private int addDeserialisedProperty(final byte[] bytes, final int carriage, final Properties properties, final SchemaElementDefinition elementDefinition, final String propertyName) throws SerialisationException { int rtn = carriage; final TypeDefinition typeDefinition = elementDefinition.getPropertyTypeDef(propertyName); final ToBytesSerialiser serialiser = (null != typeDefinition) ? (ToBytesSerialiser) typeDefinition.getSerialiser() : null; if (null != serialiser) { final int numBytesForLength = CompactRawSerialisationUtils.decodeVIntSize(bytes[rtn]); final int currentPropLength = getCurrentPropLength(bytes, rtn); int from = rtn += numBytesForLength; rtn += currentPropLength; Object deserialisedObject = getDeserialisedObject(serialiser, bytes, from, currentPropLength); properties.put(propertyName, deserialisedObject); } return rtn; }
@Override protected SchemaOptimiser createSchemaOptimiser() { return new SchemaOptimiser(new AccumuloSerialisationFactory()); }
@Override protected OperationChainValidator createOperationChainValidator() { return new FederatedOperationChainValidator(new ViewValidator()); }
private Schema cloneSchema(final Schema schema) { return null != schema ? schema.clone() : null; }
public ExtractKeyFromElements(final Schema gafferSchema) { jsonGafferSchema = gafferSchema.toCompactJson(); }
@Override protected SchemaOptimiser createSchemaOptimiser() { return new SchemaOptimiser(new SerialisationFactory(ParquetStoreConstants.SERIALISERS)); }
public WriteUnsortedDataFunction(final String tempFilesDir, final SchemaUtils schemaUtils, final Map<String, Map<Object, Integer>> groupToSplitPoints) { this.tempFilesDir = tempFilesDir; this.gafferSchema = schemaUtils.getGafferSchema().toCompactJson(); this.groupToSplitPoints = groupToSplitPoints; }