The sastrace option enabled in the first line is critical for debugging Bulkload operations because it allows you to see the exact temporary files being created on HDFS and the specific HiveQL 'LOAD DATA' commands generated by SAS, which are otherwise hidden from the standard log.
Attention : This code requires administrator privileges.
The data source is the `sashelp.cars` table, which is an internal SAS example table. The destination is an external Hadoop database, connected via a `libname`. The script does not read external data; it writes to it.
1 Code Block
LIBNAME
Explanation : Defines a connection to a Hadoop server via the SAS/ACCESS to Hadoop interface. It also enables tracing options (`sastrace`) to record detailed information about the interaction with the database in the SAS log.
Explanation : This block loads data from the `sashelp.cars` table into a new `cars` table on the Hadoop server. The `bulkload=yes` option activates bulk loading mode, optimized for large volume data transfers. The table is then dropped with `PROC SQL` to clean up the environment.
Explanation : This block performs the same load as the previous one but without the `bulkload=yes` option. This allows comparison of the performance difference between a standard load (potentially row-by-row) and a bulk load. The table is then dropped.
Explanation : This block loads the data again, but uses the `dbcreate_table_opts` option to pass a specific instruction to Hadoop when creating the table. Here, it requests that the table be stored in 'Parquet' file format, a highly performant columnar storage format. The table is finally dropped.
Copied!
proc append base=mycdh.cars (dbcreate_table_opts='stored as parquetfile')
data=sashelp.cars;
run;
proc sql;
drop table mycdh.cars;
quit;
1
PROC APPEND base=mycdh.cars (dbcreate_table_opts='stored as parquetfile')
2
DATA=sashelp.cars;
3
RUN;
4
5
PROC SQL;
6
drop TABLE mycdh.cars;
7
QUIT;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Notice: Undefined variable: stmtFrFallback in /var/www/app/detail_sascode.php on line 1428
Fatal error: Uncaught Error: Call to a member function execute() on null in /var/www/app/detail_sascode.php:1428
Stack trace:
#0 {main}
thrown in /var/www/app/detail_sascode.php on line 1428