Skip to content

Commit

Permalink
CHANGELOG:
Browse files Browse the repository at this point in the history
- support create ods table statement
- support show statics statement
- support hologres and hive create table client
  • Loading branch information
Willam2004 committed Oct 7, 2023
2 parents 3f7ca8d + b3d8643 commit 8a050c7
Show file tree
Hide file tree
Showing 261 changed files with 28,068 additions and 1,020 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,11 @@ uploads/
deploy.sh
/fastmodel-parser/src/test/resources/lsp/gen/
/**/package-lock.json
/fastmodel-parser/gen/lsp/FastModelGrammarParser.java
/fastmodel-parser/gen/lsp/FastModelGrammarParserBaseListener.java
/fastmodel-parser/gen/lsp/FastModelGrammarParserBaseVisitor.java
/fastmodel-parser/gen/lsp/FastModelGrammarParserListener.java
/fastmodel-parser/gen/lsp/FastModelGrammarParserVisitor.java
/fastmodel-parser/src/test/resources/lsp/FastModelLexer.g4
/fastmodel-parser/gen/lsp/FastModelLexer.java
/fastmodel-parser/src/test/resources/lsp/keyword.txt
27 changes: 27 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## 0.4.5
新功能(new features)
Core
• 支持Call语法的操作,支持指标SQL的转换。
• 增加CreateDwsTable,汇总逻辑表的定义。
• ShowObjects语句对象支持Limit和Offset
Transformer
• 支持Maxcompute SQL到FML模型转换
• Maxcomputer转换器默认使用1.0版本类型方式
功能优化(enhancement)
Core
• CreateTable以及子类使用Builder模式进行重构
• ColumnDefinition使用Builder模式进行重构
• ChangeCol支持更改自定义属性。
• 新增一些常用的方法,用于判断Statement内的属性是否为空。
• 标识(Identifier)支持下划线开头,兼容ODPS表的规范。
JDBC Driver
• 异常提示优化,增加requestId的请求,方便问题排查。
• 重构了底层的鉴权方式,采用Commad模式。
BugFix(bug fix)
• Fixed MaxCompute Transformer1.0 时,不支持Alter语句的列类型转换。
向下兼容(compatibility)
• 暂无
过期功能(deprecations)
安全漏洞修复(vulnerability)
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,14 @@ Developer’s IDE need to support at least:

IntelliJ IDEA IntelliJ IDEA Plugins

- IntelliJ: https://www.jetbrains.com/idea/
- IntelliJ地址: https://www.jetbrains.com/idea/
- IntelliJ ANTLR: https://plugins.jetbrains.com/plugin/7358-antlr-v4
- Code style template: docs/Alibaba_CodeStyle.xml
- ErrorProne: https://errorprone.info/docs/installation

## Documentation

The introduction and guide of the FML can be found under the `doc/` directory, the docs is managed with the Docsify, to learn more about it: docsify quickstart
FML文档可The introduction and guide of the FML can be found under the `doc/` directory, the docs is managed with the Docsify, to learn more about it: docsify quickstart

- Run locally: `docsify serve docs`
- Then visit http://localhost:3000
Expand Down
4 changes: 4 additions & 0 deletions cd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"cname": "fml.alibaba-inc.com",
"public": "./docs"
}
120 changes: 120 additions & 0 deletions docs/zh-cn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# FastModel Language

FML(Fast Model Language) 用于维度建模领域快速构建的一门类SQL语言。主要目标是提供一套kimball维度建模理论下,结合大数据开发场景下的一种领域特定语言。 FML采用了类SQL的语言方式, 创建表语法是参考了SQL标准语法,并有自己的扩展。
FML是一种模型设计语言,期望做到设计与实现解耦,在设计过程中,不用特别考虑各个大数据引擎的实现方式。 建模引擎会根据FML定义的Schema去驱动底层各个数据引擎的执行和操作。
用户在使用FML时,并不需要特别关注底层数据引擎的细节部分,只有在实际物化(将设计的表转换为底层引擎的物理表时)阶段,建模引擎会根据物化的选择,将FML语言,转换为数据引擎可识别的SQL语法,并提交任务节点执行。具体与各个数据引擎的转换,请参考 FML Transform。

阅读更多: [https://fml.alibaba-inc.com/](https://fml.alibaba-inc.com/)

### Features

* 一种支持维度建模的领域特定语言,类SQL语法。

* 支持数仓规划、数据标准、标准代码、指标等数仓建设中全流程的语法定义。

* 使用Java编写,可以方便的构造语法的节点API进行模型构建。

* 支持FML语法转换到常见引擎,如MaxCompute,Hive, Hologres,Mysql, PlantUML等Transform API.

* 提供基于JDBC Driver的方式,来使用FML语言来与模型引擎进行交互处理。

### Grammar Manual

你可以使用FML语法,来定义维度建模模型信息,比如[表的创建](/zh-cn/model/table.md)等,FML提供了丰富的DDL语句,可以让你快速 进行建模的操作。

### Parser Example

```java

import com.aliyun.fastmodel.core.parser.FastModelParser;
import com.aliyun.fastmodel.core.parser.FastModelParserFactory;

public class HelloFML {
//单例
private static final FastModelParser FAST_MODEL_PARSER = FastModelParserFactory.getInstance().get();

public static void main(String[] args) {
String fml
= "create dim table t_1 alias 'alias_name' (col bigint alias 'alias_name' comment 'col_comment') comment 'comment';";
CreateDimTable createDimTable = FAST_MODEL_PARSER.parseStatement(fml);
//do your work
}
}

```

### Transformer Example

```java
import com.aliyun.fastmodel.core.tree.BaseStatement;
import com.aliyun.fastmodel.transform.api.Transformer;
import com.aliyun.fastmodel.transform.api.TransformerFactory;
import com.aliyun.fastmodel.transform.api.context.TransformContext;
import com.aliyun.fastmodel.transform.api.dialect.DialectMeta;

public class HelloFMLTransformer {
public static void main(String[] args) {
DialectMeta dialectMeta =
Transformer < BaseStatement > statementTransformer = TransformerFactory.getInstance().get(dialectMeta);
statementTransformer.transform(statement, context).getNode();
}
}
```

## Building FML from Source

FML构建准备条件:

* Unix-like environment (we use Linux, Mac OS X, Cygwin, WSL)
* Git
* Maven (we recommend version 3.5.0+)
* Java 8

```
git clone [email protected]:base-biz/fastmodel.git
cd fastmodel
mvn clean package -DskipTests # this will take up to 10 minutes
```

## Developing FML

FML提交者使用IntelliJ IDEA来开发FML代码库,我们推荐IntelliJ IDEA开发Java工程

IDE的最小支持集包括:

* 支持Java工程
* 支持Maven

### IntelliJ IDEA

IntelliJ IDE 支持以下插件

* IntelliJ 下载地址: [https://www.jetbrains.com/idea/](https://www.jetbrains.com/idea/)
* IntelliJ ANTLR 插件地址: [https://plugins.jetbrains.com/plugin/7358-antlr-v4](https://plugins.jetbrains.com/plugin/7358-antlr-v4)

## Documentation

FML文档会部署在 : [https://fml.alibaba-inc.com](https://fml.alibaba-inc.com)
或者可以从 `docs/` 目录查看源文件。

## Fork and Contribute

当前FML处于内部开源项目,欢迎大家使用和参与并贡献它. 你可以联系我们看是否能够提供一些支持,可以从这边文章描述
[如何贡献代码](https://fml.alibaba-inc.com/#/zh-cn/how-to-contribute).

## RoadMap

```plantuml
projectscale quarterly
@startgantt
Project starts 2022-03-01
[支持hologres的从sql逆向到fml模型处理] lasts 15 days
[支持clickhouse sql的转换和逆向处理] lasts 30 days
[支持FML元数据能力] lasts 60 days
[引擎语法转换可定制] lasts 30 days
[引擎语法转换可定制]->[支持clickhouse sql的转换和逆向处理]
[支持hologres的从sql逆向到fml模型处理] -> [引擎语法转换可定制]
@endgantt
```
6 changes: 4 additions & 2 deletions docs/zh-cn/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!-- docs/_sidebar.md -->

* [首页](zh-cn/README.md)
* [入门](zh-cn/guide.md)
* [与SQL的差异](zh-cn/difference.md)
* [基本元素](zh-cn/basic.md)
Expand All @@ -15,7 +16,7 @@
* [数据质量](zh-cn/model/quality.md)
* [维度定义](zh-cn/model/dimension.md)
* 数据标准
* [数据标准](zh-cn/standard/standard_dict.md)
* [数据标准和标准集](zh-cn/standard/standard_dict.md)
* [标准代码](zh-cn/standard/code_table.md)
* [度量单位](zh-cn/standard/measure_unit.md)
* 指标管理
Expand All @@ -29,9 +30,10 @@
* [查看引用](zh-cn/references/show_references.md)
* [移动引用](zh-cn/references/move_references.md)
* 命令语句
* [导入导出](zh-cn/command/impexp.md)
* [渲染导入导出](zh-cn/command/impexp.md)
* 逆向
* [逆向建模](zh-cn/reverse/model.md)
* [逆向生成指标](zh-cn/reverse/indicator.md)
* 发布
* [模型发布](zh-cn/publish/model.md)
* DDL转换
Expand Down
16 changes: 16 additions & 0 deletions docs/zh-cn/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,22 @@ WITH (
,'type' = 'NONE'
)
```
### 派生指标
我们可以通过批量的方式,创建派生指标,而不需要一个个定义。
```fml
-- 批量创建派生指标-学生考勤
create batch edu.batch_code (
need_clock_in_class_cnt_0000 comment '当前学期_学生_全部_排课次数' references need_clock_in_class_cnt as count(1)
, clock_in_class_cnt_0000 comment '当前学期_学生_全部_出席次数' references clock_in_class_cnt as count(case when fact_student_clock_in_class.absent_tag = 0 then 1 else null end)
, not_clock_in_class_cnt_0000 comment '当前学期_学生_旷课_缺席次数' adjunct(kuangke_tag) references not_clock_in_class_cnt as count(1)
, not_clock_in_class_cnt_0001 comment '当前学期_学生_病假_缺席次数' adjunct(bingjia_tag) references not_clock_in_class_cnt as count(1)
, time_period now_term_year
, from table (fact_student_clock_in_class)
, date_field (gmt_create, 'yyyy-MM-dd')
, adjunct (all_tag)
, dim table (dim_student)
) with ('is_async'='false');
```


# 总结
Expand Down
39 changes: 21 additions & 18 deletions docs/zh-cn/how-to-contribute.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## FML包结构

## FML包结构
```plantuml
@startuml
package core <<核心模型>>{
Expand Down Expand Up @@ -58,6 +58,24 @@ package core <<核心模型>>{
FastModelParser --> ParseException
package compare <<比较>>{
abstract class BaseCompareNode {
compareNode(b : Statement , after:Statement, strategy:CompareStrategy) : List<Statement>
}
class CreateTableCompareNode
CreateTableCompareNode --|> BaseCompareNode
enum CompareStrategy <<比对策略>>
BaseCompareNode -> Statement
}
package formatter<<格式器>>{
class ExpressionFormatter
Expand All @@ -83,26 +101,10 @@ package core <<核心模型>>{
}
}
compare --> tree
}
package compare <<比较>>{
abstract class BaseCompareNode {
compareNode(b : Statement , after:Statement, strategy:CompareStrategy) : List<Statement>
}
class CreateTableCompareNode
CreateTableCompareNode --|> BaseCompareNode
enum CompareStrategy <<比对策略>>
BaseCompareNode -> Statement
}
package driver {
package cli <<CLI程序>>{
Expand Down Expand Up @@ -154,6 +156,7 @@ compare --> core
@enduml
```


## FML核心对象

```plantuml
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@

package com.aliyun.fastmodel.benchmarks;

import com.google.common.base.Stopwatch;
import java.time.Duration;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import com.google.common.base.Stopwatch;
import lombok.extern.slf4j.Slf4j;

/**
* performance util
* Desc:
*
* @author panguanjing
* @date 2021/4/1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2020. Aliyun.com All right reserved. This software is the
* confidential and proprietary information of Aliyun.com ("Confidential
* Information"). You shall not disclose such Confidential Information and shall
* use it only in accordance with the terms of the license agreement you entered
* into with Aliyun.com.
*/

package com.aliyun.fastmodel.benchmarks;

import java.io.IOException;
import java.io.UncheckedIOException;

import com.google.common.io.Resources;

import static com.google.common.base.Charsets.UTF_8;

/**
* TPCH
*
* @author panguanjing
* @date 2020/11/23
*/
public class Tpch {

public String getQuery(int i){
return getTpchQuery(i);
}

private String getTpchQuery(int q) {
return readResource("tpch/" + q + ".sql");
}

private String readResource(String name) {
try {
return Resources.toString(
Resources.getResource(name), UTF_8);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
}
Loading

0 comments on commit 8a050c7

Please sign in to comment.