You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by yl...@mail.ustc.edu.cn on 2016/01/19 07:59:21 UTC

how to find the ref file?

Hai:


class: /home/wyl/code_source/apache-calcite-1.5.0-src/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java.


i am confused by the red word below link, i want to know where i can find the ref file,i want to verify after optimization,the result is the same semanteme。


thanks you!




/**
 * Unit test for rules in {@code org.apache.calcite.rel} and subpackages.
 *
 * <p>As input, the test supplies a SQL statement and a single rule; the SQL is
 * translated into relational algebra and then fed into a
 * {@link org.apache.calcite.plan.hep.HepPlanner}. The planner fires the rule on
 * every
 * pattern match in a depth-first left-to-right preorder traversal of the tree
 * for as long as the rule continues to succeed in applying its transform. (For
 * rules which call transformTo more than once, only the last result is used.)
 * The plan before and after "optimization" is diffed against a .ref file using
 * {@link DiffRepository}.



Re: how to find the ref file?

Posted by Julian Hyde <jh...@apache.org>.
Let’s take your /home/wyl/code_source/apache-calcite-1.5.0-src as the root directory. For

  core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java

the reference resources are in

  core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml 

When you run the test, the results are placed in

  core/target/surefire/org/apache/calcite/test/RelOptRulesTest.xml

You can diff those two copies of RelOptRulesTest.xml. If the test succeeds, they will be identical (or the test framework may just delete the output file). If the test fails because the resources are out of date, you can copy the “surefire” version over the “resources” version, commit that file, and it will be the new “official” result of the test.

A similar scheme exists for other tests, e.g. SqlToRelConverterTest.

Julian


> On Jan 18, 2016, at 10:59 PM, ylw@mail.ustc.edu.cn wrote:
> 
> Hai:
> 
> 
> class: /home/wyl/code_source/apache-calcite-1.5.0-src/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java.
> 
> 
> i am confused by the red word below link, i want to know where i can find the ref file,i want to verify after optimization,the result is the same semanteme。
> 
> 
> thanks you!
> 
> 
> 
> 
> /**
> * Unit test for rules in {@code org.apache.calcite.rel} and subpackages.
> *
> * <p>As input, the test supplies a SQL statement and a single rule; the SQL is
> * translated into relational algebra and then fed into a
> * {@link org.apache.calcite.plan.hep.HepPlanner}. The planner fires the rule on
> * every
> * pattern match in a depth-first left-to-right preorder traversal of the tree
> * for as long as the rule continues to succeed in applying its transform. (For
> * rules which call transformTo more than once, only the last result is used.)
> * The plan before and after "optimization" is diffed against a .ref file using
> * {@link DiffRepository}.
> 
>