public void WriteTweet(FSTweet tweet) { CellSet.Row row = TableDomainMappers.TweetToRow(tweet); CellSet set = new CellSet(); set.rows.Add(row); HadoopContext.HBaseClient.StoreCells(HadoopContext.TweetTableName, set); }
private static FSTweet InviTweetToPTTweet(ITweet t) { FSTweet ptTweet = new FSTweet(); if (t.Coordinates != null) { ptTweet.Coordinates = t.Coordinates.Longitude.ToString() + "," + t.Coordinates.Latitude.ToString(); } ptTweet.CreatedOn = t.CreatedAt; ptTweet.Id = t.Id.ToString(); ptTweet.ReplyToId = t.InReplyToUserIdStr; ptTweet.Text = t.Text; return ptTweet; }
private static FSTweet InviTweetToPTTweet(ITweet t) { FSTweet ptTweet = new FSTweet(); if (t.Coordinates != null) { ptTweet.Coordinates = t.Coordinates.Longitude.ToString() + "," + t.Coordinates.Latitude.ToString(); } ptTweet.CreatedOn = t.CreatedAt; ptTweet.Id = t.Id.ToString(); ptTweet.ReplyToId = t.InReplyToUserIdStr; ptTweet.Text = t.Text; return(ptTweet); }
public static CellSet.Row TweetToRow(FSTweet tweet) { // Create a row with a key var row = new CellSet.Row { key = Encoding.UTF8.GetBytes(tweet.Id) }; // Add columns to the row row.values.Add( new Cell { column = Encoding.UTF8.GetBytes("d:Text"), data = Encoding.UTF8.GetBytes(tweet.Text) }); row.values.Add( new Cell { column = Encoding.UTF8.GetBytes("d:CreatedOn"), data = Encoding.UTF8.GetBytes(tweet.CreatedOn.ToString()) }); if (tweet.ReplyToId != null) { row.values.Add( new Cell { column = Encoding.UTF8.GetBytes("d:ReplyToId"), data = Encoding.UTF8.GetBytes(tweet.ReplyToId) }); } if (tweet.Coordinates != null) { row.values.Add( new Cell { column = Encoding.UTF8.GetBytes("d:Coordinates"), data = Encoding.UTF8.GetBytes(tweet.Coordinates) }); } return(row); }
public static CellSet.Row TweetToRow(FSTweet tweet) { // Create a row with a key var row = new CellSet.Row { key = Encoding.UTF8.GetBytes(tweet.Id) }; // Add columns to the row row.values.Add( new Cell { column = Encoding.UTF8.GetBytes("d:Text"), data = Encoding.UTF8.GetBytes(tweet.Text) }); row.values.Add( new Cell { column = Encoding.UTF8.GetBytes("d:CreatedOn"), data = Encoding.UTF8.GetBytes(tweet.CreatedOn.ToString()) }); if (tweet.ReplyToId != null) { row.values.Add( new Cell { column = Encoding.UTF8.GetBytes("d:ReplyToId"), data = Encoding.UTF8.GetBytes(tweet.ReplyToId) }); } if (tweet.Coordinates != null) { row.values.Add( new Cell { column = Encoding.UTF8.GetBytes("d:Coordinates"), data = Encoding.UTF8.GetBytes(tweet.Coordinates) }); } return row; }