示例#1
0
        private static TextFileContents.ColumnSplitResult InferSplit(TextFileSample sample, string separator)
        {
            var separatorCandidates = separator == null ? TextFileContents.DefaultSeparators : new string[] { separator };
            var splitInference = TextFileContents.TrySplitColumns(sample, separatorCandidates);
            
            if (!splitInference.IsSuccess)
            {
                throw new InferenceException(InferenceType.ColumnSplit, "Unable to split the file provided into multiple, consistent columns.");
            }

            return splitInference;
        }
        private static TextFileContents.ColumnSplitResult InferSplit(TextFileSample sample, string separator, bool?isQuoted, bool?isSparse)
        {
            var separatorCandidates = separator == null ? TextFileContents.DefaultSeparators : new string[] { separator };
            var splitInference      = TextFileContents.TrySplitColumns(sample, separatorCandidates);

            // respect passed-in overrides
            if (isQuoted != null)
            {
                splitInference.AllowQuote = isQuoted.Value;
            }
            if (isSparse != null)
            {
                splitInference.AllowSparse = isSparse.Value;
            }

            if (!splitInference.IsSuccess)
            {
                throw new InferenceException(InferenceType.ColumnSplit, "Unable to split the file provided into multiple, consistent columns.");
            }

            return(splitInference);
        }