• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SqlMonotonicity类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.calcite.sql.validate.SqlMonotonicity的典型用法代码示例。如果您正苦于以下问题:Java SqlMonotonicity类的具体用法?Java SqlMonotonicity怎么用?Java SqlMonotonicity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SqlMonotonicity类属于org.apache.calcite.sql.validate包,在下文中一共展示了SqlMonotonicity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: monotonicity

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
/** Converts the direction to a
 * {@link org.apache.calcite.sql.validate.SqlMonotonicity}. */
public SqlMonotonicity monotonicity() {
  switch (this) {
  case ASCENDING:
    return SqlMonotonicity.INCREASING;
  case STRICTLY_ASCENDING:
    return SqlMonotonicity.STRICTLY_INCREASING;
  case DESCENDING:
    return SqlMonotonicity.DECREASING;
  case STRICTLY_DESCENDING:
    return SqlMonotonicity.STRICTLY_DECREASING;
  case CLUSTERED:
    return SqlMonotonicity.MONOTONIC;
  default:
    throw new AssertionError("unknown: " + this);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:19,代码来源:RelFieldCollation.java


示例2: of

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
/** Converts a {@link SqlMonotonicity} to a direction. */
public static Direction of(SqlMonotonicity monotonicity) {
  switch (monotonicity) {
  case INCREASING:
    return ASCENDING;
  case DECREASING:
    return DESCENDING;
  case STRICTLY_INCREASING:
    return STRICTLY_ASCENDING;
  case STRICTLY_DECREASING:
    return STRICTLY_DESCENDING;
  case MONOTONIC:
    return CLUSTERED;
  default:
    throw new AssertionError("unknown: " + monotonicity);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:18,代码来源:RelFieldCollation.java


示例3: getMonotonicity

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
public SqlMonotonicity getMonotonicity(SqlValidatorScope scope) {
  // for "star" column, whether it's static or dynamic return not_monotonic directly.
  if (Util.last(names).equals("") || DynamicRecordType.isDynamicStarColName(Util.last(names))) {
    return SqlMonotonicity.NOT_MONOTONIC;
  }

  // First check for builtin functions which don't have parentheses,
  // like "LOCALTIME".
  final SqlValidator validator = scope.getValidator();
  SqlCall call =
      SqlUtil.makeCall(
          validator.getOperatorTable(),
          this);
  if (call != null) {
    return call.getMonotonicity(scope);
  }
  final SqlQualified qualified = scope.fullyQualify(this);
  final SqlIdentifier fqId = qualified.identifier;
  return qualified.namespace.resolve().getMonotonicity(Util.last(fqId.names));
}
 
开发者ID:apache,项目名称:calcite,代码行数:21,代码来源:SqlIdentifier.java


示例4: getMonotonicity

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
@Override public SqlMonotonicity getMonotonicity(SqlOperatorBinding call) {
  if (getName().equals("/")) {
    final SqlMonotonicity mono0 = call.getOperandMonotonicity(0);
    final SqlMonotonicity mono1 = call.getOperandMonotonicity(1);
    if (mono1 == SqlMonotonicity.CONSTANT) {
      if (call.isOperandLiteral(1, false)) {
        switch (call.getOperandLiteralValue(1, BigDecimal.class).signum()) {
        case -1:

          // mono / -ve constant --> reverse mono, unstrict
          return mono0.reverse().unstrict();
        case 0:

          // mono / zero --> constant (infinity!)
          return SqlMonotonicity.CONSTANT;
        default:

          // mono / +ve constant * mono1 --> mono, unstrict
          return mono0.unstrict();
        }
      }
    }
  }

  return super.getMonotonicity(call);
}
 
开发者ID:apache,项目名称:calcite,代码行数:27,代码来源:SqlBinaryOperator.java


示例5: getOperandMonotonicity

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
@Override public SqlMonotonicity getOperandMonotonicity(int ordinal) {
  RexNode operand = operands.get(ordinal);

  if (operand instanceof RexInputRef) {
    for (RelCollation ic : inputCollations) {
      if (ic.getFieldCollations().isEmpty()) {
        continue;
      }

      for (RelFieldCollation rfc : ic.getFieldCollations()) {
        if (rfc.getFieldIndex() == ((RexInputRef) operand).getIndex()) {
          return rfc.direction.monotonicity();
          // TODO: Is it possible to have more than one RelFieldCollation for a RexInputRef?
        }
      }
    }
  } else if (operand instanceof RexCall) {
    final RexCallBinding binding =
        RexCallBinding.create(typeFactory, (RexCall) operand, inputCollations);
    return ((RexCall) operand).getOperator().getMonotonicity(binding);
  }

  return SqlMonotonicity.NOT_MONOTONIC;
}
 
开发者ID:apache,项目名称:calcite,代码行数:25,代码来源:RexCallBinding.java


示例6: deduceMonotonicity

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
private List<RelCollation> deduceMonotonicity(SqlValidatorTable table) {
  final RelDataType rowType = table.getRowType();
  final List<RelCollation> collationList = new ArrayList<>();

  // Deduce which fields the table is sorted on.
  int i = -1;
  for (RelDataTypeField field : rowType.getFieldList()) {
    ++i;
    final SqlMonotonicity monotonicity =
        table.getMonotonicity(field.getName());
    if (monotonicity != SqlMonotonicity.NOT_MONOTONIC) {
      final RelFieldCollation.Direction direction =
          monotonicity.isDecreasing()
              ? RelFieldCollation.Direction.DESCENDING
              : RelFieldCollation.Direction.ASCENDING;
      collationList.add(
          RelCollations.of(new RelFieldCollation(i, direction)));
    }
  }
  return collationList;
}
 
开发者ID:apache,项目名称:calcite,代码行数:22,代码来源:SqlToRelTestBase.java


示例7: deduceMonotonicity

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
private static List<RelCollation> deduceMonotonicity(
    Prepare.PreparingTable table) {
  final List<RelCollation> collationList = Lists.newArrayList();

  // Deduce which fields the table is sorted on.
  int i = -1;
  for (RelDataTypeField field : table.getRowType().getFieldList()) {
    ++i;
    final SqlMonotonicity monotonicity =
        table.getMonotonicity(field.getName());
    if (monotonicity != SqlMonotonicity.NOT_MONOTONIC) {
      final RelFieldCollation.Direction direction =
          monotonicity.isDecreasing()
              ? RelFieldCollation.Direction.DESCENDING
              : RelFieldCollation.Direction.ASCENDING;
      collationList.add(
          RelCollations.of(
              new RelFieldCollation(i, direction)));
    }
  }
  return collationList;
}
 
开发者ID:apache,项目名称:calcite,代码行数:23,代码来源:MockCatalogReader.java


示例8: getMonotonicity

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
@Override public SqlMonotonicity getMonotonicity(SqlOperatorBinding call) {
  // Monotonic iff its first argument is, but not strict.
  //
  // Note: This strategy happens to works for all current group functions
  // (HOP, TUMBLE, SESSION). When there are exceptions to this rule, we'll
  // make the method abstract.
  return call.getOperandMonotonicity(0).unstrict();
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:9,代码来源:SqlGroupFunction.java


示例9: getMonotonicity

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
public SqlMonotonicity getMonotonicity(String columnName) {
  final int i = rowType.getFieldNames().indexOf(columnName);
  if (i >= 0) {
    for (RelCollation collation : table.getStatistic().getCollations()) {
      final RelFieldCollation fieldCollation =
          collation.getFieldCollations().get(0);
      if (fieldCollation.getFieldIndex() == i) {
        return fieldCollation.direction.monotonicity();
      }
    }
  }
  return SqlMonotonicity.NOT_MONOTONIC;
}
 
开发者ID:apache,项目名称:calcite,代码行数:14,代码来源:RelOptTableImpl.java


示例10: getMonotonicity

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
@Override public SqlMonotonicity getMonotonicity(SqlOperatorBinding call) {
  // SUBSTRING(x FROM 0 FOR constant) has same monotonicity as x
  if (call.getOperandCount() == 3) {
    final SqlMonotonicity mono0 = call.getOperandMonotonicity(0);
    if ((mono0 != SqlMonotonicity.NOT_MONOTONIC)
        && call.getOperandMonotonicity(1) == SqlMonotonicity.CONSTANT
        && call.getOperandLiteralValue(1, BigDecimal.class)
            .equals(BigDecimal.ZERO)
        && call.getOperandMonotonicity(2) == SqlMonotonicity.CONSTANT) {
      return mono0.unstrict();
    }
  }
  return super.getMonotonicity(call);
}
 
开发者ID:apache,项目名称:calcite,代码行数:15,代码来源:SqlSubstringFunction.java


示例11: getMonotonicity

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
@Override public SqlMonotonicity getMonotonicity(SqlOperatorBinding call) {
  switch (call.getOperandLiteralValue(0, TimeUnitRange.class)) {
  case YEAR:
    return call.getOperandMonotonicity(1).unstrict();
  default:
    return SqlMonotonicity.NOT_MONOTONIC;
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:SqlExtractFunction.java


示例12: getMonotonicity

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
@Override public SqlMonotonicity getMonotonicity(SqlOperatorBinding call) {
  RelDataTypeFamily castFrom = call.getOperandType(0).getFamily();
  RelDataTypeFamily castTo = call.getOperandType(1).getFamily();
  if (castFrom instanceof SqlTypeFamily
      && castTo instanceof SqlTypeFamily
      && nonMonotonicCasts.containsEntry(castFrom, castTo)) {
    return SqlMonotonicity.NOT_MONOTONIC;
  } else {
    return call.getOperandMonotonicity(0);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:SqlCastFunction.java


示例13: getMonotonicity

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
@Override public SqlMonotonicity getMonotonicity(SqlOperatorBinding call) {
  if (getName().equals("-")) {
    return call.getOperandMonotonicity(0).reverse();
  }

  return super.getMonotonicity(call);
}
 
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:SqlPrefixOperator.java


示例14: checkMonotonic

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
public void checkMonotonic(String query,
    SqlMonotonicity expectedMonotonicity) {
  SqlValidator validator = getValidator();
  SqlNode n = parseAndValidate(validator, query);
  final RelDataType rowType = validator.getValidatedNodeType(n);
  final SqlValidatorNamespace selectNamespace = validator.getNamespace(n);
  final String field0 = rowType.getFieldList().get(0).getName();
  final SqlMonotonicity monotonicity =
      selectNamespace.getMonotonicity(field0);
  assertThat(monotonicity, equalTo(expectedMonotonicity));
}
 
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:SqlTesterImpl.java


示例15: getMonotonicity

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
public SqlMonotonicity getMonotonicity(String sql) {
  final SqlValidator validator = getValidator();
  final SqlNode node = parseAndValidate(validator, sql);
  final SqlSelect select = (SqlSelect) node;
  final SqlNode selectItem0 = select.getSelectList().get(0);
  final SqlValidatorScope scope = validator.getSelectScope(select);
  return selectItem0.getMonotonicity(scope);
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:SqlTesterImpl.java


示例16: getColumnMonotonicities

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
public List<SqlMonotonicity> getColumnMonotonicities() {
	return columnMonotonicities;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:4,代码来源:SqlToRelConverter.java


示例17: getMonotonicity

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
@Override
public SqlMonotonicity getMonotonicity(SqlOperatorBinding call) {
  return operator.getMonotonicity(call);
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:5,代码来源:DrillCalciteSqlFunctionWrapper.java


示例18: PrimaryKey

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
public PrimaryKey(SqlMonotonicity monotonicity, SqlParserPos pos) {
  super(SqlDDLKeywords.PRIMARY, SqlTypeName.SYMBOL, pos);
  this.monotonicity = monotonicity;
}
 
开发者ID:hortonworks,项目名称:streamline,代码行数:5,代码来源:ColumnConstraint.java


示例19: monotonicity

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
public SqlMonotonicity monotonicity() {
  return monotonicity;
}
 
开发者ID:hortonworks,项目名称:streamline,代码行数:4,代码来源:ColumnConstraint.java


示例20: getColumnMonotonicities

import org.apache.calcite.sql.validate.SqlMonotonicity; //导入依赖的package包/类
public List<SqlMonotonicity> getColumnMonotonicities() {
  return columnMonotonicities;
}
 
开发者ID:apache,项目名称:kylin,代码行数:4,代码来源:SqlToRelConverter.java



注:本文中的org.apache.calcite.sql.validate.SqlMonotonicity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConversionException类代码示例发布时间:2022-05-23
下一篇:
Java LazyMetadataValue类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap