max_filter_ratio, the system can be configured to persist every filtered row into the system table _statistics_.rejected_records, allowing you to inspect bad data and replay it into the target table without re-running the whole job. This topic shows how to enable the rejected-record capture feature, query the table, and replay rejected rows with SQL.
_statistics_.rejected_records provides information of rejected data from:
- Stream Load, Routine Load, Broker Load, and
INSERT(includingINSERT INTO ... SELECT ... FROM FILES()) - Scanner parse failures (CSV column-count mismatches, type conversions, strict-mode filtering)
- Sink constraint violations (NOT NULL, partition-range misses, VARCHAR length, decimal precision)
- ORC reader row rejections (columnar formats, before the filter is applied)
Enable rejected-record capture
Rejected-record capture is disabled by default so that new clusters do not write to the system table until you explicitly enable it. To enable this feature, follow these steps:-
Enable the rejected record synchronization (into the system table) by setting the BE configuration
enable_rejected_record_synctotrue.-
To change it dynamically, execute the following SQL:
-
To change it permanently, add the following configuration in
be.conf, and restart the BE service:
-
To change it dynamically, execute the following SQL:
-
Set
log_rejected_record_numto a positive number (a cap) or-1(unlimited) for your session or your load job.
_statistics_.rejected_records for further operations.
Query _statistics_.rejected_records
You can first view the table schema of _statistics_.rejected_records by executing the following SQL:
The following examples shows some basic usages of the table:
-
View the rejected rows for a specific load, and lists the most recent record first.
- View the error distribution for a target table over the last 24 hours.
- View all rejected rows for a load job based on a Join query with
information_schema.loads. You must join them on the load label becauseinformation_schema.loadsdoes not exposetxn_id.
Replay rejected rows
Theraw_record column is a JSON string of the rejected row’s column values keyed by name. Use the ->> operator to extract a value as a string and CAST(... AS <type>) to recover the target type.
The following example fixes VARCHAR length violations by truncating, and INSERT the value to the target table.
raw_record carries a single key _raw with the raw line.
The following example shows the first 20 unparsable lines for diagnosis.
Data retention and cleanup
_statistics_.rejected_records is partitioned by day and auto-expires partitions based on the property partition_live_number = 7. You can adjust the retention by changing the FE configuration rejected_records_retained_days (default 7). The table-keeper
daemon reconciles the live table property on its next tick.
The following example deletes the records on a specific target table that are earlier than a specific date:
Permissions
Access to_statistics_.rejected_records is controlled by a built-in row access policy:
- The built-in
rootuser sees every row in the table (the policy applies no filter). - All other users — including those with the
db_admin,cluster_admin,user_admin, andsecurity_adminroles — see only rows whosetarget_database.target_tablethey have theSELECTprivilege. Rows for tables the user has no SELECT privilege on are filtered out of the result set. - If the policy cannot resolve or validate the target for a row, that row is hidden (fail-closed).
SELECT on the relevant target tables to the reporting role.
Limitations
-
Parquet rejected records carry an anchor, not the full row.
Parquet loads record the offending column’s raw value in a single-column
raw_recordfragment plus a source anchor insource_info:raw_recordalone is enough to diagnose what went wrong column by column. For full-row replay a follow-up commit will ship aparquet_read_rows(file, anchors)TVF that rehydrates the full row by re-reading the source file using the anchor. Until that TVF lands, the anchor is still useful for pointing users at the exact row in the original Parquet file (row_in_fileis 0-based) and for validating that the source file has not changed (file_sizeandfile_mtime_msare snapshotted at scan open and should be compared before attempting any manual rehydration). -
information_schema.loads.rejected_record_pathis deprecated. The BE-local tab-delimited rejected-record file it used to point at was removed; the column is kept for upgrade compatibility but is alwaysNULL. Query_statistics_.rejected_recordsdirectly byload_labelortxn_idinstead. -
Second-level delay.
Rejected rows become queryable in the system table within
rejected_record_sync_interval_sec(default 30 s) after the load completes, not immediately.