Rows with NAs disappear when filter()ed from database

I can't see where the problem is without a reprex (see the FAQ. A data.table object can be written to disk with SQLLITE() and, if read back in and converted to a data.table object it will be identical to the original object, as shown

library(data.table)
library(RSQLite)
set.seed(42)
(d <- data.table(o = c(NA,1:9)))
#>      o
#>  1: NA
#>  2:  1
#>  3:  2
#>  4:  3
#>  5:  4
#>  6:  5
#>  7:  6
#>  8:  7
#>  9:  8
#> 10:  9
con <- dbConnect(RSQLite::SQLite(), "dat")
dbWriteTable(con, "d", d)
dbListTables(con)
#> [1] "d"
(d2 <- dbGetQuery(con, "SELECT * FROM d"))
#>     o
#> 1  NA
#> 2   1
#> 3   2
#> 4   3
#> 5   4
#> 6   5
#> 7   6
#> 8   7
#> 9   8
#> 10  9
dbDisconnect(con)
con <- dbConnect(RSQLite::SQLite(), "dat")
dbListTables(con)
#> [1] "d"
(d2 <- dbGetQuery(con, "SELECT * FROM d"))
#>     o
#> 1  NA
#> 2   1
#> 3   2
#> 4   3
#> 5   4
#> 6   5
#> 7   6
#> 8   7
#> 9   8
#> 10  9
dbDisconnect(con)
identical(d,d2)
#> [1] FALSE
# because
class(d)
#> [1] "data.table" "data.frame"
class(d2)
#> [1] "data.frame"
# so
d2 <- data.table(d)
identical(d,d2)
#> [1] TRUE

Created on 2023-04-06 with reprex v2.0.2