Before you start
Prepare file access and a client connection using Read and write files. Prepare two columns namedorder_id and amount, with data rows (1, 12.5) and (2, 7.5). Put an actual tab between fields in each record.
Read data with headers
Enable headers explicitly. The default isfalse. With header 'true', the first record supplies column names and is excluded from the data.
(1, 12.5) and (2, 7.5). The header must match the explicit schema in both names and order. Omit the column list and set inferSchema 'true' to infer types from a bounded sample instead.
Read data without headers
Supply column names and types, and leave headers disabled:Write data
Use the shared guide’sspark connection and a private mounted output directory.
header is enabled. Use mode("append") to add rows with the same schema and compatible parsing settings.
Options
Use the shared file options for folder filtering and storage access. No delimiter option is needed for normal TSV input.
Data types and limits
An explicit schema converts text fields to the selected types. Without a schema or type inference, discovered columns are strings. Keep header names, order, and field types consistent across a folder. Quoted newlines are supported directly.multiLine is not a TSV option. Row updates, deletes, and merges are not supported by the file sink. Use a table connector when rows need those changes.