@Override public RawRecordMetadata createMetadata(Text shardTableName, Text metadataTableName, Text loadDatesTableName, Text shardIndexTableName, Text shardReverseIndexTableName, boolean frequency) { return new EventMetadata(shardTableName, metadataTableName, loadDatesTableName, shardIndexTableName, shardReverseIndexTableName, frequency); } }
@Override public void addEventWithoutLoadDates(final IngestHelperInterface helper, final RawRecordContainer event, final Multimap<String,NormalizedContentInterface> fields) { updateStats(helper, event, fields); }
protected void addToLoadDates(Multimap<BulkIngestKey,Value> results, MetadataCounterGroup countsGroup) { if (loadDatesTableName != null) { for (MetadataCounterGroup.CountAndKeyComponents entry : countsGroup.getEntries()) { Long count = entry.getCount(); Key k = new Key(new Text(entry.getRowId()), countsGroup.getColumnFamily(), new Text(entry.getDate() + DELIMITER + entry.getDataType())); addToResults(results, count, k, loadDatesTableName); } } }
@Test public void testAssignments() { MetadataWithMostRecentDate counters = new MetadataWithMostRecentDate(COLUMN_FAMILY); counters.createOrUpdate(fieldName, dataTypeName, normalizerClassName, date); MetadataWithMostRecentDate.MostRecentEventDateAndKeyComponents entry = getOnlyEntry(counters); Assert.assertEquals(fieldName, entry.getFieldName()); Assert.assertEquals(dataTypeName, entry.getDataType()); Assert.assertEquals(normalizerClassName, entry.getNormalizerClassName()); Assert.assertEquals(date, entry.getMostRecentDate()); }
@Test public void testAssignments() { MetadataCounterGroup counters = new MetadataCounterGroup(COLUMN_FAMILY); counters.addToCount(1, dataType, fieldName, date); MetadataCounterGroup.CountAndKeyComponents entry = getOnlyEntry(counters); Assert.assertEquals(dataType, entry.getDataType()); Assert.assertEquals(fieldName, entry.getRowId()); Assert.assertEquals(date, entry.getDate()); } }
@Test public void testCountsUpAndDownCorrectly() { MetadataCounterGroup counters = new MetadataCounterGroup(COLUMN_FAMILY); counters.addToCount(1, dataType, fieldName, date); counters.addToCount(1, dataType, fieldName, date); counters.addToCount(-1, dataType, fieldName, date); assertOneEntryWithExpectedCount(counters, 1); }
public void createOrUpdate(String fieldName, String dataTypeOutputName, String normalizerClassName, long eventDate) { String identifier = createKey(fieldName, dataTypeOutputName, normalizerClassName); MostRecentEventDateAndKeyComponents value = mostRecentDates.get(identifier); if (null == value) { mostRecentDates.put(identifier, new MostRecentEventDateAndKeyComponents(fieldName, dataTypeOutputName, normalizerClassName, eventDate)); } else if (eventDate > value.getMostRecentDate()) { value.setMostRecentDate(eventDate); } }
@Test public void testNoReplacement() { MetadataWithMostRecentDate counters = new MetadataWithMostRecentDate(COLUMN_FAMILY); counters.createOrUpdate(fieldName, dataTypeName, normalizerClassName, date); counters.createOrUpdate(fieldName, dataTypeName, normalizerClassName, 123L); assertOneEntryWithExpectedDate(counters, date); }
public void addToCount(long countDelta, String dataType, String rowId, String date) { String hashMapKey = createKey(dataType, rowId, date); CountAndKeyComponents value = counts.get(hashMapKey); if (null == value) { counts.put(hashMapKey, new CountAndKeyComponents(dataType, rowId, date, countDelta)); } else { value.incrementCount(countDelta); } }
private void helperTestAdd(MetadataCounterGroup counters) { counters.addToCount(1, dataType, fieldName, date); counters.addToCount(1, dataType, fieldName, date); assertOneEntryWithExpectedCount(counters, 2); }
@Test public void testCanAdd() { helperTestAdd(new MetadataCounterGroup(COLUMN_FAMILY)); helperTestAdd(new MetadataCounterGroup("LAC", COLUMN_FAMILY)); }
@Test public void testTwoDataTypes() { helperTestTwoDataTypes(new MetadataCounterGroup(COLUMN_FAMILY)); helperTestTwoDataTypes(new MetadataCounterGroup("FIELD_NAME", COLUMN_FAMILY)); }
public GeoWaveMetadata(final String tableNamespace, final PrimaryIndex index, final FeatureDataAdapter dataAdapter, final SimpleFeatureType originalType, final SimpleFeatureType reprojectedType, final MathTransform transform, final boolean flattenGeometry) { this.tableNamespace = tableNamespace; this.index = index; this.dataAdapter = dataAdapter; this.originalType = originalType; this.reprojectedType = reprojectedType; this.transform = transform; this.flattenGeometry = flattenGeometry; init(); }
@Test public void testCountsDownCorrectly() { MetadataCounterGroup counters = new MetadataCounterGroup(COLUMN_FAMILY); counters.addToCount(-5, dataType, fieldName, date); counters.addToCount(-5, dataType, fieldName, date); assertOneEntryWithExpectedCount(counters, -10); }
@Test public void testReplacement() { MetadataWithMostRecentDate counters = new MetadataWithMostRecentDate(COLUMN_FAMILY); counters.createOrUpdate(fieldName, dataTypeName, normalizerClassName, 123L); counters.createOrUpdate(fieldName, dataTypeName, normalizerClassName, date); assertOneEntryWithExpectedDate(counters, date); }
@Override public RawRecordMetadata createMetadata(Text shardTableName, Text metadataTableName, Text loadDatesTableName, Text shardIndexTableName, Text shardReverseIndexTableName, boolean frequency) { return new EventMetadata(shardTableName, metadataTableName, loadDatesTableName, shardIndexTableName, shardReverseIndexTableName, frequency); } }
@Override public void addEvent(final IngestHelperInterface helper, final RawRecordContainer event, final Multimap<String,NormalizedContentInterface> fields, final boolean frequency) { updateStats(helper, event, fields); }
@Override public void clear() { builder = null; bboxStats = null; rowStats = null; init(); } }
@Override public void addEvent(final IngestHelperInterface helper, final RawRecordContainer event, final Multimap<String,NormalizedContentInterface> fields, final long loadTimeInMillis) { updateStats(helper, event, fields); }