Giter Site home page Giter Site logo

mayursoneji145 / sql_schema_to_hiveql Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 8 KB

The objective of this project is to read all the schema files present on HDFS and generate files which will have the CREATE Database and table commands, along with the LOAD statement

Java 100.00%

sql_schema_to_hiveql's Introduction

SQL_schema_to_HiveQL

The objective of this project is to read all the schema files present on HDFS and generate files which will have the CREATE Database and table commands, along with the LOAD statement


Pre-requisites

  1. Have all the schema files downloaded into ONE HDFS folder
  2. Create a HDFS folder on which the HQL files will be saved at the end of the program
  3. Provide appropriate permissions, so that there is no error while saving the files on the folder
  4. The program takes 3 arguments as input: a. HDFS path where all the input schema files are present b. HDFS path where the HQL scripts need to be saved c. HDFS path where all the files to load are present

Process

  1. Retrieve the file names via wholetextfiles, where the files names will be present on the keys of the PairedRDD
  2. Generate the full paths of the input files, and loop thru these files to generate the HiveQL file; the loop contains below steps:
  3. Extract the database name and table name from the file been read
  4. Filter out only those lines which contain the column names
  5. Replace the datatypes as applicable. In our example, we are converting the SQL datatype VARCHAR to HIVE Datatype String
  6. Ensure that only the datatypes are been processed, column names should remain the same
  7. Populate the statements in the final Arraylist
  8. Create database
  9. Use Database 10.Create table 11.Load data inpath 12.Convert this Arraylist to RDD via parallelize 13.Write this RDD via saveAsTextFile onto the destination path provided as Argument 2

sql_schema_to_hiveql's People

Contributors

mayursoneji145 avatar

Watchers

 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.