本文整理汇总了Java中com.facebook.presto.sql.tree.LambdaExpression类的典型用法代码示例。如果您正苦于以下问题:Java LambdaExpression类的具体用法?Java LambdaExpression怎么用?Java LambdaExpression使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LambdaExpression类属于com.facebook.presto.sql.tree包,在下文中一共展示了LambdaExpression类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitLambdaExpression
import com.facebook.presto.sql.tree.LambdaExpression; //导入依赖的package包/类
@Override
protected String visitLambdaExpression(LambdaExpression node, StackableAstVisitorContext<Integer> indent)
{
StringBuilder builder = new StringBuilder();
builder.append('(');
Joiner.on(", ").appendTo(builder, node.getArguments());
builder.append(") -> ");
builder.append(process(node.getBody(), indent));
return builder.toString();
}
示例2: visitLambda
import com.facebook.presto.sql.tree.LambdaExpression; //导入依赖的package包/类
@Override
public Node visitLambda(SqlBaseParser.LambdaContext context)
{
List<String> arguments = context.identifier().stream()
.map(SqlBaseParser.IdentifierContext::getText)
.collect(toList());
Expression body = (Expression) visit(context.expression());
return new LambdaExpression(arguments, body);
}
示例3: visitLambdaExpression
import com.facebook.presto.sql.tree.LambdaExpression; //导入依赖的package包/类
@Override
protected String visitLambdaExpression(LambdaExpression node, Boolean unmangleNames)
{
StringBuilder builder = new StringBuilder();
builder.append('(');
Joiner.on(", ").appendTo(builder, node.getArguments());
builder.append(") -> ");
builder.append(process(node.getBody(), unmangleNames));
return builder.toString();
}
示例4: testLambda
import com.facebook.presto.sql.tree.LambdaExpression; //导入依赖的package包/类
@Test
public void testLambda()
throws Exception
{
assertExpression("x -> sin(x)",
new LambdaExpression(
ImmutableList.of("x"),
new FunctionCall(QualifiedName.of("sin"), ImmutableList.of(new QualifiedNameReference(QualifiedName.of("x"))))));
assertExpression("(x, y) -> mod(x, y)",
new LambdaExpression(
ImmutableList.of("x", "y"),
new FunctionCall(
QualifiedName.of("mod"),
ImmutableList.of(new QualifiedNameReference(QualifiedName.of("x")), new QualifiedNameReference(QualifiedName.of("y"))))));
}