“Invalid BXL stream” in MS-SQL server while executing R scripts

前端 未结 2 1708
广开言路
广开言路 2021-01-23 22:38

I am executing an R script as ms-sql stored procedure. I\'m trying to use the \"geosphere\" package, however when I execute the stored procedure, I\'m getting the error \"Invali

相关标签:
2条回答
  • 2021-01-23 23:31

    I know this question is dated but I've run into the same issue multiple times so I wanted to leave my results here.

    What I've found in using sp_execute_external_script to run R and Python scripts in MS-SQL 2016/17 is that the BXL error comes for 2 different reasons

    1. Bad data types - Often, SQL doesn't understand the data types being sent out of the script. Usually explicitly casting the data as a certain datatype helps here.

    2. Bad package configuration - Certain packages in the R and Anaconda distributions don't sync well with the stored procedure since the database blocks certain dependencies in these packages. Try reinstalling the package in the SQL installed instance of R or Python.

    It seems that your problem falls in the latter category. I hope that helped!

    0 讨论(0)
  • 2021-01-23 23:32

    Had a similar issue today but with a different package. Getting "invalid BXL stream from MSSQL stored procedure. However, i found that If i opened up Rterm.exe and typed the command 'require(packagename)' then Rterm crashes with "Rterm frontend has stopped working". This looks like a memory issue - which has also been suggested causes the "invalid BXL stream" error. However, my issue turned out to be the fact that the dependencies for the packages had not been installed correctly (perhaps you are working through a proxy?). I basically removed all the library packages that had been created when I first installed the problem package and did a install.packages("packagename"). All started working!

    Apologies - just noticed that you stated that the package worked independently with R studio - this is probably an issue with R Memory allocation with SQL - See http://henkvandervalk.com/introducing-microsoft-sql-server-2016-r-services

    0 讨论(0)
提交回复
热议问题