library(sergeant)

ds <- src_drill("drill.local")

db2 <- tbl(ds, "dfs.tmp.`/in/c.parquet`")
glimpse(db2)
## Observations: NA
## Variables: 7
## $ fqn      <chr> "/tmp/in/c.parquet/0_0_0.parquet", "/tmp/in/c.parquet...
## $ filename <chr> "0_0_0.parquet", "0_0_0.parquet", "0_0_0.parquet", "0...
## $ filepath <chr> "/tmp/in/c.parquet", "/tmp/in/c.parquet", "/tmp/in/c....
## $ car      <chr> "Mazda RX4", "Mazda RX4 Wag", "Datsun 710", "Hornet 4...
## $ mpg      <dbl> 21.0, 21.0, 22.8, 21.4, 18.7, 18.1, 14.3, 24.4, 22.8,...
## $ cyl      <int> 6, 6, 4, 6, 8, 6, 8, 4, 4, 6, 6, 8, 8, 8, 8, 8, 8, 4,...
## $ suffix   <chr> "parquet", "parquet", "parquet", "parquet", "parquet"...
db3 <- tbl(ds, "dfs.tmp.`/in/b.json`")
glimpse(db3)
## Observations: NA
## Variables: 7
## $ fqn      <chr> "/tmp/in/b.json", "/tmp/in/b.json", "/tmp/in/b.json",...
## $ filename <chr> "b.json", "b.json", "b.json", "b.json", "b.json", "b....
## $ filepath <chr> "/tmp/in", "/tmp/in", "/tmp/in", "/tmp/in", "/tmp/in"...
## $ car      <chr> "Mazda RX4", "Mazda RX4 Wag", "Datsun 710", "Hornet 4...
## $ suffix   <chr> "json", "json", "json", "json", "json", "json", "json...
## $ disp     <dbl> 160.0, 160.0, 108.0, 258.0, 360.0, 225.0, 360.0, 146....
## $ wt       <dbl> 2.620, 2.875, 2.320, 3.215, 3.440, 3.460, 3.570, 3.19...
glimpse(left_join(db2, db3))
## Observations: NA
## Variables: 9
## $ car0 <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ car  <chr> "Mazda RX4", "Mazda RX4 Wag", "Datsun 710", "Hornet 4 Dri...
## $ mpg  <dbl> 21.0, 21.0, 22.8, 21.4, 18.7, 18.1, 14.3, 24.4, 22.8, 19....
## $ cyl  <int> 6, 6, 4, 6, 8, 6, 8, 4, 4, 6, 6, 8, 8, 8, 8, 8, 8, 4, 4, ...
## $ disp <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ wt   <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
filter(db2, cyl==6) %>%
  left_join(db3)
## Source:   query [?? x 9]
## Database: Version: 1.9.0; Direct memory: 34,359,738,368 bytes
## Warning in .local(res, ...): SYSTEM ERROR: DrillRuntimeException: Join only supports implicit casts between 1. Numeric data
##  2. Varchar, Varbinary data 3. Date, Timestamp data Left type: INT, Right type: VARCHAR. Add explicit casts to avoid this error
## 
## Fragment 0:0
## 
## [Error Id: 52ff00a6-f638-4705-a2ab-441727969e76 on drill.local:31010]