コード例 #1
0
        private static async Task <bool> CheckIsEmail(DConnection conn, ExplorerContext ctx)
        {
            var emailCheck = await conn.Exec(
                new TextColumnTrim(ctx.Table, ctx.Column, TextColumnTrimType.Both, Constants.EmailAddressChars));

            return(emailCheck.Rows.All(r => r.IsNull || (!r.IsSuppressed && r.Value == "@")));
        }
コード例 #2
0
        /// <summary>
        /// Finds common substrings for each position in the texts of the specified column.
        /// It uses a batch approach to query for several positions (specified using SubstringQueryColumnCount)
        /// using a single query.
        /// </summary>
        private static async Task <SubstringsData> ExploreSubstrings(
            DConnection conn,
            ExplorerContext ctx,
            int substringQueryColumnCount,
            params int[] substringLengths)
        {
            var substrings = new SubstringsData();

            foreach (var length in substringLengths)
            {
                var hasRows = true;
                for (var pos = 0; hasRows; pos += substringQueryColumnCount)
                {
                    var query      = new TextColumnSubstring(ctx.Table, ctx.Column, pos, length, substringQueryColumnCount);
                    var sstrResult = await conn.Exec(query);

                    hasRows = false;
                    foreach (var row in sstrResult.Rows)
                    {
                        if (row.HasValue)
                        {
                            hasRows = true;
                            substrings.Add(pos + row.Index, row.Value, row.Count);
                        }
                    }
                }
            }
            return(substrings);
        }
コード例 #3
0
        protected override async Task <Result> Explore()
        {
            var isolators = await conn.Exec(new IsolatorQuery(ctx.Table));

            var isIsolatorColumn = isolators.Rows.First(r => r.Item1 == ctx.Column).Item2;

            return(new Result(ctx.Column, isIsolatorColumn));
        }
コード例 #4
0
        private static async Task <SubstringWithCountList> ExploreEmailTopLevelDomains(DConnection conn, ExplorerContext ctx)
        {
            var suffixes = await conn.Exec(new TextColumnSuffix(ctx.Table, ctx.Column, 3, 7));

            return(SubstringWithCountList.FromValueWithCountEnum(
                       suffixes.Rows
                       .Where(r => r.HasValue && r.Value.StartsWith(".", StringComparison.InvariantCulture))));
        }
コード例 #5
0
        private static async Task <SubstringWithCountList> ExploreEmailDomains(DConnection conn, ExplorerContext ctx)
        {
            var domains = await conn.Exec(new TextColumnTrim(
                                              ctx.Table, ctx.Column, TextColumnTrimType.Leading, Constants.EmailAddressChars));

            return(SubstringWithCountList.FromValueWithCountEnum(
                       domains.Rows
                       .Where(r => r.HasValue && r.Value.StartsWith("@", StringComparison.InvariantCulture))));
        }
コード例 #6
0
        protected override async Task <Result> Explore()
        {
            var queryResult = await conn.Exec(
                new CyclicalDatetimes(ctx.Table, ctx.Column, ctx.ColumnType));

            var groupings = await Task.Run(() => ProcessCyclicalBuckets(queryResult.Rows));

            return(new Result(
                       groupings.Select(g => g.Item1),
                       groupings.Select(g => g.Item2)));
        }
コード例 #7
0
        protected override async Task <SimpleStats <T> .Result> Explore()
        {
            var statsQ = await conn.Exec(new BasicColumnStats <T>(ctx.Table, ctx.Column));

            return(new Result(statsQ.Rows.Single()));
        }