internal override void Populate(string property) { base.Populate(property); InputVariable.Populate(property); OptionalContext.Populate(property); }
public override WTableReference ToTableReference() { WSelectQueryBlock firstQueryExpr = new WSelectQueryBlock(); foreach (var projectProperty in ProjectedProperties) { if (projectProperty == GremlinKeyword.TableDefaultColumnName) { firstQueryExpr.SelectElements.Add(SqlUtil.GetSelectScalarExpr(InputVariable.GetDefaultProjection().ToScalarExpression(), GremlinKeyword.TableDefaultColumnName)); } else if (InputVariable.ProjectedProperties.Contains(projectProperty)) { firstQueryExpr.SelectElements.Add( SqlUtil.GetSelectScalarExpr( InputVariable.GetVariableProperty(projectProperty).ToScalarExpression(), projectProperty)); } else { firstQueryExpr.SelectElements.Add( SqlUtil.GetSelectScalarExpr(SqlUtil.GetValueExpr(null), projectProperty)); } } WSelectQueryBlock secondQueryExpr = OptionalContext.ToSelectQueryBlock(); bool HasAggregateFunctionAsChildren = false; foreach (var variable in OptionalContext.TableReferences) { if (variable is GremlinFoldVariable || variable is GremlinCountVariable || variable is GremlinMinVariable || variable is GremlinMaxVariable || variable is GremlinSumVariable || variable is GremlinMeanVariable || variable is GremlinTreeVariable) { HasAggregateFunctionAsChildren = true; } var group = variable as GremlinGroupVariable; if (group != null && group.SideEffectKey == null) { HasAggregateFunctionAsChildren = true; } } var WBinaryQueryExpression = SqlUtil.GetBinaryQueryExpr(firstQueryExpr, secondQueryExpr); List <WScalarExpression> parameters = new List <WScalarExpression>(); parameters.Add(SqlUtil.GetScalarSubquery(WBinaryQueryExpression)); var tableRef = SqlUtil.GetFunctionTableReference(GremlinKeyword.func.Optional, parameters, GetVariableName()); ((WOptionalTableReference)tableRef).HasAggregateFunctionAsChildren = HasAggregateFunctionAsChildren; return(SqlUtil.GetCrossApplyTableReference(tableRef)); }
internal override void PopulateLocalPath() { if (ProjectedProperties.Contains(GremlinKeyword.Path)) { return; } ProjectedProperties.Add(GremlinKeyword.Path); OptionalContext.PopulateLocalPath(); }
internal override List <GremlinVariable> FetchAllTableVars() { List <GremlinVariable> variableList = new List <GremlinVariable>() { this }; variableList.AddRange(OptionalContext.FetchAllTableVars()); return(variableList); }
internal override void Populate(string property) { if (ProjectedProperties.Contains(property)) { return; } base.Populate(property); InputVariable.Populate(property); OptionalContext.Populate(property); }
public override WTableReference ToTableReference() { WSelectQueryBlock firstQueryExpr = new WSelectQueryBlock(); foreach (var projectProperty in ProjectedProperties) { if (projectProperty == GremlinKeyword.TableDefaultColumnName) { firstQueryExpr.SelectElements.Add(SqlUtil.GetSelectScalarExpr(InputVariable.DefaultProjection().ToScalarExpression(), GremlinKeyword.TableDefaultColumnName)); } else if (InputVariable.ProjectedProperties.Contains(projectProperty)) { firstQueryExpr.SelectElements.Add( SqlUtil.GetSelectScalarExpr( InputVariable.GetVariableProperty(projectProperty).ToScalarExpression(), projectProperty)); } else { firstQueryExpr.SelectElements.Add( SqlUtil.GetSelectScalarExpr(SqlUtil.GetValueExpr(null), projectProperty)); } } if (OptionalContext.IsPopulateGremlinPath) { firstQueryExpr.SelectElements.Add(SqlUtil.GetSelectScalarExpr(SqlUtil.GetValueExpr(null), GremlinKeyword.Path)); } WSelectQueryBlock secondQueryExpr = OptionalContext.ToSelectQueryBlock(ProjectedProperties); var WBinaryQueryExpression = SqlUtil.GetBinaryQueryExpr(firstQueryExpr, secondQueryExpr); List <WScalarExpression> parameters = new List <WScalarExpression>(); parameters.Add(SqlUtil.GetScalarSubquery(WBinaryQueryExpression)); var tableRef = SqlUtil.GetFunctionTableReference(GremlinKeyword.func.Optional, parameters, GetVariableName()); return(SqlUtil.GetCrossApplyTableReference(tableRef)); }
internal override void PopulateGremlinPath() { OptionalContext.PopulateGremlinPath(); }
internal override List <GremlinVariable> FetchVarsFromCurrAndChildContext() { return(OptionalContext.FetchVarsFromCurrAndChildContext()); }
internal override List <GremlinVariable> PopulateAllTaggedVariable(string label) { return(OptionalContext.SelectVarsFromCurrAndChildContext(label)); }
internal override GremlinPathStepVariable GetAndPopulatePath() { GremlinPathVariable pathVariable = OptionalContext.PopulateGremlinPath(); return(new GremlinPathStepVariable(pathVariable, this)); }