【问题标题】:How to use CalciteAssert when test my own adapter?测试我自己的适配器时如何使用 CalciteAssert?
【发布时间】:2020-01-03 23:52:53
【问题描述】:

我写了一个方解石适配器,现在我想写一些测试来验证我的物理计划。我想像在 Cassandra Adapter 中一样使用 CalciteAssert 来执行此操作,但在 Calcite 项目之外我该怎么做?

  @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]]");
  }

【问题讨论】:

    标签: apache-calcite


    【解决方案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>
    

    【讨论】:

    • 我也这样做了,使用 CalciteAssert 实用程序来测试自定义适配器。效果很好
    猜你喜欢
    • 2020-12-15
    • 2013-08-27
    • 2013-08-13
    • 2021-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-18
    相关资源
    最近更新 更多