dremio 社区flight 格式化扩展说明

实际上代码来自一个老项目,现在dremio 的变动还是很大的,项目是运行不起来的,但是还是很值得学习参考的

开发说明

formation 是基于dremio 3.0 版本,特别老的,,此版本对于reader 以及writer的处理还是很复杂的,代码量很大,
详细的可以参考代码,开发机制相对有点复杂,新版本的,处理上更加灵活,而且代码处理上
更加清晰,测试部分很是值得学习的(我以前也简单介绍过)

  • 单元测试部分
    我们扩展BaseTestQuery 就可以方便的实现测试了
 
public class TestFormation extends BaseTestQuery {
 
  @Test
  public void test1() throws Exception {
    SourceConfig c = new SourceConfig();
    FormationConfig conf = new FormationConfig();
    c.setConnectionConf(conf);
    c.setName("flight");
    c.setMetadataPolicy(CatalogService.NEVER_REFRESH_POLICY);
    CatalogServiceImpl cserv = (CatalogServiceImpl) getBindingProvider().lookup(CatalogService.class);
    cserv.createSourceIfMissingWithThrow(c);
    test("create table flight.blue as select * from sys.options");
//    test("create table flight.lineitem as select * from dfs_root.opt.data.sf1p.lineitem");
//    test("select count(*) from flight.lineitem");
    test("select * from flight.blue");
    test("select * from flight.blue");
  }
}

新版本存储扩展依赖

通过下图可以看到新版本flight 扩展的处理

 

 

说明

因为dremio 12 之后flight 就放到core 中了,所以早期的设计很多会不太一样了,而且新版本代码设计更加灵活简单(尤其扩展的arp机制还有抽象接口提升不少)

参考资料

https://github.com/jacques-n/formation

posted on 2022-03-02 13:11  荣锋亮  阅读(35)  评论(0编辑  收藏  举报

导航