Exemple #1
0
        public void Write(TProtocol oprot)
        {
            TStruct struc = new TStruct("ColumnStatisticsData");

            oprot.WriteStructBegin(struc);
            TField field = new TField();

            if (BooleanStats != null && __isset.booleanStats)
            {
                field.Name = "booleanStats";
                field.Type = TType.Struct;
                field.ID   = 1;
                oprot.WriteFieldBegin(field);
                BooleanStats.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (LongStats != null && __isset.longStats)
            {
                field.Name = "longStats";
                field.Type = TType.Struct;
                field.ID   = 2;
                oprot.WriteFieldBegin(field);
                LongStats.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (DoubleStats != null && __isset.doubleStats)
            {
                field.Name = "doubleStats";
                field.Type = TType.Struct;
                field.ID   = 3;
                oprot.WriteFieldBegin(field);
                DoubleStats.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (StringStats != null && __isset.stringStats)
            {
                field.Name = "stringStats";
                field.Type = TType.Struct;
                field.ID   = 4;
                oprot.WriteFieldBegin(field);
                StringStats.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (BinaryStats != null && __isset.binaryStats)
            {
                field.Name = "binaryStats";
                field.Type = TType.Struct;
                field.ID   = 5;
                oprot.WriteFieldBegin(field);
                BinaryStats.Write(oprot);
                oprot.WriteFieldEnd();
            }
            oprot.WriteFieldStop();
            oprot.WriteStructEnd();
        }
Exemple #2
0
        /// <summary>
        /// Return a set of stats (Min, Max, Avg, Total, Count) on a collection of numbers.
        /// </summary>
        /// <typeparam name="T">The Type of the data in the collection</typeparam>
        /// <param name="data">The data to analyse</param>
        /// <param name="_selector">The selctor to get an INT from the data</param>
        /// <returns>The stats on the data</returns>
        public static LongStats GetStats <T>(this IEnumerable <T> data, Func <T, long> _selector)
        {
            var retval = new LongStats();

            foreach (var row in data)
            {
                var val = _selector(row);
                retval.Accumulate(val);
            }

            return(retval);
        }
Exemple #3
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder("ColumnStatisticsData(");

            sb.Append("BooleanStats: ");
            sb.Append(BooleanStats == null ? "<null>" : BooleanStats.ToString());
            sb.Append(",LongStats: ");
            sb.Append(LongStats == null ? "<null>" : LongStats.ToString());
            sb.Append(",DoubleStats: ");
            sb.Append(DoubleStats == null ? "<null>" : DoubleStats.ToString());
            sb.Append(",StringStats: ");
            sb.Append(StringStats == null ? "<null>" : StringStats.ToString());
            sb.Append(",BinaryStats: ");
            sb.Append(BinaryStats == null ? "<null>" : BinaryStats.ToString());
            sb.Append(")");
            return(sb.ToString());
        }