[SPARK-2393][SQL] Cost estimation optimization framework for Catalyst logical plans & sample usage.

The idea is that every Catalyst logical plan gets hold of a Statistics class, the usage of which provides useful estimations on various statistics. See the implementations of `MetastoreRelation`.

This patch also includes several usages of the estimation interface in the planner. For instance, we now use physical table sizes from the estimate interface to convert an equi-join to a broadcast join (when doing so is beneficial, as determined by a size threshold). 

Finally, there are a couple minor accompanying changes including:
- Remove the not-in-use `BaseRelation`.
- Make SparkLogicalPlan take a `SQLContext` in the second param list.

Thanks for the note -- I wasn't well aware of the memory/time overhead of lazy vals. Since we have one statistic at the moment, `childrenStats` is used only once for a logical node, so I went ahead and removed it. 

However, memoizing `statistics` itself probably would save some planning time, as it will get called multiple times during planning (e.g. different cases in the HashJoin pattern match). If we were to use a `def` it is going to be evaluated in the quadratic order.

Using `val` only will fire off the computation of the stats for all logical nodes right away. I think this might be less desirable to only evaluating it for everything under a Join when needed by a Strategy. Also, we'd have very few operators in a typical query anyway.