gpt4 book ai didi

com.facebook.presto.sql.tree.WindowFrame.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 01:43:05 25 4
gpt4 key购买 nike

本文整理了Java中com.facebook.presto.sql.tree.WindowFrame.<init>()方法的一些代码示例,展示了WindowFrame.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WindowFrame.<init>()方法的具体详情如下:
包路径:com.facebook.presto.sql.tree.WindowFrame
类名称:WindowFrame
方法名:<init>

WindowFrame.<init>介绍

暂无

代码示例

代码示例来源: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

@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

@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: 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: 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));
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com