如何在测试自己的适配器时使用CalciteAssert?

huangapple go评论106阅读模式
英文:

How to use CalciteAssert when test my own adapter?

问题

@Test public void testFilter() {
    CalciteAssert.that()
        .with(TWISSANDRA)
        .query("select * from \"userline\" where \"username\"='!PUBLIC!'")
        .limit(1)
        .returns("username=!PUBLIC!; time=e8754000-80b8-1fe9-8e73-e3698c967ddd; "
            + "tweet_id=f3c329de-d05b-11e5-b58b-90e2ba530b12\n")
        .explainContains("PLAN=CassandraToEnumerableConverter\n"
           + "  CassandraFilter(condition=[=($0, '!PUBLIC!')])\n"
           + "    CassandraTableScan(table=[[twissandra, userline]]");
}
英文:

I wrote a calcite adapter and now I want to write some tests to verify my physical plan. I want to use CalciteAssert to do that like in Cassandra Adapter, but outside the Calcite Project how can I do that?

  @Test public void testFilter() {
    CalciteAssert.that()
        .with(TWISSANDRA)
        .query("select * from \"userline\" where \"username\"='!PUBLIC!'")
        .limit(1)
        .returns("username=!PUBLIC!; time=e8754000-80b8-1fe9-8e73-e3698c967ddd; "
            + "tweet_id=f3c329de-d05b-11e5-b58b-90e2ba530b12\n")
        .explainContains("PLAN=CassandraToEnumerableConverter\n"
           + "  CassandraFilter(condition=[=($0, '!PUBLIC!')])\n"
           + "    CassandraTableScan(table=[[twissandra, userline]]");
  }

答案1

得分: 1

目前有关将来更改此内容的讨论,但目前您可以将测试代码添加为项目的依赖项。在Maven中,这将类似于以下内容:

<dependency>
    <groupId>org.apache.calcite</groupId>
    <artifactId>calcite-core</artifactId>
    <version>1.20.0</version>
    <classifier>tests</classifier>
    <type>test-jar</type>
</dependency>
英文:

There has been talk of changing this in the future, but currently you can add the test code as a dependency to your project. In Maven, this would look something like this:

&lt;dependency&gt;
    &lt;groupId&gt;org.apache.calcite&lt;/groupId&gt;
    &lt;artifactId&gt;calcite-core&lt;/artifactId&gt;
    &lt;version&gt;1.20.0&lt;/version&gt;
    &lt;classifier&gt;tests&lt;/classifier&gt;
    &lt;type&gt;test-jar&lt;/type&gt;
&lt;/dependency&gt;

huangapple
  • 本文由 发表于 2020年1月3日 19:28:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/59577833.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定