Search in sources :

Example 1 with FrontendException

use of org.apache.pig.impl.logicalLayer.FrontendException in project sketches-pig by DataSketches.

the class SketchToEstimateAndErrorBounds method outputSchema.

/**
 * The output is a Sketch Result Tuple Schema.
 */
@Override
public Schema outputSchema(final Schema input) {
    if (input == null) {
        return null;
    }
    try {
        final Schema tupleSchema = new Schema();
        tupleSchema.add(new Schema.FieldSchema("Estimate", DataType.DOUBLE));
        tupleSchema.add(new Schema.FieldSchema("LowerBound", DataType.DOUBLE));
        tupleSchema.add(new Schema.FieldSchema("UpperBound", DataType.DOUBLE));
        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), tupleSchema, DataType.TUPLE));
    } catch (final FrontendException e) {
        throw new RuntimeException(e);
    }
}
Also used : Schema(org.apache.pig.impl.logicalLayer.schema.Schema) FrontendException(org.apache.pig.impl.logicalLayer.FrontendException)

Example 2 with FrontendException

use of org.apache.pig.impl.logicalLayer.FrontendException in project sketches-pig by DataSketches.

the class DataToDoublesSketch method outputSchema.

@Override
public Schema outputSchema(final Schema input) {
    if (input == null) {
        return null;
    }
    try {
        final Schema tupleSchema = new Schema();
        tupleSchema.add(new Schema.FieldSchema("Sketch", DataType.BYTEARRAY));
        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), tupleSchema, DataType.TUPLE));
    } catch (final FrontendException e) {
        throw new RuntimeException(e);
    }
}
Also used : Schema(org.apache.pig.impl.logicalLayer.schema.Schema) FrontendException(org.apache.pig.impl.logicalLayer.FrontendException)

Example 3 with FrontendException

use of org.apache.pig.impl.logicalLayer.FrontendException in project sketches-pig by DataSketches.

the class MurmurHash3 method outputSchema.

/**
 * The output consists of two longs, or 128 bits, plus the result of the modulo division if
 * specified.
 */
@Override
public Schema outputSchema(final Schema input) {
    if (input != null) {
        try {
            final Schema tupleSchema = new Schema();
            tupleSchema.add(new Schema.FieldSchema("Hash0", DataType.LONG));
            tupleSchema.add(new Schema.FieldSchema("Hash1", DataType.LONG));
            tupleSchema.add(new Schema.FieldSchema("ModuloResult", DataType.INTEGER));
            return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), tupleSchema, DataType.TUPLE));
        } catch (final FrontendException e) {
        // fall through
        }
    }
    return null;
}
Also used : Schema(org.apache.pig.impl.logicalLayer.schema.Schema) FrontendException(org.apache.pig.impl.logicalLayer.FrontendException)

Example 4 with FrontendException

use of org.apache.pig.impl.logicalLayer.FrontendException in project sketches-pig by DataSketches.

the class AexcludeB method outputSchema.

@Override
public Schema outputSchema(final Schema input) {
    if (input != null) {
        try {
            final Schema tupleSchema = new Schema();
            tupleSchema.add(new Schema.FieldSchema("Sketch", DataType.BYTEARRAY));
            return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), tupleSchema, DataType.TUPLE));
        } catch (final FrontendException e) {
        // fall through
        }
    }
    return null;
}
Also used : Schema(org.apache.pig.impl.logicalLayer.schema.Schema) FrontendException(org.apache.pig.impl.logicalLayer.FrontendException)

Example 5 with FrontendException

use of org.apache.pig.impl.logicalLayer.FrontendException in project sketches-pig by DataSketches.

the class Intersect method outputSchema.

@Override
public Schema outputSchema(final Schema input) {
    if (input != null) {
        try {
            final Schema tupleSchema = new Schema();
            tupleSchema.add(new Schema.FieldSchema("Sketch", DataType.BYTEARRAY));
            return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), tupleSchema, DataType.TUPLE));
        } catch (final FrontendException e) {
        // fall through
        }
    }
    return null;
}
Also used : Schema(org.apache.pig.impl.logicalLayer.schema.Schema) FrontendException(org.apache.pig.impl.logicalLayer.FrontendException)

Aggregations

FrontendException (org.apache.pig.impl.logicalLayer.FrontendException)36 Schema (org.apache.pig.impl.logicalLayer.schema.Schema)27 FieldSchema (org.apache.pig.impl.logicalLayer.schema.Schema.FieldSchema)11 ArrayList (java.util.ArrayList)6 HCatFieldSchema (org.apache.hive.hcatalog.data.schema.HCatFieldSchema)5 HCatSchema (org.apache.hive.hcatalog.data.schema.HCatSchema)5 ResourceSchema (org.apache.pig.ResourceSchema)4 IOException (java.io.IOException)3 OriginalType (org.apache.parquet.schema.OriginalType)3 PigServer (org.apache.pig.PigServer)3 DataType (org.apache.pig.data.DataType)3 Tuple (org.apache.pig.data.Tuple)3 File (java.io.File)2 List (java.util.List)2 HCatException (org.apache.hive.hcatalog.common.HCatException)2 PigSchemaConverter.parsePigSchema (org.apache.parquet.pig.PigSchemaConverter.parsePigSchema)2 GroupType (org.apache.parquet.schema.GroupType)2 MessageType (org.apache.parquet.schema.MessageType)2 PrimitiveType (org.apache.parquet.schema.PrimitiveType)2 Type (org.apache.parquet.schema.Type)2