예제 #1
0
        /// <summary>
        /// Read SqlCommands from the stream based on the given version.
        /// </summary>
        /// <param name="evalType">Evaluation type for the current commands</param>
        /// <param name="stream">Stream to read from</param>
        /// <param name="version">Spark version</param>
        /// <returns>SqlCommand objects</returns>
        private static SqlCommand[] ReadSqlCommands(
            PythonEvalType evalType,
            Stream stream,
            Version version)
        {
            if ((evalType != PythonEvalType.SQL_BATCHED_UDF) &&
                (evalType != PythonEvalType.SQL_SCALAR_PANDAS_UDF) &&
                (evalType != PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF))
            {
                throw new NotImplementedException($"{evalType} is not supported.");
            }

            if (version.Major == 2)
            {
                switch (version.Minor)
                {
                case 3:
                    return(SqlCommandProcessorV2_3_X.Process(evalType, stream));

                case 4:
                    return(SqlCommandProcessorV2_4_X.Process(evalType, stream));
                }
            }

            throw new NotSupportedException($"Spark {version} not supported.");
        }
예제 #2
0
        /// <summary>
        /// Read SqlCommands from the stream based on the given version.
        /// </summary>
        /// <param name="evalType">Evaluation type for the current commands</param>
        /// <param name="stream">Stream to read from</param>
        /// <param name="version">Spark version</param>
        /// <returns>SqlCommand objects</returns>
        private static SqlCommand[] ReadSqlCommands(
            PythonEvalType evalType,
            Stream stream,
            Version version)
        {
            if ((evalType != PythonEvalType.SQL_BATCHED_UDF) &&
                (evalType != PythonEvalType.SQL_SCALAR_PANDAS_UDF) &&
                (evalType != PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF))
            {
                throw new NotImplementedException($"{evalType} is not supported.");
            }

            return((version.Major, version.Minor) switch
            {
                (2, 4) => SqlCommandProcessorV2_4_X.Process(evalType, stream),
                (3, _) => SqlCommandProcessorV2_4_X.Process(evalType, stream),
                _ => throw new NotSupportedException($"Spark {version} not supported.")
            });