gpt4 book ai didi

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

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

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

WindowFrame.getStart介绍

暂无

代码示例

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

frameType = frame.getType();
frameStartType = frame.getStart().getType();
frameStart = frame.getStart().getValue().orElse(null);

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

代码示例来源: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: 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 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-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: 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();
}

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

frameType = frame.getType();
frameStartType = frame.getStart().getType();
frameStart = frame.getStart().getValue().orElse(null);

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

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

private static 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");
  }
}

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