Examples

The following example writes output to a Hadoop filesystem deployed on IBM Cloud (IBM Analytics Engine).


 stream<rstring fileName, uint64 size> HdfsSink = HDFS2FileSink(Input) {
      param
         file          : "/user/clsadmin/myfile.txt";
         hdfsUri       : "webhdfs://server_host_name:port";
         hdfsUser      : "clsadmin";
         hdfsPassword  : "IAEPassword";
 }

The following example writes tuples to output files that have names like output0.txt. SSL certificate validation is enabled.


 stream<PersonSchema> In = FileSource() {
     param
         file: "Input.txt"; 
 }

 stream<rstring PersonSchemString> SingleStringIn = Functor(In) {
    output
        SingleStringIn : PersonSchemString = (rstring) In ;
 }

 () as txtSink = HDFS2FileSink(SingleStringIn) {
      param
         file             : "output%FILENUM.txt";
         bytesPerFile     : (int64)(16*1024);
         hdfsUri          : "webhdfs://server_host_name:port";
         hdfsUser         : "clsadmin";
         hdfsPassword     : "IAEPassword";
         keyStorePassword : "storepass";
         keyStorePath     : "etc/store.jks";
 }