Code Monkey home page Code Monkey logo

calcite-sql-executor's Introduction

Description

基于Apache calcite构建多数据源联合查询适配器,当前已支持:

  • CSV
    • 支持投影下推
  • DynamoDb
    • 支持无模式定义:动态表名,其映射至一个json文本,json中描述具体的查询目标table、hashKey等信息;
    • 支持模式定义:通过读取被@DynamoDBTable注解的Entity类,注册Table信息;
    • 支持投影下推
    • 支持过滤下推
  • HTTP
    • TODO

Constraint

所有的查询适配器当前仅验证了Varchar和Integer类型,其他处于Todo验证状态。

CSV

  • 数据行head需要包含SqlTypeName定义,其格式如下
ID:VARCHAR,NAME1:VARCHAR,NAME2:VARCHAR

DynamoDb

无模式

  • 待查询目标表需要通过script定义,否则无法获取完整的AttributeDefinition, 其应用于DynamoDbTable
  • 有别于有模式注册,每个查询均会动态注册一个新的DynamoDbTable实例。而getTableMap仅仅返回一个占位表信息作为标识。

有模式

  • 实体定义中字段schema定义全部小写,便于与sql文对应匹配;
  • 实体定义中表名、索引连接符采用_
  • 通过-实现tableName-indexName的连接操作,其作为索引表的注册表名;
  • 目前仅支持所有query filter的AND连接语义操作;
  • 目前仅支持等值过滤,若需要添加其他类型,则需要更多判断,如dynamoDb中hashKey仅支持等值;
  • 当前支持的数据类型有限;

Test

CSV

DynamoDb

Load sample dynamoDb data with AbstractDynamoDbTest

无模式

有模式

MultipleDatasource

组合DynamoDb和CSV两个数据源的联合查询

Reference

官方示例,可参考example中实现,包含UDF和Rule示例。
一个支持HTTP的示例。
以CSV适配器实现,介绍SQL的parse和validate,以及RBO和CBO的使用。
基于blog介绍的一个示例项目。

calcite-sql-executor's People

Contributors

soulsong avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.