Code refactoring: construct SqlContext outside of RolsynScriptEngine
This commit is contained in:
Родитель
1eb7d98158
Коммит
25bb151cdb
|
@ -6,6 +6,7 @@ using System.IO;
|
|||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Spark.CSharp.Core;
|
||||
using Microsoft.Spark.CSharp.Sql;
|
||||
|
||||
namespace Microsoft.Spark.CSharp
|
||||
{
|
||||
|
@ -203,7 +204,7 @@ namespace Microsoft.Spark.CSharp
|
|||
|
||||
internal void Help()
|
||||
{
|
||||
const string helps = "Commands:\r\n :help\t\tDisplay help on available commands.\r\n :load\t\tLoad extra library to current execution context, e.g. :load \"myLib.dll\".\r\n :quit\t\tcd loExit REPL.";
|
||||
const string helps = "Commands:\r\n :help\t\tDisplay help on available commands.\r\n :load\t\tLoad extra library to current execution context, e.g. :load \"myLib.dll\".\r\n :quit\t\tExit REPL.";
|
||||
ioHandler.WriteLine(helps);
|
||||
}
|
||||
|
||||
|
@ -211,7 +212,8 @@ namespace Microsoft.Spark.CSharp
|
|||
{
|
||||
SparkConf sparkConf = new SparkConf();
|
||||
SparkContext sc = new SparkContext(sparkConf);
|
||||
var scriptEngine = new RoslynScriptEngine(sc);
|
||||
SqlContext sqlContext = new SqlContext(sc);
|
||||
var scriptEngine = new RoslynScriptEngine(sc, sqlContext);
|
||||
var repl = new Repl(scriptEngine, new ConsoleIoHandler());
|
||||
repl.Init();
|
||||
repl.Run();
|
||||
|
|
|
@ -45,14 +45,14 @@ namespace Microsoft.Spark.CSharp
|
|||
|
||||
internal readonly string compilationDumpDirectory;
|
||||
|
||||
public RoslynScriptEngine(SparkContext sc)
|
||||
public RoslynScriptEngine(SparkContext sc, SqlContext sqlContext)
|
||||
{
|
||||
this.sc = sc;
|
||||
sparkConf = sc.GetConf();
|
||||
host = new SparkCLRHost
|
||||
{
|
||||
sc = sc,
|
||||
sqlContext = new SqlContext(sc)
|
||||
sqlContext = sqlContext
|
||||
};
|
||||
|
||||
var sparkLocalDir = sparkConf.Get("spark.local.dir", Path.GetTempPath());
|
||||
|
|
|
@ -13,6 +13,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.Spark.CSharp;
|
||||
using Microsoft.Spark.CSharp.Core;
|
||||
using Microsoft.Spark.CSharp.Sql;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
|
||||
|
@ -51,8 +52,9 @@ namespace ReplTest
|
|||
public void Test()
|
||||
{
|
||||
var sc = new SparkContext("", "");
|
||||
var sqlContext = new SqlContext(sc);
|
||||
|
||||
var scriptEngine = new RoslynScriptEngine(sc);
|
||||
var scriptEngine = new RoslynScriptEngine(sc, sqlContext);
|
||||
var ioHandler = new TestIoHandler();
|
||||
|
||||
var repl = new Repl(scriptEngine, ioHandler);
|
||||
|
|
Загрузка…
Ссылка в новой задаче