test_class.file: parser/src/test/java/com/qihoo/qsql/org/apache/calcite/rel/rules/DateRangeRulesTest.java
test_class.identifier: DateRangeRulesTest
test_case.body: @Test public void testExtractYearFromDateColumn() {
      final Fixture2 f = new Fixture2();
  
      final RexNode e = f.eq(f.literal(2014), f.exYearD);
      assertThat(DateRangeRules.extractTimeUnits(e),
          is(set(TimeUnitRange.YEAR)));
      assertThat(DateRangeRules.extractTimeUnits(f.dec), is(set()));
      assertThat(DateRangeRules.extractTimeUnits(f.literal(1)), is(set()));
  
      // extract YEAR from a DATE column
      checkDateRange(f, e, is("AND(>=($8, 2014-01-01), <($8, 2015-01-01))"));
      checkDateRange(f, f.eq(f.exYearD, f.literal(2014)),
          is("AND(>=($8, 2014-01-01), <($8, 2015-01-01))"));
      checkDateRange(f, f.ge(f.exYearD, f.literal(2014)),
          is(">=($8, 2014-01-01)"));
      checkDateRange(f, f.gt(f.exYearD, f.literal(2014)),
          is(">=($8, 2015-01-01)"));
      checkDateRange(f, f.lt(f.exYearD, f.literal(2014)),
          is("<($8, 2014-01-01)"));
      checkDateRange(f, f.le(f.exYearD, f.literal(2014)),
          is("<($8, 2015-01-01)"));
      checkDateRange(f, f.ne(f.exYearD, f.literal(2014)),
          is("<>(EXTRACT(FLAG(YEAR), $8), 2014)"));
    }
test_case.class_method_signature: DateRangeRulesTest.testExtractYearFromDateColumn()
test_case.full_signature: @Test public void testExtractYearFromDateColumn()
test_case.identifier: testExtractYearFromDateColumn
test_case.invocations: eq literal assertThat extractTimeUnits is set assertThat extractTimeUnits is set assertThat extractTimeUnits literal is set checkDateRange is checkDateRange eq literal is checkDateRange ge literal is checkDateRange gt literal is checkDateRange lt literal is checkDateRange le literal is checkDateRange ne literal is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testExtractYearFromDateColumn()
focal_class.declarator: FILTER_PREDICATE =
        filter -> {
          try (ExtractFinder finder = ExtractFinder.THREAD_INSTANCES.get()) {
            assert finder.timeUnits.isEmpty() && finder.opKinds.isEmpty()
                : "previous user did not clean up";
            filter.getCondition().accept(finder);
            // bail out if there is no EXTRACT of YEAR, or call to FLOOR or CEIL
            return finder.timeUnits.contains(TimeUnitRange.YEAR)
                || finder.opKinds.contains(SqlKind.FLOOR)
                || finder.opKinds.contains(SqlKind.CEIL);
          }
        }
focal_class.modifier: private static final
focal_class.original_string: private static final Predicate<Filter> FILTER_PREDICATE =
        filter -> {
          try (ExtractFinder finder = ExtractFinder.THREAD_INSTANCES.get()) {
            assert finder.timeUnits.isEmpty() && finder.opKinds.isEmpty()
                : "previous user did not clean up";
            filter.getCondition().accept(finder);
            // bail out if there is no EXTRACT of YEAR, or call to FLOOR or CEIL
            return finder.timeUnits.contains(TimeUnitRange.YEAR)
                || finder.opKinds.contains(SqlKind.FLOOR)
                || finder.opKinds.contains(SqlKind.CEIL);
          }
        };
focal_class.type: Predicate<Filter>
focal_class.var_name: FILTER_PREDICATE
focal_class.declarator: FILTER_INSTANCE =
        new FilterDateRangeRule(RelFactories.LOGICAL_BUILDER)
focal_class.modifier: public static final
focal_class.original_string: public static final RelOptRule FILTER_INSTANCE =
        new FilterDateRangeRule(RelFactories.LOGICAL_BUILDER);
focal_class.type: RelOptRule
focal_class.var_name: FILTER_INSTANCE
focal_class.declarator: TIME_UNIT_CODES =
        ImmutableMap.<TimeUnitRange, Integer>builder()
            .put(TimeUnitRange.YEAR, Calendar.YEAR)
            .put(TimeUnitRange.MONTH, Calendar.MONTH)
            .put(TimeUnitRange.DAY, Calendar.DAY_OF_MONTH)
            .put(TimeUnitRange.HOUR, Calendar.HOUR)
            .put(TimeUnitRange.MINUTE, Calendar.MINUTE)
            .put(TimeUnitRange.SECOND, Calendar.SECOND)
            .put(TimeUnitRange.MILLISECOND, Calendar.MILLISECOND)
            .build()
focal_class.modifier: private static final
focal_class.original_string: private static final Map<TimeUnitRange, Integer> TIME_UNIT_CODES =
        ImmutableMap.<TimeUnitRange, Integer>builder()
            .put(TimeUnitRange.YEAR, Calendar.YEAR)
            .put(TimeUnitRange.MONTH, Calendar.MONTH)
            .put(TimeUnitRange.DAY, Calendar.DAY_OF_MONTH)
            .put(TimeUnitRange.HOUR, Calendar.HOUR)
            .put(TimeUnitRange.MINUTE, Calendar.MINUTE)
            .put(TimeUnitRange.SECOND, Calendar.SECOND)
            .put(TimeUnitRange.MILLISECOND, Calendar.MILLISECOND)
            .build();
focal_class.type: Map<TimeUnitRange, Integer>
focal_class.var_name: TIME_UNIT_CODES
focal_class.declarator: TIME_UNIT_PARENTS =
        ImmutableMap.<TimeUnitRange, TimeUnitRange>builder()
            .put(TimeUnitRange.MONTH, TimeUnitRange.YEAR)
            .put(TimeUnitRange.DAY, TimeUnitRange.MONTH)
            .put(TimeUnitRange.HOUR, TimeUnitRange.DAY)
            .put(TimeUnitRange.MINUTE, TimeUnitRange.HOUR)
            .put(TimeUnitRange.SECOND, TimeUnitRange.MINUTE)
            .put(TimeUnitRange.MILLISECOND, TimeUnitRange.SECOND)
            .put(TimeUnitRange.MICROSECOND, TimeUnitRange.SECOND)
            .build()
focal_class.modifier: private static final
focal_class.original_string: private static final Map<TimeUnitRange, TimeUnitRange> TIME_UNIT_PARENTS =
        ImmutableMap.<TimeUnitRange, TimeUnitRange>builder()
            .put(TimeUnitRange.MONTH, TimeUnitRange.YEAR)
            .put(TimeUnitRange.DAY, TimeUnitRange.MONTH)
            .put(TimeUnitRange.HOUR, TimeUnitRange.DAY)
            .put(TimeUnitRange.MINUTE, TimeUnitRange.HOUR)
            .put(TimeUnitRange.SECOND, TimeUnitRange.MINUTE)
            .put(TimeUnitRange.MILLISECOND, TimeUnitRange.SECOND)
            .put(TimeUnitRange.MICROSECOND, TimeUnitRange.SECOND)
            .build();
focal_class.type: Map<TimeUnitRange, TimeUnitRange>
focal_class.var_name: TIME_UNIT_PARENTS
focal_class.file: parser/src/main/java/com/qihoo/qsql/org/apache/calcite/rel/rules/DateRangeRules.java
focal_class.identifier: DateRangeRules
focal_class.class_method_signature: DateRangeRules.DateRangeRules()
focal_class.full_signature: private  DateRangeRules()
focal_class.identifier: DateRangeRules
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  DateRangeRules()
focal_class.class_method_signature: DateRangeRules.extractTimeUnits(RexNode e)
focal_class.full_signature: static ImmutableSortedSet<TimeUnitRange> extractTimeUnits(RexNode e)
focal_class.identifier: extractTimeUnits
focal_class.modifiers: static
focal_class.parameters: (RexNode e)
focal_class.return: ImmutableSortedSet<TimeUnitRange>
focal_class.signature: ImmutableSortedSet<TimeUnitRange> extractTimeUnits(RexNode e)
focal_class.class_method_signature: DateRangeRules.replaceTimeUnits(RexBuilder rexBuilder, RexNode e,
        String timeZone)
focal_class.full_signature: @VisibleForTesting public static RexNode replaceTimeUnits(RexBuilder rexBuilder, RexNode e,
        String timeZone)
focal_class.identifier: replaceTimeUnits
focal_class.modifiers: @VisibleForTesting public static
focal_class.parameters: (RexBuilder rexBuilder, RexNode e,
        String timeZone)
focal_class.return: RexNode
focal_class.signature: RexNode replaceTimeUnits(RexBuilder rexBuilder, RexNode e,
        String timeZone)
focal_method.body: static ImmutableSortedSet<TimeUnitRange> extractTimeUnits(RexNode e) {
      try (ExtractFinder finder = ExtractFinder.THREAD_INSTANCES.get()) {
        assert finder.timeUnits.isEmpty() && finder.opKinds.isEmpty()
            : "previous user did not clean up";
        e.accept(finder);
        return ImmutableSortedSet.copyOf(finder.timeUnits);
      }
    }
focal_method.class_method_signature: DateRangeRules.extractTimeUnits(RexNode e)
focal_method.full_signature: static ImmutableSortedSet<TimeUnitRange> extractTimeUnits(RexNode e)
focal_method.identifier: extractTimeUnits
focal_method.invocations: get isEmpty isEmpty accept copyOf
focal_method.modifiers: static
focal_method.parameters: (RexNode e)
focal_method.return: ImmutableSortedSet<TimeUnitRange>
focal_method.signature: ImmutableSortedSet<TimeUnitRange> extractTimeUnits(RexNode e)