GithubHelp home page GithubHelp logo

turkcell / shrimp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from burakisikli/shrimp

1.0 9.0 1.0 105 KB

Pig library for simplifying the programming

License: Apache License 2.0

Java 100.00%

shrimp's Introduction

Shrimp

Shrimp is a library of user-defined functions for simplifying the programming in Hadoop and Pig.

### NVL: NVL lets you replace null (returned as a blank) with a string in the results of a query. If expr1 is null, then NVL returns expr2. If expr1 is not null, then NVL returns expr1.
DEFINE NVL com.ttech.shrimp.NVL();
-- input:
-- (1,,2)
A = LOAD '/data/smp' USING PigStorage(',') as (f1:int, f2:chararray, f3:chararray);
-- NVL(exp1, exp2)
-- NVL2(string1, value_if_null )
B = FOREACH A GENERATE NVL(f1, '-1') as f1, NVL(f2, '-1') as f2, NVL(f3, '-1') as f3;
-- output:
-- (1, -1, 2)
dump B;

Source: http://docs.oracle.com/cd/B28359_01/server.111/b28286/functions110.htm

NVL2:

NVL2 lets you determine the value returned by a query based on whether a specified expression is null or not null. If expr1 is not null, then NVL2 returns expr2. If expr1 is null, then NVL2 returns expr3.

DEFINE NVL2 com.ttech.shrimp.NVL2();
-- input:
-- (1,,2)
-- NVL2(string1, value_if_NOT_null, value_if_null )
A = LOAD '/data/smp' USING PigStorage(',') as (f1:int, f2:chararray, f3:chararray);
-- NVL2(exp1, exp2, exp3);
-- NVL2(string1, value_if_NOT_null, value_if_null )
B = FOREACH A GENERATE NVL2(f1, f1, '-1');
-- output:
-- (1)
dump B;

Source: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions120.htm

SQOOP_DATE_FORMAT:

To be able to load Oracle, date format must be "DD-MM-YYYY HH24:MI:SS". SQOOP_DATE_FORMAT lets you to convert the format to be able to load to the Oracle. Input format must be "YYYYMMDDHH24MISS"

DEFINE SQOOP_DATE_FORMAT com.ttech.shrimp.SQOOP_DATE_FORMAT();
-- input:
-- (20130905225900)
A = LOAD '/data/smp' USING PigStorage(',') as (f1:int, f2:chararray, f3:chararray);
B = FOREACH A GENERATE SQOOP_DATE_FORMAT(f1);
-- output:
-- (2013-09-05 22:59:00)
dump B;

Working with the source code

Here are some common tasks when working with the source code.

Build the JAR

mvn package

shrimp's People

Contributors

burakisikli avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

ynnsrinivas

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.