forked from microsoft/Mobius
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
expose HadoopConfiguration in SparkContext
- Loading branch information
Showing
14 changed files
with
1,192 additions
and
945 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
csharp/Adapter/Microsoft.Spark.CSharp/Core/HadoopConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using Microsoft.Spark.CSharp.Proxy; | ||
|
||
namespace Microsoft.Spark.CSharp.Core | ||
{ | ||
/// <summary> | ||
/// Configuration for Hadoop operations | ||
/// </summary> | ||
public class HadoopConfiguration | ||
{ | ||
private readonly IHadoopConfigurationProxy hadoopConfigurationProxy; | ||
internal HadoopConfiguration(IHadoopConfigurationProxy hadoopConfProxy) | ||
{ | ||
hadoopConfigurationProxy = hadoopConfProxy; | ||
} | ||
|
||
/// <summary> | ||
/// Sets a property value to HadoopConfiguration | ||
/// </summary> | ||
/// <param name="name">Name of the property</param> | ||
/// <param name="value">Value of the property</param> | ||
public void Set(string name, string value) | ||
{ | ||
hadoopConfigurationProxy.Set(name, value); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the value of a property from HadoopConfiguration | ||
/// </summary> | ||
/// <param name="name">Name of the property</param> | ||
/// <param name="defaultValue">Default value if the property is not available in the configuration</param> | ||
/// <returns></returns> | ||
public string Get(string name, string defaultValue) | ||
{ | ||
return hadoopConfigurationProxy.Get(name, defaultValue); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
csharp/Adapter/Microsoft.Spark.CSharp/Proxy/IHadoopConfigurationProxy.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Microsoft.Spark.CSharp.Proxy | ||
{ | ||
interface IHadoopConfigurationProxy | ||
{ | ||
void Set(string name, string value); | ||
string Get(string name, string defaultValue); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
csharp/Adapter/Microsoft.Spark.CSharp/Proxy/Ipc/HadoopConfigurationIpcProxy.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.Diagnostics.CodeAnalysis; | ||
using Microsoft.Spark.CSharp.Interop.Ipc; | ||
|
||
namespace Microsoft.Spark.CSharp.Proxy.Ipc | ||
{ | ||
[ExcludeFromCodeCoverage] //IPC calls to JVM validated using validation-enabled samples - unit test coverage not reqiured | ||
internal class HadoopConfigurationIpcProxy : IHadoopConfigurationProxy | ||
{ | ||
private readonly JvmObjectReference jvmHadoopConfigurationReference; | ||
public HadoopConfigurationIpcProxy(JvmObjectReference jHadoopConf) | ||
{ | ||
jvmHadoopConfigurationReference = jHadoopConf; | ||
} | ||
|
||
public void Set(string name, string value) | ||
{ | ||
SparkCLRIpcProxy.JvmBridge.CallNonStaticJavaMethod(jvmHadoopConfigurationReference, "set", new object[] { name, value }); | ||
} | ||
|
||
public string Get(string name, string defaultvalue) | ||
{ | ||
return SparkCLRIpcProxy.JvmBridge.CallNonStaticJavaMethod(jvmHadoopConfigurationReference, "get", new object[] { name, defaultvalue }).ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.