public void CellSerialization() { var cell = new HBaseCell { Column = new HBaseColumn("family", "column"), Timestamp = 325, Data = Encoding.UTF8.GetBytes("hello world") }; var json = HBaseSerializationHelper.SerializeObject(cell); var compactJson = Regex.Replace(json, @"\s+", string.Empty); Assert.Equal("{\"column\":\"ZmFtaWx5OmNvbHVtbg==\",\"timestamp\":325,\"$\":\"aGVsbG8gd29ybGQ=\"}", compactJson); }
public async Task <IDataItem> ReadNextAsync(ReadOutputByRef readOutput, CancellationToken cancellation) { if (rowsCursor == null) { throw Errors.SourceIsNotInitialized(); } if (!await rowsCursor.MoveNextAsync(cancellation)) { return(null); } var currentRow = rowsCursor.Current; readOutput.DataItemId = currentRow.Key; var cells = new Dictionary <string, HBaseCell>(currentRow.Cells.Count + 1); if (!configuration.ExcludeId) { cells[RowIdFieldName] = new HBaseCell { ColumnName = RowIdFieldName, Value = currentRow.Key }; } foreach (var cell in rowsCursor.Current.Cells) { HBaseCell existingCell; if (!cells.TryGetValue(cell.ColumnName, out existingCell) || cell.Timestamp > existingCell.Timestamp) { cells[cell.ColumnName] = cell; } } return(new HBaseCellsDataItem(cells)); }