public override IEnumerable <IRow> Extract(IUnstructuredReader input, IUpdatableRow output) { var parser = new InternalParser(output.Schema, this.expressions); foreach (Stream current in input.Split((byte)'\n')) { var row = parser.ParseEvent(output, current); if (row != null) { yield return(row); } } }
public override IEnumerable <IRow> Extract(IUnstructuredReader input, IUpdatableRow output) { var parser = new InternalParser(output.Schema, this.expressions); int idxParseError; bool hasParseError = HasColumnOfType(output.Schema, "ParseError", typeof(string), out idxParseError); foreach (Stream current in input.Split((byte)'\n')) { IRow row; try { if (hasParseError) { output.Set <string>(idxParseError, null); } row = parser.ParseEvent(output, current); } catch (Exception e) { if (hasParseError) { output.Set <string>(idxParseError, $"ParseError: {e.Message}"); row = output.AsReadOnly(); } else { row = null; } } if (row != null) { yield return(row); } } }