Skip to content

R type coercion in performanceTable causes BigQuery rolleback error #801

@eddy-ccc

Description

@eddy-ccc

Overview:
When running the latest development branch of Achilles on BigQuery, the achilles_performance table insert fails because it attempts to insert analysis_id values are of type FLOAT64, whereas the BigQuery table has analysis_id of type INT64, causing BigQuery to reject the insert and trigger a rollback error:

Error in rJava::.jcall(batchedInsert, "Z", "executeBatch") :
java.sql.SQLException: [Simba][JDBC](11680) Cannot use rollback while Connection is in auto-commit mode.

Root Cause:
In R/Achilles.R line 459, the code uses c() to add rows to performanceTable:

performanceTable[nrow(performanceTable) + 1, ] <- c(analysisId, delta, start, endTime)

The c() function coerces all elements to the same type. Since delta, start, and endTime are numeric double, c() converts the integer analysisId to numeric as well, even though it was explicitly cast to integer earlier in the code block.

When DatabaseConnector inserts this data into BigQuery, it sends FLOAT64 parameters, but the achilles_performance.analysis_id column is INT64, causing BigQuery to reject the insert.

Fix:
Change c() to list() on line 459:

performanceTable[nrow(performanceTable) + 1, ] <- list(analysisId, delta, start, endTime)

Using list() preserves each element's original type, keeping analysisId as integer.

Environment:

  • Database: BigQuery
  • DatabaseConnector: v7.0.0
  • Achilles: v1.8 (develop branch, commit 00555c0)
  • JDBC Driver: Simba BigQuery 1.2.21.1025 and 1.3.3.1004

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions