aboutsummaryrefslogtreecommitdiff
path: root/ec2
diff options
context:
space:
mode:
authorzsxwing <zsxwing@gmail.com>2014-12-16 14:13:40 -0800
committerMichael Armbrust <michael@databricks.com>2014-12-16 14:13:40 -0800
commit6530243a52b05007e566d458cd8f075e851e91f1 (patch)
tree41556cccdbbfb39020e721065f1b8c578ba8f19c /ec2
parentdc8280dcca7b54793a3db644f74fd33460960d4a (diff)
downloadspark-6530243a52b05007e566d458cd8f075e851e91f1.tar.gz
spark-6530243a52b05007e566d458cd8f075e851e91f1.tar.bz2
spark-6530243a52b05007e566d458cd8f075e851e91f1.zip
[SPARK-4812][SQL] Fix the initialization issue of 'codegenEnabled'
The problem is `codegenEnabled` is `val`, but it uses a `val` `sqlContext`, which can be override by subclasses. Here is a simple example to show this issue. ```Scala scala> :paste // Entering paste mode (ctrl-D to finish) abstract class Foo { protected val sqlContext = "Foo" val codegenEnabled: Boolean = { println(sqlContext) // it will call subclass's `sqlContext` which has not yet been initialized. if (sqlContext != null) { true } else { false } } } class Bar extends Foo { override val sqlContext = "Bar" } println(new Bar().codegenEnabled) // Exiting paste mode, now interpreting. null false defined class Foo defined class Bar ``` We should make `sqlContext` `final` to prevent subclasses from overriding it incorrectly. Author: zsxwing <zsxwing@gmail.com> Closes #3660 from zsxwing/SPARK-4812 and squashes the following commits: 1cbb623 [zsxwing] Make `sqlContext` final to prevent subclasses from overriding it incorrectly
Diffstat (limited to 'ec2')
0 files changed, 0 insertions, 0 deletions