@@ -79,6 +79,12 @@ int Date::Day() const {
7979 return tm.tm_mday ;
8080}
8181
82+ static void check_generic_row_available (const ffi::GenericRowInner* inner) {
83+ if (!inner) {
84+ throw std::logic_error (" GenericRow: not available (moved-from or null)" );
85+ }
86+ }
87+
8288// ============================================================================
8389// GenericRow — write-only row backed by opaque Rust GenericRowInner
8490// ============================================================================
@@ -100,6 +106,7 @@ void GenericRow::Destroy() noexcept {
100106 rust::Box<ffi::GenericRowInner>::from_raw (inner_);
101107 inner_ = nullptr ;
102108 }
109+ column_map_.reset ();
103110}
104111
105112GenericRow::GenericRow (GenericRow&& other) noexcept
@@ -120,54 +127,68 @@ GenericRow& GenericRow::operator=(GenericRow&& other) noexcept {
120127bool GenericRow::Available () const { return inner_ != nullptr ; }
121128
122129void GenericRow::Reset () {
123- if (inner_) inner_->gr_reset ();
130+ check_generic_row_available (inner_);
131+ inner_->gr_reset ();
124132}
125133
126134void GenericRow::SetNull (size_t idx) {
127- if (inner_) inner_->gr_set_null (idx);
135+ check_generic_row_available (inner_);
136+ inner_->gr_set_null (idx);
128137}
129138void GenericRow::SetBool (size_t idx, bool v) {
130- if (inner_) inner_->gr_set_bool (idx, v);
139+ check_generic_row_available (inner_);
140+ inner_->gr_set_bool (idx, v);
131141}
132142void GenericRow::SetInt32 (size_t idx, int32_t v) {
133- if (inner_) inner_->gr_set_i32 (idx, v);
143+ check_generic_row_available (inner_);
144+ inner_->gr_set_i32 (idx, v);
134145}
135146void GenericRow::SetInt64 (size_t idx, int64_t v) {
136- if (inner_) inner_->gr_set_i64 (idx, v);
147+ check_generic_row_available (inner_);
148+ inner_->gr_set_i64 (idx, v);
137149}
138150void GenericRow::SetFloat32 (size_t idx, float v) {
139- if (inner_) inner_->gr_set_f32 (idx, v);
151+ check_generic_row_available (inner_);
152+ inner_->gr_set_f32 (idx, v);
140153}
141154void GenericRow::SetFloat64 (size_t idx, double v) {
142- if (inner_) inner_->gr_set_f64 (idx, v);
155+ check_generic_row_available (inner_);
156+ inner_->gr_set_f64 (idx, v);
143157}
144158
145159void GenericRow::SetString (size_t idx, std::string v) {
146- if (inner_) inner_->gr_set_str (idx, v);
160+ check_generic_row_available (inner_);
161+ inner_->gr_set_str (idx, v);
147162}
148163
149164void GenericRow::SetBytes (size_t idx, std::vector<uint8_t > v) {
150- if (inner_) inner_->gr_set_bytes (idx, rust::Slice<const uint8_t >(v.data (), v.size ()));
165+ check_generic_row_available (inner_);
166+ inner_->gr_set_bytes (idx, rust::Slice<const uint8_t >(v.data (), v.size ()));
151167}
152168
153169void GenericRow::SetDate (size_t idx, fluss::Date d) {
154- if (inner_) inner_->gr_set_date (idx, d.days_since_epoch );
170+ check_generic_row_available (inner_);
171+ inner_->gr_set_date (idx, d.days_since_epoch );
155172}
156173
157174void GenericRow::SetTime (size_t idx, fluss::Time t) {
158- if (inner_) inner_->gr_set_time (idx, t.millis_since_midnight );
175+ check_generic_row_available (inner_);
176+ inner_->gr_set_time (idx, t.millis_since_midnight );
159177}
160178
161179void GenericRow::SetTimestampNtz (size_t idx, fluss::Timestamp ts) {
162- if (inner_) inner_->gr_set_ts_ntz (idx, ts.epoch_millis , ts.nano_of_millisecond );
180+ check_generic_row_available (inner_);
181+ inner_->gr_set_ts_ntz (idx, ts.epoch_millis , ts.nano_of_millisecond );
163182}
164183
165184void GenericRow::SetTimestampLtz (size_t idx, fluss::Timestamp ts) {
166- if (inner_) inner_->gr_set_ts_ltz (idx, ts.epoch_millis , ts.nano_of_millisecond );
185+ check_generic_row_available (inner_);
186+ inner_->gr_set_ts_ltz (idx, ts.epoch_millis , ts.nano_of_millisecond );
167187}
168188
169189void GenericRow::SetDecimal (size_t idx, const std::string& value) {
170- if (inner_) inner_->gr_set_decimal_str (idx, value);
190+ check_generic_row_available (inner_);
191+ inner_->gr_set_decimal_str (idx, value);
171192}
172193
173194// ============================================================================
0 commit comments