Exemplo n.º 1
0
        /// <summary>
        /// This is a helper function that generates the steps that need to be executed for initializing the kernel and ProcessedInput
        /// </summary>
        /// <param name="rawSchema">rawSchema as passed in from the frontend</param>
        /// <param name="sampleDataPath">Sample Data path where the sample data is stored</param>
        /// <param name="normalizationSnippet">normalizationSnippet as passed in from the frontend</param>
        private void DiagnosticInputhelper(string rawSchema, string sampleDataPath, string normalizationSnippet, string flowId)
        {
            List <string> columnNames = new List <string>();
            var           normalizationSnippetLines = normalizationSnippet.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

            columnNames.AddRange(normalizationSnippetLines);
            string finalNormalizationString = string.Empty;

            if (columnNames.Count == 0)
            {
                finalNormalizationString = "\"Raw.*\"";
            }
            else
            {
                finalNormalizationString = $"\"{columnNames[0]}\"";
                for (int i = 1; i < columnNames.Count; i++)
                {
                    finalNormalizationString = finalNormalizationString + $@",""{columnNames[i]}""";
                }
            }
            Dictionary <string, string> values = new Dictionary <string, string>
            {
                ["RawSchema"]            = rawSchema,
                ["SampleDataPath"]       = sampleDataPath,
                ["NormalizationSnippet"] = finalNormalizationString,
                ["BinName"]           = TranslateBinNames(_engineEnvironment.EngineFlowConfig.BinaryName, _engineEnvironment.EngineFlowConfig.OpsStorageAccountName, _engineEnvironment.EngineFlowConfig.InteractiveQueryDefaultContainer),
                ["KernelDisplayName"] = _engineEnvironment.GenerateKernelDisplayName(flowId)
            };

            SetupSteps = Helper.TranslateOutputTemplate(TemplateGenerator.GetSetupStepsTemplate(), values);
        }