GithubHelp home page GithubHelp logo

bingrao / sparkdataset_generator Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 1.0 160.7 MB

[sql to spark DataSet] A library to translate SQL query into Spark DataSet API using JSQLParser and Scala implicit

Java 0.93% Scala 44.52% TSQL 54.54%
spark sql sparkdataframe jsqlparser scala implicit dataframe dataset sparkdataset

sparkdataset_generator's Introduction

Sql to DataFrame Generator

To convert most of the sql queries to Spark DataFrames(scala) and reduce copy paste work of developers while doing the same.

Motivation :

Spark DataFrames provide high performance and reduce cost. So, I converted Many SQL scripts to spark DataFrames. It converts complex nested SQL, arithmetic expressions and nested functions, to spark DataFrame's. Sample Example is provided below.

Why to convert to DataFrames when we can run SQL in spark mode

Advantages of DataFrame over sql:-

  • Advantage to write UDF and UDAF using FP's of scala.

  • Better type safe than sql.

  • Using functional programming API we can define filters or Select statement at runtime.

  • Splitting complex sql to small data frames used for optimizations.

  • Decrease load over meta store.

Sample Examples:

Input sql

SELECT count(*) FROM head WHERE age  >  56           

output dataframe

head.where(col("age") > 56).agg(count("*"))

Please refer to the more case study in File case examples

Notes

This project is still in early development, if there is any problem, please free to let me know.

Please refer to the unSupport SQL file to see the unsupport sql.

sparkdataset_generator's People

Contributors

bingrao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ghfork

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.