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
import org.apache.spark.sql.Column | |
def treeFold( | |
columns: List[Column], | |
initialValue: Column, | |
op: (Column, Column) => Column | |
): Column = { | |
if (columns.isEmpty) { | |
initialValue | |
} else if (columns.length == 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
f(H) = | |
f(H - 1) // for the first transform call | |
+ | |
f(H - 1) // for the second transform call | |
= 2 * f(H - 1) = | |
= 2 * 2 * f(H - 2) = ... = 2 ^ (H - 1) * f(1) // unfolding further |
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 andPredicates: Array[Column] = parseAndPredicates(...) | |
val compositePredicate: Column = andPredicates.foldLeft(lit(true))((x, y) => x && y) |
OlderNewer