Created
July 30, 2015 19:14
-
-
Save marcovivero/069621ed8add8c40bcb2 to your computer and use it in GitHub Desktop.
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 filterRecentTimeUDF : Long => UserDefinedFunction = { | |
(l : Long) => { | |
functions.udf( | |
// s refers to eventTime, t refers to userEventTime | |
(s : Timestamp, t: Timestamp) => if (s.getTime - t.getTime < l) true else false | |
) | |
} | |
} | |
val day : Long = 1000*60*60*24 | |
val week : Long = day * 7 | |
val month : Long = week * 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(s.getTime - t.getTime < l)
already return a boolean value. don't need to applyif
else
.