influxdata/influxdb · warning

expected datatime column value but got

Error message

expected datatime column value but got: {got_val:?}

What it means

A test assertion panicking when the produced ColumnValue is not ColumnValue::Datetime while the expected value was a timestamp range. In the property tests comparing partition output, a Datetime {begin, end} is required; any other variant (String, Bucket) trips this panic with a debug dump of the actual value.

Solutions

  1. Align the template configuration so the part produces a Datetime range
  2. Match on the actual variant and use expect_bucket()/string assertions as appropriate
  3. Inspect the {got_val:?} debug output in the panic to identify which variant was produced and why

Example fix

// before
match got_val {
    ColumnValue::Datetime{begin, end} => { assert_eq!(want_begin, *begin); }
    _ => panic!("expected datatime column value but got: {got_val:?}")
}
// after
match got_val {
    ColumnValue::Datetime{begin, end} => { assert_eq!(want_begin, *begin); assert_eq!(want_end, *end); }
    other => panic!("unexpected partition value variant {:?}; check template part configuration", other),
}
Defensive patterns

Strategy: type-guard

Validate before calling

if !matches!(got_val, ColumnValue::Datetime{..}) {
    panic!("expected Datetime partition value, got {got_val:?}; check template part config");
}

Type guard

fn is_datetime(v: &ColumnValue) -> bool { matches!(v, ColumnValue::Datetime{..}) }

Prevention

When it happens

Trigger: Calling expect_ts_range() on the expected value but the actual partition output was ColumnValue::String or ColumnValue::Bucket rather than Datetime — e.g. template rendered as string or bucket instead of a datetime range.

Common situations: Test fixtures with templates that don't produce datetime ranges (missing/incorrect time part); asserting against bucketed output with datetime expectations.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/d4e45330c3d17d50. Report an issue: GitHub.

Appendix: source

Thrown at core/partition/src/lib.rs:1657

                            got_val.is_prefix_match_of(want_val),
                            "prefix mismatch; {got_val:?} is not a prefix of {want_val:?}",
                        );
                    },
                    ColumnValue::Prefix(_) => {
                        let want_val = want_val.expect_string();
                        assert!(
                            got_val.is_prefix_match_of(want_val),
                            "prefix mismatch; {got_val:?} is not a prefix of {want_val:?}",
                        );
                    },
                    ColumnValue::Datetime{..} => {
                        let (want_begin, want_end) = want_val.expect_ts_range();
                        match got_val {
                            ColumnValue::Datetime{begin, end} => {
                                assert_eq!(want_begin, *begin);
                                assert_eq!(want_end, *end);
                            }
                            _ => panic!("expected datatime column value but got: {got_val:?}")
                        }
                    },
                    ColumnValue::Bucket{id: got_bucket_id, num_buckets: got_num_buckets} => {
                        let (want_bucket_id, want_num_buckets) = want_val.expect_bucket();
                        assert_eq!(*got_bucket_id, want_bucket_id);
                        assert_eq!(*got_num_buckets, want_num_buckets);
                    }
                };
            }
        }

        /// A property test that asserts the partitioner tolerates (does not
        /// panic) randomised, potentially invalid strftime formatter strings.
        #[test]
        fn prop_arbitrary_strftime_format(fmt in any::<String>()) {
            let mut batch = MutableBatch::new();
            let mut writer = Writer::new(&mut batch, 1);

View on GitHub (pinned to 06200ef96b)