コード例 #1
0
ファイル: UdfUtils.cs プロジェクト: zwhrenxiaoxue/spark
        /// <summary>
        /// Creates the PythonFunction object on the JVM side wrapping the given command bytes.
        /// </summary>
        /// <param name="jvm">JVM bridge to use</param>
        /// <param name="command">Serialized command bytes</param>
        /// <returns>JvmObjectReference object to the PythonFunction object</returns>
        internal static JvmObjectReference CreatePythonFunction(IJvmBridge jvm, byte[] command)
        {
            var arrayList          = new ArrayList(jvm);
            var broadcastVariables = new ArrayList(jvm);

            broadcastVariables.AddAll(JvmBroadcastRegistry.GetAll());
            JvmBroadcastRegistry.Clear();

            return((JvmObjectReference)jvm.CallStaticJavaMethod(
                       "org.apache.spark.sql.api.dotnet.SQLUtils",
                       "createPythonFunction",
                       command,
                       CreateEnvVarsForPythonFunction(jvm),
                       arrayList, // Python includes
                       SparkEnvironment.ConfigurationService.GetWorkerExePath(),
                       Versions.CurrentVersion,
                       broadcastVariables,
                       null)); // Accumulator
        }
コード例 #2
0
ファイル: UdfUtils.cs プロジェクト: ScriptBox21/dotnet-spark
        /// <summary>
        /// Creates the PythonFunction object on the JVM side wrapping the given command bytes.
        /// </summary>
        /// <param name="jvm">JVM bridge to use</param>
        /// <param name="command">Serialized command bytes</param>
        /// <returns>JvmObjectReference object to the PythonFunction object</returns>
        internal static JvmObjectReference CreatePythonFunction(IJvmBridge jvm, byte[] command)
        {
            var arrayList          = new ArrayList(jvm);
            var broadcastVariables = new ArrayList(jvm);

            broadcastVariables.AddAll(JvmBroadcastRegistry.GetAll());
            JvmBroadcastRegistry.Clear();

            return((JvmObjectReference)jvm.CallStaticJavaMethod(
                       "org.apache.spark.sql.api.dotnet.SQLUtils",
                       "createPythonFunction",
                       command,
                       CreateEnvVarsForPythonFunction(jvm),
                       arrayList, // Python includes
                       SparkEnvironment.ConfigurationService.GetWorkerExePath(),
                       // Used to check the compatibility of UDFs between the driver and worker.
                       AssemblyInfoProvider.MicrosoftSparkAssemblyInfo().AssemblyVersion,
                       broadcastVariables,
                       null)); // Accumulator
        }