public static ITypeTraits[] variablesToTypeTraits(List<LogicalVariable> varLogical, int start, int size, IVariableTypeEnvironment env, JobGenContext context) throws AlgebricksException { ITypeTraits[] typeTraits = new ITypeTraits[size]; ITypeTraitProvider typeTraitProvider = context.getTypeTraitProvider(); for (int i = 0; i < size; i++) { Object type = env.getVarType(varLogical.get(start + i)); typeTraits[i] = typeTraitProvider.getTypeTrait(type); } return typeTraits; }
public static ITypeTraits[] variablesToTypeTraits(Collection<LogicalVariable> varLogical, IVariableTypeEnvironment env, JobGenContext context) throws AlgebricksException { ITypeTraits[] typeTraits = new ITypeTraits[varLogical.size()]; ITypeTraitProvider typeTraitProvider = context.getTypeTraitProvider(); int i = 0; for (LogicalVariable v : varLogical) { Object type = env.getVarType(v); typeTraits[i++] = typeTraitProvider.getTypeTrait(type); } return typeTraits; }
@SuppressWarnings("rawtypes") public static RecordDescriptor mkRecordDescriptor(IVariableTypeEnvironment env, IOperatorSchema opSchema, JobGenContext context) throws AlgebricksException { ISerializerDeserializer[] fields = new ISerializerDeserializer[opSchema.getSize()]; ITypeTraits[] typeTraits = new ITypeTraits[opSchema.getSize()]; ISerializerDeserializerProvider sdp = context.getSerializerDeserializerProvider(); ITypeTraitProvider ttp = context.getTypeTraitProvider(); int i = 0; for (LogicalVariable var : opSchema) { Object t = env.getVarType(var); if (t == null) { LOGGER.warn("No type for variable " + var); } fields[i] = sdp.getSerializerDeserializer(t); typeTraits[i] = ttp.getTypeTrait(t); i++; } return new RecordDescriptor(fields, typeTraits); }