@@ -231,46 +231,57 @@ type DeletableTable interface {
231231
232232### catalog.UpdatableBatchTable
233233
234- Alternative UPDATE interface where the rowid column is embedded in the RecordReader .
234+ Alternative UPDATE interface where the rowid column is embedded in the RecordBatch .
235235This interface is preferred over ` UpdatableTable ` when both are implemented.
236236
237237``` go
238238type UpdatableBatchTable interface {
239239 Table
240240
241- // Update modifies existing rows using data from the RecordReader .
242- // The rows RecordReader contains both the rowid column (identifying rows to update)
241+ // Update modifies existing rows using data from the RecordBatch .
242+ // The rows RecordBatch contains both the rowid column (identifying rows to update)
243243 // and the new column values. Implementations MUST extract rowid values from
244244 // the rowid column (identified by name "rowid" or metadata key "is_rowid").
245245 // Use FindRowIDColumn(rows.Schema()) to locate the rowid column.
246- // Row order in RecordReader determines update order.
246+ // Implementations MUST return ErrNullRowID if any rowid value is null.
247+ // Row order in RecordBatch determines update order.
247248 // opts contains RETURNING clause information.
248249 // Returns DMLResult with affected row count and optional returning data.
249250 // Caller MUST call rows.Release() after Update returns.
250- Update (ctx context.Context , rows array. RecordReader , opts *DMLOptions) (*DMLResult, error )
251+ Update (ctx context.Context , rows arrow. RecordBatch , opts *DMLOptions) (*DMLResult, error )
251252}
252253```
253254
254255### catalog.DeletableBatchTable
255256
256- Alternative DELETE interface where the rowid column is embedded in the RecordReader .
257+ Alternative DELETE interface where the rowid column is embedded in the RecordBatch .
257258This interface is preferred over ` DeletableTable ` when both are implemented.
258259
259260``` go
260261type DeletableBatchTable interface {
261262 Table
262263
263- // Delete removes rows identified by rowid values in the RecordReader .
264- // The rows RecordReader contains the rowid column (identified by name "rowid"
264+ // Delete removes rows identified by rowid values in the RecordBatch .
265+ // The rows RecordBatch contains the rowid column (identified by name "rowid"
265266 // or metadata key "is_rowid") that identifies rows to delete.
266267 // Use FindRowIDColumn(rows.Schema()) to locate the rowid column.
268+ // Implementations MUST return ErrNullRowID if any rowid value is null.
267269 // opts contains RETURNING clause information.
268270 // Returns DMLResult with affected row count and optional returning data.
269271 // Caller MUST call rows.Release() after Delete returns.
270- Delete (ctx context.Context , rows array. RecordReader , opts *DMLOptions) (*DMLResult, error )
272+ Delete (ctx context.Context , rows arrow. RecordBatch , opts *DMLOptions) (*DMLResult, error )
271273}
272274```
273275
276+ ### catalog.ErrNullRowID
277+
278+ Sentinel error for null rowid values:
279+
280+ ``` go
281+ // ErrNullRowID is returned when a null rowid value is encountered in UPDATE or DELETE operations.
282+ var ErrNullRowID = errors.New (" null rowid value not allowed" )
283+ ```
284+
274285### catalog.FindRowIDColumn
275286
276287Helper function to locate the rowid column in a schema:
@@ -288,21 +299,26 @@ func FindRowIDColumn(schema *arrow.Schema) int
288299**Example usage:**
289300
290301```go
291- func (t *MyTable) Update(ctx context.Context, rows array.RecordReader , opts *catalog.DMLOptions) (*catalog.DMLResult, error) {
302+ func (t *MyTable) Update(ctx context.Context, rows arrow.RecordBatch , opts *catalog.DMLOptions) (*catalog.DMLResult, error) {
292303 rowidIdx := catalog.FindRowIDColumn (rows.Schema ())
293304 if rowidIdx == -1 {
294305 return nil , errors.New (" rowid column required" )
295306 }
296307
297- var affected int64
298- for rows.Next () {
299- batch := rows.RecordBatch ()
300- rowidCol := batch.Column (rowidIdx).(*array.Int64 )
301- // Process updates using rowidCol values...
302- affected += batch.NumRows ()
308+ // Check for null rowids
309+ rowidCol := rows.Column (rowidIdx)
310+ if rowidCol.NullN () > 0 {
311+ return nil , catalog.ErrNullRowID
303312 }
304313
305- return &catalog.DMLResult {AffectedRows: affected}, nil
314+ // Direct access to RecordBatch - no iterator needed
315+ rowidArr := rowidCol.(*array.Int64 )
316+ for i := 0 ; i < int (rows.NumRows ()); i++ {
317+ rowID := rowidArr.Value (i)
318+ // Process update for rowID...
319+ }
320+
321+ return &catalog.DMLResult {AffectedRows: rows.NumRows ()}, nil
306322}
307323```
308324
@@ -500,6 +516,9 @@ type DynamicTable interface {
500516
501517 // RenameField renames a field in a struct-typed column.
502518 RenameField (ctx context.Context , columnPath []string , newName string , opts RenameFieldOptions ) error
519+
520+ // RemoveField removes a field from a struct-typed column.
521+ RemoveField (ctx context.Context , columnPath []string , opts RemoveFieldOptions ) error
503522}
504523
505524type AddColumnOptions struct {
@@ -541,6 +560,10 @@ type AddFieldOptions struct {
541560type RenameFieldOptions struct {
542561 IgnoreNotFound bool
543562}
563+
564+ type RemoveFieldOptions struct {
565+ IgnoreNotFound bool // Don't error if table/column doesn't exist
566+ }
544567```
545568
546569## Statistics Interface
0 commit comments