throws ColumnNotFoundException,
IOException,
UnsupportedTupleTypeException,
UndefinedTupleTypeException
{
TupleMetadata metadata;
if (type == null || type == AnySType.INSTANCE)
{
metadata = constructMetadataFromValue(literals);
}
else
{
metadata = constructMetadataFromType(type);
}
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
TupleOutputStream output = new TupleOutputStream(bytes);
output.writeMetadata(metadata);
for (int i=1; i<literals.size()-1; i++)
{
Map<String, Object> map = (Map<String, Object>) literals.get(i);
List<Object> elements = new ArrayList<Object>(map.size());
for (int c=0; c<metadata.getColumnCount(); c++)
{
Object value = map.get(metadata.getColumnMetadata(c).getName());
if (value == null)
{
value = Null.VALUE;
}
elements.add(value);