This file contains hidden or 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
-- Gets all queries for a given date range | |
select starttime, endtime, trim(querytxt) as query | |
from stl_query | |
where starttime between '2014-11-04' and '2014-11-05' | |
order by starttime desc; | |
-- Gets all queries that have been aborted for a given date range | |
select starttime, endtime, trim(querytxt) as query, aborted | |
from stl_query | |
where aborted=1 |
This file contains hidden or 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
scala> val foo = Map("one" -> List("one", "two")) | |
foo: scala.collection.immutable.Map[String,List[String]] = Map(one -> List(one, two)) | |
scala> foo.get("one").asInstanceOf[Option[Int]] | |
res1: Option[Int] = Some(List(one, two)) | |
scala> val bar:Option[Int] = Some(List("one", "two")) | |
<console>:7: error: type mismatch; | |
found : List[String] | |
required: Int |
This file contains hidden or 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
// I don't find this behavior remarkably consistent | |
scala> foo.get("one") | |
res0: Option[Int] = Some(1) | |
scala> foo.getOrElse("one", 2) | |
res1: Int = 1 | |
scala> foo.getOrElse("two", 2) | |
res2: Int = 2 |
This file contains hidden or 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
In [1]: 1 + 1 | |
Out[1]: 2 | |
In [2]: 1 + 1.0 | |
Out[2]: 2.0 | |
In [3]: 1 + "string" | |
--------------------------------------------------------------------------- | |
TypeError Traceback (most recent call last) | |
<ipython-input-3-d295ea69933a> in <module>() |
This file contains hidden or 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
aux.get("amounts").asInstanceOf[Option[Map[String,Any]]].flatMap(_.get("originalAmount")).asInstanceOf[Option[Long]] |
This file contains hidden or 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
scala> List(1,2,3).toSet() | |
res23: Boolean = false | |
scala> List(1,2,3).toSet | |
res24: scala.collection.immutable.Set[Int] = Set(1, 2, 3) |
This file contains hidden or 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
def add(x: Int, y: Int = 1): Int = x + y | |
def transform(z: Int, transformer: (Int, Int) => Int): Int = transformer(z) | |
// Exiting paste mode, now interpreting. | |
<console>:9: error: not enough arguments for method apply: (v1: Int, v2: Int)Int in trait Function2. | |
Unspecified value parameter v2. | |
def transform(z: Int, transformer: (Int, Int) => Int): Int = transformer(z) |
This file contains hidden or 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
stats = malort.run('mydir/files', delimiter='|') | |
redshift_suggestions = malort.get_redshift_types(stats) | |
df = malort.get_dataframe(stats) | |
# OR | |
result = malort.run('mydir/files', delimiter='|') | |
redshift_suggestions = result.get_redshift_types() | |
df = result.get_dataframe() |
This file contains hidden or 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
class YoDawg(FacetGrid): | |
"""I got facets in your facets""" | |
def __init__(args, kwargs) | |
super(YoDawg, self).__init__(*args, **kwargs) |
This file contains hidden or 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
val vec1 = Vector(1, 2, 3) | |
val vec2 = Vector(3, 4, 5, 6, 7, 8) | |
val vec3 = Vector("foo", "bar", "baz") | |
val vec4 = Vector("one", Map("one" -> 1, "two" -> 2)) | |
def match_vec(vec: Vector[Any]) { | |
vec match { | |
case Vector(_, _, 3) => println("Vector ends in 3!") | |
case Vector(3, _*) => println("Vector starts with three, has any number of elements!") | |
case Vector(_, "bar", _) => println("String Vector!") |