public override void Output(IRow input, IUnstructuredWriter output) { ISchema schema = input.Schema; if (_ds == null) { List <SchemaElement> lse = new List <SchemaElement>(); for (int i = 0; i < schema.Count(); i++) { var col = schema[i]; lse.Add(new SchemaElement(col.Name, Type.GetType(getColType(col)))); } _ds = new DataSet(new Schema(lse)); _tempStream = new MemoryStream(); _resultStream = output.BaseStream; _writer = new ParquetWriter(output.BaseStream, null, writeroptions); //create DS based on schema //input.Schema } List <object> ls = new List <object>(); for (int i = 0; i < schema.Count; i++) { ls.Add(input.Get <dynamic>(input.Schema[i].Name)); } Row r = new Row(ls); _ds.Add(r); }
// Output // // Outputs the names of the rowset columns in a column separated row and optionally adds their types in a second row. // public override void Output(IRow row, IUnstructuredWriter output) { if (_first_row_written) { return; } using (StreamWriter streamWriter = new StreamWriter(output.BaseStream, this._encoding)) { streamWriter.NewLine = this._row_delim; ISchema schema = row.Schema; for (int i = 0; i < schema.Count(); i++) { var col = schema[i]; if (i > 0) { streamWriter.Write(this._col_delim); } var val = _quoting ? AddQuotes(col.Name) : col.Name; streamWriter.Write(val); } streamWriter.WriteLine(); if (_with_types) { for (int i = 0; i < schema.Count(); i++) { var col = schema[i]; if (i > 0) { streamWriter.Write(this._col_delim); } var val = _quoting ? AddQuotes(col.Type.FullName) : col.Type.FullName; streamWriter.Write(val); } streamWriter.WriteLine(); } } _first_row_written = true; }