IMSMWU/RClickhouse

Unpredictable behavior with NULL response

Opened this issue · 1 comments

Empty response from CH is captured in unpredictable way. I suppose that this can happened in case of 'Division by Zero' under uniq(account_id) / (SELECT uniq(account_id) ... . But native CH client didn't print any error. Simply "Ok. 0 rows".

Browse[1]> dbGetQuery(conn, r)
Error in select(conn@ptr, statement) : unsupported column type: Null
Browse[1]> dbGetQuery(conn, r)
data frame with 0 columns and 0 rows
Browse[1]> dbGetQuery(conn, r)
Error in select(conn@ptr, statement) : unsupported column type: Null
Browse[1]> dbGetQuery(conn, r)
data frame with 0 columns and 0 rows
Browse[1]> dbGetQuery(conn, r)
Error in select(conn@ptr, statement) : unsupported column type: Null

SQL request in native CH console is evaluated in correct way.

SELECT 
    date, 
    switchevent, 
    min(duration_minutes), 
    uniq(epgId), 
    uniq(account_id) / 
    (
        SELECT uniq(account_id)
        FROM view_states 
        WHERE ((date >= '2018-01-19') AND (date <= '2018-01-20')) AND ((duration >= 60) AND (duration <= 18000)) AND (account_id LIKE '%#34%')
    ) AS uniq_account_id_ratio
FROM view_states 
WHERE ((date >= '2018-01-19') AND (date <= '2018-01-20')) AND ((duration >= 60) AND (duration <= 18000)) AND (account_id LIKE '%#34%')
GROUP BY 
    date, 
    switchevent

Ok.

0 rows in set. Elapsed: 0.269 sec. Processed 245.77 thousand rows, 8.82 MB (912.36 thousand rows/s., 32.73 MB/s.) 

Session details:

sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=Russian_Russia.1251  LC_CTYPE=Russian_Russia.1251    LC_MONETARY=Russian_Russia.1251 LC_NUMERIC=C                   
[5] LC_TIME=Russian_Russia.1251    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] dvtdspack_0.1.2       bindrcpp_0.2          checkmate_1.8.5       assertr_2.5           openxlsx_4.0.17       officer_0.2.1        
 [7] digest_0.6.15         tictoc_1.0            anytime_0.3.0         shinycssloaders_0.2.0 shinyWidgets_0.4.1    shinyjs_1.0          
[13] shinyBS_0.61          shinythemes_1.1.1     shinyjqui_0.2.0       shiny_1.0.5           config_0.2            RPostgreSQL_0.6-2    
[19] DBI_0.7               hrbrthemes_0.1.0      extrafont_0.17        RColorBrewer_1.1-2    Cairo_1.5-9           jsonlite_1.5         
[25] futile.logger_1.4.3   stringi_1.1.6         magrittr_1.5          readxl_1.0.0          scales_0.5.0          glue_1.2.0           
[31] lubridate_1.7.2       forcats_0.3.0         dplyr_0.7.4           purrr_0.2.4           readr_1.1.1           tidyr_0.8.0          
[37] tibble_1.4.2          ggplot2_2.2.1         tidyverse_1.2.1       stringr_1.3.0        

loaded via a namespace (and not attached):
 [1] nlme_3.1-131         bitops_1.0-6         fs_1.1.0             httr_1.3.1           hunspell_2.9         backports_1.1.2     
 [7] tools_3.4.3          utf8_1.1.3           R6_2.2.2             DT_0.4               lazyeval_0.2.1       colorspace_1.3-2    
[13] tidyselect_0.2.3     mnormt_1.5-5         chron_2.3-52         compiler_3.4.3       extrafontdb_1.0      cli_1.0.0           
[19] rvest_0.3.2          xml2_1.2.0           qdapTools_1.3.3      psych_1.7.8          RApiDatetime_0.0.3   foreign_0.8-69      
[25] R.utils_2.6.0        base64enc_0.1-3      pkgconfig_2.0.1      htmltools_0.3.6      dbplyr_1.2.1         htmlwidgets_1.0     
[31] rlang_0.2.0          rstudioapi_0.7       bindr_0.1            crosstalk_1.0.0      zip_1.0.0            R.oo_1.21.0         
[37] RCurl_1.95-4.10      Rcpp_0.12.15         munsell_0.4.3        RClickhouse_0.4.0    R.methodsS3_1.7.1    yaml_2.1.16         
[43] plyr_1.8.4           grid_3.4.3           parallel_3.4.3       crayon_1.3.4         lattice_0.20-35      haven_1.1.1         
[49] hms_0.4.1            pillar_1.2.0         uuid_0.1-2           reshape2_1.4.3       futile.options_1.0.0 data.table_1.10.4-3 
[55] lambda.r_1.2         modelr_0.1.1         httpuv_1.3.5         Rttf2pt1_1.3.6       cellranger_1.1.0     gtable_0.2.0        
[61] assertthat_0.2.0     mime_0.5             xtable_1.8-2         broom_0.4.3          rsconnect_0.8.5  

@iMissile Thanks for reporting this issue, we'll release a fix in near future.