File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ trait HiveTypeCoercion {
190190 case Sum (e) if e.dataType == StringType =>
191191 Sum (Cast (e, DoubleType ))
192192 case Average (e) if e.dataType == StringType =>
193- Sum (Cast (e, DoubleType ))
193+ Average (Cast (e, DoubleType ))
194194 }
195195 }
196196
@@ -252,7 +252,6 @@ trait HiveTypeCoercion {
252252 case s @ Sum (e @ DecimalType ()) => s // Decimal is already the biggest.
253253 case Sum (e @ IntegralType ()) if e.dataType != LongType => Sum (Cast (e, LongType ))
254254 case Sum (e @ FractionalType ()) if e.dataType != DoubleType => Sum (Cast (e, DoubleType ))
255-
256255 }
257256 }
258257}
Original file line number Diff line number Diff line change @@ -2,8 +2,9 @@ package catalyst
22package rules
33
44import trees ._
5+ import util ._
56
6- abstract class RuleExecutor [TreeType <: TreeNode [_]] {
7+ abstract class RuleExecutor [TreeType <: TreeNode [_]] extends Logging {
78
89 /**
910 * An execution strategy for rules that indicates the maximum number of executions. If the
@@ -38,7 +39,19 @@ abstract class RuleExecutor[TreeType <: TreeNode[_]] {
3839 // Run until fix point (or the max number of iterations as specified in the strategy.
3940 while (iteration < batch.strategy.maxIterations && ! curPlan.fastEquals(lastPlan)) {
4041 lastPlan = curPlan
41- curPlan = batch.rules.foldLeft(curPlan) { case (curPlan, rule) => rule(curPlan) }
42+ curPlan = batch.rules.foldLeft(curPlan) {
43+ case (curPlan, rule) =>
44+ val result = rule(curPlan)
45+ if (! result.fastEquals(curPlan)) {
46+ logger.debug(
47+ s """
48+ |=== Applying Rule ${rule.ruleName} ===
49+ | ${sideBySide(curPlan.treeString, result.treeString).mkString(" \n " )}
50+ """ .stripMargin)
51+ }
52+
53+ result
54+ }
4255 iteration += 1
4356 }
4457 }
You can’t perform that action at this time.
0 commit comments