通过dremio git 提交学习dremio 插件开发以及测试

主要是一个简单的说明,我们可以通过源码以及git 提交学习一些不错的关于dremio 开发相关的东西

一个参考插的开发

如下图

 

 

  • 插件开发
    从上图可以看出核心就是config以及存储插件,以及相关的配置,还有插件加载的配置(类扫描)
  • 插件测试
    此测试类比较有意义,很多时间大家不爱测试,碰到问题就比较难解决了,此类就是一个不错的参考
    参考测试类
 
public class AWSGlueStoragePluginTest extends BaseTestQuery {

插件注册

public static void addGlueTestPlugin(final String pluginName, final CatalogService pluginRegistry) throws Exception {
    SourceConfig sc = new SourceConfig();
    sc.setName(pluginName);
    AWSGluePluginConfig conf = new AWSGluePluginConfig();
    final List<Property> finalProperties = new ArrayList<>();
    finalProperties.add(new Property("hive.imetastoreclient.factory.class",
      "com.amazonaws.glue.catalog.metastore.MockAWSGlueDataCatalogHiveClientFactory"));
 
    finalProperties.add(new Property("fs.s3a.bucket.qa1.dremio.com." +
      "access.key", "test"));
    finalProperties.add(new Property("fs.s3a.bucket.qa1.dremio.com.secret.key", "test"));
    finalProperties.add(new Property("fs.s3a.bucket.qa1.dremio.com.aws.credentials.provider", "org.apache.hadoop.fs.s3a" +
        ".SimpleAWSCredentialsProvider"));
    finalProperties.add(new Property("fs.s3a.bucket.qa1.dremio.com.endpoint", "localhost:"+port));
    finalProperties.add(new Property("fs.s3a.bucket.qa1.dremio.com.path.style.access", "true"));
    finalProperties.add(new Property("fs.s3a.bucket.qa1.dremio.com.connection.ssl.enabled", "false"));
 
    File file = new File(
      AWSGlueStoragePluginTest.class.getClassLoader().getResource("catalog_store.json").getFile()
    );
    String content = new String(Files.readAllBytes(file.toPath()));
    finalProperties.add(new Property("awsglue.catalog.store.content", content));
    conf.enableAsync = false;
 
    conf.propertyList = finalProperties;
    conf.accessKey = "test";
    conf.accessSecret = "test";
    sc.setType(conf.getType());
    sc.setConfig(conf.toBytesString());
    sc.setMetadataPolicy(CatalogService.DEFAULT_METADATA_POLICY);
    // 注册插件
    ((CatalogServiceImpl) pluginRegistry).getSystemUserCatalog().createSource(sc);
  }

说明

通过官方的git 提交我们可以学到不少有意思的东西,可以更好的学习dremio,以上只是一个简单的说明,大家可以更好的发掘dremio 的价值

参考资料

https://github.com/dremio/dremio-oss/commit/07ab5d99b4fa14b77f12043f2640b1273f7886d5
https://github.com/dremio/dremio-oss/blob/07ab5d99b4fa14b77f12043f2640b1273f7886d5/sabot/kernel/src/main/java/com/dremio/exec/server/SabotContext.java

posted on   荣锋亮  阅读(49)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2021-10-23 openmetadata connector 开发简单说明
2021-10-23 openmetadata es 存储安全认证添加
2021-10-23 openmetadata 构建说明
2020-10-23 apache trafficcontrol 开源的基于golang 的cdn 框架
2020-10-23 sftpgo 多功能高度可配置的sftp server
2020-10-23 opencsv csv 数据解析通用包
2020-10-23 jenkins+ rclone定时同步sftp数据到s3

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示