static class DateRangeRules.ExtractShuttle extends RexShuttle
EXTRACT, FLOOR and CEIL with date ranges.| Modifier and Type | Field and Description |
|---|---|
private Deque<RexCall> |
calls |
private Map<String,com.google.common.collect.RangeSet<Calendar>> |
operandRanges |
private RexBuilder |
rexBuilder |
private org.apache.calcite.avatica.util.TimeUnitRange |
timeUnit |
private com.google.common.collect.ImmutableSortedSet<org.apache.calcite.avatica.util.TimeUnitRange> |
timeUnitRanges |
private String |
timeZone |
| Constructor and Description |
|---|
ExtractShuttle(RexBuilder rexBuilder,
org.apache.calcite.avatica.util.TimeUnitRange timeUnit,
Map<String,com.google.common.collect.RangeSet<Calendar>> operandRanges,
com.google.common.collect.ImmutableSortedSet<org.apache.calcite.avatica.util.TimeUnitRange> timeUnitRanges,
String timeZone) |
| Modifier and Type | Method and Description |
|---|---|
private boolean |
canRewriteExtract(RexNode operand) |
private Calendar |
ceil(Calendar c,
org.apache.calcite.avatica.util.TimeUnitRange timeUnit) |
private com.google.common.collect.Range<Calendar> |
ceilRange(org.apache.calcite.avatica.util.TimeUnitRange timeUnit,
SqlKind comparison,
Calendar c) |
(package private) RexNode |
compareExtract(SqlKind comparison,
RexNode operand,
RexLiteral literal) |
private RexNode |
compareFloorCeil(SqlKind comparison,
RexNode operand,
RexLiteral timeLiteral,
org.apache.calcite.avatica.util.TimeUnitRange timeUnit,
boolean floor) |
private RexLiteral |
dateTimeLiteral(RexBuilder rexBuilder,
Calendar calendar,
RexNode operand) |
private Calendar |
decrement(Calendar c,
org.apache.calcite.avatica.util.TimeUnitRange timeUnit) |
private com.google.common.collect.Range<Calendar> |
extractRange(org.apache.calcite.avatica.util.TimeUnitRange timeUnit,
SqlKind comparison,
Calendar c) |
private Calendar |
floor(Calendar c,
org.apache.calcite.avatica.util.TimeUnitRange timeUnit)
Computes floor of a calendar to a given time unit.
|
private com.google.common.collect.Range<Calendar> |
floorRange(org.apache.calcite.avatica.util.TimeUnitRange timeUnit,
SqlKind comparison,
Calendar c) |
private Calendar |
increment(Calendar c,
org.apache.calcite.avatica.util.TimeUnitRange timeUnit) |
(package private) boolean |
isExtractCall(RexNode e) |
(package private) boolean |
isFloorCeilCall(RexNode e) |
private static boolean |
isValid(int v,
org.apache.calcite.avatica.util.TimeUnitRange timeUnit) |
private boolean |
next(Calendar c,
org.apache.calcite.avatica.util.TimeUnitRange timeUnit,
int v,
com.google.common.collect.Range<Calendar> r,
boolean strict) |
private Calendar |
round(Calendar c,
org.apache.calcite.avatica.util.TimeUnitRange timeUnit,
boolean down)
Returns a copy of a calendar, optionally rounded up to the next time
unit.
|
private Calendar |
timestampValue(RexLiteral timeLiteral) |
private RexNode |
toRex(RexNode operand,
com.google.common.collect.Range<Calendar> r) |
RexNode |
visitCall(RexCall call) |
protected List<RexNode> |
visitList(List<? extends RexNode> exprs,
boolean[] update)
Visits each of a list of expressions and returns a list of the
results.
|
apply, apply, apply, mutate, visitArray, visitCorrelVariable, visitDynamicParam, visitFieldAccess, visitFieldCollations, visitInputRef, visitList, visitLiteral, visitLocalRef, visitOver, visitPatternFieldRef, visitRangeRef, visitSubQuery, visitTableInputRef, visitWindowprivate final RexBuilder rexBuilder
private final org.apache.calcite.avatica.util.TimeUnitRange timeUnit
private final com.google.common.collect.ImmutableSortedSet<org.apache.calcite.avatica.util.TimeUnitRange> timeUnitRanges
private final String timeZone
ExtractShuttle(RexBuilder rexBuilder, org.apache.calcite.avatica.util.TimeUnitRange timeUnit, Map<String,com.google.common.collect.RangeSet<Calendar>> operandRanges, com.google.common.collect.ImmutableSortedSet<org.apache.calcite.avatica.util.TimeUnitRange> timeUnitRanges, String timeZone)
public RexNode visitCall(RexCall call)
visitCall in interface RexVisitor<RexNode>visitCall in class RexShuttleprivate boolean canRewriteExtract(RexNode operand)
protected List<RexNode> visitList(List<? extends RexNode> exprs, boolean[] update)
RexShuttlevisitList in class RexShuttleexprs - List of expressionsupdate - If not null, sets this to true if any of the expressions
was modifiedboolean isExtractCall(RexNode e)
RexNode compareExtract(SqlKind comparison, RexNode operand, RexLiteral literal)
private boolean next(Calendar c, org.apache.calcite.avatica.util.TimeUnitRange timeUnit, int v, com.google.common.collect.Range<Calendar> r, boolean strict)
private static boolean isValid(int v,
org.apache.calcite.avatica.util.TimeUnitRange timeUnit)
private RexLiteral dateTimeLiteral(RexBuilder rexBuilder, Calendar calendar, RexNode operand)
private com.google.common.collect.Range<Calendar> extractRange(org.apache.calcite.avatica.util.TimeUnitRange timeUnit, SqlKind comparison, Calendar c)
private Calendar round(Calendar c, org.apache.calcite.avatica.util.TimeUnitRange timeUnit, boolean down)
private RexNode compareFloorCeil(SqlKind comparison, RexNode operand, RexLiteral timeLiteral, org.apache.calcite.avatica.util.TimeUnitRange timeUnit, boolean floor)
private Calendar timestampValue(RexLiteral timeLiteral)
private com.google.common.collect.Range<Calendar> floorRange(org.apache.calcite.avatica.util.TimeUnitRange timeUnit, SqlKind comparison, Calendar c)
private com.google.common.collect.Range<Calendar> ceilRange(org.apache.calcite.avatica.util.TimeUnitRange timeUnit, SqlKind comparison, Calendar c)
boolean isFloorCeilCall(RexNode e)
private Calendar increment(Calendar c, org.apache.calcite.avatica.util.TimeUnitRange timeUnit)
private Calendar decrement(Calendar c, org.apache.calcite.avatica.util.TimeUnitRange timeUnit)
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.