/** * 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: 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)); }
/** * 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 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)); }
/** * 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 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); }