Skip to content

Instantly share code, notes, and snippets.

View MansurAshraf's full-sized avatar

Mansur Ashraf MansurAshraf

  • Apple
  • San Francisco, CA
View GitHub Profile
package com.twitter.algebird
import com.twitter.scalding.typed.TypedPipe
/**
* @author Mansur Ashraf.
*/
class jankyMonoid {
implicit val sg = new EnumSemiGroup
package com.twitter.algebird
import com.twitter.scalding.typed.TypedPipe
/**
* @author Mansur Ashraf.
*/
class jankyMonoid {
implicit val sg = new EnumSemiGroup
def checkPath(p: String) : Boolean
val futureA = Future{
if(!checkPath(...)) throw new IllegalStateException("path doesnt exisit")
}
val futureB = Future(..)
futureA.flatMap(futureB)
colums: A B C D E
types: String String String Int Int
/**
Group By ABC, and within each group find the max of (E-D)
then fanout from E to D, assign 1 to each value from E to D and put them in a map.
GroupBy AB, merge all the maps
*/
class InMemoryStore[M[_]: Monad, K, V] extends Store[M, K, V] {
override val monad: Monad[M] = implicitly[Monad[M]]
private val map = new ConcurrentHashMap[K, V]()
override def get(k: K): M[Option[V]] = monad.pure(Option(map.get(k)))
override def put(kv: (K, V)): M[Unit] = monad.pure {
val (k, v) = kv
map.put(k, v)
--
-- NOTE:
--
-- File paths need to be edited. Search for $$PATH$$ and
-- replace it with the path to the directory containing
-- the extracted data files.
--
--
-- PostgreSQL database dump
--