Skip to content
Browse files

Merge from 1.0

  • Loading branch information...
2 parents f1ee34f + 6ba0633 commit 0529feb79164a2f010689f6e5dace24969dd5964 @driftx driftx committed May 1, 2012
View
6 examples/pig/test/populate-cli.txt
@@ -12,6 +12,7 @@ column_metadata =
{column_name: score, validation_class: LongType},
{column_name: percent, validation_class: FloatType},
{column_name: atomic_weight, validation_class: DoubleType},
+ {column_name: created, validation_class: DateType},
];
create column family CopyOfSomeApp with
@@ -26,6 +27,7 @@ column_metadata =
{column_name: score, validation_class: LongType},
{column_name: percent, validation_class: FloatType},
{column_name: atomic_weight, validation_class: DoubleType},
+ {column_name: created, validation_class: DateType},
];
set SomeApp['foo']['name'] = 'User Foo';
@@ -34,20 +36,23 @@ set SomeApp['foo']['rating'] = 8;
set SomeApp['foo']['score'] = 125000;
set SomeApp['foo']['percent'] = '85.0';
set SomeApp['foo']['atomic_weight'] = '2.7182818284590451';
+set SomeApp['foo']['created'] = 1335890877;
set SomeApp['bar']['name'] = 'User Bar';
set SomeApp['bar']['vote_type'] = 'like';
set SomeApp['bar']['rating'] = 9;
set SomeApp['bar']['score'] = 15000;
set SomeApp['bar']['percent'] = '35.0';
set SomeApp['bar']['atomic_weight'] = '3.1415926535897931';
+set SomeApp['bar']['created'] = 1335890877;
set SomeApp['baz']['name'] = 'User Baz';
set SomeApp['baz']['vote_type'] = 'dislike';
set SomeApp['baz']['rating'] = 3;
set SomeApp['baz']['score'] = 512000;
set SomeApp['baz']['percent'] = '95.3';
set SomeApp['baz']['atomic_weight'] = '1.61803399';
+set SomeApp['baz']['created'] = 1335890877;
set SomeApp['baz']['extra1'] = lexicaluuid();
set SomeApp['baz']['extra2'] = lexicaluuid();
set SomeApp['baz']['extra3'] = lexicaluuid();
@@ -58,6 +63,7 @@ set SomeApp['qux']['rating'] = 2;
set SomeApp['qux']['score'] = 12000;
set SomeApp['qux']['percent'] = '64.7';
set SomeApp['qux']['atomic_weight'] = '0.660161815846869';
+set SomeApp['qux']['created'] = 1335890877;
set SomeApp['qux']['extra1'] = lexicaluuid();
set SomeApp['qux']['extra2'] = lexicaluuid();
set SomeApp['qux']['extra3'] = lexicaluuid();
View
4 src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
@@ -313,6 +313,8 @@ else if (value instanceof ByteBuffer)
pair.set(position, new DataByteArray(ByteBufferUtil.getArray((ByteBuffer) value)));
else if (value instanceof UUID)
pair.set(position, new DataByteArray(UUIDGen.decompose((java.util.UUID) value)));
+ else if (value instanceof Date)
+ pair.set(position, new DataByteArray(ByteBufferUtil.getArray(DateType.instance.decompose((Date) value))));
else
pair.set(position, value);
}
@@ -607,7 +609,7 @@ public ResourceSchema getSchema(String location, Job job) throws IOException
private byte getPigType(AbstractType type)
{
- if (type instanceof LongType)
+ if (type instanceof LongType || type instanceof DateType) // DateType is bad and it should feel bad
return DataType.LONG;
else if (type instanceof IntegerType)
return DataType.INTEGER;

0 comments on commit 0529feb

Please sign in to comment.
Something went wrong with that request. Please try again.