001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019 package org.apache.hadoop.mapred.join; 020 021 import org.apache.hadoop.classification.InterfaceAudience; 022 import org.apache.hadoop.classification.InterfaceStability; 023 import org.apache.hadoop.io.Writable; 024 025 /** 026 * Writable type storing multiple {@link org.apache.hadoop.io.Writable}s. 027 * 028 * This is *not* a general-purpose tuple type. In almost all cases, users are 029 * encouraged to implement their own serializable types, which can perform 030 * better validation and provide more efficient encodings than this class is 031 * capable. TupleWritable relies on the join framework for type safety and 032 * assumes its instances will rarely be persisted, assumptions not only 033 * incompatible with, but contrary to the general case. 034 * 035 * @see org.apache.hadoop.io.Writable 036 * 037 * @deprecated Use 038 * {@link org.apache.hadoop.mapreduce.lib.join.TupleWritable} instead 039 */ 040 @Deprecated 041 @InterfaceAudience.Public 042 @InterfaceStability.Stable 043 public class TupleWritable 044 extends org.apache.hadoop.mapreduce.lib.join.TupleWritable { 045 046 /** 047 * Create an empty tuple with no allocated storage for writables. 048 */ 049 public TupleWritable() { 050 super(); 051 } 052 053 /** 054 * Initialize tuple with storage; unknown whether any of them contain 055 * "written" values. 056 */ 057 public TupleWritable(Writable[] vals) { 058 super(vals); 059 } 060 061 /** 062 * Record that the tuple contains an element at the position provided. 063 */ 064 void setWritten(int i) { 065 written.set(i); 066 } 067 068 /** 069 * Record that the tuple does not contain an element at the position 070 * provided. 071 */ 072 void clearWritten(int i) { 073 written.clear(i); 074 } 075 076 /** 077 * Clear any record of which writables have been written to, without 078 * releasing storage. 079 */ 080 void clearWritten() { 081 written.clear(); 082 } 083 084 085 }