public UngroupedAverageProvider(string field, IRecordProvider provider) : base(provider) { this.field = field; if (!provider.MetaData.ColumnDescriptors.ContainsKey(field)) { throw new MalformedQueryException($"Could not find field named {field}"); } MetaData = new RecordMetaData(); MetaData.AddField($"avg_of_{field}", ColumnType.Float); }
public ComputedFieldProvider(string fieldName, ColumnType type, Func<RecordMetaData, byte[], dynamic> computation, IRecordProvider provider) : base(provider) { this.fieldName = fieldName; this.type = type; this.computation = computation; MetaData = new RecordMetaData(); foreach (var columnDescriptor in provider.MetaData.ColumnDescriptors) { MetaData.ColumnDescriptors.Add(columnDescriptor.Key, columnDescriptor.Value); } MetaData.AddField(fieldName, type); }