/** * Create a new tuple schema according one list: types of fields, the * default names of fields are f0,f1,f2..., and the tuple is t, the bag name * is b. * * @param dataTypes * @return bag schema * @throws FrontendException */ public static Schema newBagSchema(List<Byte> dataTypes) throws FrontendException { List<String> names = newNames(dataTypes.size()); return newBagSchema(names, dataTypes); }
/** * Create a new tuple schema according one list: types of fields, the * default names of fields are f0,f1,f2..., and the tuple name is t. * * @param dataTypes * @return tuple schema * @throws FrontendException */ public static Schema newTupleSchema(List<Byte> dataTypes) throws FrontendException { List<String> names = newNames(dataTypes.size()); return newTupleSchema("t", names, dataTypes); }
/** * Create a bag schema according two list: name of fields, type of fields, * and the default bag name is b, the default tuple name is t. * * @param names * @param dataTypes * @return bag schema * @throws FrontendException */ public static Schema newBagSchema(List<String> names, List<Byte> dataTypes) throws FrontendException { checkParameters(names, dataTypes); Schema tupleSchema = newTupleSchema(names, dataTypes); Schema.FieldSchema bagField = new Schema.FieldSchema("b", tupleSchema, DataType.BAG); return new Schema(bagField); }
/** * Create a new tuple schema according the two list: names of fields, types * of fields, the default tuple name is t. * * @param fieldNames * @param dataTypes * @return tuple schema * @throws FrontendException */ public static Schema newTupleSchema(List<String> fieldNames, List<Byte> dataTypes) throws FrontendException { return newTupleSchema("t", fieldNames, dataTypes); }
/** * Create a new tuple schema according one array: the type of fields, the * tuple name is t, and the bag name is b. * * @param dataTypes * @return bag schema * @throws FrontendException */ public static Schema newBagSchema(Byte[] dataTypes) throws FrontendException { return newBagSchema(Arrays.asList(dataTypes)); }
private static void checkParameters(List<String> names, List<Byte> dataTypes) throws FrontendException { checkDataTypes(dataTypes); if (names.size() != dataTypes.size()) { throw new FrontendException( "The number of names (" + names.size() + ") is not equal to the number of dataTypes (" + dataTypes.size() + ")"); } }
/** * Create a new tuple schema according the tuple name and two list: names of * fields, types of fields * * @param tupleName * @param fieldNames * @param dataTypes * @return tuple schema * @throws FrontendException */ public static Schema newTupleSchema(String tupleName, List<String> fieldNames, List<Byte> dataTypes) throws FrontendException { checkParameters(fieldNames, dataTypes); List<Schema.FieldSchema> tokenSchemas = new ArrayList<Schema.FieldSchema>(); for (int i = 0; i < fieldNames.size(); ++i) { String name = fieldNames.get(i); Byte type = dataTypes.get(i); tokenSchemas.add(new Schema.FieldSchema(name, type)); } Schema tupleSchema = new Schema(tokenSchemas); Schema.FieldSchema tupleField = new Schema.FieldSchema(tupleName, tupleSchema); return new Schema(tupleField); }
/** * Create a bag schema according the bag name,tuple name and two list: name * of fields, type of fields * * @param bagName * @param tupleName * @param fieldNames * @param dataTypes * @return bag schema * @throws FrontendException */ public static Schema newBagSchema(String bagName, String tupleName, List<String> fieldNames, List<Byte> dataTypes) throws FrontendException { checkParameters(fieldNames, dataTypes); Schema tupleSchema = newTupleSchema(tupleName, fieldNames, dataTypes); Schema.FieldSchema bagField = new Schema.FieldSchema(bagName, tupleSchema, DataType.BAG); return new Schema(bagField); }
/** * Create a new tuple schema according one array: types of fields, the * default names of fields are f0,f1,f2..., and the tuple name is t. * * @param dataTypes * @return tuple schema * @throws FrontendException */ public static Schema newTupleSchema(Byte[] dataTypes) throws FrontendException { return newTupleSchema(Arrays.asList(dataTypes)); }
public static Schema newBagSchema(String bagName, String tupleName, String[] fieldNames, Byte[] dataTypes) throws FrontendException { return newBagSchema(bagName, tupleName, Arrays.asList(fieldNames), Arrays.asList(dataTypes)); }
/** * Create a new tuple schema according the two arrays: names of fields, * types of fields, the default tuple name is t. * * @param names * @param dataTypes * @return tuple schema * @throws FrontendException */ public static Schema newTupleSchema(String[] names, Byte[] dataTypes) throws FrontendException { return newTupleSchema("t", Arrays.asList(names), Arrays .asList(dataTypes)); }
/** * Create a new tuple schema according two arrays: names of field,types of * fields. The default tuple name is t, and the bag is b. * * @param names * @param dataTypes * @return bag schema * @throws FrontendException */ public static Schema newBagSchema(String[] names, Byte[] dataTypes) throws FrontendException { return newBagSchema(Arrays.asList(names), Arrays.asList(dataTypes)); }
/** * Create a new tuple schema according the tuple name and two arrays: names * of fields, types of fields * * @param tupleName * @param fieldNames * @param dataTypes * @return tuple schema * @throws FrontendException */ public static Schema newTupleSchema(String tupleName, String[] fieldNames, Byte[] dataTypes) throws FrontendException { return newTupleSchema(tupleName, Arrays.asList(fieldNames), Arrays .asList(dataTypes)); }