Author: daijy
Date: Fri Jun 12 22:54:38 2015
New Revision: 1685186
URL: http://svn.apache.org/r1685186
Log:
PIG-4570: Allow AvroStorage to use a class for the schema
Modified:
pig/trunk/src/docs/src/documentation/content/xdocs/func.xml
pig/trunk/test/org/apache/pig/builtin/avro/code/java/RecordPojo.java
Modified: pig/trunk/src/docs/src/documentation/content/xdocs/func.xml
URL:
http://svn.apache.org/viewvc/pig/trunk/src/docs/src/documentation/content/xdocs/func.xml?rev=1685186&r1=1685185&r2=1685186&view=diff
==============================================================================
--- pig/trunk/src/docs/src/documentation/content/xdocs/func.xml (original)
+++ pig/trunk/src/docs/src/documentation/content/xdocs/func.xml Fri Jun 12
22:54:38 2015
@@ -1394,12 +1394,9 @@ A = load 'myinput.bz';
store A into 'myoutput.bz';
</source>
-<p>Note: PigStorage and TextLoader correctly read compressed files as long as
they are NOT CONCATENATED FILES generated in this manner: </p>
+<p>Note: PigStorage and TextLoader correctly read compressed files as long as
they are NOT CONCATENATED bz/bz2 FILES generated in this manner: </p>
<ul>
<li>
- <p>cat *.gz > text/concat.gz</p>
- </li>
- <li>
<p>cat *.bz > text/concat.bz </p>
</li>
<li>
@@ -1407,7 +1404,7 @@ store A into 'myoutput.bz';
</li>
</ul>
<p></p>
-<p>If you use concatenated gzip or bzip files with your Pig jobs, you will NOT
see a failure but the results will be INCORRECT.</p>
+<p>If you use concatenated bzip files with your Pig jobs, you will NOT see a
failure but the results will be INCORRECT.</p>
<p></p>
</section>
Modified: pig/trunk/test/org/apache/pig/builtin/avro/code/java/RecordPojo.java
URL:
http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/builtin/avro/code/java/RecordPojo.java?rev=1685186&r1=1685185&r2=1685186&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/builtin/avro/code/java/RecordPojo.java
(original)
+++ pig/trunk/test/org/apache/pig/builtin/avro/code/java/RecordPojo.java Fri
Jun 12 22:54:38 2015
@@ -497,485 +497,3 @@ public class RecordPojo extends org.apac
}
}
}
-/**
- * Autogenerated by Avro
- *
- * DO NOT EDIT DIRECTLY
- */
-package org.apache.pig.builtin.avro.code.java;
-@SuppressWarnings("all")
-/** to test a generated Avro Java class */
[email protected]
-public class RecordPojo extends org.apache.avro.specific.SpecificRecordBase
implements org.apache.avro.specific.SpecificRecord {
- public static final org.apache.avro.Schema SCHEMA$ = new
org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"RecordPojo\",\"namespace\":\"org.apache.pig.builtin.avro.code.java\",\"doc\":\"to
test a generated Avro Java
class\",\"fields\":[{\"name\":\"key\",\"type\":\"string\"},{\"name\":\"intValue\",\"type\":\"int\"},{\"name\":\"longValue\",\"type\":\"long\"},{\"name\":\"booleanValue\",\"type\":\"boolean\"},{\"name\":\"floatValue\",\"type\":\"float\"},{\"name\":\"doubleValue\",\"type\":\"double\"},{\"name\":\"bytesValue\",\"type\":\"bytes\"},{\"name\":\"nullValue\",\"type\":\"null\"}]}");
- public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
- @Deprecated public java.lang.CharSequence key;
- @Deprecated public int intValue;
- @Deprecated public long longValue;
- @Deprecated public boolean booleanValue;
- @Deprecated public float floatValue;
- @Deprecated public double doubleValue;
- @Deprecated public java.nio.ByteBuffer bytesValue;
- @Deprecated public java.lang.Void nullValue;
-
- /**
- * Default constructor.
- */
- public RecordPojo() {}
-
- /**
- * All-args constructor.
- */
- public RecordPojo(java.lang.CharSequence key, java.lang.Integer intValue,
java.lang.Long longValue, java.lang.Boolean booleanValue, java.lang.Float
floatValue, java.lang.Double doubleValue, java.nio.ByteBuffer bytesValue,
java.lang.Void nullValue) {
- this.key = key;
- this.intValue = intValue;
- this.longValue = longValue;
- this.booleanValue = booleanValue;
- this.floatValue = floatValue;
- this.doubleValue = doubleValue;
- this.bytesValue = bytesValue;
- this.nullValue = nullValue;
- }
-
- public org.apache.avro.Schema getSchema() { return SCHEMA$; }
- // Used by DatumWriter. Applications should not call.
- public java.lang.Object get(int field$) {
- switch (field$) {
- case 0: return key;
- case 1: return intValue;
- case 2: return longValue;
- case 3: return booleanValue;
- case 4: return floatValue;
- case 5: return doubleValue;
- case 6: return bytesValue;
- case 7: return nullValue;
- default: throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
- // Used by DatumReader. Applications should not call.
- @SuppressWarnings(value="unchecked")
- public void put(int field$, java.lang.Object value$) {
- switch (field$) {
- case 0: key = (java.lang.CharSequence)value$; break;
- case 1: intValue = (java.lang.Integer)value$; break;
- case 2: longValue = (java.lang.Long)value$; break;
- case 3: booleanValue = (java.lang.Boolean)value$; break;
- case 4: floatValue = (java.lang.Float)value$; break;
- case 5: doubleValue = (java.lang.Double)value$; break;
- case 6: bytesValue = (java.nio.ByteBuffer)value$; break;
- case 7: nullValue = (java.lang.Void)value$; break;
- default: throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- /**
- * Gets the value of the 'key' field.
- */
- public java.lang.CharSequence getKey() {
- return key;
- }
-
- /**
- * Sets the value of the 'key' field.
- * @param value the value to set.
- */
- public void setKey(java.lang.CharSequence value) {
- this.key = value;
- }
-
- /**
- * Gets the value of the 'intValue' field.
- */
- public java.lang.Integer getIntValue() {
- return intValue;
- }
-
- /**
- * Sets the value of the 'intValue' field.
- * @param value the value to set.
- */
- public void setIntValue(java.lang.Integer value) {
- this.intValue = value;
- }
-
- /**
- * Gets the value of the 'longValue' field.
- */
- public java.lang.Long getLongValue() {
- return longValue;
- }
-
- /**
- * Sets the value of the 'longValue' field.
- * @param value the value to set.
- */
- public void setLongValue(java.lang.Long value) {
- this.longValue = value;
- }
-
- /**
- * Gets the value of the 'booleanValue' field.
- */
- public java.lang.Boolean getBooleanValue() {
- return booleanValue;
- }
-
- /**
- * Sets the value of the 'booleanValue' field.
- * @param value the value to set.
- */
- public void setBooleanValue(java.lang.Boolean value) {
- this.booleanValue = value;
- }
-
- /**
- * Gets the value of the 'floatValue' field.
- */
- public java.lang.Float getFloatValue() {
- return floatValue;
- }
-
- /**
- * Sets the value of the 'floatValue' field.
- * @param value the value to set.
- */
- public void setFloatValue(java.lang.Float value) {
- this.floatValue = value;
- }
-
- /**
- * Gets the value of the 'doubleValue' field.
- */
- public java.lang.Double getDoubleValue() {
- return doubleValue;
- }
-
- /**
- * Sets the value of the 'doubleValue' field.
- * @param value the value to set.
- */
- public void setDoubleValue(java.lang.Double value) {
- this.doubleValue = value;
- }
-
- /**
- * Gets the value of the 'bytesValue' field.
- */
- public java.nio.ByteBuffer getBytesValue() {
- return bytesValue;
- }
-
- /**
- * Sets the value of the 'bytesValue' field.
- * @param value the value to set.
- */
- public void setBytesValue(java.nio.ByteBuffer value) {
- this.bytesValue = value;
- }
-
- /**
- * Gets the value of the 'nullValue' field.
- */
- public java.lang.Void getNullValue() {
- return nullValue;
- }
-
- /**
- * Sets the value of the 'nullValue' field.
- * @param value the value to set.
- */
- public void setNullValue(java.lang.Void value) {
- this.nullValue = value;
- }
-
- /** Creates a new RecordPojo RecordBuilder */
- public static org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
newBuilder() {
- return new org.apache.pig.builtin.avro.code.java.RecordPojo.Builder();
- }
-
- /** Creates a new RecordPojo RecordBuilder by copying an existing Builder */
- public static org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
newBuilder(org.apache.pig.builtin.avro.code.java.RecordPojo.Builder other) {
- return new org.apache.pig.builtin.avro.code.java.RecordPojo.Builder(other);
- }
-
- /** Creates a new RecordPojo RecordBuilder by copying an existing RecordPojo
instance */
- public static org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
newBuilder(org.apache.pig.builtin.avro.code.java.RecordPojo other) {
- return new org.apache.pig.builtin.avro.code.java.RecordPojo.Builder(other);
- }
-
- /**
- * RecordBuilder for RecordPojo instances.
- */
- public static class Builder extends
org.apache.avro.specific.SpecificRecordBuilderBase<RecordPojo>
- implements org.apache.avro.data.RecordBuilder<RecordPojo> {
-
- private java.lang.CharSequence key;
- private int intValue;
- private long longValue;
- private boolean booleanValue;
- private float floatValue;
- private double doubleValue;
- private java.nio.ByteBuffer bytesValue;
- private java.lang.Void nullValue;
-
- /** Creates a new Builder */
- private Builder() {
- super(org.apache.pig.builtin.avro.code.java.RecordPojo.SCHEMA$);
- }
-
- /** Creates a Builder by copying an existing Builder */
- private Builder(org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
other) {
- super(other);
- }
-
- /** Creates a Builder by copying an existing RecordPojo instance */
- private Builder(org.apache.pig.builtin.avro.code.java.RecordPojo other) {
- super(org.apache.pig.builtin.avro.code.java.RecordPojo.SCHEMA$);
- if (isValidValue(fields()[0], other.key)) {
- this.key = data().deepCopy(fields()[0].schema(), other.key);
- fieldSetFlags()[0] = true;
- }
- if (isValidValue(fields()[1], other.intValue)) {
- this.intValue = data().deepCopy(fields()[1].schema(), other.intValue);
- fieldSetFlags()[1] = true;
- }
- if (isValidValue(fields()[2], other.longValue)) {
- this.longValue = data().deepCopy(fields()[2].schema(),
other.longValue);
- fieldSetFlags()[2] = true;
- }
- if (isValidValue(fields()[3], other.booleanValue)) {
- this.booleanValue = data().deepCopy(fields()[3].schema(),
other.booleanValue);
- fieldSetFlags()[3] = true;
- }
- if (isValidValue(fields()[4], other.floatValue)) {
- this.floatValue = data().deepCopy(fields()[4].schema(),
other.floatValue);
- fieldSetFlags()[4] = true;
- }
- if (isValidValue(fields()[5], other.doubleValue)) {
- this.doubleValue = data().deepCopy(fields()[5].schema(),
other.doubleValue);
- fieldSetFlags()[5] = true;
- }
- if (isValidValue(fields()[6], other.bytesValue)) {
- this.bytesValue = data().deepCopy(fields()[6].schema(),
other.bytesValue);
- fieldSetFlags()[6] = true;
- }
- if (isValidValue(fields()[7], other.nullValue)) {
- this.nullValue = data().deepCopy(fields()[7].schema(),
other.nullValue);
- fieldSetFlags()[7] = true;
- }
- }
-
- /** Gets the value of the 'key' field */
- public java.lang.CharSequence getKey() {
- return key;
- }
-
- /** Sets the value of the 'key' field */
- public org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
setKey(java.lang.CharSequence value) {
- validate(fields()[0], value);
- this.key = value;
- fieldSetFlags()[0] = true;
- return this;
- }
-
- /** Checks whether the 'key' field has been set */
- public boolean hasKey() {
- return fieldSetFlags()[0];
- }
-
- /** Clears the value of the 'key' field */
- public org.apache.pig.builtin.avro.code.java.RecordPojo.Builder clearKey()
{
- key = null;
- fieldSetFlags()[0] = false;
- return this;
- }
-
- /** Gets the value of the 'intValue' field */
- public java.lang.Integer getIntValue() {
- return intValue;
- }
-
- /** Sets the value of the 'intValue' field */
- public org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
setIntValue(int value) {
- validate(fields()[1], value);
- this.intValue = value;
- fieldSetFlags()[1] = true;
- return this;
- }
-
- /** Checks whether the 'intValue' field has been set */
- public boolean hasIntValue() {
- return fieldSetFlags()[1];
- }
-
- /** Clears the value of the 'intValue' field */
- public org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
clearIntValue() {
- fieldSetFlags()[1] = false;
- return this;
- }
-
- /** Gets the value of the 'longValue' field */
- public java.lang.Long getLongValue() {
- return longValue;
- }
-
- /** Sets the value of the 'longValue' field */
- public org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
setLongValue(long value) {
- validate(fields()[2], value);
- this.longValue = value;
- fieldSetFlags()[2] = true;
- return this;
- }
-
- /** Checks whether the 'longValue' field has been set */
- public boolean hasLongValue() {
- return fieldSetFlags()[2];
- }
-
- /** Clears the value of the 'longValue' field */
- public org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
clearLongValue() {
- fieldSetFlags()[2] = false;
- return this;
- }
-
- /** Gets the value of the 'booleanValue' field */
- public java.lang.Boolean getBooleanValue() {
- return booleanValue;
- }
-
- /** Sets the value of the 'booleanValue' field */
- public org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
setBooleanValue(boolean value) {
- validate(fields()[3], value);
- this.booleanValue = value;
- fieldSetFlags()[3] = true;
- return this;
- }
-
- /** Checks whether the 'booleanValue' field has been set */
- public boolean hasBooleanValue() {
- return fieldSetFlags()[3];
- }
-
- /** Clears the value of the 'booleanValue' field */
- public org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
clearBooleanValue() {
- fieldSetFlags()[3] = false;
- return this;
- }
-
- /** Gets the value of the 'floatValue' field */
- public java.lang.Float getFloatValue() {
- return floatValue;
- }
-
- /** Sets the value of the 'floatValue' field */
- public org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
setFloatValue(float value) {
- validate(fields()[4], value);
- this.floatValue = value;
- fieldSetFlags()[4] = true;
- return this;
- }
-
- /** Checks whether the 'floatValue' field has been set */
- public boolean hasFloatValue() {
- return fieldSetFlags()[4];
- }
-
- /** Clears the value of the 'floatValue' field */
- public org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
clearFloatValue() {
- fieldSetFlags()[4] = false;
- return this;
- }
-
- /** Gets the value of the 'doubleValue' field */
- public java.lang.Double getDoubleValue() {
- return doubleValue;
- }
-
- /** Sets the value of the 'doubleValue' field */
- public org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
setDoubleValue(double value) {
- validate(fields()[5], value);
- this.doubleValue = value;
- fieldSetFlags()[5] = true;
- return this;
- }
-
- /** Checks whether the 'doubleValue' field has been set */
- public boolean hasDoubleValue() {
- return fieldSetFlags()[5];
- }
-
- /** Clears the value of the 'doubleValue' field */
- public org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
clearDoubleValue() {
- fieldSetFlags()[5] = false;
- return this;
- }
-
- /** Gets the value of the 'bytesValue' field */
- public java.nio.ByteBuffer getBytesValue() {
- return bytesValue;
- }
-
- /** Sets the value of the 'bytesValue' field */
- public org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
setBytesValue(java.nio.ByteBuffer value) {
- validate(fields()[6], value);
- this.bytesValue = value;
- fieldSetFlags()[6] = true;
- return this;
- }
-
- /** Checks whether the 'bytesValue' field has been set */
- public boolean hasBytesValue() {
- return fieldSetFlags()[6];
- }
-
- /** Clears the value of the 'bytesValue' field */
- public org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
clearBytesValue() {
- bytesValue = null;
- fieldSetFlags()[6] = false;
- return this;
- }
-
- /** Gets the value of the 'nullValue' field */
- public java.lang.Void getNullValue() {
- return nullValue;
- }
-
- /** Sets the value of the 'nullValue' field */
- public org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
setNullValue(java.lang.Void value) {
- validate(fields()[7], value);
- this.nullValue = value;
- fieldSetFlags()[7] = true;
- return this;
- }
-
- /** Checks whether the 'nullValue' field has been set */
- public boolean hasNullValue() {
- return fieldSetFlags()[7];
- }
-
- /** Clears the value of the 'nullValue' field */
- public org.apache.pig.builtin.avro.code.java.RecordPojo.Builder
clearNullValue() {
- nullValue = null;
- fieldSetFlags()[7] = false;
- return this;
- }
-
- @Override
- public RecordPojo build() {
- try {
- RecordPojo record = new RecordPojo();
- record.key = fieldSetFlags()[0] ? this.key : (java.lang.CharSequence)
defaultValue(fields()[0]);
- record.intValue = fieldSetFlags()[1] ? this.intValue :
(java.lang.Integer) defaultValue(fields()[1]);
- record.longValue = fieldSetFlags()[2] ? this.longValue :
(java.lang.Long) defaultValue(fields()[2]);
- record.booleanValue = fieldSetFlags()[3] ? this.booleanValue :
(java.lang.Boolean) defaultValue(fields()[3]);
- record.floatValue = fieldSetFlags()[4] ? this.floatValue :
(java.lang.Float) defaultValue(fields()[4]);
- record.doubleValue = fieldSetFlags()[5] ? this.doubleValue :
(java.lang.Double) defaultValue(fields()[5]);
- record.bytesValue = fieldSetFlags()[6] ? this.bytesValue :
(java.nio.ByteBuffer) defaultValue(fields()[6]);
- record.nullValue = fieldSetFlags()[7] ? this.nullValue :
(java.lang.Void) defaultValue(fields()[7]);
- return record;
- } catch (Exception e) {
- throw new org.apache.avro.AvroRuntimeException(e);
- }
- }
- }
-}