Reading data from a source file
Suppose that detailed stock transaction data for a day is contained in a file named
TradesAndQuotes.csv.gz and can be represented by the
BigDataType
tuple type. You can use the FileSource operator
to read data from the file and generates tuples for that data.
The TradesAndQuotes.csv.gz input file can be found in the Teracloud® Streams product installation under the product-installation-root-directory/7.2.0.0/samples/spl/application/Vwap/data directory.
Similar to the previous application example, you can use the FileSource
operator to read data from a file and generate tuples for that data. As shown in the diagram
below, there is no input stream for the FileSource operator; the output stream
is transactions of BigDataType
type.

The SPL code for the FileSource operator is shown. Because the FileSource operator does not ingest an input stream, you do not specify a value in the parentheses that follow the operator name.
stream<BigDataType> BigDataStream = FileSource() {
param
file : "TradesAndQuotes.csv.gz";
format : csv;
compression : gzip;
}
For more information about the FileSource operator, see the example in Reading data from a source file. In this example, you specified the
compression parameter because the source file is in the
gzip
compressed form. This FileSource operator generates
tuples of BigDataType
type to the BigDataStream
output
stream.