( ctx *sql.Context, conn *stdsql.Conn, tx *stdsql.Tx, table tableIdentifier, appender *DeltaAppender, stats *FlushStats, )
| 264 | } |
| 265 | |
| 266 | func (c *DeltaController) handleInsertOnly( |
| 267 | ctx *sql.Context, |
| 268 | conn *stdsql.Conn, |
| 269 | tx *stdsql.Tx, |
| 270 | table tableIdentifier, |
| 271 | appender *DeltaAppender, |
| 272 | stats *FlushStats, |
| 273 | ) error { |
| 274 | // Ignore the augmented fields |
| 275 | viewName, release, err := c.prepareArrowView(ctx, conn, table, appender, appender.NumAugmentedFields(), nil) |
| 276 | if err != nil { |
| 277 | return err |
| 278 | } |
| 279 | defer release() |
| 280 | |
| 281 | // Perform direct INSERT without deduplication |
| 282 | var b strings.Builder |
| 283 | b.Grow(128) |
| 284 | |
| 285 | b.WriteString("INSERT INTO ") |
| 286 | b.WriteString(catalog.ConnectIdentifiersANSI(table.dbName, table.tableName)) |
| 287 | b.WriteString(" SELECT ") |
| 288 | buildColumnList(&b, appender.BaseSchema()) |
| 289 | b.WriteString(" FROM ") |
| 290 | b.WriteString(viewName) |
| 291 | |
| 292 | sql := b.String() |
| 293 | |
| 294 | result, err := tx.ExecContext(ctx, sql) |
| 295 | if err != nil { |
| 296 | return err |
| 297 | } |
| 298 | |
| 299 | affected, err := result.RowsAffected() |
| 300 | if err != nil { |
| 301 | return err |
| 302 | } |
| 303 | stats.Insertions += affected |
| 304 | stats.DeltaSize += affected |
| 305 | |
| 306 | if log := ctx.GetLogger(); log.Logger.IsLevelEnabled(logrus.DebugLevel) { |
| 307 | log.WithFields(logrus.Fields{ |
| 308 | "db": table.dbName, |
| 309 | "table": table.tableName, |
| 310 | "rows": affected, |
| 311 | }).Debug("Inserted") |
| 312 | } |
| 313 | |
| 314 | return nil |
| 315 | } |
| 316 | |
| 317 | func (c *DeltaController) handleDeleteOnly( |
| 318 | ctx *sql.Context, |
no test coverage detected