dremio 开发测试简单说明

目前官方关于如何进行相关开发测试的明确的文档说明,但是我们基于官方提供的测试用例可以基本了解

官方提供的测试用例

sabot/kernel/src/test/java/com/dremio 目录

├── ArrowDsUtil.java
├── BaseDecimalFunctionTests.java
├── BaseTestQuery.java
├── DecimalCompleteTest.java
├── DremioTestWrapper.java
├── ParquetSchemaMerge.java
├── PlanTestBase.java
├── QueryTestUtil.java
├── SingleRowListener.java
├── TestAggNullable.java
├── TestAggregationQueries.java
├── TestAltSortQueries.java
├── TestBugFixes.java
├── TestBuilder.java
├── TestCTASPartitionFilter.java
├── TestCaseSensitivity.java
├── TestCorrelation.java
├── TestDecimalFunctionsInGandivaCodeGen.java
├── TestDecimalFunctionsInGandivaOnlyCodeGen.java
├── TestDecimalFunctionsInJavaCodeGen.java
├── TestDecimalQueries.java
├── TestDecimalSetting.java
├── TestDecimalStreamAgg.java
├── TestDecimalVJoin.java
├── TestDecimalVectorizedAgg.java
├── TestDisabledFunctionality.java
├── TestDropTable.java
├── TestExampleQueries.java
├── TestExplainJson.java
├── TestFilterPastJoin.java
├── TestFrameworkTest.java
├── TestFunctionsQuery.java
├── TestFunctionsWithTypeExpoQueries.java
├── TestGandivaOnlyQueries.java
├── TestImplicitCasting.java
├── TestInList.java
├── TestIndexBasedPruning.java
├── TestIsNotDistinctFromJoin.java
├── TestJoinNullable.java
├── TestMergeFilterPlan.java
├── TestMergingReceiverSpooling.java
├── TestMfsBlockLoader.java
├── TestMixedDecimalFunctionTests.java
├── TestNljPushdown.java
├── TestNotInQueries.java
├── TestOutOfMemoryException.java
├── TestOutOfMemoryOutcome.java
├── TestProjectPushDown.java
├── TestResult.java
├── TestSchemaChange.java
├── TestSelectWithOption.java
├── TestStarQueries.java
├── TestTextJoin.java
├── TestTextWriter.java
├── TestTpchDistributed.java
├── TestTpchDistributedConcurrent.java
├── TestTpchDistributedStreaming.java
├── TestTpchExplain.java
├── TestTpchLimit0.java
├── TestTpchPlanning.java
├── TestTpchSingleMode.java
├── TestTransitiveJoin.java
├── TestTruncateTable.java
├── TestUnionAll.java
├── TestUnionDistinct.java
├── TestVectorizedPartitionSender.java
├── common
├── exec
└── sabot

plugin 测试简单说明

参考自官方的测试demo
需要做的事情,初始化一个dremio catalog 服务(进行插件管理),注册自己开发的插件,进行查询测试(注意测试基类需要继承自BaseTestQuery我们可以利用好多base 的方法,test...)

  • 简单参考
 
public class TestSubPathFileSystemPlugin extends BaseTestQuery {
  @ClassRule
  public static TemporaryFolder testFolder = new TemporaryFolder();
 
  protected static File storageBase;
 
  @Rule
  public TemporarySystemProperties properties = new TemporarySystemProperties();
 
  @Before
  public void before() {
    properties.set(DremioConfig.LEGACY_STORE_VIEWS_ENABLED, "true");
  }
 
  @BeforeClass
  public static void setup() throws Exception {
    testNoResult("alter system set \"%s\" = 1", FileDatasetHandle.DFS_MAX_FILES.getOptionName());
    generateTestData();
    addSubPathDfsPlugin();
  }
 
  @Test
  public void queryValidPath() throws Exception {
    test("SELECT * FROM subPathDfs.\"tblInside.csv\"");
    test("SELECT * FROM subPathDfs.\"dirInside/tbl.csv\"");
  }

maven 依赖包

  • 参考
    注意需要引用dremio kernel 的test 包,同时repo 需要使用dremio 自己的
 
<dependency>
  <groupId>com.dremio.sabot</groupId>
  <artifactId>dremio-sabot-kernel</artifactId>
  <version>${project.version}</version>
  <classifier>tests</classifier>
  <scope>test</scope>
  <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
        </exclusion>      
  </exclusions>
</dependency>
 
<repositories>
    <repository>
        <id>tencent-public</id>
        <url>http://mirrors.cloud.tencent.com/nexus/repository/maven-public/</url>
    </repository>
    <repository>
        <id>dremio-public</id>
        <url>http://maven.dremio.com/public/</url>
    </repository>
    <repository>
        <id>dremio-free</id>
        <url>http://maven.dremio.com/free/</url>
    </repository>
</repositories>

说明

以上是一个简单的说明,实际还需要自己多研究,官方已经提供了好多demo

参考资料

https://github.com/dremio/dremio-oss

posted on 2021-04-10 23:26  荣锋亮  阅读(232)  评论(0编辑  收藏  举报

导航