- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.facebook.presto.sql.tree.WindowFrame
类的一些代码示例,展示了WindowFrame
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WindowFrame
类的具体详情如下:
包路径:com.facebook.presto.sql.tree.WindowFrame
类名称:WindowFrame
暂无
代码示例来源:origin: prestodb/presto
@Override
public String visitWindowFrame(WindowFrame node, Void context)
{
StringBuilder builder = new StringBuilder();
builder.append(node.getType().toString()).append(' ');
if (node.getEnd().isPresent()) {
builder.append("BETWEEN ")
.append(process(node.getStart(), context))
.append(" AND ")
.append(process(node.getEnd().get(), context));
}
else {
builder.append(process(node.getStart(), context));
}
return builder.toString();
}
代码示例来源:origin: prestodb/presto
@Override
public Node visitWindowFrame(SqlBaseParser.WindowFrameContext context)
{
return new WindowFrame(
getLocation(context),
getFrameType(context.frameType),
(FrameBound) visit(context.start),
visitIfPresent(context.end, FrameBound.class));
}
代码示例来源:origin: prestodb/presto
@Override
public String toString()
{
return format("%s%s (%s%s) %s",
distinct ? "DISTINCT" : "",
name,
Joiner.on(", ").join(args),
orderBy.isEmpty() ? "" : " ORDER BY " + Joiner.on(", ").join(orderBy),
frame.isPresent() ? frame.get().toString() : "");
}
代码示例来源:origin: prestodb/presto
@Override
public R visitWindowFrame(WindowFrame node, C context)
{
process(node.getStart(), context);
if (node.getEnd().isPresent()) {
process(node.getEnd().get(), context);
}
return null;
}
代码示例来源:origin: prestodb/presto
@Override
public Boolean visitWindowFrame(WindowFrame node, Void context)
{
Optional<Expression> start = node.getStart().getValue();
if (start.isPresent()) {
if (!process(start.get(), context)) {
throw new SemanticException(MUST_BE_AGGREGATE_OR_GROUP_BY, start.get(), "Window frame start must be an aggregate expression or appear in GROUP BY clause");
}
}
if (node.getEnd().isPresent() && node.getEnd().get().getValue().isPresent()) {
Expression endValue = node.getEnd().get().getValue().get();
if (!process(endValue, context)) {
throw new SemanticException(MUST_BE_AGGREGATE_OR_GROUP_BY, endValue, "Window frame end must be an aggregate expression or appear in GROUP BY clause");
}
}
return true;
}
代码示例来源:origin: prestodb/presto
private void analyzeWindowFrame(WindowFrame frame)
{
FrameBound.Type startType = frame.getStart().getType();
FrameBound.Type endType = frame.getEnd().orElse(new FrameBound(CURRENT_ROW)).getType();
if (startType == UNBOUNDED_FOLLOWING) {
throw new SemanticException(INVALID_WINDOW_FRAME, frame, "Window frame start cannot be UNBOUNDED FOLLOWING");
}
if (endType == UNBOUNDED_PRECEDING) {
throw new SemanticException(INVALID_WINDOW_FRAME, frame, "Window frame end cannot be UNBOUNDED PRECEDING");
}
if ((startType == CURRENT_ROW) && (endType == PRECEDING)) {
throw new SemanticException(INVALID_WINDOW_FRAME, frame, "Window frame starting from CURRENT ROW cannot end with PRECEDING");
}
if ((startType == FOLLOWING) && (endType == PRECEDING)) {
throw new SemanticException(INVALID_WINDOW_FRAME, frame, "Window frame starting from FOLLOWING cannot end with PRECEDING");
}
if ((startType == FOLLOWING) && (endType == CURRENT_ROW)) {
throw new SemanticException(INVALID_WINDOW_FRAME, frame, "Window frame starting from FOLLOWING cannot end with CURRENT ROW");
}
if ((frame.getType() == RANGE) && ((startType == PRECEDING) || (endType == PRECEDING))) {
throw new SemanticException(INVALID_WINDOW_FRAME, frame, "Window frame RANGE PRECEDING is only supported with UNBOUNDED");
}
if ((frame.getType() == RANGE) && ((startType == FOLLOWING) || (endType == FOLLOWING))) {
throw new SemanticException(INVALID_WINDOW_FRAME, frame, "Window frame RANGE FOLLOWING is only supported with UNBOUNDED");
}
}
代码示例来源:origin: prestodb/presto
WindowFrame frame = node.getWindow().get().getFrame().get();
if (frame.getStart().getValue().isPresent()) {
Type type = process(frame.getStart().getValue().get(), context);
if (!type.equals(INTEGER) && !type.equals(BIGINT)) {
throw new SemanticException(TYPE_MISMATCH, node, "Window frame start value type must be INTEGER or BIGINT(actual %s)", type);
if (frame.getEnd().isPresent() && frame.getEnd().get().getValue().isPresent()) {
Type type = process(frame.getEnd().get().getValue().get(), context);
if (!type.equals(INTEGER) && !type.equals(BIGINT)) {
throw new SemanticException(TYPE_MISMATCH, node, "Window frame end value type must be INTEGER or BIGINT (actual %s)", type);
代码示例来源:origin: prestodb/presto
@Test
public void testMergeDifferentFrames()
{
Optional<WindowFrame> frameC = Optional.of(new WindowFrame(
WindowFrame.Type.ROWS,
new FrameBound(FrameBound.Type.UNBOUNDED_PRECEDING),
Optional.of(new FrameBound(FrameBound.Type.CURRENT_ROW))));
ExpectedValueProvider<WindowNode.Specification> specificationC = specification(
ImmutableList.of(SUPPKEY_ALIAS),
ImmutableList.of(ORDERKEY_ALIAS),
ImmutableMap.of(ORDERKEY_ALIAS, SortOrder.ASC_NULLS_LAST));
Optional<WindowFrame> frameD = Optional.of(new WindowFrame(
WindowFrame.Type.ROWS,
new FrameBound(FrameBound.Type.CURRENT_ROW),
Optional.of(new FrameBound(FrameBound.Type.UNBOUNDED_FOLLOWING))));
@Language("SQL") String sql = "SELECT " +
"SUM(quantity) OVER (PARTITION BY suppkey ORDER BY orderkey ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) sum_quantity_C, " +
"AVG(quantity) OVER (PARTITION BY suppkey ORDER BY orderkey ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) avg_quantity_D, " +
"SUM(discount) OVER (PARTITION BY suppkey ORDER BY orderkey ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) sum_discount_C " +
"FROM lineitem";
assertUnitPlan(sql,
anyTree(
window(windowMatcherBuilder -> windowMatcherBuilder
.specification(specificationC)
.addFunction(functionCall("avg", frameD, ImmutableList.of(QUANTITY_ALIAS)))
.addFunction(functionCall("sum", frameC, ImmutableList.of(DISCOUNT_ALIAS)))
.addFunction(functionCall("sum", frameC, ImmutableList.of(QUANTITY_ALIAS))),
LINEITEM_TABLESCAN_DOQS)));
}
代码示例来源:origin: prestodb/presto
frameType = frame.getType();
frameStartType = frame.getStart().getType();
frameStart = frame.getStart().getValue().orElse(null);
if (frame.getEnd().isPresent()) {
frameEndType = frame.getEnd().get().getType();
frameEnd = frame.getEnd().get().getValue().orElse(null);
代码示例来源:origin: uk.co.nichesolutions.presto/presto-parser
@Override
public R visitWindowFrame(WindowFrame node, C context)
{
process(node.getStart(), context);
if (node.getEnd().isPresent()) {
process(node.getEnd().get(), context);
}
return null;
}
代码示例来源:origin: prestodb/presto
@Test
public void testMergeDifferentFramesWithDefault()
{
Optional<WindowFrame> frameD = Optional.of(new WindowFrame(
WindowFrame.Type.ROWS,
new FrameBound(FrameBound.Type.CURRENT_ROW),
Optional.of(new FrameBound(FrameBound.Type.UNBOUNDED_FOLLOWING))));
ExpectedValueProvider<WindowNode.Specification> specificationD = specification(
ImmutableList.of(SUPPKEY_ALIAS),
ImmutableList.of(ORDERKEY_ALIAS),
ImmutableMap.of(ORDERKEY_ALIAS, SortOrder.ASC_NULLS_LAST));
@Language("SQL") String sql = "SELECT " +
"SUM(quantity) OVER (PARTITION BY suppkey ORDER BY orderkey) sum_quantity_C, " +
"AVG(quantity) OVER (PARTITION BY suppkey ORDER BY orderkey ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) avg_quantity_D, " +
"SUM(discount) OVER (PARTITION BY suppkey ORDER BY orderkey) sum_discount_C " +
"FROM lineitem";
assertUnitPlan(sql,
anyTree(
window(windowMatcherBuilder -> windowMatcherBuilder
.specification(specificationD)
.addFunction(functionCall("avg", frameD, ImmutableList.of(QUANTITY_ALIAS)))
.addFunction(functionCall("sum", UNSPECIFIED_FRAME, ImmutableList.of(DISCOUNT_ALIAS)))
.addFunction(functionCall("sum", UNSPECIFIED_FRAME, ImmutableList.of(QUANTITY_ALIAS))),
LINEITEM_TABLESCAN_DOQS)));
}
代码示例来源:origin: rakam-io/rakam
@Override
public String visitWindowFrame(WindowFrame node, Void context) {
StringBuilder builder = new StringBuilder();
builder.append(node.getType().toString()).append(' ');
if (node.getEnd().isPresent()) {
builder.append("BETWEEN ")
.append(process(node.getStart(), context))
.append(" AND ")
.append(process(node.getEnd().get(), context));
} else {
builder.append(process(node.getStart(), context));
}
return builder.toString();
}
代码示例来源:origin: com.facebook.presto/presto-parser
@Override
public R visitWindowFrame(WindowFrame node, C context)
{
process(node.getStart(), context);
if (node.getEnd().isPresent()) {
process(node.getEnd().get(), context);
}
return null;
}
代码示例来源:origin: com.facebook.presto/presto-parser
@Override
public Node visitWindowFrame(SqlBaseParser.WindowFrameContext context)
{
return new WindowFrame(
getLocation(context),
getFrameType(context.frameType),
(FrameBound) visit(context.start),
visitIfPresent(context.end, FrameBound.class));
}
代码示例来源:origin: com.facebook.presto/presto-parser
@Override
public String visitWindowFrame(WindowFrame node, Void context)
{
StringBuilder builder = new StringBuilder();
builder.append(node.getType().toString()).append(' ');
if (node.getEnd().isPresent()) {
builder.append("BETWEEN ")
.append(process(node.getStart(), context))
.append(" AND ")
.append(process(node.getEnd().get(), context));
}
else {
builder.append(process(node.getStart(), context));
}
return builder.toString();
}
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
@Override
public Boolean visitWindowFrame(WindowFrame node, Void context)
{
Optional<Expression> start = node.getStart().getValue();
if (start.isPresent()) {
if (!process(start.get(), context)) {
throw new SemanticException(MUST_BE_AGGREGATE_OR_GROUP_BY, start.get(), "Window frame start must be an aggregate expression or appear in GROUP BY clause");
}
}
if (node.getEnd().isPresent() && node.getEnd().get().getValue().isPresent()) {
Expression endValue = node.getEnd().get().getValue().get();
if (!process(endValue, context)) {
throw new SemanticException(MUST_BE_AGGREGATE_OR_GROUP_BY, endValue, "Window frame end must be an aggregate expression or appear in GROUP BY clause");
}
}
return true;
}
代码示例来源:origin: uk.co.nichesolutions.presto/presto-parser
@Override
public Node visitWindowFrame(SqlBaseParser.WindowFrameContext context)
{
return new WindowFrame(
getLocation(context),
getFrameType(context.frameType),
(FrameBound) visit(context.start),
visitIfPresent(context.end, FrameBound.class));
}
代码示例来源:origin: uk.co.nichesolutions.presto/presto-parser
@Override
public String visitWindowFrame(WindowFrame node, Boolean unmangleNames)
{
StringBuilder builder = new StringBuilder();
builder.append(node.getType().toString()).append(' ');
if (node.getEnd().isPresent()) {
builder.append("BETWEEN ")
.append(process(node.getStart(), unmangleNames))
.append(" AND ")
.append(process(node.getEnd().get(), unmangleNames));
}
else {
builder.append(process(node.getStart(), unmangleNames));
}
return builder.toString();
}
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
WindowFrame frame = node.getWindow().get().getFrame().get();
if (frame.getStart().getValue().isPresent()) {
Type type = process(frame.getStart().getValue().get(), context);
if (!type.equals(BIGINT)) {
throw new SemanticException(TYPE_MISMATCH, node, "Window frame start value type must be BIGINT (actual %s)", type);
if (frame.getEnd().isPresent() && frame.getEnd().get().getValue().isPresent()) {
Type type = process(frame.getEnd().get().getValue().get(), context);
if (!type.equals(BIGINT)) {
throw new SemanticException(TYPE_MISMATCH, node, "Window frame end value type must be BIGINT (actual %s)", type);
代码示例来源:origin: vqtran/EchoQuery
@Override
public String visitWindowFrame(WindowFrame node, Boolean unmangleNames)
{
StringBuilder builder = new StringBuilder();
builder.append(node.getType().toString()).append(' ');
if (node.getEnd().isPresent()) {
builder.append("BETWEEN ")
.append(process(node.getStart(), unmangleNames))
.append(" AND ")
.append(process(node.getEnd().get(), unmangleNames));
}
else {
builder.append(process(node.getStart(), unmangleNames));
}
return builder.toString();
}
是否有任何选项可以在 Presto CLI 上提供参数。 我正在尝试将我的 impala-shell 命令更改为 Presto,其中我的 HQL 文件从 impala 的命令行获取参数,如下所示。 i
默认情况下,Presto 执行区分大小写的分组依据。但我想知道如何进行不区分大小写的分组。一种方法是将列中的所有东西都转换为小写,然后进行group by ie select * from ( sel
我怀疑答案是“视情况而定”,但是否有关于计划用于 Presto 的硬件类型的一般指导? 由于 Presto 使用一个协调器和一组工作器,并且工作器使用数据运行,我想主要问题将是协调器有足够的 RAM,
Presto 有多个 connectors 。虽然连接器确实实现了读写操作,但从我读过的所有教程来看,它们似乎通常用作仅读取的数据源。例如,netflix 在 Amazon S3 上有“10 PB”的
Postgres 有: SELECT VERSION(); 什么是 Presto 等价物? 我已经看过 Presto docs ,但无法找到等价物。 最佳答案 你试过下面的吗? SELECT node
Presto 支持哪些文件格式?是否有推荐的特定文件格式以获得更好的性能。我很想知道是否有像 RCfile 这样针对 Presto 进行优化的柱状文件格式? 最佳答案 我们测试每个 Trino (fo
我目前正在使用 Presto 0.80。我必须编写一个用户定义的函数来在选择查询期间将摄氏度转换为华氏度。我使用 Hive QL 做了同样的事情,但想知道我们是否可以在 Facebook Presto
我想获得所有连接的工作人员的列表,以便我可以检测哪个工作人员不工作。 我试过 select * from sys.node;但它不起作用。 我正在使用 Presto 0.128。 最佳答案 对于 0.
我是 Presto 的新手,无法弄清楚如何检查 map 中是否存在 key 。当我运行 SELECT查询,返回此错误信息: Key not present in map: element SELECT
我的数据如下所述 customer_id usage_month usage_by_product usage 1 June {"A":5
我的问题有点类似于这个( Athena/Presto - UNNEST MAP to columns )。但就我而言,我事先知道我需要哪些列。 我的用例是这样的 我有一个 json blob,其中包含
如何在 Presto 中创建一个表,其中其中一列具有数组数据类型? 例如: 如果不存在则创建表(ID BIGINT、ARRAY_COL 数组)... 最佳答案 编辑 数组类型的语法为array(ele
我的问题有点类似于这个( Athena/Presto - UNNEST MAP to columns )。但就我而言,我事先知道我需要哪些列。 我的用例是这样的 我有一个 json blob,其中包含
使用 Impala 运行 CDH4 集群,我创建了 parquet 表并在 adding 之后parquet jar 文件到 hive,我可以使用 hive 查询表。 将相同的 jar 集添加到/op
我将为这个站点做一个简化的例子,但基本上我正在尝试编写一个 Athena 查询(由 Glue 爬虫加载的数据,意图在 Quicksight 中使用),这将允许我在 select 语句中扩展一个结构。
我尝试运行启动器但遇到此错误: Exception in thread "main" java.lang.UnsupportedClassVersionError: sun/misc/Floating
我看到明确的要求,要构建 presto,您需要 Mac OS/Linux。 https://github.com/prestodb/presto我还看到正在讨论有关为 Presto 构建提供 Wind
我有以下查询,其中 shopname 存储为 varbinary 而不是 varchar 类型。 select shopname, itemname from shop_profile where c
能够设置脚本变量非常方便。例如, SET start_date = 20151201; SELECT * FROM some_table where date = {$hiveconf:start_d
我在 Presto 教程上看到了这个,它说好处是“在数据存在的地方查询数据”。 这是什么意思?我喜欢与事物的传统 v. Presto 版本进行比较。 编辑:通过链接到主页上的引用来添加上下文 http
我是一名优秀的程序员,十分优秀!