您好,欢迎访问代理记账网站
移动应用 微信公众号 联系我们

咨询热线 -

电话 15988168888

联系客服
  • 价格透明
  • 信息保密
  • 进度掌控
  • 售后无忧

山东大学软件工程应用与实践——PIG代码分析(三)

2021SC@SDUSC


目录

2021SC@SDUSC

Transformer是抽象类,有三个方法需要子类实现

check()方法,利用pattern来匹配plan里符合的operator集合,返回match的operator集

transform()方法,具体实施对tree的转换操作

reportChanges()方法,报告tree的哪部分被transform操作过了(只包括被修改了的或增加了的,不包括删除的node),目的是为了让Listener得知,从而可以修改schema或annotation等等。



 

Transformer是抽象类,有三个方法需要子类实现

check()方法,利用pattern来匹配plan里符合的operator集合,返回match的operator集

    /**
     * check if the transform should be done.  If this is being called then
     * the pattern matches, but there may be other criteria that must be met
     * as well.
     * @param matched the sub-set of the plan that matches the pattern. This 
     *        subset has the same graph as the pattern, but the operators
     *        point to the same objects as the plan to be matched.
     * @return true if the transform should be done.
     * @throws Transformer
     */
    public abstract boolean check(OperatorPlan matched) throws FrontendException;

transform()方法,具体实施对tree的转换操作

    /**
     * Transform the tree
     * @param matched the sub-set of the plan that matches the pattern. This 
     *        subset has the same graph as the pattern, but the operators
     *        point to the same objects as the plan to be matched.
     * @throws Transformer
     */
    public abstract void transform(OperatorPlan matched) throws FrontendException;

reportChanges()方法,报告tree的哪部分被transform操作过了(只包括被修改了的或增加了的,不包括删除的node),目的是为了让Listener得知,从而可以修改schema或annotation等等。

    /**
     * Report what parts of the tree were transformed.  This is so that 
     * listeners can know which part of the tree to visit and modify
     * schemas, annotations, etc.  So any nodes that were removed need
     * will not be in this plan, only nodes that were added or moved.
     * @return OperatorPlan that describes just the changed nodes.
     */
    public abstract OperatorPlan reportChanges();


 


分享:

低价透明

统一报价,无隐形消费

金牌服务

一对一专属顾问7*24小时金牌服务

信息保密

个人信息安全有保障

售后无忧

服务出问题客服经理全程跟进