Skip to content

Instantly share code, notes, and snippets.

@anuvrat
anuvrat / Pair.java
Created April 19, 2010 10:37
class Pair<L, R>
import java.io.Serializable;
/**
* A pair utility class
*
* @author AnuvratSingh
* @param <L> The left component type
* @param <R> The right component type
*/
public class Pair<L, R> implements Serializable, Comparable<Pair<L, R>>, Cloneable {
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="pba" xmlns="pba">
<xs:element name="plgen">
<xs:complexType>
<xs:sequence>
<xs:element ref="playlist" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
public class Plgen implements java.io.Serializable {
/**
* Field _playlistList.
*/
private java.util.List<Playlist> _playlistList;
/*
* Methods of this class
*/
public class Playlist implements java.io.Serializable {
/**
* Field _extensionType.
*/
private ExtensionType _extensionType;
/*
* Methods of this class
*/
public enum ExtensionType implements java.io.Serializable {
/**
* Constant M3U
*/
M3U("m3u"),
/**
* Constant SF
*/
SF("sf");
<?xml version="1.0" encoding="UTF-8"?>
<castor:mapping>
<castor:class name="test.Plgen">
<castor:map-to xml="plgen" />
<castor:field name="playlist" type="test.Playlist" collection="arraylist">
<castor:bind-xml name="playlist" />
</castor:field>
</castor:class>
<castor:class name="test.Playlist">
@anuvrat
anuvrat / Remove SVN
Created January 27, 2012 13:26
Recursively remove .svn folders
find . -name .svn -print0 | xargs -0 rm -rf
@anuvrat
anuvrat / parse_name.pl
Created February 26, 2012 13:00
A sample user defined function for hive
while(<>) {
chomp;
# Input fields full_name, <more data>
my ($full_name, @other_cols) = split(/\t/);
my($first_name, $last_name) = _parse_name($full_name);
print join("\t", $first_name, $last_name, @other_cols) . "\n";
}
select
transform(full_name, address, email_id)
using 's3://<>/parse_name.pl'
as (first_name, last_name, address, email_id)
from names_table;
from (
select
transform(full_name, address, email_id)
using 's3://<>/parse_name.pl'
as (first_name, last_name, address, email_id)
from names_table
) t
select t.first_name, t.last_name, t.address, t.email_id
where t.last_name like 'Singh';