Giter Site home page Giter Site logo

sunsky667 / mlsql Goto Github PK

View Code? Open in Web Editor NEW

This project forked from byzer-org/byzer-lang

0.0 0.0 0.0 52.31 MB

The Programming Language Designed For Big Data and AI

Home Page: https://mlsql.ai

License: Apache License 2.0

Scala 13.56% Java 1.88% CSS 12.57% JavaScript 54.48% HTML 10.30% Roff 0.02% Shell 0.30% ANTLR 0.02% Python 1.38% Dockerfile 0.02% Batchfile 0.02% Less 5.44%

mlsql's Introduction

MLSQL

MLSQL is a distributed Programming Language designed For Big Data and AI.

load hive.`raw.stripe_discounts` as discounts;
load hive.`raw.stripe_invoice_items` as invoice_items;

select
        invoice_items.*,
        case
            when discounts.discount_type = 'percent'
                then amount * (1.0 - discounts.discount_value::float / 100)
            else amount - discounts.discount_value
        end as discounted_amount

    from invoice_items

    left outer join discounts
        on invoice_items.customer_id = discounts.customer_id
        and invoice_items.invoice_date > discounts.discount_start
        and (invoice_items.invoice_date < discounts.discount_end
             or discounts.discount_end is null)
as joined;



select

        id,
        invoice_id,
        customer_id,
        coalesce(discounted_amount, amount) as discounted_amount,
        currency,
        description,
        created_at,
        deleted_at

    from joined
as final;



set allColumns = "all,wow";

!if ''' split(:allColumns,",")[0] == "all" ''';
   select * from final as final2;
!else;
   select id,invoice from final as final2;
!fi;

select * from final2 as output;

Official WebSite

https://mlsql.tech

Desktop(MacOS、Linux)

mlsql-lang-vscode-plugin

more document about mlsql lang desktop/Chinese

Docker Sandbox

Pulling Sandbox Docker Image

For Spark 2.4.3 bundle:

docker pull techmlsql/mlsql-sandbox:2.4.3-2.1.0

For Spark 3.1.1 bundle:

docker pull techmlsql/mlsql-sandbox:3.1.1-2.1.0

Start Container

docker run -d \
-p 3306:3306 \
-p 9002:9002 \
-e MYSQL_ROOT_PASSWORD=mlsql \
--name mlsql-sandbox-2.4.3-2.1.0 \
techmlsql/mlsql-sandbox:2.4.3-2.1.0
  1. Launch a browser, enter http://localhost:9002, and "Setup MLSQL Console in 2 Steps" page shows.
  2. Enter admin username and password, click "Go" button.
  3. Enter spark for "Engine Name", http://localhost:9003 for "Engine Url", leave "Access Token" blank, click "Go" button.
  4. Click "Go to Console Page", and you're all set to play with mlsql.

Download MLSQL

  • The latest stable version is release-2.1.0
  • You can download from MLSQL Website
  • Spark 2.4.3/3.1.1 are tested

Naming Convention

mlsql-engine_${spark_major_version}-${mlsql_version}.tgz

## Pre-built for Spark 2.4.3
mlsql-engine_2.4-2.1.0.tar.gz

## Pre-built for Spark 3.1.1
mlsql-engine_3.0-2.1.0.tar.gz

Building a Distribution

Prerequisites

  • JDK 8+
  • Maven
  • Linux or MacOS

Downloading Source Code

## Clone the code base
git clone https://github.com/allwefantasy/mlsql.git .
cd mlsql

Building Spark 2.4.3 Bundle

export MLSQL_SPARK_VERSION=2.4
./dev/make-distribution.sh

Building Spark 3.1.1 Bundle

export MLSQL_SPARK_VERSION=3.0
./dev/make-distribution.sh

Building without Chinese Analyzer

## Chinese analyzer is enabled by default.
export ENABLE_CHINESE_ANALYZER=false
./dev/make-distribution.sh <spark_version>

Building with Aliyun OSS Support

## Aliyun OSS support is disabled by default
export OSS_ENABLE=true
./dev/make-distribution.sh <spark_version>

Deploying

  1. Download or build a distribution
  2. Install Spark and set environment variable SPARK_HOME, make sure Spark version matches that of MLSQL
  3. Deploy tgz
  • Set environment variable MLSQL_HOME
  • Copy distribution tar ball over and untar it

4.Start MLSQL in local mode

cd $MLSQL_HOME
## Run process in background
nohup ./bin/start-local.sh 2>&1 > ./local_mlsql.log &
  1. Open a browser and type in http://localhost:9003, have fun.

Directory structure

|-- mlsql
    |-- bin        
    |-- conf       
    |-- data       
    |-- examples   
    |-- libs       
    |-- README.md  
    |-- LICENSE
    |-- RELEASE

Contributing to MLSQL

If you are planning to contribute to this repository, please create an issue at our Issue page even if the topic is not related to source code itself (e.g., documentation, new idea and proposal).

This is an active open source project for everyone, and we are always open to people who want to use this system or contribute to it.

Contributors

  • Zhu William/allwefantasy#gmail.com
  • Chen Fu/cfmcgrady#gmail.com
  • Geng Yifei/pigeongeng#gmail.com
  • wanp1989/wanp1989#126.com
  • chenliang613
  • RebieKong
  • CoderOverflow
  • ghsuzzy
  • xubo245
  • zhuohuwu0603
  • liyubin117
  • 9bbword
  • Slash-Wong/523935329#qq.com
  • anan0120/158989903#qq.com

WeChat Group

扫码添加K小助微信号,添加成功后,发送 mlsql 这5个英文字母进群。

mlsql's People

Contributors

2efper avatar allwefantasy avatar anan0120 avatar bbword avatar bebee4java avatar bigalansun avatar cfmcgrady avatar chncaesar avatar ckeys avatar coderoverflow avatar dantezhao avatar dongbin86 avatar ghsuzzy avatar hellozepp avatar jovany-wang avatar lifanfanalice avatar liuweixiao avatar liuyonghengheng avatar liyubin117 avatar lwz9103 avatar mapxn avatar philmirez avatar rebiekong avatar scott-coding avatar slashwong avatar xubo245 avatar xuqianjin-stars avatar zhuohuwu0603 avatar zml1206 avatar zzcclp 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.