Export_Binary Command

The export_binary command exports the results of an SQL query to one or more binary files.

This command is currently limited to writing binary files only in parquet format; other formats will be supported in a future release.


EXPORT_BINARY ( exportPath,
                format )  <SQL_QUERY>;


The directory in which you want the export file(s) written.


A Boolean value that specifies whether (true) or not (false) to compress the exported files. Files are compressed using the Snappy compression standard.


The format in which to write the exported file(s). The only format supported at this time is parquet.


The EXPORT_BINARY command generates one or more binary files and stores them in the directory that you specify in the exportPath parameter. More than one output file can be generated to enhance the parallelism and performance of this operation.

If compression=true, then each of the generated files is named with this format:


If compression=false, then each of the generated files is named with this format:


The value of <N> is a sequence of numbers and letters.

Merging the Exported Files

You can copy all of the exported files into a single file on your local file system using the Hadoop FS command getmerge. The syntax for getmerge is:

hadoop fs -getmerge sourceDir localPath

Use the exportPath directory as the value of sourceDir to copy all of the exported files to your localPath.

For more information about the getmerge command, see http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/FileSystemShell.html#getmerge.


 splice> EXPORT_BINARY('/my/export/dir', true, 'parquet')
          SELECT a,b,sqrt(c) FROM t1 WHERE a > 100;

See Also