本文整理汇总了C#中ExpressionVisitor.ToNodes方法的典型用法代码示例。如果您正苦于以下问题:C# ExpressionVisitor.ToNodes方法的具体用法?C# ExpressionVisitor.ToNodes怎么用?C# ExpressionVisitor.ToNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExpressionVisitor
的用法示例。
在下文中一共展示了ExpressionVisitor.ToNodes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderPartitionedAggregatePlan
public static PartitionedAggregatePlan RenderPartitionedAggregatePlan(Workspace Home, HScriptParser.Crudam_aggregateContext context)
{
// Get the data source //
DataSet data = VisitorHelper.GetData(Home, context.full_table_name());
string alias =
(context.K_AS() != null)
? context.IDENTIFIER().GetText()
: data.Name;
// Create a register //
StaticRegister memory = new StaticRegister(null);
// Create expression visitor //
ExpressionVisitor exp_vis = new ExpressionVisitor(null, Home, alias, data.Columns, memory);
// Get where //
Predicate where = VisitorHelper.GetWhere(exp_vis, context.where_clause());
// Get the reader //
//RecordReader reader = data.OpenReader(where);
// Get the keys //
FNodeSet keys =
(context.K_BY() != null)
? exp_vis.ToNodes(context.expression_alias_list())
: new FNodeSet();
// Get the reducers //
AggregateSet values =
(context.K_OVER() != null)
? exp_vis.ToReducers(context.beta_reduction_list())
: new AggregateSet();
// Create a second register for the return memory //
StaticRegister return_memory = new StaticRegister(null);
// Need to build a visitor off of the aggregator schema //
ExpressionVisitor agg_vis = new ExpressionVisitor(null, Home, "agg", AggregatePlan.GetInterimSchema(keys, values), return_memory);
// Get the output //
FNodeSet return_vars = VisitorHelper.GetReturnStatement(agg_vis, context.return_action().expression_or_wildcard_set());
// Get the output cursor //
RecordWriter out_put_writter = VisitorHelper.GetWriter(Home, return_vars.Columns, context.return_action());
// Get the partitioner //
int Partitions = VisitorHelper.GetPartitions(exp_vis, context.partitions());
return new PartitionedAggregatePlan(out_put_writter, data, where, keys, values, return_vars, Home.TempSpace, Partitions);
}
示例2: ParseFNodeSet
public static FNodeSet ParseFNodeSet(string Text, MemoryStruct LocalHeap, Workspace Home, string Alias, Schema Columns, Register Memory)
{
// Build text stream //
AntlrInputStream ais = new AntlrInputStream(Text);
HScriptLexer lex = new HScriptLexer(ais);
// Build token tree //
CommonTokenStream cts = new CommonTokenStream(lex);
HScriptParser par = new HScriptParser(cts);
// Build AST //
IParseTree tree = par.expression_alias_list();
if (tree == null)
tree = par.expression_or_wildcard_set();
// Visit each node getting the final node //
ExpressionVisitor v = new ExpressionVisitor(LocalHeap, Home);
v.AddSchema(Alias, Columns, Memory);
if (tree is HScriptParser.Expression_or_wildcard_setContext)
{
HScriptParser.Expression_or_wildcard_setContext a = tree as HScriptParser.Expression_or_wildcard_setContext;
return VisitorHelper.GetReturnStatement(v, a);
}
else if (tree is HScriptParser.Expression_alias_listContext)
{
HScriptParser.Expression_alias_listContext b = tree as HScriptParser.Expression_alias_listContext;
return v.ToNodes(b);
}
throw new Exception("Expression is not an expression set: " + Text);
}