Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
* except in compliance with the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "LICENSE.TXT" file accompanying this file. This file 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 org.apache.hadoop.dynamodb.read;
import static org.apache.hadoop.dynamodb.DynamoDBUtil.createJobClient;
import com.amazonaws.services.dynamodbv2.model.AttributeValue;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.dynamodb.DynamoDBClient;
import org.apache.hadoop.dynamodb.DynamoDBConstants;
import org.apache.hadoop.dynamodb.DynamoDBItemWritable;
import org.apache.hadoop.dynamodb.IopsCalculator;
import org.apache.hadoop.dynamodb.preader.AbstractReadManager;
import org.apache.hadoop.dynamodb.preader.DynamoDBRecordReaderContext;
import org.apache.hadoop.dynamodb.preader.PageResultMultiplexer;
import org.apache.hadoop.dynamodb.preader.QueryReadManager;
import org.apache.hadoop.dynamodb.preader.RateController;
import org.apache.hadoop.dynamodb.preader.ScanReadManager;
import org.apache.hadoop.dynamodb.split.DynamoDBSplit;
import org.apache.hadoop.dynamodb.util.TimeSource;
import org.apache.hadoop.mapred.RecordReader;
import org.apache.hadoop.mapred.Reporter;
import java.io.IOException;
import java.util.Map;
/**
* AbstractDynamoDBRecordReader does all the backend work for splitting up the data in DynamoDB,
* reading it in, and outputting them into key-value pairs for the mapper. To use the
* DynamoDBRecordReader class, you need to subclass this and overwrite the
* convertDynamoDBItemToValue with a conversion from the DynamoDB item to the desired value type. As
* an alternative, you can also use DefaultDynamoDBRecordReader, and do the conversion to a
* DynamoDBItemWritable inside of the reducer.
*
* @param The type of Key that will be passed to the Mapper
* @param The type of Value that will be passed to the Mapper
*/
public abstract class AbstractDynamoDBRecordReader implements RecordReader {
private static final Log log = LogFactory.getLog(AbstractDynamoDBRecordReader.class);
protected final DynamoDBClient client;
protected final String tableName;
protected final DynamoDBSplit split;
protected final long approxTotalItemCount;
protected final Reporter reporter;
private final PageResultMultiplexer