All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nflabs.zeppelin.result.Result Maven / Gradle / Ivy

Go to download

Zengine is java framework for data analysis on Hadoop. see http://nflabs.github.io/zeppelin/#/zengine

There is a newer version: 0.3.3
Show newest version
package com.nflabs.zeppelin.result;

import java.io.IOException;
import java.io.OutputStream;
import java.sql.ResultSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;


public class Result extends AbstractResult{
	public List rows;

	public Result(ResultSet res, int max) throws ResultDataException {
		super(res, max);
	}
	
	public Result(Exception e1) throws ResultDataException {
		super(e1);
	}

	@Override
	protected void process(ColumnDef[] columnDef, Object[] row, long n) {
		if(rows==null) rows = new LinkedList(); 
		rows.add(row);
	}
	
	public List getRows(){
		if(rows==null) rows = new LinkedList(); 
		return rows;
	}
	
	public void write(OutputStream out) throws IOException{
		write(out, "\t", "\n");
	}
	public void write(OutputStream out, String columnSep, String rowSep) throws IOException{
		Iterator it = getRows().iterator();
		while(it.hasNext()){
			Object[] row = it.next();
			
			for(int i=0; i