BigRQuery在导入时删除数据
我有一个大型数据库,其中有几个表正试图导入和连接:BigRQuery在导入时删除数据,r,bigrquery,R,Bigrquery,我有一个大型数据库,其中有几个表正试图导入和连接: con <- DBI::dbConnect( bigrquery::bigquery(), project = "project", dataset = "dataset" ) table1 <- dplyr::tbl(con, "table1") table2 <- dplyr::tbl(con, "table2") df <
con <- DBI::dbConnect(
bigrquery::bigquery(),
project = "project",
dataset = "dataset"
)
table1 <- dplyr::tbl(con, "table1")
table2 <- dplyr::tbl(con, "table2")
df <- puf %>% dplyr::filter(code == "48140") %>% dplyr::left_join(., table2, by = c("id", "year")) %>% dplyr::collect()
它返回相同数量的行(20515),但min(id)
是28309
。所以我知道数据正在改变。我知道数据集中没有7656条相同的记录
id year sex race ethnicity codex code hourwks inout train age yr syr nextyr colorof goingto boolean1 boolean2 int1 int2 height weight boolean3 boolean4
<int> <dbl> <lgl> <int> <lgl> <chr> <chr> <dbl> <lgl> <int> <int> <date> <date> <date> <lgl> <int> <int> <int> <int> <int> <int> <int> <lgl> <lgl>
1 0 0 FALSE 0 FALSE "" "" 0 FALSE 0 0 1970-01-01 1970-01-01 1970-01-01 FALSE 0 0 0 0 0 0 0 FALSE FALSE
2 0 0 FALSE 0 FALSE "" "" 0 FALSE 0 0 1970-01-01 1970-01-01 1970-01-01 FALSE 0 0 0 0 0 0 0 FALSE FALSE
3 0 0 FALSE 0 FALSE "" "" 0 FALSE 0 0 1970-01-01 1970-01-01 1970-01-01 FALSE 0 0 0 0 0 0 0 FALSE FALSE
4 0 0 FALSE 0 FALSE "" "" 0 FALSE 0 0 1970-01-01 1970-01-01 1970-01-01 FALSE 0 0 0 0 0 0 0 FALSE FALSE
5 0 0 FALSE 0 FALSE "" "" 0 FALSE 0 0 1970-01-01 1970-01-01 1970-01-01 FALSE 0 0 0 0 0 0 0 FALSE FALSE
6 0 0 FALSE 0 FALSE "" "" 0 FALSE 0 0 1970-01-01 1970-01-01 1970-01-01 FALSE 0 0 0 0 0 0 0 FALSE FALSE
7 0 0 FALSE 0 FALSE "" "" 0 FALSE 0 0 1970-01-01 1970-01-01 1970-01-01 FALSE 0 0 0 0 0 0 0 FALSE FALSE
8 0 0 FALSE 0 FALSE "" "" 0 FALSE 0 0 1970-01-01 1970-01-01 1970-01-01 FALSE 0 0 0 0 0 0 0 FALSE FALSE
9 0 0 FALSE 0 FALSE "" "" 0 FALSE 0 0 1970-01-01 1970-01-01 1970-01-01 FALSE 0 0 0 0 0 0 0 FALSE FALSE
10 0 0 FALSE 0 FALSE "" "" 0 FALSE 0 0 1970-01-01 1970-01-01 1970-01-01 FALSE 0 0 0 0 0 0 0 FALSE FALSE
SELECT min(id),
FROM table1
LEFT JOIN table2 using (id, year)
WHERE code in ("48140")