@@ -34,39 +34,26 @@ pub struct DatasetTable {
3434 pub name : String ,
3535 /// The Arrow schema for the table (without the time column).
3636 pub schema : SchemaRef ,
37- /// The time column for the table, if any .
37+ /// The time column for the table.
3838 ///
39- /// When set, this column is *not* included in [`schema`] — it is appended
39+ /// This column is *not* included in [`schema`] — it is appended
4040 /// during rehydration via [`DatasetTable::rehydrate`].
41- pub time_column : Option < String > ,
41+ pub time_column : String ,
4242}
4343
4444impl DatasetTable {
45- /// Returns the full schema including the time column, if one is configured.
46- ///
47- /// If `time_column` is `None`, this returns the same schema as [`schema`].
45+ /// Returns the full schema including the time column.
4846 pub fn rehydrated_schema ( & self ) -> SchemaRef {
49- let Some ( ref time_col) = self . time_column else {
50- return Arc :: clone ( & self . schema ) ;
51- } ;
52-
5347 let ts_type = DataType :: Timestamp ( TimeUnit :: Microsecond , Some ( "UTC" . into ( ) ) ) ;
5448 let mut fields: Vec < _ > = self . schema . fields ( ) . iter ( ) . cloned ( ) . collect ( ) ;
55- fields. push ( Arc :: new ( Field :: new ( time_col , ts_type, true ) ) ) ;
49+ fields. push ( Arc :: new ( Field :: new ( & self . time_column , ts_type, true ) ) ) ;
5650 Arc :: new ( arrow:: datatypes:: Schema :: new ( fields) )
5751 }
5852
5953 /// Rehydrate a batch by appending the time column with the current timestamp.
6054 ///
61- /// If this table has no `time_column`, the batch is returned unchanged.
6255 /// The batch schema must match [`schema`] (i.e. without the time column).
6356 pub fn rehydrate ( & self , batch : & RecordBatch ) -> anyhow:: Result < RecordBatch > {
64- if self . time_column . is_none ( ) {
65- anyhow:: bail!(
66- "Cannot rehydrate table '{}' without a time column" ,
67- self . name
68- ) ;
69- }
7057
7158 if batch. schema ( ) != self . schema {
7259 let mut diffs = Vec :: new ( ) ;
@@ -284,8 +271,7 @@ pub trait Dataset: Send + Sync {
284271 /// Rehydrate a batch for the given table by appending the time column.
285272 ///
286273 /// Uses the table metadata from [`tables()`] to look up the time column name
287- /// and delegates to [`DatasetTable::rehydrate`]. If the table has no time column,
288- /// a rehydration error is returned.
274+ /// and delegates to [`DatasetTable::rehydrate`].
289275 fn rehydrate ( & self , table : & str , batch : & RecordBatch ) -> anyhow:: Result < RecordBatch > {
290276 let tables = self . tables ( ) ;
291277 let dataset_table = tables
0 commit comments