/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. */ package com.aliyun.odps.local.common; import java.io.File; import com.aliyun.odps.Column; import com.aliyun.odps.OdpsType; public class FileSplit { public static final FileSplit NullSplit = new FileSplit(null, new Column[]{new Column("nil", OdpsType.STRING)}, 0, 0); private File file; private Column[] schema; private long start; private long length; FileSplit() { } /** * Constructs a split with host information * * @param file * the file name * @param start * the position of the first byte in the file to process * @param length * the number of bytes in the file to process */ public FileSplit(File file, Column[] schema, long start, long length) { this.file = file; this.schema = schema; this.start = start; this.length = length; } /** * The file containing this split's data. */ public File getFile() { return file; } public Column[] getSchema() { return schema; } /** * The position of the first byte in the file to process. */ public long getStart() { return start; } /** * The number of bytes in the file to process. */ public long getLength() { return length; } public String toString() { return file + ":" + start + "+" + length; } }