MapR Database JSON FormatResult

Parses a sequence file generated by the difftables utility for JSON tables and converts the results into a format that makes the results easier to understand.

Required Permissions

The user that runs the FormatResult utility must have the readAce and writeAce permissions on the volumes where the input and output paths are located.

For information about how to set permissions on volumes, see Setting Whole Volume ACEs.

NOTE The mapr user is not treated as a superuser. MapR Database does not allow the mapr user to run this utility unless that user is given the relevant permission or permissions with access-control expressions.

Syntax

mapr formatresult
-indir <input file path>
-outdir <output file path> 
[-mapreduce <true|false> (default: false)]

Parameters

Parameter Description
indir The path to a file or directory of files that contains the output of the mapr difftables utility.
outdir The path to a file or a directory for the output. If the file or directory already exists, the utility fails. When a single sequence file is provided as input, the utility generates a single output file. When a directory of sequence files is provided as input, the utility generates a directory with output files.
mapreduce

A Boolean value that specifies whether or not to use a MapReduce program to perform the copying operation. The default, preferred method is to use a MapReduce program (true).

Example

This example shows the results of the following actions that followed a comparison by difftables of two JSON tables:
  1. Formatting the sequence file for the source JSON table.
  2. Formatting the sequence file for the destination JSON table.
  3. Viewing the content of the first sequence file.
  4. Viewing the content of the second sequence file.
This is the command that was used for maprdb difftables:
mapr difftables -src /src_table -dst /dest_table -outdir 
output/diffs -columns dateRange.endYear
Here is the command that was used for mapr formatresult and the resulting output:
[user@hostname ~]$ mapr formatresult -indir output/diffs/OpsForSrcTable -outdir output/outputForSrcTable5
Header: hostName: maprdemo, Time Zone: Pacific Standard Time, processName: null, processId: null
2015-10-01 14:46:48,887 INFO org.apache.hadoop.io.compress.zlib.ZlibFactory <clinit> pool-1-thread-1: Successfully loaded & initialized native-zlib library
2015-10-01 14:46:48,894 INFO org.apache.hadoop.io.compress.CodecPool getDecompressor pool-1-thread-1: Got brand-new decompressor [.deflate]
2015-10-01 14:46:48,915 INFO org.apache.hadoop.io.compress.CodecPool getDecompressor pool-1-thread-1: Got brand-new decompressor [.deflate]
2015-10-01 14:46:48,915 INFO org.apache.hadoop.io.compress.CodecPool getDecompressor pool-1-thread-1: Got brand-new decompressor [.deflate]
2015-10-01 14:46:48,916 INFO org.apache.hadoop.io.compress.CodecPool getDecompressor pool-1-thread-1: Got brand-new decompressor [.deflate]
Successfully created files in output/outputForSrcTable5
[user@hostname ~]$ mapr formatresult -indir output/diffs/OpsForDstTable -outdir output/outputForDstTable5
Header: hostName: maprdemo, Time Zone: Pacific Standard Time, processName: null, processId: null
2015-10-01 14:47:10,004 INFO org.apache.hadoop.io.compress.zlib.ZlibFactory <clinit> pool-1-thread-1: Successfully loaded & initialized native-zlib library
2015-10-01 14:47:10,012 INFO org.apache.hadoop.io.compress.CodecPool getDecompressor pool-1-thread-1: Got brand-new decompressor [.deflate]
2015-10-01 14:47:10,030 INFO org.apache.hadoop.io.compress.CodecPool getDecompressor pool-1-thread-1: Got brand-new decompressor [.deflate]
2015-10-01 14:47:10,031 INFO org.apache.hadoop.io.compress.CodecPool getDecompressor pool-1-thread-1: Got brand-new decompressor [.deflate]
2015-10-01 14:47:10,031 INFO org.apache.hadoop.io.compress.CodecPool getDecompressor pool-1-thread-1: Got brand-new decompressor [.deflate]
Successfully created files in output/outputForDstTable5
[user@hostname ~]$ hadoop fs -cat output/outputForSrcTable5/opsforsrc_0.diff.txt
"row":{ "_id":"A1A4MDE5OQ==(P80199)", "value":{"_familypath":"","_value":{"_timestamp":[0.0, 1443730581185.0, 1443730581185.0]}}}
[user@hostname ~]$ hadoop fs -cat output/outputForDstTable5/opsfordst_0.diff.txt
"row":{ "_id":"A1A4MDE5OQ==(P80199)", "value":{"_familypath":"","_value":{"_timestamp":[1443708157657.0, 1443708157657.0, 1443708157657.0], "dateRange":{"_timestamp":[1443708157657.0, 1443708157657.0, 0.0], "_value":{"endYear":{"_timestamp":[1443708157657.0, 1443708157657.0, 0.0], "_value":1938.0}}}}}}
[user@hostname ~]$