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

com.splout.db.hadoop.TableInput Maven / Gradle / Ivy

Go to download

Splout is a read only, horizontally scalable SQL database that plays well with Hadoop.

There is a newer version: 0.3.0
Show newest version
package com.splout.db.hadoop;

/*
 * #%L
 * Splout SQL Hadoop library
 * %%
 * Copyright (C) 2012 Datasalt Systems S.L.
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.InputFormat;

import com.datasalt.pangool.io.ITuple;
import com.datasalt.pangool.io.Schema;

/**
 * A file (represented by a Hadoop Path) associated with an Pangool's InputFormat. TableFiles are used by {@link Table} instances
 * to represent a mapping between files and Tables.
 */
public class TableInput {

	private final InputFormat format;
	private final Path[] paths;
	private final Schema fileSchema;
	private final RecordProcessor recordProcessor;
	
	public TableInput(InputFormat format, Schema fileSchema, RecordProcessor recordProcessor, Path... paths) {
		if(format == null) {
			throw new IllegalArgumentException("Input format can't be null");
		}
		if(fileSchema == null) {
			throw new IllegalArgumentException("File schema can't be null");
		}
		if(recordProcessor == null) {
			throw new IllegalArgumentException("Record processor can't be null. Use new IdentityRecordProcessor() for using the default one.");
		}
		if(paths == null) {
			throw new IllegalArgumentException("Input paths can't be null");
		}
		this.format = format;
		this.fileSchema = fileSchema;
		this.recordProcessor = recordProcessor;
		this.paths = paths;
	}

	public InputFormat getFormat() {
  	return format;
  }
	public Path[] getPaths() {
  	return paths;
  }
	public Schema getFileSchema() {
  	return fileSchema;
  }
	public RecordProcessor getRecordProcessor() {
  	return recordProcessor;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy