This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.apache.spark.sql | |
import org.apache.spark.sql.catalyst.InternalRow | |
import org.apache.spark.sql.catalyst.encoders.{ExpressionEncoder, RowEncoder} | |
import org.apache.spark.sql.catalyst.expressions.{GenericRow, GenericRowWithSchema} | |
import org.apache.spark.sql.catalyst.json.{JSONOptions, JacksonParser} | |
import org.apache.spark.sql.catalyst.util.GenericArrayData | |
import org.apache.spark.sql.types._ | |
import org.apache.spark.unsafe.types.UTF8String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Bowling { | |
type Coef = (Int, Int) | |
implicit class Tuple2Ops[A, B](val t: (A, B)) extends AnyVal { | |
def map_1[C](f: A => C): (C, B) = (f(t._1), t._2) | |
def map_2[C](f: B => C): (A, C) = (t._1, f(t._2)) | |
} | |
case class TempScore(scoreTotal: Int, coef: Coef, isNewTurn: Boolean, nbTurn: Int, lastShot: Option[Int]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import estrapade.{TestApp, test} | |
import magnolia.{Param, _} | |
import magnolia.tests.{Destination, Item, OffRoad, Path} | |
import scala.language.experimental.macros | |
case class Prefix(names:Seq[String]) { | |
def add(name:String): Prefix = this.copy(names :+ name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import estrapade.{TestApp, test} | |
import magnolia._ | |
import magnolia.tests.{Destination, Item, OffRoad, Path} | |
import scala.language.experimental.macros | |
sealed trait TC[A] { | |
def mapWithPrefix(prefix: String, value: A): Map[String, String] = { | |
this match { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object ToMap_byHand2 { | |
def toMap(entity: Level1CC): Map[String, Any] = new ToMap_byHandWrapper(entity) | |
class ToMap_byHandWrapper(val entity: Level1CC) extends Map[String, Any] { | |
type A = String | |
type B = Any | |
override def size = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sandbox | |
trait ToMapoid[T] { | |
def toMap(t: T):Mapoid | |
} | |
sealed trait Mapoid | |
case class MLeaf(a:Any) extends Mapoid | |
case class MMap(map:Map[String,Mapoid]) extends Mapoid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Multiline { | |
def splitOn[T](iterator: Iterator[T])(split: T => Boolean): Iterator[Seq[T]] = { | |
new Iterator[Seq[T]] { | |
var nextFrame: Seq[T] = Vector.empty | |
override def hasNext: Boolean = nextFrame.nonEmpty || iterator.hasNext | |
override def next(): Seq[T] = { | |
while (iterator.hasNext) { | |
val t = iterator.next() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package recursion2 | |
import scalaz.Free._ | |
import slamdata.Predef._ | |
import matryoshka._ | |
import matryoshka.data._ | |
import matryoshka.implicits._ | |
import org.scalatest.FunSuite | |
import scalaz._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package recursion | |
import matryoshka.Algebra | |
import matryoshka.data.Fix | |
import org.scalatest.FunSuite | |
import slamdata.Predef.Int | |
import scala.annotation.tailrec | |
import scalaz.Free.Trampoline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package casttostruct | |
import org.apache.spark.sql.{Encoder, SaveMode, SparkSession} | |
import org.scalatest.FunSuite | |
case class A1(name: String) | |
case class A2(name: String, age: Option[Int]) |