/**
* Grabs the next result and process the DynamicTableEntity into a Hive
* friendly MapWriteable
*
* @param key
* The RowID for the entity. Not that this is not really an Azure
* key, since the partition is implicit in the key
* @param value
* A MapWriteable which will be populated with values from the
* DynamicTableEntity returned by the Azure query.
*/
public boolean next(Text key, MapWritable value) throws IOException {
if (!results.hasNext())
return false;
DynamicTableEntity entity = results.next();
key.set(entity.getRowKey());
for (Entry<String, EntityProperty> entry : entity.getProperties()
.entrySet()) {
final EntityProperty property = entry.getValue();
// Note that azure table entity keys are forced to lower case for
// matching with hive column names
final String propertyKey = entry.getKey().toLowerCase();
final String propertyValue = property.getValueAsString();
final Writable writableValue = SERIALIZED_NULL
.equals(propertyValue) ? NullWritable.get() : new Text(
propertyValue);
value.put(new Text(propertyKey), writableValue);
}
pos++;
return true;
}
AzureTablesRecordReader.java 文件源码
java
阅读 19
收藏 0
点赞 0
评论 0
项目:hive-azuretables
作者:
评论列表
文章目录