Keep in touch and up-to-date with the latest shapeless news here:
https://gitter.im/milessabin/shapeless
The shapeless codebase is on Miles' Github:
trait LabelMaker[T] { | |
def toLabel(value: T): String | |
} | |
object LabelMaker { | |
implicit object AddressLabelMaker extends LabelMaker[Address] { | |
def toLabel(address: Address): String = { | |
import address._ | |
"%d %s, %s, %s - %s".format(no, street, city, state, zip) | |
} |
object Query extends App { | |
val conf = new SparkConf() | |
.setAppName("StatJobTest") | |
.setMaster("local") | |
val sc = new SparkContext(conf) | |
val sqlContext = new SQLContext(sc) | |
val data = sqlContext.read.format("filodb.spark").option("dataset", "tracking").load() | |
println(data.count()) | |
} |
trait TestTrait { | |
def f(a: => Int): Int = { | |
println("fffff") | |
a | |
} | |
def a: Int = 5 | |
def start: Int = f(a) | |
} |
SLF4J: Class path contains multiple SLF4J bindings. | |
SLF4J: Found binding in [jar:file:/home/darkjh/spark-1.4.1/assembly/target/scala-2.11/spark-assembly-1.4.1-hadoop2.6.0.jar!/org/slf4j/impl/StaticLoggerBinder.class] | |
SLF4J: Found binding in [jar:file:/home/darkjh/projects/scala/filo-test/lib/filodb-spark-assembly-0.1-SNAPSHOT.jar!/org/slf4j/impl/StaticLoggerBinder.class] | |
SLF4J: Found binding in [jar:file:/home/darkjh/.ivy2/cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class] | |
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. | |
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] | |
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties | |
15/10/06 12:10:02 INFO SparkContext: Running Spark version 1.4.1 | |
15/10/06 12:10:03 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable | |
15/10/06 12:10:03 WARN Utils: Your hostname, JH resolves |
Keep in touch and up-to-date with the latest shapeless news here:
https://gitter.im/milessabin/shapeless
The shapeless codebase is on Miles' Github:
import snappy | |
with open('./test.dat', 'wb') as f: | |
print 'finish!' | |
print 'return' |
import scala.collection.GenTraversable | |
import scala.reflect.runtime.universe._ | |
object JsonSerializer extends App { | |
def serialize[T: TypeTag](obj: T): String = { | |
def recurse(obj: Any, objType: Type): String = { | |
if (objType <:< typeOf[String]) s""""$obj"""" | |
else if (objType <:< definitions.AnyValTpe) obj.toString | |
else if (objType.baseType(typeOf[GenTraversable[_]].typeSymbol) != NoType) { | |
val refinedType = objType.baseType(typeOf[GenTraversable[_]].typeSymbol) |
import java.lang.reflect.ParameterizedType | |
import com.google.common.reflect.TypeToken | |
import scala.reflect.ClassTag | |
import scala.reflect.runtime.universe._ | |
class KV[I, O] |
import dpark | |
import logging | |
import os | |
import re | |
logging.basicConfig(level=logging.DEBUG) | |
def list_files(dirpath, full_path=True, regexp=None): |
from cdf.utils.kvstore import LevelDB | |
import struct | |
class LevelDBExternalSort(object): | |
SEP = '\0' | |
FMT = '>i' | |
def __init__(self, tmp_dir=None, **configs): | |
if tmp_dir is None: |