Water utility IoT readings arrive as strings and sometimes include non-numeric spikes. What should the transform do?
Select an answer to reveal the explanation.
Short Explanation
Sensor strings that say "oops" aren't gallons—you've got to cast to DOUBLE and kick non-numeric spikes out during typing. You'll fake usage if you interpolate those spikes, so reject them. You'll lose precision with INTEGER or FLOAT, so you've got to stick with DOUBLE.
Full Explanation
Water-utility IoT readings that arrive as strings must be cast to DOUBLE (or DECIMAL, per precision policy) during typing, and non-numeric spikes must be rejected or quarantined. Numeric typing enables threshold alerts, demand forecasting, and unit conversions; rejecting garbage strings prevents "ERR" or sensor glitch tokens from poisoning aggregates. That combination is the core silver typing discipline for civic telemetry.
Casting sensor strings to INTEGER and rejecting non-numeric spikes during typing fails by concept: even though rejecting spikes is correct, utility readings often include fractional values, and INTEGER truncates the precision needed for accurate flow and pressure calculations where DOUBLE is required. Casting sensor strings to DOUBLE and interpolating non-numeric spikes during typing fails by concept: it invents plausible flow values where none was measured and hides sensor faults that should be quarantined. Casting sensor strings to FLOAT and rejecting non-numeric spikes during typing fails by concept: even though rejecting spikes is correct, FLOAT loses precision where DOUBLE is required for accurate flow and pressure calculations.
Exam caveat: Cast-and-validate is part of silver curation. Bronze may keep raw strings; silver enforces numeric types and quality gates. Range checks often follow typing for physical plausibility.
Operational check: Feed a batch mixing valid numeric strings and tokens like "N/A", cast to DOUBLE, and confirm valid rows type correctly while non-numeric spikes quarantine. Compare daily volume sums to SCADA extracts. Verify INTEGER-typing, interpolation, or FLOAT-typing paths are not used in the production water telemetry job to preserve DOUBLE precision and proper spike quarantine.
Prefer to study offline? Printable PDF study book + test engine ($7.50, unofficial). These questions stay free here.