public override object Aggregate(int[] records, AggregateType kind) { try { int num; int num2; switch (kind) { case AggregateType.First: if (records.Length <= 0) { return(null); } return(this.values[records[0]]); case AggregateType.Count: num2 = 0; num = 0; goto Label_0044; default: goto Label_0068; } Label_0031: if (!this.IsNull(records[num])) { num2++; } num++; Label_0044: if (num < records.Length) { goto Label_0031; } return(num2); } catch (OverflowException) { throw ExprException.Overflow(typeof(SqlXml)); } Label_0068: throw ExceptionBuilder.AggregateException(kind, base.DataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool flag = false; try { int num; int num2; DateTimeOffset minValue; int num3; DateTimeOffset maxValue; int num4; int num5; int num6; switch (kind) { case AggregateType.Min: maxValue = DateTimeOffset.MaxValue; num3 = 0; goto Label_007D; case AggregateType.Max: minValue = DateTimeOffset.MinValue; num2 = 0; goto Label_00F2; case AggregateType.First: if (records.Length <= 0) { return(null); } return(this.values[records[0]]); case AggregateType.Count: num4 = 0; num = 0; goto Label_0152; default: goto Label_0177; } Label_0030: num6 = records[num3]; if (base.HasValue(num6)) { maxValue = (DateTimeOffset.Compare(this.values[num6], maxValue) < 0) ? this.values[num6] : maxValue; flag = true; } num3++; Label_007D: if (num3 < records.Length) { goto Label_0030; } if (flag) { return(maxValue); } return(base.NullValue); Label_00AB: num5 = records[num2]; if (base.HasValue(num5)) { minValue = (DateTimeOffset.Compare(this.values[num5], minValue) >= 0) ? this.values[num5] : minValue; flag = true; } num2++; Label_00F2: if (num2 < records.Length) { goto Label_00AB; } if (flag) { return(minValue); } return(base.NullValue); Label_013D: if (base.HasValue(records[num])) { num4++; } num++; Label_0152: if (num < records.Length) { goto Label_013D; } return(num4); } catch (OverflowException) { throw ExprException.Overflow(typeof(DateTimeOffset)); } Label_0177: throw ExceptionBuilder.AggregateException(kind, base.DataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool hasData = false; try { switch (kind) { case AggregateType.Sum: SqlDecimal sum = 0; foreach (int record in records) { if (IsNull(record)) { continue; } checked { sum += _values[record]; } hasData = true; } if (hasData) { return(sum); } return(_nullValue); case AggregateType.Mean: SqlDecimal meanSum = 0; int meanCount = 0; foreach (int record in records) { if (IsNull(record)) { continue; } checked { meanSum += _values[record]; } meanCount++; hasData = true; } if (hasData) { SqlDecimal mean = 0; checked { mean = (meanSum / meanCount); } return(mean); } return(_nullValue); case AggregateType.Var: case AggregateType.StDev: int count = 0; SqlDouble var = 0; SqlDouble prec = 0; SqlDouble dsum = 0; SqlDouble sqrsum = 0; foreach (int record in records) { if (IsNull(record)) { continue; } dsum += _values[record].ToSqlDouble(); sqrsum += (_values[record]).ToSqlDouble() * (_values[record]).ToSqlDouble(); count++; } if (count > 1) { var = count * sqrsum - (dsum * dsum); prec = var / (dsum * dsum); // we are dealing with the risk of a cancellation error // double is guaranteed only for 15 digits so a difference // with a result less than 1e-15 should be considered as zero if ((prec < 1e-15) || (var < 0)) { var = 0; } else { var = var / (count * (count - 1)); } if (kind == AggregateType.StDev) { return(Math.Sqrt(var.Value)); } return(var); } return(_nullValue); case AggregateType.Min: SqlDecimal min = SqlDecimal.MaxValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (IsNull(record)) { continue; } if ((SqlDecimal.LessThan(_values[record], min)).IsTrue) { min = _values[record]; } hasData = true; } if (hasData) { return(min); } return(_nullValue); case AggregateType.Max: SqlDecimal max = SqlDecimal.MinValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (IsNull(record)) { continue; } if ((SqlDecimal.GreaterThan(_values[record], max)).IsTrue) { max = _values[record]; } hasData = true; } if (hasData) { return(max); } return(_nullValue); case AggregateType.First: if (records.Length > 0) { return(_values[records[0]]); } return(null); case AggregateType.Count: count = 0; for (int i = 0; i < records.Length; i++) { if (!IsNull(records[i])) { count++; } } return(count); } } catch (OverflowException) { throw ExprException.Overflow(typeof(SqlDecimal)); } throw ExceptionBuilder.AggregateException(kind, _dataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool hasData = false; try { switch (kind) { case AggregateType.Min: DateTime min = DateTime.MaxValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (HasValue(record)) { min = (DateTime.Compare(_values[record], min) < 0) ? _values[record] : min; hasData = true; } } if (hasData) { return(min); } return(_nullValue); case AggregateType.Max: DateTime max = DateTime.MinValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (HasValue(record)) { max = (DateTime.Compare(_values[record], max) >= 0) ? _values[record] : max; hasData = true; } } if (hasData) { return(max); } return(_nullValue); case AggregateType.First: // Does not seem to be implemented if (records.Length > 0) { return(_values[records[0]]); } return(null !); case AggregateType.Count: int count = 0; for (int i = 0; i < records.Length; i++) { if (HasValue(records[i])) { count++; } } return(count); } } catch (OverflowException) { throw ExprException.Overflow(typeof(DateTime)); } throw ExceptionBuilder.AggregateException(kind, _dataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool hasData = false; try { switch (kind) { case AggregateType.Min: bool min = true; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (IsNull(record)) { continue; } min = _values[record] && min; hasData = true; } if (hasData) { return(min); } return(_nullValue); case AggregateType.Max: bool max = false; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (IsNull(record)) { continue; } max = _values[record] || max; hasData = true; } if (hasData) { return(max); } return(_nullValue); case AggregateType.First: if (records.Length > 0) { return(_values[records[0]]); } return(null); case AggregateType.Count: return(base.Aggregate(records, kind)); } } catch (OverflowException) { throw ExprException.Overflow(typeof(bool)); } throw ExceptionBuilder.AggregateException(kind, _dataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool hasData = false; try { switch (kind) { case AggregateType.Min: SqlDateTime min = SqlDateTime.MaxValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (IsNull(record)) { continue; } if ((SqlDateTime.LessThan(_values[record], min)).IsTrue) { min = _values[record]; } hasData = true; } if (hasData) { return(min); } return(_nullValue); case AggregateType.Max: SqlDateTime max = SqlDateTime.MinValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (IsNull(record)) { continue; } if ((SqlDateTime.GreaterThan(_values[record], max)).IsTrue) { max = _values[record]; } hasData = true; } if (hasData) { return(max); } return(_nullValue); case AggregateType.First: // Does not seem to be implemented if (records.Length > 0) { return(_values[records[0]]); } return(null !); // no data => null case AggregateType.Count: int count = 0; for (int i = 0; i < records.Length; i++) { if (!IsNull(records[i])) { count++; } } return(count); } } catch (OverflowException) { throw ExprException.Overflow(typeof(SqlDateTime)); } throw ExceptionBuilder.AggregateException(kind, _dataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool flag = false; try { double num; double num2; int num3; int num4; int num5; int num6; int num7; int num8; int num9; long num10; long num11; double num12; int num13; decimal num14; long num15; int num16; int num17; int[] numArray; double num18; int num19; int[] numArray2; int num20; int[] numArray3; switch (kind) { case AggregateType.Sum: num15 = 0L; numArray3 = records; num9 = 0; goto Label_0066; case AggregateType.Mean: num14 = 0M; num13 = 0; numArray2 = records; num8 = 0; goto Label_00D3; case AggregateType.Min: num11 = 0x7fffffffffffffffL; num5 = 0; goto Label_023C; case AggregateType.Max: num10 = -9223372036854775808L; num4 = 0; goto Label_0299; case AggregateType.First: if (records.Length <= 0) { return(null); } return(this.values[records[0]]); case AggregateType.Count: return(base.Aggregate(records, kind)); case AggregateType.Var: case AggregateType.StDev: num3 = 0; num = 0.0; num18 = 0.0; num2 = 0.0; num12 = 0.0; numArray = records; num7 = 0; goto Label_0185; default: goto Label_02F2; } Label_003F: num20 = numArray3[num9]; if (base.HasValue(num20)) { num15 += this.values[num20]; flag = true; } num9++; Label_0066: if (num9 < numArray3.Length) { goto Label_003F; } if (flag) { return(num15); } return(base.NullValue); Label_009D: num19 = numArray2[num8]; if (base.HasValue(num19)) { num14 += this.values[num19]; num13++; flag = true; } num8++; Label_00D3: if (num8 < numArray2.Length) { goto Label_009D; } if (flag) { return((long)(num14 / num13)); } return(base.NullValue); Label_0141: num6 = numArray[num7]; if (base.HasValue(num6)) { num2 += this.values[num6]; num12 += this.values[num6] * this.values[num6]; num3++; } num7++; Label_0185: if (num7 < numArray.Length) { goto Label_0141; } if (num3 <= 1) { return(base.NullValue); } num = (num3 * num12) - (num2 * num2); num18 = num / (num2 * num2); if ((num18 < 1E-15) || (num < 0.0)) { num = 0.0; } else { num /= (double)(num3 * (num3 - 1)); } if (kind == AggregateType.StDev) { return(Math.Sqrt(num)); } return(num); Label_0212: num17 = records[num5]; if (base.HasValue(num17)) { num11 = Math.Min(this.values[num17], num11); flag = true; } num5++; Label_023C: if (num5 < records.Length) { goto Label_0212; } if (flag) { return(num11); } return(base.NullValue); Label_026F: num16 = records[num4]; if (base.HasValue(num16)) { num10 = Math.Max(this.values[num16], num10); flag = true; } num4++; Label_0299: if (num4 < records.Length) { goto Label_026F; } if (flag) { return(num10); } return(base.NullValue); } catch (OverflowException) { throw ExprException.Overflow(typeof(long)); } Label_02F2: throw ExceptionBuilder.AggregateException(kind, base.DataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool flag = false; try { int num; TimeSpan minValue; int num2; TimeSpan maxValue; int num3; int num4; switch (kind) { case AggregateType.Min: maxValue = TimeSpan.MaxValue; num2 = 0; goto Label_0079; case AggregateType.Max: minValue = TimeSpan.MinValue; num = 0; goto Label_00ED; case AggregateType.First: if (records.Length <= 0) { return(null); } return(this.values[records[0]]); case AggregateType.Count: return(base.Aggregate(records, kind)); default: goto Label_014E; } Label_002F: num4 = records[num2]; if (!this.IsNull(num4)) { maxValue = (TimeSpan.Compare(this.values[num4], maxValue) < 0) ? this.values[num4] : maxValue; flag = true; } num2++; Label_0079: if (num2 < records.Length) { goto Label_002F; } if (flag) { return(maxValue); } return(base.NullValue); Label_00A6: num3 = records[num]; if (!this.IsNull(num3)) { minValue = (TimeSpan.Compare(this.values[num3], minValue) >= 0) ? this.values[num3] : minValue; flag = true; } num++; Label_00ED: if (num < records.Length) { goto Label_00A6; } if (flag) { return(minValue); } return(base.NullValue); } catch (OverflowException) { throw ExprException.Overflow(typeof(TimeSpan)); } Label_014E: throw ExceptionBuilder.AggregateException(kind, base.DataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool flag = false; try { int num; double num2; double num3; int num4; int num5; int num6; int num7; int num8; int num9; int num10; ushort num11; ushort num12; double num13; int num14; long num15; ulong defaultValue; int num17; int num18; int[] numArray; double num19; int num20; int[] numArray2; int num21; int[] numArray3; switch (kind) { case AggregateType.Sum: defaultValue = UInt16Storage.defaultValue; numArray3 = records; num10 = 0; goto Label_006B; case AggregateType.Mean: num15 = UInt16Storage.defaultValue; num14 = 0; numArray2 = records; num9 = 0; goto Label_00D0; case AggregateType.Min: num12 = 0xffff; num6 = 0; goto Label_0229; case AggregateType.Max: num11 = 0; num5 = 0; goto Label_027E; case AggregateType.First: if (records.Length <= 0) { return(null); } return(this.values[records[0]]); case AggregateType.Count: num = 0; num4 = 0; goto Label_02D7; case AggregateType.Var: case AggregateType.StDev: num = 0; num2 = 0.0; num19 = 0.0; num3 = 0.0; num13 = 0.0; numArray = records; num8 = 0; goto Label_0176; default: goto Label_02FC; } Label_0043: num21 = numArray3[num10]; if (base.HasValue(num21)) { defaultValue += this.values[num21]; flag = true; } num10++; Label_006B: if (num10 < numArray3.Length) { goto Label_0043; } if (flag) { return(defaultValue); } return(base.NullValue); Label_00A2: num20 = numArray2[num9]; if (base.HasValue(num20)) { num15 += this.values[num20]; num14++; flag = true; } num9++; Label_00D0: if (num9 < numArray2.Length) { goto Label_00A2; } if (flag) { return((ushort)(num15 / ((long)num14))); } return(base.NullValue); Label_0132: num7 = numArray[num8]; if (base.HasValue(num7)) { num3 += this.values[num7]; num13 += this.values[num7] * this.values[num7]; num++; } num8++; Label_0176: if (num8 < numArray.Length) { goto Label_0132; } if (num <= 1) { return(base.NullValue); } num2 = (num * num13) - (num3 * num3); num19 = num2 / (num3 * num3); if ((num19 < 1E-15) || (num2 < 0.0)) { num2 = 0.0; } else { num2 /= (double)(num * (num - 1)); } if (kind == AggregateType.StDev) { return(Math.Sqrt(num2)); } return(num2); Label_01FF: num18 = records[num6]; if (base.HasValue(num18)) { num12 = Math.Min(this.values[num18], num12); flag = true; } num6++; Label_0229: if (num6 < records.Length) { goto Label_01FF; } if (flag) { return(num12); } return(base.NullValue); Label_0254: num17 = records[num5]; if (base.HasValue(num17)) { num11 = Math.Max(this.values[num17], num11); flag = true; } num5++; Label_027E: if (num5 < records.Length) { goto Label_0254; } if (flag) { return(num11); } return(base.NullValue); Label_02C1: if (base.HasValue(records[num4])) { num++; } num4++; Label_02D7: if (num4 < records.Length) { goto Label_02C1; } return(num); } catch (OverflowException) { throw ExprException.Overflow(typeof(ushort)); } Label_02FC: throw ExceptionBuilder.AggregateException(kind, base.DataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool flag = false; try { int num; int num2; int num3; int num4; int num5; SqlDateTime minValue; int num6; SqlDateTime maxValue; switch (kind) { case AggregateType.Min: maxValue = SqlDateTime.MaxValue; num3 = 0; goto Label_007D; case AggregateType.Max: minValue = SqlDateTime.MinValue; num2 = 0; goto Label_00F9; case AggregateType.First: if (records.Length <= 0) { return(null); } return(this.values[records[0]]); case AggregateType.Count: num4 = 0; num = 0; goto Label_015A; default: goto Label_017F; } Label_002F: num6 = records[num3]; if (!this.IsNull(num6)) { if (SqlDateTime.LessThan(this.values[num6], maxValue).IsTrue) { maxValue = this.values[num6]; } flag = true; } num3++; Label_007D: if (num3 < records.Length) { goto Label_002F; } if (flag) { return(maxValue); } return(base.NullValue); Label_00AB: num5 = records[num2]; if (!this.IsNull(num5)) { if (SqlDateTime.GreaterThan(this.values[num5], minValue).IsTrue) { minValue = this.values[num5]; } flag = true; } num2++; Label_00F9: if (num2 < records.Length) { goto Label_00AB; } if (flag) { return(minValue); } return(base.NullValue); Label_0145: if (!this.IsNull(records[num])) { num4++; } num++; Label_015A: if (num < records.Length) { goto Label_0145; } return(num4); } catch (OverflowException) { throw ExprException.Overflow(typeof(SqlDateTime)); } Label_017F: throw ExceptionBuilder.AggregateException(kind, base.DataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool flag = false; try { int num; SqlDouble num2; SqlDouble num3; int num4; int num5; int num6; int num7; int num8; int num9; int num10; int num11; SqlMoney minValue; int num12; SqlMoney maxValue; SqlDouble num13; int num14; SqlDecimal num15; SqlDecimal num16; int[] numArray; SqlDouble num17; int num18; int[] numArray2; int num19; int[] numArray3; switch (kind) { case AggregateType.Sum: num16 = 0L; numArray3 = records; num10 = 0; goto Label_007D; case AggregateType.Mean: num15 = 0L; num14 = 0; numArray2 = records; num9 = 0; goto Label_00EF; case AggregateType.Min: maxValue = SqlMoney.MaxValue; num6 = 0; goto Label_0314; case AggregateType.Max: minValue = SqlMoney.MinValue; num5 = 0; goto Label_0393; case AggregateType.First: if (records.Length <= 0) { return(null); } return(this.values[records[0]]); case AggregateType.Count: num = 0; num4 = 0; goto Label_03F8; case AggregateType.Var: case AggregateType.StDev: num = 0; num2 = 0.0; num17 = 0.0; num3 = 0.0; num13 = 0.0; numArray = records; num8 = 0; goto Label_01E7; default: goto Label_041D; } Label_0044: num19 = numArray3[num10]; if (!this.IsNull(num19)) { num16 += this.values[num19]; flag = true; } num10++; Label_007D: if (num10 < numArray3.Length) { goto Label_0044; } if (flag) { return(num16); } return(base.NullValue); Label_00B5: num18 = numArray2[num9]; if (!this.IsNull(num18)) { num15 += this.values[num18].ToSqlDecimal(); num14++; flag = true; } num9++; Label_00EF: if (num9 < numArray2.Length) { goto Label_00B5; } if (flag) { SqlDecimal num20 = num15 / ((long)num14); return(num20.ToSqlMoney()); } return(base.NullValue); Label_017F: num7 = numArray[num8]; if (!this.IsNull(num7)) { num3 += this.values[num7].ToSqlDouble(); num13 += this.values[num7].ToSqlDouble() * this.values[num7].ToSqlDouble(); num++; } num8++; Label_01E7: if (num8 < numArray.Length) { goto Label_017F; } if (num <= 1) { return(base.NullValue); } num2 = ((SqlDouble)(num * num13)) - (num3 * num3); num17 = num2 / (num3 * num3); bool x = num17 < 1E-15; if (!SqlBoolean.op_True(x)) { } if (SqlBoolean.op_True(x | (num2 < 0.0))) { num2 = 0.0; } else { num2 /= (double)(num * (num - 1)); } if (kind == AggregateType.StDev) { return(Math.Sqrt(num2.Value)); } return(num2); Label_02C4: num12 = records[num6]; if (!this.IsNull(num12)) { if (SqlMoney.LessThan(this.values[num12], maxValue).IsTrue) { maxValue = this.values[num12]; } flag = true; } num6++; Label_0314: if (num6 < records.Length) { goto Label_02C4; } if (flag) { return(maxValue); } return(base.NullValue); Label_0343: num11 = records[num5]; if (!this.IsNull(num11)) { if (SqlMoney.GreaterThan(this.values[num11], minValue).IsTrue) { minValue = this.values[num11]; } flag = true; } num5++; Label_0393: if (num5 < records.Length) { goto Label_0343; } if (flag) { return(minValue); } return(base.NullValue); Label_03E2: if (!this.IsNull(records[num4])) { num++; } num4++; Label_03F8: if (num4 < records.Length) { goto Label_03E2; } return(num); } catch (OverflowException) { throw ExprException.Overflow(typeof(SqlMoney)); } Label_041D: throw ExceptionBuilder.AggregateException(kind, base.DataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool flag = false; try { int num; char ch; int num2; char ch2; int num3; int num4; switch (kind) { case AggregateType.Min: ch2 = 0xffff; num2 = 0; goto Label_0061; case AggregateType.Max: ch = '\0'; num = 0; goto Label_00B9; case AggregateType.First: if (records.Length <= 0) { return(null); } return(this.values[records[0]]); case AggregateType.Count: return(base.Aggregate(records, kind)); default: goto Label_0111; } Label_002F: num4 = records[num2]; if (!this.IsNull(num4)) { ch2 = (this.values[num4] < ch2) ? this.values[num4] : ch2; flag = true; } num2++; Label_0061: if (num2 < records.Length) { goto Label_002F; } if (flag) { return(ch2); } return(base.NullValue); Label_008A: num3 = records[num]; if (!this.IsNull(num3)) { ch = (this.values[num3] > ch) ? this.values[num3] : ch; flag = true; } num++; Label_00B9: if (num < records.Length) { goto Label_008A; } if (flag) { return(ch); } return(base.NullValue); } catch (OverflowException) { throw ExprException.Overflow(typeof(char)); } Label_0111: throw ExceptionBuilder.AggregateException(kind, base.DataType); }
public override object Aggregate(int[] recordNos, AggregateType kind) { try { int num; int num2; int num3; int num4; switch (kind) { case AggregateType.Min: num3 = -1; num = 0; goto Label_003C; case AggregateType.Max: num2 = -1; num = 0; goto Label_00A6; case AggregateType.Count: num4 = 0; num = 0; goto Label_0100; default: goto Label_0125; } Label_0027: if (!this.IsNull(recordNos[num])) { num3 = recordNos[num]; goto Label_0042; } num++; Label_003C: if (num < recordNos.Length) { goto Label_0027; } Label_0042: if (num3 >= 0) { num++; while (num < recordNos.Length) { if (!this.IsNull(recordNos[num]) && (this.Compare(num3, recordNos[num]) > 0)) { num3 = recordNos[num]; } num++; } return(this.Get(num3)); } return(base.NullValue); Label_0091: if (!this.IsNull(recordNos[num])) { num2 = recordNos[num]; goto Label_00AC; } num++; Label_00A6: if (num < recordNos.Length) { goto Label_0091; } Label_00AC: if (num2 >= 0) { num++; while (num < recordNos.Length) { if (this.Compare(num2, recordNos[num]) < 0) { num2 = recordNos[num]; } num++; } return(this.Get(num2)); } return(base.NullValue); Label_00EB: if (!this.IsNull(recordNos[num])) { num4++; } num++; Label_0100: if (num < recordNos.Length) { goto Label_00EB; } return(num4); } catch (OverflowException) { throw ExprException.Overflow(typeof(SqlString)); } Label_0125: throw ExceptionBuilder.AggregateException(kind, base.DataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool flag = false; try { int num; int num2; int num3; int num4; SqlBoolean flag2; SqlBoolean flag3; int num5; int num6; switch (kind) { case AggregateType.Min: flag3 = 1; num3 = 0; goto Label_0061; case AggregateType.Max: flag2 = 0; num2 = 0; goto Label_00C1; case AggregateType.First: if (records.Length <= 0) { return(base.NullValue); } return(this.values[records[0]]); case AggregateType.Count: num4 = 0; num = 0; goto Label_012A; default: goto Label_014F; } Label_0030: num6 = records[num3]; if (!this.IsNull(num6)) { flag3 = SqlBoolean.And(this.values[num6], flag3); flag = true; } num3++; Label_0061: if (num3 < records.Length) { goto Label_0030; } if (flag) { return(flag3); } return(base.NullValue); Label_0090: num5 = records[num2]; if (!this.IsNull(num5)) { flag2 = SqlBoolean.Or(this.values[num5], flag2); flag = true; } num2++; Label_00C1: if (num2 < records.Length) { goto Label_0090; } if (flag) { return(flag2); } return(base.NullValue); Label_0115: if (!this.IsNull(records[num])) { num4++; } num++; Label_012A: if (num < records.Length) { goto Label_0115; } return(num4); } catch (OverflowException) { throw ExprException.Overflow(typeof(SqlBoolean)); } Label_014F: throw ExceptionBuilder.AggregateException(kind, base.DataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool hasData = false; try { switch (kind) { case AggregateType.Min: TimeSpan min = TimeSpan.MaxValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (IsNull(record)) { continue; } min = (TimeSpan.Compare(_values[record], min) < 0) ? _values[record] : min; hasData = true; } if (hasData) { return(min); } return(_nullValue); case AggregateType.Max: TimeSpan max = TimeSpan.MinValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (IsNull(record)) { continue; } max = (TimeSpan.Compare(_values[record], max) >= 0) ? _values[record] : max; hasData = true; } if (hasData) { return(max); } return(_nullValue); case AggregateType.First: if (records.Length > 0) { return(_values[records[0]]); } return(null); case AggregateType.Count: return(base.Aggregate(records, kind)); case AggregateType.Sum: { decimal sum = 0; foreach (int record in records) { if (IsNull(record)) { continue; } sum += _values[record].Ticks; hasData = true; } if (hasData) { return(TimeSpan.FromTicks((long)Math.Round(sum))); } return(null); } case AggregateType.Mean: { decimal meanSum = 0; int meanCount = 0; foreach (int record in records) { if (IsNull(record)) { continue; } meanSum += _values[record].Ticks; meanCount++; } if (meanCount > 0) { return(TimeSpan.FromTicks((long)Math.Round(meanSum / meanCount))); } return(null); } case AggregateType.StDev: { int count = 0; decimal meanSum = 0; foreach (int record in records) { if (IsNull(record)) { continue; } meanSum += _values[record].Ticks; count++; } if (count > 1) { double varSum = 0; decimal mean = meanSum / count; foreach (int record in records) { if (IsNull(record)) { continue; } double x = (double)(_values[record].Ticks - mean); varSum += x * x; } ulong stDev = (ulong)Math.Round(Math.Sqrt(varSum / (count - 1))); if (stDev > long.MaxValue) { stDev = long.MaxValue; } return(TimeSpan.FromTicks((long)stDev)); } return(null); } } } catch (OverflowException) { throw ExprException.Overflow(typeof(TimeSpan)); } throw ExceptionBuilder.AggregateException(kind, _dataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool hasData = false; try { switch (kind) { case AggregateType.Min: char min = char.MaxValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (IsNull(record)) { continue; } min = (_values[record] < min) ? _values[record] : min; hasData = true; } if (hasData) { return(min); } return(_nullValue); case AggregateType.Max: char max = char.MinValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (IsNull(record)) { continue; } max = (_values[record] > max) ? _values[record] : max; hasData = true; } if (hasData) { return(max); } return(_nullValue); case AggregateType.First: // Does not seem to be implemented if (records.Length > 0) { return(_values[records[0]]); } return(null !); case AggregateType.Count: return(base.Aggregate(records, kind)); } } catch (OverflowException) { throw ExprException.Overflow(typeof(char)); } throw ExceptionBuilder.AggregateException(kind, _dataType); }
public override object Aggregate(int[] recordNos, AggregateType kind) { try { int i; switch (kind) { case AggregateType.Min: int min = -1; for (i = 0; i < recordNos.Length; i++) { if (IsNull(recordNos[i])) { continue; } min = recordNos[i]; break; } if (min >= 0) { for (i++; i < recordNos.Length; i++) { if (IsNull(recordNos[i])) { continue; } if (Compare(min, recordNos[i]) > 0) { min = recordNos[i]; } } return(Get(min)); } return(_nullValue); case AggregateType.Max: int max = -1; for (i = 0; i < recordNos.Length; i++) { if (IsNull(recordNos[i])) { continue; } max = recordNos[i]; break; } if (max >= 0) { for (i++; i < recordNos.Length; i++) { if (Compare(max, recordNos[i]) < 0) { max = recordNos[i]; } } return(Get(max)); } return(_nullValue); case AggregateType.Count: int count = 0; for (i = 0; i < recordNos.Length; i++) { if (!IsNull(recordNos[i])) { count++; } } return(count); } } catch (OverflowException) { throw ExprException.Overflow(typeof(SqlString)); } throw ExceptionBuilder.AggregateException(kind, _dataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool flag = false; try { int num; SqlDouble num2; SqlDouble num3; int num4; int num5; int num6; int num7; int num8; int num9; int num10; int num11; SqlDecimal minValue; int num13; SqlDecimal maxValue; SqlDouble num15; int num16; SqlDecimal num17; SqlDecimal num18; int[] numArray; SqlDouble num19; int num21; int[] numArray2; int num22; int[] numArray3; switch (kind) { case AggregateType.Sum: num18 = 0L; numArray3 = records; num10 = 0; goto Label_0078; case AggregateType.Mean: num17 = 0L; num16 = 0; numArray2 = records; num9 = 0; goto Label_00EA; case AggregateType.Min: maxValue = SqlDecimal.MaxValue; num6 = 0; goto Label_0306; case AggregateType.Max: minValue = SqlDecimal.MinValue; num5 = 0; goto Label_0385; case AggregateType.First: if (records.Length <= 0) { return(null); } return(this.values[records[0]]); case AggregateType.Count: num = 0; num4 = 0; goto Label_03EA; case AggregateType.Var: case AggregateType.StDev: num = 0; num2 = 0.0; num19 = 0.0; num3 = 0.0; num15 = 0.0; numArray = records; num8 = 0; goto Label_01D9; default: goto Label_040F; } Label_0044: num22 = numArray3[num10]; if (!this.IsNull(num22)) { num18 += this.values[num22]; flag = true; } num10++; Label_0078: if (num10 < numArray3.Length) { goto Label_0044; } if (flag) { return(num18); } return(base.NullValue); Label_00B0: num21 = numArray2[num9]; if (!this.IsNull(num21)) { num17 += this.values[num21]; num16++; flag = true; } num9++; Label_00EA: if (num9 < numArray2.Length) { goto Label_00B0; } if (flag) { return(num17 / ((long)num16)); } return(base.NullValue); Label_0171: num7 = numArray[num8]; if (!this.IsNull(num7)) { num3 += this.values[num7].ToSqlDouble(); num15 += this.values[num7].ToSqlDouble() * this.values[num7].ToSqlDouble(); num++; } num8++; Label_01D9: if (num8 < numArray.Length) { goto Label_0171; } if (num <= 1) { return(base.NullValue); } num2 = ((SqlDouble)(num * num15)) - (num3 * num3); num19 = num2 / (num3 * num3); bool x = num19 < 1E-15; if (!SqlBoolean.op_True(x)) { } if (SqlBoolean.op_True(x | (num2 < 0.0))) { num2 = 0.0; } else { num2 /= (double)(num * (num - 1)); } if (kind == AggregateType.StDev) { return(Math.Sqrt(num2.Value)); } return(num2); Label_02B6: num13 = records[num6]; if (!this.IsNull(num13)) { if (SqlDecimal.LessThan(this.values[num13], maxValue).IsTrue) { maxValue = this.values[num13]; } flag = true; } num6++; Label_0306: if (num6 < records.Length) { goto Label_02B6; } if (flag) { return(maxValue); } return(base.NullValue); Label_0335: num11 = records[num5]; if (!this.IsNull(num11)) { if (SqlDecimal.GreaterThan(this.values[num11], minValue).IsTrue) { minValue = this.values[num11]; } flag = true; } num5++; Label_0385: if (num5 < records.Length) { goto Label_0335; } if (flag) { return(minValue); } return(base.NullValue); Label_03D4: if (!this.IsNull(records[num4])) { num++; } num4++; Label_03EA: if (num4 < records.Length) { goto Label_03D4; } return(num); } catch (OverflowException) { throw ExprException.Overflow(typeof(SqlDecimal)); } Label_040F: throw ExceptionBuilder.AggregateException(kind, base.DataType); }
override public Object Aggregate(int[] records, AggregateType kind) { bool hasData = false; try { switch (kind) { case AggregateType.Min: DateTimeOffset min = DateTimeOffset.MaxValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (HasValue(record)) { min = (DateTimeOffset.Compare(values[record], min) < 0) ? values[record] : min; hasData = true; } } if (hasData) { return(min); } return(NullValue); case AggregateType.Max: DateTimeOffset max = DateTimeOffset.MinValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (HasValue(record)) { max = (DateTimeOffset.Compare(values[record], max) >= 0) ? values[record] : max; hasData = true; } } if (hasData) { return(max); } return(NullValue); case AggregateType.First: if (records.Length > 0) { return(values[records[0]]); } return(null); case AggregateType.Count: int count = 0; for (int i = 0; i < records.Length; i++) { if (HasValue(records[i])) { count++; } } return(count); } } catch (OverflowException) { throw ExprException.Overflow(typeof(DateTimeOffset)); } throw ExceptionBuilder.AggregateException(kind, DataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool hasData = false; try { switch (kind) { case AggregateType.Sum: long sum = defaultValue; foreach (int record in records) { if (HasValue(record)) { checked { sum += _values[record]; } hasData = true; } } if (hasData) { return sum; } return _nullValue; case AggregateType.Mean: decimal meanSum = defaultValue; int meanCount = 0; foreach (int record in records) { if (HasValue(record)) { checked { meanSum += _values[record]; } meanCount++; hasData = true; } } if (hasData) { long mean; checked { mean = (long)(meanSum / (decimal)meanCount); } return mean; } return _nullValue; case AggregateType.Var: case AggregateType.StDev: int count = 0; double var = 0.0f; double prec = 0.0f; double dsum = 0.0f; double sqrsum = 0.0f; foreach (int record in records) { if (HasValue(record)) { dsum += _values[record]; sqrsum += _values[record] * (double)_values[record]; count++; } } if (count > 1) { var = count * sqrsum - (dsum * dsum); prec = var / (dsum * dsum); // we are dealing with the risk of a cancellation error // double is guaranteed only for 15 digits so a difference // with a result less than 1e-15 should be considered as zero if ((prec < 1e-15) || (var < 0)) var = 0; else var = var / (count * (count - 1)); if (kind == AggregateType.StDev) { return Math.Sqrt(var); } return var; } return _nullValue; case AggregateType.Min: long min = long.MaxValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (HasValue(record)) { min = Math.Min(_values[record], min); hasData = true; } } if (hasData) { return min; } return _nullValue; case AggregateType.Max: long max = long.MinValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (HasValue(record)) { max = Math.Max(_values[record], max); hasData = true; } } if (hasData) { return max; } return _nullValue; case AggregateType.First: if (records.Length > 0) { return _values[records[0]]; } return null; case AggregateType.Count: return base.Aggregate(records, kind); } } catch (OverflowException) { throw ExprException.Overflow(typeof(long)); } throw ExceptionBuilder.AggregateException(kind, _dataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool flag = false; try { int num; int num2; bool flag2; bool flag3; int num3; int num4; switch (kind) { case AggregateType.Min: flag3 = true; num2 = 0; goto Label_0051; case AggregateType.Max: flag2 = false; num = 0; goto Label_00A1; case AggregateType.First: if (records.Length <= 0) { return(null); } return(this.values[records[0]]); case AggregateType.Count: return(base.Aggregate(records, kind)); default: goto Label_00F9; } Label_002A: num4 = records[num2]; if (!this.IsNull(num4)) { flag3 = this.values[num4] && flag3; flag = true; } num2++; Label_0051: if (num2 < records.Length) { goto Label_002A; } if (flag) { return(flag3); } return(base.NullValue); Label_007A: num3 = records[num]; if (!this.IsNull(num3)) { flag2 = this.values[num3] || flag2; flag = true; } num++; Label_00A1: if (num < records.Length) { goto Label_007A; } if (flag) { return(flag2); } return(base.NullValue); } catch (OverflowException) { throw ExprException.Overflow(typeof(bool)); } Label_00F9: throw ExceptionBuilder.AggregateException(kind, base.DataType); }
override public Object Aggregate(int[] records, AggregateType kind) { bool hasData = false; try { switch (kind) { case AggregateType.Min: SqlBoolean min = true; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (IsNull(record)) { continue; } min = SqlBoolean.And(values[record], min); hasData = true; } if (hasData) { return(min); } return(NullValue); case AggregateType.Max: SqlBoolean max = false; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (IsNull(record)) { continue; } max = SqlBoolean.Or(values[record], max); hasData = true; } if (hasData) { return(max); } return(NullValue); case AggregateType.First: if (records.Length > 0) { return(values[records[0]]); } return(NullValue); case AggregateType.Count: int count = 0; for (int i = 0; i < records.Length; i++) { if (!IsNull(records[i])) { count++; } } return(count); } } catch (OverflowException) { throw ExprException.Overflow(typeof(SqlBoolean)); } throw ExceptionBuilder.AggregateException(kind, DataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool flag = false; try { double num; double num2; int num3; int num4; int num5; int num6; int num7; int num8; int num9; float minValue; float maxValue; double num12; int num13; double num14; float num15; int num16; int num17; int[] numArray; double num18; int num19; int[] numArray2; int num20; int[] numArray3; switch (kind) { case AggregateType.Sum: num15 = 0f; numArray3 = records; num9 = 0; goto Label_0069; case AggregateType.Mean: num14 = 0.0; num13 = 0; numArray2 = records; num8 = 0; goto Label_00D1; case AggregateType.Min: maxValue = float.MaxValue; num5 = 0; goto Label_022A; case AggregateType.Max: minValue = float.MinValue; num4 = 0; goto Label_0283; case AggregateType.First: if (records.Length <= 0) { return(null); } return(this.values[records[0]]); case AggregateType.Count: return(base.Aggregate(records, kind)); case AggregateType.Var: case AggregateType.StDev: num3 = 0; num = 0.0; num18 = 0.0; num2 = 0.0; num12 = 0.0; numArray = records; num7 = 0; goto Label_0177; default: goto Label_02DC; } Label_0042: num20 = numArray3[num9]; if (!this.IsNull(num20)) { num15 += this.values[num20]; flag = true; } num9++; Label_0069: if (num9 < numArray3.Length) { goto Label_0042; } if (flag) { return(num15); } return(base.NullValue); Label_00A3: num19 = numArray2[num8]; if (!this.IsNull(num19)) { num14 += this.values[num19]; num13++; flag = true; } num8++; Label_00D1: if (num8 < numArray2.Length) { goto Label_00A3; } if (flag) { return((float)(num14 / ((double)num13))); } return(base.NullValue); Label_0133: num6 = numArray[num7]; if (!this.IsNull(num6)) { num2 += this.values[num6]; num12 += this.values[num6] * this.values[num6]; num3++; } num7++; Label_0177: if (num7 < numArray.Length) { goto Label_0133; } if (num3 <= 1) { return(base.NullValue); } num = (num3 * num12) - (num2 * num2); num18 = num / (num2 * num2); if ((num18 < 1E-15) || (num < 0.0)) { num = 0.0; } else { num /= (double)(num3 * (num3 - 1)); } if (kind == AggregateType.StDev) { return(Math.Sqrt(num)); } return(num); Label_0200: num17 = records[num5]; if (!this.IsNull(num17)) { maxValue = Math.Min(this.values[num17], maxValue); flag = true; } num5++; Label_022A: if (num5 < records.Length) { goto Label_0200; } if (flag) { return(maxValue); } return(base.NullValue); Label_0259: num16 = records[num4]; if (!this.IsNull(num16)) { minValue = Math.Max(this.values[num16], minValue); flag = true; } num4++; Label_0283: if (num4 < records.Length) { goto Label_0259; } if (flag) { return(minValue); } return(base.NullValue); } catch (OverflowException) { throw ExprException.Overflow(typeof(float)); } Label_02DC: throw ExceptionBuilder.AggregateException(kind, base.DataType); }
override public Object Aggregate(int[] records, AggregateType kind) { bool hasData = false; try { switch (kind) { case AggregateType.Sum: UInt64 sum = defaultValue; foreach (int record in records) { if (HasValue(record)) { checked { sum += (UInt64)values[record]; } hasData = true; } } if (hasData) { return(sum); } return(NullValue); case AggregateType.Mean: Int64 meanSum = (Int64)defaultValue; int meanCount = 0; foreach (int record in records) { if (HasValue(record)) { checked { meanSum += (Int64)values[record]; } meanCount++; hasData = true; } } if (hasData) { UInt32 mean; checked { mean = (UInt32)(meanSum / meanCount); } return(mean); } return(NullValue); case AggregateType.Var: case AggregateType.StDev: int count = 0; double var = 0.0f; double prec = 0.0f; double dsum = 0.0f; double sqrsum = 0.0f; foreach (int record in records) { if (HasValue(record)) { dsum += (double)values[record]; sqrsum += (double)values[record] * (double)values[record]; count++; } } if (count > 1) { var = ((double)count * sqrsum - (dsum * dsum)); prec = var / (dsum * dsum); // we are dealing with the risk of a cancellation error // double is guaranteed only for 15 digits so a difference // with a result less than 1e-15 should be considered as zero if ((prec < 1e-15) || (var < 0)) { var = 0; } else { var = var / (count * (count - 1)); } if (kind == AggregateType.StDev) { return(Math.Sqrt(var)); } return(var); } return(NullValue); case AggregateType.Min: UInt32 min = UInt32.MaxValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (HasValue(record)) { min = Math.Min(values[record], min); hasData = true; } } if (hasData) { return(min); } return(NullValue); case AggregateType.Max: UInt32 max = UInt32.MinValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (HasValue(record)) { max = Math.Max(values[record], max); hasData = true; } } if (hasData) { return(max); } return(NullValue); case AggregateType.First: if (records.Length > 0) { return(values[records[0]]); } return(null); case AggregateType.Count: count = 0; for (int i = 0; i < records.Length; i++) { if (HasValue(records[i])) { count++; } } return(count); } } catch (OverflowException) { throw ExprException.Overflow(typeof(UInt32)); } throw ExceptionBuilder.AggregateException(kind, DataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool flag = false; try { double num; double num2; int num3; int num4; int num5; int num6; int num7; int num8; int num9; ulong num10; ulong maxValue; double num12; int num13; decimal num14; ulong defaultValue; int num16; int num17; int[] numArray; double num18; int num19; int[] numArray2; int num20; int[] numArray3; switch (kind) { case AggregateType.Sum: defaultValue = UInt64Storage.defaultValue; numArray3 = records; num9 = 0; goto Label_0069; case AggregateType.Mean: num14 = UInt64Storage.defaultValue; num13 = 0; numArray2 = records; num8 = 0; goto Label_00DA; case AggregateType.Min: maxValue = ulong.MaxValue; num5 = 0; goto Label_023F; case AggregateType.Max: num10 = 0L; num4 = 0; goto Label_0295; case AggregateType.First: if (records.Length <= 0) { return(null); } return(this.values[records[0]]); case AggregateType.Count: return(base.Aggregate(records, kind)); case AggregateType.Var: case AggregateType.StDev: num3 = 0; num = 0.0; num18 = 0.0; num2 = 0.0; num12 = 0.0; numArray = records; num7 = 0; goto Label_018F; default: goto Label_02EE; } Label_0042: num20 = numArray3[num9]; if (base.HasValue(num20)) { defaultValue += this.values[num20]; flag = true; } num9++; Label_0069: if (num9 < numArray3.Length) { goto Label_0042; } if (flag) { return(defaultValue); } return(base.NullValue); Label_00A4: num19 = numArray2[num8]; if (base.HasValue(num19)) { num14 += this.values[num19]; num13++; flag = true; } num8++; Label_00DA: if (num8 < numArray2.Length) { goto Label_00A4; } if (flag) { return((ulong)(num14 / num13)); } return(base.NullValue); Label_0148: num6 = numArray[num7]; if (base.HasValue(num6)) { num2 += this.values[num6]; num12 += this.values[num6] * this.values[num6]; num3++; } num7++; Label_018F: if (num7 < numArray.Length) { goto Label_0148; } if (num3 <= 1) { return(base.NullValue); } num = (num3 * num12) - (num2 * num2); num18 = num / (num2 * num2); if ((num18 < 1E-15) || (num < 0.0)) { num = 0.0; } else { num /= (double)(num3 * (num3 - 1)); } if (kind == AggregateType.StDev) { return(Math.Sqrt(num)); } return(num); Label_0215: num17 = records[num5]; if (base.HasValue(num17)) { maxValue = Math.Min(this.values[num17], maxValue); flag = true; } num5++; Label_023F: if (num5 < records.Length) { goto Label_0215; } if (flag) { return(maxValue); } return(base.NullValue); Label_026B: num16 = records[num4]; if (base.HasValue(num16)) { num10 = Math.Max(this.values[num16], num10); flag = true; } num4++; Label_0295: if (num4 < records.Length) { goto Label_026B; } if (flag) { return(num10); } return(base.NullValue); } catch (OverflowException) { throw ExprException.Overflow(typeof(ulong)); } Label_02EE: throw ExceptionBuilder.AggregateException(kind, base.DataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool hasData = false; try { switch (kind) { case AggregateType.Sum: long sum = defaultValue; foreach (int record in records) { if (IsNull(record)) { continue; } checked { sum += _values[record]; } hasData = true; } if (hasData) { return(sum); } return(_nullValue); case AggregateType.Mean: long meanSum = defaultValue; int meanCount = 0; foreach (int record in records) { if (IsNull(record)) { continue; } checked { meanSum += _values[record]; } meanCount++; hasData = true; } if (hasData) { sbyte mean; checked { mean = (sbyte)(meanSum / meanCount); } return(mean); } return(_nullValue); case AggregateType.Var: case AggregateType.StDev: int count = 0; double var = defaultValue; double prec = defaultValue; double dsum = defaultValue; double sqrsum = defaultValue; foreach (int record in records) { if (IsNull(record)) { continue; } dsum += _values[record]; sqrsum += _values[record] * (double)_values[record]; count++; } if (count > 1) { var = count * sqrsum - (dsum * dsum); prec = var / (dsum * dsum); // we are dealing with the risk of a cancellation error // double is guaranteed only for 15 digits so a difference // with a result less than 1e-15 should be considered as zero if ((prec < 1e-15) || (var < 0)) { var = 0; } else { var = var / (count * (count - 1)); } if (kind == AggregateType.StDev) { return(Math.Sqrt(var)); } return(var); } return(_nullValue); case AggregateType.Min: sbyte min = sbyte.MaxValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (IsNull(record)) { continue; } min = Math.Min(_values[record], min); hasData = true; } if (hasData) { return(min); } return(_nullValue); case AggregateType.Max: sbyte max = sbyte.MinValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (IsNull(record)) { continue; } max = Math.Max(_values[record], max); hasData = true; } if (hasData) { return(max); } return(_nullValue); case AggregateType.First: // Does not seem to be implemented if (records.Length > 0) { return(_values[records[0]]); } return(null !); case AggregateType.Count: return(base.Aggregate(records, kind)); } } catch (OverflowException) { throw ExprException.Overflow(typeof(sbyte)); } throw ExceptionBuilder.AggregateException(kind, _dataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool flag = false; try { int num; double num2; double num3; int num4; int num5; int num6; int num7; int num8; int num9; int num10; int num11; int num12; double num13; int num14; long num15; long num16; int num17; int num18; int[] numArray; double num19; int num20; int[] numArray2; int num21; int[] numArray3; switch (kind) { case AggregateType.Sum: num16 = 0L; numArray3 = records; num10 = 0; goto Label_0067; case AggregateType.Mean: num15 = 0L; num14 = 0; numArray2 = records; num9 = 0; goto Label_00C8; case AggregateType.Min: num12 = 0x7fffffff; num6 = 0; goto Label_0221; case AggregateType.Max: num11 = -2147483648; num5 = 0; goto Label_027A; case AggregateType.First: if (records.Length <= 0) { return(null); } return(this.values[records[0]]); case AggregateType.Count: num = 0; num4 = 0; goto Label_02D3; case AggregateType.Var: case AggregateType.StDev: num = 0; num2 = 0.0; num19 = 0.0; num3 = 0.0; num13 = 0.0; numArray = records; num8 = 0; goto Label_016E; default: goto Label_02F8; } Label_003F: num21 = numArray3[num10]; if (base.HasValue(num21)) { num16 += this.values[num21]; flag = true; } num10++; Label_0067: if (num10 < numArray3.Length) { goto Label_003F; } if (flag) { return(num16); } return(base.NullValue); Label_009A: num20 = numArray2[num9]; if (base.HasValue(num20)) { num15 += this.values[num20]; num14++; flag = true; } num9++; Label_00C8: if (num9 < numArray2.Length) { goto Label_009A; } if (flag) { return((int)(num15 / ((long)num14))); } return(base.NullValue); Label_012A: num7 = numArray[num8]; if (base.HasValue(num7)) { num3 += this.values[num7]; num13 += this.values[num7] * this.values[num7]; num++; } num8++; Label_016E: if (num8 < numArray.Length) { goto Label_012A; } if (num <= 1) { return(base.NullValue); } num2 = (num * num13) - (num3 * num3); num19 = num2 / (num3 * num3); if ((num19 < 1E-15) || (num2 < 0.0)) { num2 = 0.0; } else { num2 /= (double)(num * (num - 1)); } if (kind == AggregateType.StDev) { return(Math.Sqrt(num2)); } return(num2); Label_01F7: num18 = records[num6]; if (base.HasValue(num18)) { num12 = Math.Min(this.values[num18], num12); flag = true; } num6++; Label_0221: if (num6 < records.Length) { goto Label_01F7; } if (flag) { return(num12); } return(base.NullValue); Label_0250: num17 = records[num5]; if (base.HasValue(num17)) { num11 = Math.Max(this.values[num17], num11); flag = true; } num5++; Label_027A: if (num5 < records.Length) { goto Label_0250; } if (flag) { return(num11); } return(base.NullValue); Label_02BD: if (base.HasValue(records[num4])) { num++; } num4++; Label_02D3: if (num4 < records.Length) { goto Label_02BD; } return(num); } catch (OverflowException) { throw ExprException.Overflow(typeof(int)); } Label_02F8: throw ExceptionBuilder.AggregateException(kind, base.DataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool flag = false; try { double num; double num2; int num3; int num4; int num5; int num6; int num7; int num8; int num9; decimal num10; decimal num11; double num12; int num13; decimal num14; decimal defaultValue; int num16; int num17; int[] numArray; double num18; int num19; int[] numArray2; int num20; int[] numArray3; switch (kind) { case AggregateType.Sum: defaultValue = DecimalStorage.defaultValue; numArray3 = records; num9 = 0; goto Label_0076; case AggregateType.Mean: num14 = DecimalStorage.defaultValue; num13 = 0; numArray2 = records; num8 = 0; goto Label_00E6; case AggregateType.Min: num11 = 79228162514264337593543950335M; num5 = 0; goto Label_0286; case AggregateType.Max: num10 = -79228162514264337593543950335M; num4 = 0; goto Label_02F1; case AggregateType.First: if (records.Length <= 0) { return(null); } return(this.values[records[0]]); case AggregateType.Count: return(base.Aggregate(records, kind)); case AggregateType.Var: case AggregateType.StDev: num3 = 0; num = (double)DecimalStorage.defaultValue; num18 = (double)DecimalStorage.defaultValue; num2 = (double)DecimalStorage.defaultValue; num12 = (double)DecimalStorage.defaultValue; numArray = records; num7 = 0; goto Label_01C5; default: goto Label_0353; } Label_0042: num20 = numArray3[num9]; if (base.HasValue(num20)) { defaultValue += this.values[num20]; flag = true; } num9++; Label_0076: if (num9 < numArray3.Length) { goto Label_0042; } if (flag) { return(defaultValue); } return(base.NullValue); Label_00AC: num19 = numArray2[num8]; if (base.HasValue(num19)) { num14 += this.values[num19]; num13++; flag = true; } num8++; Label_00E6: if (num8 < numArray2.Length) { goto Label_00AC; } if (flag) { return(num14 / num13); } return(base.NullValue); Label_0157: num6 = numArray[num7]; if (base.HasValue(num6)) { num2 += (double)this.values[num6]; num12 += ((double)this.values[num6]) * ((double)this.values[num6]); num3++; } num7++; Label_01C5: if (num7 < numArray.Length) { goto Label_0157; } if (num3 <= 1) { return(base.NullValue); } num = (num3 * num12) - (num2 * num2); num18 = num / (num2 * num2); if ((num18 < 1E-15) || (num < 0.0)) { num = 0.0; } else { num /= (double)(num3 * (num3 - 1)); } if (kind == AggregateType.StDev) { return(Math.Sqrt(num)); } return(num); Label_0253: num17 = records[num5]; if (base.HasValue(num17)) { num11 = Math.Min(this.values[num17], num11); flag = true; } num5++; Label_0286: if (num5 < records.Length) { goto Label_0253; } if (flag) { return(num11); } return(base.NullValue); Label_02BE: num16 = records[num4]; if (base.HasValue(num16)) { num10 = Math.Max(this.values[num16], num10); flag = true; } num4++; Label_02F1: if (num4 < records.Length) { goto Label_02BE; } if (flag) { return(num10); } return(base.NullValue); } catch (OverflowException) { throw ExprException.Overflow(typeof(decimal)); } Label_0353: throw ExceptionBuilder.AggregateException(kind, base.DataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool flag = false; try { double num; double num2; int num3; int num4; int num5; int num6; int num7; int num8; int num9; byte num10; byte num11; double num12; int num13; long num14; ulong num15; int num16; int num17; int[] numArray; double num18; int num19; int[] numArray2; int num20; int[] numArray3; switch (kind) { case AggregateType.Sum: num15 = 0L; numArray3 = records; num9 = 0; goto Label_0067; case AggregateType.Mean: num14 = 0L; num13 = 0; numArray2 = records; num8 = 0; goto Label_00C8; case AggregateType.Min: num11 = 0xff; num5 = 0; goto Label_0221; case AggregateType.Max: num10 = 0; num4 = 0; goto Label_0276; case AggregateType.First: if (records.Length <= 0) { return(null); } return(this.values[records[0]]); case AggregateType.Count: return(base.Aggregate(records, kind)); case AggregateType.Var: case AggregateType.StDev: num3 = 0; num = 0.0; num18 = 0.0; num2 = 0.0; num12 = 0.0; numArray = records; num7 = 0; goto Label_016E; default: goto Label_02CF; } Label_003F: num20 = numArray3[num9]; if (!this.IsNull(num20)) { num15 += this.values[num20]; flag = true; } num9++; Label_0067: if (num9 < numArray3.Length) { goto Label_003F; } if (flag) { return(num15); } return(base.NullValue); Label_009A: num19 = numArray2[num8]; if (!this.IsNull(num19)) { num14 += this.values[num19]; num13++; flag = true; } num8++; Label_00C8: if (num8 < numArray2.Length) { goto Label_009A; } if (flag) { return((byte)(num14 / ((long)num13))); } return(base.NullValue); Label_012A: num6 = numArray[num7]; if (!this.IsNull(num6)) { num2 += this.values[num6]; num12 += this.values[num6] * this.values[num6]; num3++; } num7++; Label_016E: if (num7 < numArray.Length) { goto Label_012A; } if (num3 <= 1) { return(base.NullValue); } num = (num3 * num12) - (num2 * num2); num18 = num / (num2 * num2); if ((num18 < 1E-15) || (num < 0.0)) { num = 0.0; } else { num /= (double)(num3 * (num3 - 1)); } if (kind == AggregateType.StDev) { return(Math.Sqrt(num)); } return(num); Label_01F7: num17 = records[num5]; if (!this.IsNull(num17)) { num11 = Math.Min(this.values[num17], num11); flag = true; } num5++; Label_0221: if (num5 < records.Length) { goto Label_01F7; } if (flag) { return(num11); } return(base.NullValue); Label_024C: num16 = records[num4]; if (!this.IsNull(num16)) { num10 = Math.Max(this.values[num16], num10); flag = true; } num4++; Label_0276: if (num4 < records.Length) { goto Label_024C; } if (flag) { return(num10); } return(base.NullValue); } catch (OverflowException) { throw ExprException.Overflow(typeof(byte)); } Label_02CF: throw ExceptionBuilder.AggregateException(kind, base.DataType); }