internal GroupByChainer(Chainer prev, GroupingArgument[] columns)
            : base(prev)
        {
            Query.Clause.GroupBy = this;

            CheckNullOrEmptyAndThrow(Argc(() => columns, columns));

            Query.AddArguments(columns);

            Build = (buildContext, buildArgs) =>
            {
                var sql = Text.GenerateSql(100)
                          .NewLine(Text.GroupBy).S()
                          .Append(GroupingArgument.Concatenate(columns, buildContext, buildArgs, false));

                if (IsWithCube == true)
                {
                    sql.NewLine(Text.WithCube);
                }
                else if (IsWithCube == false)
                {
                    sql.NewLine(Text.WithRollup);
                }

                TryThrow(buildContext);

                return(sql.ToString());
            };
        }
        internal RankingPartitionByChainer(Chainer prev, GroupingArgument[] columns)
            : base(prev)
        {
            Build = (buildContext, buildArgs) =>
            {
                var sql = Text.GenerateSql(30)
                          .Append(Text.PartitionBy).S()
                          .Append(GroupingArgument.Concatenate(columns, buildContext, buildArgs, false)).S()
                          .ToString();

                TryThrow(buildContext);

                return(sql);
            };
        }
        internal GroupByChainer(ISemantic prev, GroupingArgument[] columns)
            : base(prev.Translate(new SemqContext(((DbNode)prev).Root), null))
        {
            Query.Clause.GroupBy = this;

            CheckNullOrEmptyAndThrow(Argc(() => columns, columns));

            Query.AddArguments(columns);

            Build = (buildContext, buildArgs) =>
            {
                var sql = Text.GenerateSql(100)
                          .NewLine(Text.GroupBy).S()
                          .Append(GroupingArgument.Concatenate(columns, buildContext, buildArgs, false))
                          .ToString();

                TryThrow(buildContext);

                return(sql);
            };
        }