spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Santiago M. Mola (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SPARK-7727) Avoid inner classes in RuleExecutor
Date Tue, 26 May 2015 07:01:18 GMT

    [ https://issues.apache.org/jira/browse/SPARK-7727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14558758#comment-14558758
] 

Santiago M. Mola commented on SPARK-7727:
-----------------------------------------

[~chenghao] I think that is a good idea. Analyzer could be converted into a trait, moving
current Analyzer to DefaultAnalyzer. It is probably a good idea to use a separate JIRA and
pull request for that though.

> Avoid inner classes in RuleExecutor
> -----------------------------------
>
>                 Key: SPARK-7727
>                 URL: https://issues.apache.org/jira/browse/SPARK-7727
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 1.3.1
>            Reporter: Santiago M. Mola
>              Labels: easyfix, starter
>
> In RuleExecutor, the following classes and objects are defined as inner classes or objects:
Strategy, Once, FixedPoint, Batch.
> This does not seem to accomplish anything in this case, but makes extensibility harder.
For example, if I want to define a new Optimizer that uses all batches from the DefaultOptimizer
plus some more, I would do something like:
> {code}
> new Optimizer {
>     override protected val batches: Seq[Batch] =
>       DefaultOptimizer.batches ++ myBatches
>  }
> {code}
> But this will give a typing error because batches in DefaultOptimizer are of type DefaultOptimizer#Batch
while myBatches are this#Batch.
> Workarounds include either copying the list of batches from DefaultOptimizer or using
a method like this:
> {code}
>     private def transformBatchType(b: DefaultOptimizer.Batch): Batch = {
>       val strategy = b.strategy.maxIterations match {
>         case 1 => Once
>         case n => FixedPoint(n)
>       }
>       Batch(b.name, strategy, b.rules)
>     }
> {code}
> However, making these classes outer would solve the problem.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org


Mime
View raw message