@Override public FuncSpec clone() throws CloneNotSupportedException { String[] args = null; if (ctorArgs != null) { args = new String[ctorArgs.length]; for (int i = 0; i < ctorArgs.length; i++) { // Can use the same strings, they're immutable args[i] = ctorArgs[i]; } } Schema s = null; if (inputArgsSchema != null) s = inputArgsSchema.clone(); return new FuncSpec(className, args, s); }
/** * Make a deep copy of this FieldSchema and return it. * @return clone of the this FieldSchema. * @throws CloneNotSupportedException */ @Override public FieldSchema clone() throws CloneNotSupportedException { // Strings are immutable, so we don't need to copy alias. Schemas // are mutable so we need to make a copy. try { FieldSchema fs = new FieldSchema(alias, (schema == null ? null : schema.clone()), type); fs.canonicalName = CanonicalNamer.getNewName(); return fs; } catch (FrontendException fe) { throw new RuntimeException( "Should never fail to clone a FieldSchema", fe); } }
Schema outputTupleSchema = inputTupleSchema.clone();
Schema outputTupleSchema = inputTupleSchema.clone(); outputTupleSchema.add(new Schema.FieldSchema("i", DataType.LONG));
udfSchema = udfSchema.clone(); } catch (CloneNotSupportedException e) { throw new RuntimeException("Unable to clone Schema: " + udfSchema, e);
Schema outputTupleSchema = inputTupleSchema.clone(); outputTupleSchema.add(new Schema.FieldSchema("i", DataType.LONG));
ouputTupleSchema.add(new Schema.FieldSchema("elem1", inputBagSchema.getField(0).schema.clone(), DataType.TUPLE)); ouputTupleSchema.add(new Schema.FieldSchema("elem2", inputBagSchema.getField(0).schema.clone(), DataType.TUPLE)); return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), ouputTupleSchema,
@Override public Schema outputSchema(Schema input) { try { if (input.getField(0).type != DataType.INTEGER) { throw new RuntimeException("Expected first argument to be an INTEGER"); } if (input.getField(1).type != DataType.BAG) { throw new RuntimeException("Expected second argument to be a BAG"); } Schema tupleSchema = new Schema(); tupleSchema.add(new Schema.FieldSchema("data", input.getField(1).schema.clone(), DataType.BAG)); if (this.appendBagNum) { tupleSchema.add(new Schema.FieldSchema("index", DataType.INTEGER)); } return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), tupleSchema, DataType.BAG)); } catch (Exception e) { throw new RuntimeException(e); } } }
Schema outputTupleSchema = inputTupleSchema.clone(); outputTupleSchema.add(new Schema.FieldSchema("session_id", DataType.CHARARRAY));
outputTupleSchema = inputTupleSchema.clone(); outputTupleSchema.add(new Schema.FieldSchema("count", DataType.INTEGER)); } else { outputTupleSchema = new Schema(); outputTupleSchema.add(new Schema.FieldSchema("tuple_schema", inputTupleSchema.clone(), DataType.TUPLE)); outputTupleSchema.add(new Schema.FieldSchema("count", DataType.INTEGER));