internal JoinBigQueryable(
            IBigQueryable parent,
            InternalJoinType joinType,
            string joinTableName,
            IExecutableBigQueryable <TInner> joinTable,
            IFlattenBigQueryable <TInner> joinFlattenTable,
            Expression <Func <TOuter, TInner, TResult> > aliasSelector,
            Expression <Func <TResult, bool> > joinCondition)
            : base(parent)
        {
            this.joinType         = joinType;
            this.joinTableName    = joinTableName;
            this.joinFlattenTable = joinFlattenTable as FlattenBigQueryable <TInner>;
            var sub = joinTable as SubqueryBigQueryable <TInner>;

            if (sub != null)
            {
                this.joinTable = sub;
            }
            else if (joinTable != null)
            {
                this.joinTable = joinTable.Into() as SubqueryBigQueryable <TInner>;
            }
            this.aliasSelector = aliasSelector;
            this.joinCondition = joinCondition;
        }
Example #2
0
 internal GroupByBigQueryable(IBigQueryable parent, Expression <Func <TSource, TKey> > keySelector, bool each, bool rollup)
     : base(parent)
 {
     this.keySelector = keySelector;
     this.each        = each;
     this.rollup      = rollup;
 }
        public override string BuildQueryString(int depth)
        {
            ITableName    tableName = null;
            IBigQueryable parent    = null;

            if (typedParent is ITableName)
            {
                parent    = (IBigQueryable)typedParent;
                tableName = (ITableName)typedParent;
            }
            else if (typedParent is ITableName)
            {
                parent    = (IBigQueryable)typedParent;
                tableName = (ITableName)typedParent;
            }

            if (tableName != null)
            {
                var sb = new StringBuilder();

                sb.Append(Indent(depth));
                sb.AppendLine("FROM");

                sb.Append(Indent(depth + 1));
                sb.Append("FLATTEN(");
                sb.Append(tableName.GetTableName());

                sb.Append(", ");
                sb.Append(BigQueryTranslateVisitor.BuildQuery(depth, parent.QueryContext.IndentSize, fieldSelector));

                sb.Append(")");

                return(sb.ToString());
            }

            var subquery = typedParent as SubqueryBigQueryable <T>;

            if (subquery != null)
            {
                var sb = new StringBuilder();

                sb.Append(Indent(depth));
                sb.AppendLine("FROM FLATTEN(");

                sb.Append(subquery.BuildQueryStringWithoutFrom(depth));

                sb.Append(", ");
                sb.Append(BigQueryTranslateVisitor.BuildQuery(depth, subquery.QueryContext.IndentSize, fieldSelector));

                sb.Append(")");

                return(sb.ToString());
            }

            throw new InvalidOperationException("Unexpected pattern, please report query to GitHub issues");
        }
Example #4
0
 internal FromDateRangeBigQueryable(string prefix, DateTimeOffset timestampFrom, DateTimeOffset timestampTo, IBigQueryable parent)
     : base(parent)
 {
     this.prefix        = prefix.EscapeBq();
     this.timestampFrom = timestampFrom;
     this.timestampTo   = timestampTo;
 }
Example #5
0
 internal FromBigQueryable(string[] tableNames, IBigQueryable parent)
     : base(parent)
 {
     this.tableNames = tableNames.Select(x => x.EscapeBq()).ToArray();
 }
Example #6
0
 internal FromTableQueryBigQueryable(string dataset, Expression <Func <MetaTable, bool> > tableMatchCondition, IBigQueryable parent)
     : base(parent)
 {
     this.dataset             = dataset.EscapeBq();
     this.tableMatchCondition = tableMatchCondition;
 }
Example #7
0
 protected BigQueryable(IBigQueryable parent)
 {
     this.Parent       = parent;
     this.QueryContext = parent.QueryContext;
 }
Example #8
0
 public ExecutableBigQueryableBase(IBigQueryable parent)
     : base(parent)
 {
 }
Example #9
0
 OrderByBigQueryable(IBigQueryable parent, Tuple <Expression, bool>[] keySelectors)
     : base(parent)
 {
     this.keySelectors = keySelectors;
 }
 internal WhereBigQueryable(IBigQueryable parent, Expression <Func <TSource, bool> > predicate)
     : base(parent)
 {
     this.predicate = predicate;
 }
Example #11
0
 internal OrderByBigQueryable(IBigQueryable parent, Expression <Func <TSource, TKey> > keySelector, bool isDescending)
     : base(parent)
 {
     this.keySelectors = new[] { Tuple.Create <Expression, bool>(keySelector, isDescending) };
 }
Example #12
0
 internal FromDateRangeBigQueryable(string prefix, Expression <Func <DateTimeOffset> > timestampFrom, Expression <Func <DateTimeOffset> > timestampTo, IBigQueryable parent)
     : base(parent)
 {
     this.prefix            = prefix.EscapeBq();
     this.timestampFromExpr = timestampFrom;
     this.timestampToExpr   = timestampTo;
 }
 internal IgnoreCaseBigQueryable(IBigQueryable parent)
     : base(parent)
 {
 }
Example #14
0
 internal LimitBigQueryable(IBigQueryable parent, int numRows)
     : base(parent)
 {
     this.numRows = numRows;
 }
 internal SelectBigQueryable(IBigQueryable parent, Expression <Func <TSource, TResult> > selector)
     : base(parent)
 {
     this.selector = selector;
 }