shlogg · Early preview
Judy @esproc_spl

Handling NULL Values In PostgreSQL With SPL: Efficient Data Processing

Handle records with NULL column3 values: delete until first non-NULL appears, then modify each NULL value to its previous one. Repeat for new non-NULL values.

The following PostgreSQL database table is ordered by date field and company field. Some values of column3 are NULL.

Task: Handle records of same company in time order according to the specified rule: First, in each group, delete records until the first non-NULL column3 value appears; then modify each NULL column3 value to its directly previous column3 value until the next non-NULL column3 value appears. Repeat the modification until a new non-NULL column3 value appears, and so on.

Write the following SPL code:

A1: Query the database via JDBC and sort rows by company field and date field.
A...