You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by da...@apache.org on 2020/05/30 15:37:52 UTC

[calcite] branch master updated: [CALCITE-4031] Remove code to be removed before 1.24

This is an automated email from the ASF dual-hosted git repository.

danny0405 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/master by this push:
     new 61bba25  [CALCITE-4031] Remove code to be removed before 1.24
61bba25 is described below

commit 61bba252075abad42f4b239636367acead838144
Author: yuzhao.cyz <yu...@gmail.com>
AuthorDate: Fri May 29 16:57:42 2020 +0800

    [CALCITE-4031] Remove code to be removed before 1.24
    
    * Remove code to be removed before 1.24;
    * Make sure that any code labelled @Deprecated is followed by a comment
    'to be removed before x.x';
    * Fix some code which uses Bug.upgrade();
    * Some cosmetic changes.
---
 .../calcite/config/CalciteConnectionProperty.java  |  26 +---
 .../org/apache/calcite/interpreter/Bindables.java  |  13 --
 .../apache/calcite/jdbc/ContextSqlValidator.java   |   3 +-
 .../apache/calcite/plan/AbstractRelOptPlanner.java |   4 -
 .../org/apache/calcite/plan/RelOptPlanner.java     |  19 ---
 .../java/org/apache/calcite/plan/RelTraitDef.java  |  18 ---
 .../calcite/plan/volcano/VolcanoPlanner.java       |   8 --
 .../apache/calcite/rel/hint/HintOptionChecker.java |  11 +-
 .../org/apache/calcite/rel/hint/HintStrategy.java  |   4 +-
 .../apache/calcite/rel/hint/HintStrategyTable.java |  23 +--
 .../java/org/apache/calcite/rel/hint/RelHint.java  |  67 +++++----
 .../apache/calcite/rel/rules/DateRangeRules.java   |   3 -
 .../main/java/org/apache/calcite/rex/RexUtil.java  |   2 +-
 .../main/java/org/apache/calcite/runtime/Hook.java |   4 +-
 .../org/apache/calcite/runtime/SqlFunctions.java   |  10 +-
 .../org/apache/calcite/sql/advise/SqlAdvisor.java  |   2 +-
 .../apache/calcite/sql/advise/SqlSimpleParser.java |   4 +-
 .../apache/calcite/sql/validate/SqlValidator.java  | 155 ---------------------
 .../calcite/sql/validate/SqlValidatorImpl.java     |  19 ---
 .../validate/implicit/AbstractTypeCoercion.java    |  10 +-
 .../sql/validate/implicit/TypeCoercion.java        |  24 ++--
 .../org/apache/calcite/util/ImmutableIntList.java  |  10 +-
 .../calcite/test/AbstractMaterializedViewTest.java |  82 ++++++-----
 .../org/apache/calcite/test/CalciteAssert.java     |  13 --
 .../apache/calcite/linq4j/function/Functions.java  |   7 +-
 .../calcite/linq4j/function/FunctionTest.java      |   7 +-
 26 files changed, 135 insertions(+), 413 deletions(-)

diff --git a/core/src/main/java/org/apache/calcite/config/CalciteConnectionProperty.java b/core/src/main/java/org/apache/calcite/config/CalciteConnectionProperty.java
index a061fb7..f09b052 100644
--- a/core/src/main/java/org/apache/calcite/config/CalciteConnectionProperty.java
+++ b/core/src/main/java/org/apache/calcite/config/CalciteConnectionProperty.java
@@ -21,16 +21,15 @@ import org.apache.calcite.avatica.util.Casing;
 import org.apache.calcite.avatica.util.Quoting;
 import org.apache.calcite.model.JsonSchema;
 import org.apache.calcite.sql.validate.SqlConformanceEnum;
-import org.apache.calcite.util.Bug;
 
 import java.util.HashMap;
-import java.util.LinkedHashMap;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
 import java.util.TimeZone;
 
 import static org.apache.calcite.avatica.ConnectionConfigImpl.PropEnv;
+import static org.apache.calcite.avatica.ConnectionConfigImpl.parse;
 
 /**
  * Properties that may be specified on the JDBC connect string.
@@ -222,27 +221,6 @@ public enum CalciteConnectionProperty implements ConnectionProperty {
   }
 
   public PropEnv wrap(Properties properties) {
-    return new PropEnv(parse2(properties, NAME_TO_PROPS), this);
+    return new PropEnv(parse(properties, NAME_TO_PROPS), this);
   }
-
-  /** Fixed version of
-   * {@link org.apache.calcite.avatica.ConnectionConfigImpl#parse}
-   * until we upgrade Avatica. */
-  private static Map<ConnectionProperty, String> parse2(Properties properties,
-      Map<String, ? extends ConnectionProperty> nameToProps) {
-    Bug.upgrade("avatica-1.10");
-    final Map<ConnectionProperty, String> map = new LinkedHashMap<>();
-    for (String name : properties.stringPropertyNames()) {
-      final ConnectionProperty connectionProperty =
-          nameToProps.get(name.toUpperCase(Locale.ROOT));
-      if (connectionProperty == null) {
-        // For now, don't throw. It messes up sub-projects.
-        //throw new RuntimeException("Unknown property '" + name + "'");
-        continue;
-      }
-      map.put(connectionProperty, properties.getProperty(name));
-    }
-    return map;
-  }
-
 }
diff --git a/core/src/main/java/org/apache/calcite/interpreter/Bindables.java b/core/src/main/java/org/apache/calcite/interpreter/Bindables.java
index 8490405..958437a 100644
--- a/core/src/main/java/org/apache/calcite/interpreter/Bindables.java
+++ b/core/src/main/java/org/apache/calcite/interpreter/Bindables.java
@@ -521,19 +521,6 @@ public class Bindables {
     }
   }
 
-  @Deprecated // Use BindableSetOpRule instead, to be removed before 1.24.0
-  public static class BindableUnionRule extends BindableSetOpRule {
-
-    /**
-     * Creates a BindableUnionRule.
-     *
-     * @param relBuilderFactory Builder for relational expressions
-     */
-    public BindableUnionRule(RelBuilderFactory relBuilderFactory) {
-      super(relBuilderFactory);
-    }
-  }
-
   /**
    * Rule to convert an {@link SetOp} to a {@link BindableUnion}
    * or {@link BindableIntersect} or {@link BindableMinus}.
diff --git a/core/src/main/java/org/apache/calcite/jdbc/ContextSqlValidator.java b/core/src/main/java/org/apache/calcite/jdbc/ContextSqlValidator.java
index ca6631f..db8583b 100644
--- a/core/src/main/java/org/apache/calcite/jdbc/ContextSqlValidator.java
+++ b/core/src/main/java/org/apache/calcite/jdbc/ContextSqlValidator.java
@@ -19,7 +19,6 @@ package org.apache.calcite.jdbc;
 import org.apache.calcite.config.CalciteConnectionConfigImpl;
 import org.apache.calcite.prepare.CalciteCatalogReader;
 import org.apache.calcite.sql.fun.SqlStdOperatorTable;
-import org.apache.calcite.sql.validate.SqlConformanceEnum;
 import org.apache.calcite.sql.validate.SqlValidatorImpl;
 
 import com.google.common.collect.ImmutableList;
@@ -47,7 +46,7 @@ public class ContextSqlValidator extends SqlValidatorImpl {
    */
   public ContextSqlValidator(CalcitePrepare.Context context, boolean mutable) {
     super(SqlStdOperatorTable.instance(), getCatalogReader(context, mutable),
-        context.getTypeFactory(), SqlConformanceEnum.DEFAULT);
+        context.getTypeFactory(), Config.DEFAULT);
   }
 
   private static CalciteCatalogReader getCatalogReader(
diff --git a/core/src/main/java/org/apache/calcite/plan/AbstractRelOptPlanner.java b/core/src/main/java/org/apache/calcite/plan/AbstractRelOptPlanner.java
index c08975e..cf350b6 100644
--- a/core/src/main/java/org/apache/calcite/plan/AbstractRelOptPlanner.java
+++ b/core/src/main/java/org/apache/calcite/plan/AbstractRelOptPlanner.java
@@ -222,10 +222,6 @@ public abstract class AbstractRelOptPlanner implements RelOptPlanner {
     return 0;
   }
 
-  @Deprecated // to be removed before 1.24
-  public void setImportance(RelNode rel, double importance) {
-  }
-
   @Override public void prune(RelNode rel) {
   }
 
diff --git a/core/src/main/java/org/apache/calcite/plan/RelOptPlanner.java b/core/src/main/java/org/apache/calcite/plan/RelOptPlanner.java
index 02ebc04..e2117b5 100644
--- a/core/src/main/java/org/apache/calcite/plan/RelOptPlanner.java
+++ b/core/src/main/java/org/apache/calcite/plan/RelOptPlanner.java
@@ -297,25 +297,6 @@ public interface RelOptPlanner {
   long getRelMetadataTimestamp(RelNode rel);
 
   /**
-   * Sets the importance of a relational expression.
-   *
-   * <p>An important use of this method is when a {@link RelOptRule} has
-   * created a relational expression which is indisputably better than the
-   * original relational expression. The rule set the original relational
-   * expression's importance to zero, to reduce the search space. Pending rule
-   * calls are cancelled, and future rules will not fire.
-   *
-   * @param rel        Relational expression
-   * @param importance Importance
-   *
-   * @deprecated This API will be removed in a future release, as we no longer
-   * support the concept of node importance. Please use
-   * {@link RelOptPlanner#prune(RelNode)} method instead.
-   */
-  @Deprecated // to be removed before 1.24
-  void setImportance(RelNode rel, double importance);
-
-  /**
    * Prunes a node from the planner.
    *
    * <p>When a node is pruned, the related pending rule
diff --git a/core/src/main/java/org/apache/calcite/plan/RelTraitDef.java b/core/src/main/java/org/apache/calcite/plan/RelTraitDef.java
index 07207c9..0bba404 100644
--- a/core/src/main/java/org/apache/calcite/plan/RelTraitDef.java
+++ b/core/src/main/java/org/apache/calcite/plan/RelTraitDef.java
@@ -139,24 +139,6 @@ public abstract class RelTraitDef<T extends RelTrait> {
       T toTrait);
 
   /**
-   * Tests whether the given RelTrait can be converted to another RelTrait.
-   *
-   * @param planner   the planner requesting the conversion test
-   * @param fromTrait the RelTrait to convert from
-   * @param toTrait   the RelTrait to convert to
-   * @param fromRel   the RelNode to convert from (with fromTrait)
-   * @return true if fromTrait can be converted to toTrait
-   */
-  @Deprecated // to be removed before 1.24
-  public boolean canConvert(
-      RelOptPlanner planner,
-      T fromTrait,
-      T toTrait,
-      RelNode fromRel) {
-    return canConvert(planner, fromTrait, toTrait);
-  }
-
-  /**
    * Provides notification of the registration of a particular
    * {@link ConverterRule} with a {@link RelOptPlanner}. The default
    * implementation does nothing.
diff --git a/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java b/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java
index d0adf48..90030d0 100644
--- a/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java
+++ b/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java
@@ -855,14 +855,6 @@ public class VolcanoPlanner extends AbstractRelOptPlanner {
     return converted;
   }
 
-  @Deprecated // to be removed before 1.24
-  public void setImportance(RelNode rel, double importance) {
-    assert rel != null;
-    if (importance == 0d) {
-      prunedNodes.add(rel);
-    }
-  }
-
   @Override public void prune(RelNode rel) {
     prunedNodes.add(rel);
   }
diff --git a/core/src/main/java/org/apache/calcite/rel/hint/HintOptionChecker.java b/core/src/main/java/org/apache/calcite/rel/hint/HintOptionChecker.java
index f0aeb8f..d2feaa5 100644
--- a/core/src/main/java/org/apache/calcite/rel/hint/HintOptionChecker.java
+++ b/core/src/main/java/org/apache/calcite/rel/hint/HintOptionChecker.java
@@ -19,16 +19,11 @@ package org.apache.calcite.rel.hint;
 import org.apache.calcite.util.Litmus;
 
 /**
- * A {@code HintOptionChecker} checks if a {@link RelHint}'s options are valid.
+ * A {@code HintOptionChecker} validates the options of a {@link RelHint}.
  *
  * <p>Every hint would have a validation when converting to a {@link RelHint}, the
- * validation logic is as follows:
- *
- * <ul>
- *   <li>Checks whether the hint name was already registered</li>
- *   <li>If a {@code HintOptionChecker} was registered,
- *   use it to check the hint options</li>
- * </ul>
+ * validation logic is: i) checks whether the hint was already registered;
+ * ii) use the registered {@code HintOptionChecker} to check the hint options.
  *
  * <p>In {@link HintStrategyTable} the option checker is used for
  * hints registration as an optional parameter.
diff --git a/core/src/main/java/org/apache/calcite/rel/hint/HintStrategy.java b/core/src/main/java/org/apache/calcite/rel/hint/HintStrategy.java
index c58a58c..7670f78 100644
--- a/core/src/main/java/org/apache/calcite/rel/hint/HintStrategy.java
+++ b/core/src/main/java/org/apache/calcite/rel/hint/HintStrategy.java
@@ -27,7 +27,7 @@ import javax.annotation.Nullable;
 /**
  * Represents a hint strategy entry of {@link HintStrategyTable}.
  *
- * <p>A {@code HintStrategy} includes:
+ * <p>A {@code HintStrategy} defines:
  *
  * <ul>
  *   <li>{@link HintPredicate}: tests whether a hint should apply to
@@ -41,7 +41,7 @@ import javax.annotation.Nullable;
  *
  * <p>The {@link HintPredicate} is required, all the other items are optional.
  *
- * <p>A {@link HintStrategy} is immutable.
+ * <p>{@link HintStrategy} is immutable.
  */
 public class HintStrategy {
   //~ Instance fields --------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/hint/HintStrategyTable.java b/core/src/main/java/org/apache/calcite/rel/hint/HintStrategyTable.java
index ac75153..fc4db46 100644
--- a/core/src/main/java/org/apache/calcite/rel/hint/HintStrategyTable.java
+++ b/core/src/main/java/org/apache/calcite/rel/hint/HintStrategyTable.java
@@ -34,12 +34,14 @@ import java.util.Set;
 import java.util.stream.Collectors;
 
 /**
- * A collections of {@link HintStrategy}s.
+ * A collection of {@link HintStrategy}s.
  *
- * <p>Every supported hint should register a {@link HintPredicate}
- * into this collection. For example, {@link HintPredicates#JOIN} implies that this hint
- * would be propagated and attached to the {@link org.apache.calcite.rel.core.Join}
- * relational expressions.
+ * <p>Every hint must register a {@link HintStrategy} into the collection.
+ * With a hint strategies mapping, the hint strategy table is used as a tool
+ * to decide i) if the given hint was registered; ii) which hints are suitable for the rel with
+ * a given hints collection; iii) if the hint options are valid.
+ *
+ * <p>Once built, the hint strategy table is immutable during the planning phrase.
  *
  * <p>Match of hint name is case in-sensitive.
  *
@@ -49,7 +51,6 @@ public class HintStrategyTable {
   //~ Static fields/initializers ---------------------------------------------
 
   /** Empty strategies. */
-  // Need to replace the EMPTY with DEFAULT if we have any hint implementations.
   public static final HintStrategyTable EMPTY = new HintStrategyTable(
       Collections.emptyMap(), HintErrorLogger.INSTANCE);
 
@@ -163,11 +164,15 @@ public class HintStrategyTable {
       return new Key(name.toLowerCase(Locale.ROOT));
     }
 
-    @Override public boolean equals(Object obj) {
-      if (!(obj instanceof Key)) {
+    @Override public boolean equals(Object o) {
+      if (this == o) {
+        return true;
+      }
+      if (o == null || getClass() != o.getClass()) {
         return false;
       }
-      return Objects.equals(this.name, ((Key) obj).name);
+      Key key = (Key) o;
+      return name.equals(key.name);
     }
 
     @Override public int hashCode() {
diff --git a/core/src/main/java/org/apache/calcite/rel/hint/RelHint.java b/core/src/main/java/org/apache/calcite/rel/hint/RelHint.java
index 8102905..169e1bd 100644
--- a/core/src/main/java/org/apache/calcite/rel/hint/RelHint.java
+++ b/core/src/main/java/org/apache/calcite/rel/hint/RelHint.java
@@ -29,14 +29,29 @@ import java.util.Objects;
 import javax.annotation.Nullable;
 
 /**
- * Represents hint within a relation expression.
+ * Hint attached to a relation expression.
  *
- * <p>Every hint has a {@code inheritPath} (integers list) which records its propagate path
- * from the root node,
- * number `0` represents the hint is propagated from the first(left) child,
- * number `1` represents the hint is propagated from the second(right) child.
+ * <p>A hint can be used to:
  *
- * <p>Given a relational expression tree with initial attached hints:
+ * <ul>
+ *   <li>Enforce planner: there's no perfect planner, so it makes sense to implement hints to
+ *   allow user better control the execution. For instance, "never merge this subquery with others",
+ *   "treat those tables as leading ones" in the join ordering, etc.</li>
+ *   <li>Append meta data/statistics: Some statistics like “table index for scan” and
+ *   “skew info of some shuffle keys” are somewhat dynamic for the query, it would be very
+ *   convenient to config them with hints because our planning metadata from the planner is very
+ *   often not that accurate.</li>
+ *   <li>Operator resource constraints: For many cases, we would give a default resource
+ *   configuration for the execution operators, i.e. min parallelism or
+ *   managed memory (resource consuming UDF) or special resource requirement (GPU or SSD disk)
+ *   and so on, it would be very flexible to profile the resource with hints per query
+ *   (instead of the Job).</li>
+ * </ul>
+ *
+ * <p>In order to support hint override, each hint has a {@code inheritPath} (integers list) to
+ * record its propagate path from the root node, number `0` represents the hint was propagated
+ * along the first(left) child, number `1` represents the hint was propagated along the
+ * second(right) child. Given a relational expression tree with initial attached hints:
  *
  * <blockquote><pre>
  *            Filter (Hint1)
@@ -48,20 +63,21 @@ import javax.annotation.Nullable;
  *                    Scan2
  * </pre></blockquote>
  *
- * <p>The plan would have hints path as follows
- * (assumes each hint can be propagated to all child nodes):
- * <ul>
- *   <li>Filter would have hints {Hint1[]}</li>
- *   <li>Join would have hints {Hint1[0]}</li>
- *   <li>Scan would have hints {Hint1[0, 0]}</li>
- *   <li>Project would have hints {Hint1[0,1], Hint2[]}</li>
- *   <li>Scan2 would have hints {[Hint1[0, 1, 0], Hint2[0]}</li>
- * </ul>
+ * <p>The plan would have hints path as follows (assumes each hint can be propagated to all
+ * child nodes):
+ *
+ * <blockquote><ul>
+ *   <li>Filter &#8594; {Hint1[]}</li>
+ *   <li>Join &#8594; {Hint1[0]}</li>
+ *   <li>Scan &#8594; {Hint1[0, 0]}</li>
+ *   <li>Project &#8594; {Hint1[0,1], Hint2[]}</li>
+ *   <li>Scan2 &#8594; {[Hint1[0, 1, 0], Hint2[0]}</li>
+ * </ul></blockquote>
  *
- * <p>The {@code listOptions} and {@code kvOptions} are supposed to contain the same information,
+ * <p>{@code listOptions} and {@code kvOptions} are supposed to contain the same information,
  * they are mutually exclusive, that means, they can not both be non-empty.
  *
- * <p>The <code>RelHint</code> is immutable.
+ * <p>RelHint is immutable.
  */
 public class RelHint {
   //~ Instance fields --------------------------------------------------------
@@ -112,15 +128,18 @@ public class RelHint {
     return new RelHint(inheritPath, hintName, listOptions, kvOptions);
   }
 
-  @Override public boolean equals(Object obj) {
-    if (!(obj instanceof RelHint)) {
+  @Override public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (o == null || getClass() != o.getClass()) {
       return false;
     }
-    final RelHint that = (RelHint) obj;
-    return this.hintName.equals(that.hintName)
-        && this.inheritPath.equals(that.inheritPath)
-        && Objects.equals(this.listOptions, that.listOptions)
-        && Objects.equals(this.kvOptions, that.kvOptions);
+    RelHint hint = (RelHint) o;
+    return inheritPath.equals(hint.inheritPath)
+        && hintName.equals(hint.hintName)
+        && Objects.equals(listOptions, hint.listOptions)
+        && Objects.equals(kvOptions, hint.kvOptions);
   }
 
   @Override public int hashCode() {
diff --git a/core/src/main/java/org/apache/calcite/rel/rules/DateRangeRules.java b/core/src/main/java/org/apache/calcite/rel/rules/DateRangeRules.java
index cf1a13a..9029ab2 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/DateRangeRules.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/DateRangeRules.java
@@ -36,7 +36,6 @@ import org.apache.calcite.sql.SqlKind;
 import org.apache.calcite.sql.fun.SqlStdOperatorTable;
 import org.apache.calcite.tools.RelBuilder;
 import org.apache.calcite.tools.RelBuilderFactory;
-import org.apache.calcite.util.Bug;
 import org.apache.calcite.util.DateString;
 import org.apache.calcite.util.TimestampString;
 import org.apache.calcite.util.TimestampWithTimeZoneString;
@@ -249,8 +248,6 @@ public abstract class DateRangeRules {
         ImmutableSortedSet<TimeUnitRange> timeUnitRanges, String timeZone) {
       this.rexBuilder = Objects.requireNonNull(rexBuilder);
       this.timeUnit = Objects.requireNonNull(timeUnit);
-      Bug.upgrade("Change type to Map<RexNode, RangeSet<Calendar>> when"
-          + " [CALCITE-1367] is fixed");
       this.operandRanges = Objects.requireNonNull(operandRanges);
       this.timeUnitRanges = Objects.requireNonNull(timeUnitRanges);
       this.timeZone = timeZone;
diff --git a/core/src/main/java/org/apache/calcite/rex/RexUtil.java b/core/src/main/java/org/apache/calcite/rex/RexUtil.java
index 26211c1..98ef1e2 100644
--- a/core/src/main/java/org/apache/calcite/rex/RexUtil.java
+++ b/core/src/main/java/org/apache/calcite/rex/RexUtil.java
@@ -2031,7 +2031,7 @@ public class RexUtil {
    *
    * @deprecated Use {@link #not} */
   @SuppressWarnings("Guava")
-  @Deprecated // to be removed in 2.0
+  @Deprecated // to be removed before 2.0
   public static com.google.common.base.Function<RexNode, RexNode> notFn(
       final RexBuilder rexBuilder) {
     return e -> not(rexBuilder, e);
diff --git a/core/src/main/java/org/apache/calcite/runtime/Hook.java b/core/src/main/java/org/apache/calcite/runtime/Hook.java
index 22ac163..372572f 100644
--- a/core/src/main/java/org/apache/calcite/runtime/Hook.java
+++ b/core/src/main/java/org/apache/calcite/runtime/Hook.java
@@ -132,7 +132,7 @@ public enum Hook {
 
   /** @deprecated Use {@link #add(Consumer)}. */
   @SuppressWarnings("Guava")
-  @Deprecated // to be removed in 2.0
+  @Deprecated // to be removed before 2.0
   public <T, R> Closeable add(final Function<T, R> handler) {
     return add((Consumer<T>) handler::apply);
   }
@@ -151,7 +151,7 @@ public enum Hook {
 
   /** @deprecated Use {@link #addThread(Consumer)}. */
   @SuppressWarnings("Guava")
-  @Deprecated // to be removed in 2.0
+  @Deprecated // to be removed before 2.0
   public <T, R> Closeable addThread(
       final com.google.common.base.Function<T, R> handler) {
     return addThread((Consumer<T>) handler::apply);
diff --git a/core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java b/core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java
index 4b89963..8b9b59d 100644
--- a/core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java
+++ b/core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java
@@ -33,7 +33,6 @@ import org.apache.calcite.linq4j.function.Function1;
 import org.apache.calcite.linq4j.function.NonDeterministic;
 import org.apache.calcite.linq4j.tree.Primitive;
 import org.apache.calcite.runtime.FlatLists.ComparableList;
-import org.apache.calcite.util.Bug;
 import org.apache.calcite.util.NumberUtil;
 import org.apache.calcite.util.TimeWithTimeZoneString;
 import org.apache.calcite.util.TimestampWithTimeZoneString;
@@ -2165,14 +2164,7 @@ public class SqlFunctions {
       return 0;
     }
 
-    // ByteString doesn't have indexOf(ByteString, int) until avatica-1.9
-    // (see [CALCITE-1423]), so apply substring and find from there.
-    Bug.upgrade("in avatica-1.9, use ByteString.substring(ByteString, int)");
-    final int p = s.substring(from0).indexOf(seek);
-    if (p < 0) {
-      return 0;
-    }
-    return p + from;
+    return s.indexOf(seek, from0) + 1;
   }
 
   /** Helper for rounding. Truncate(12345, 1000) returns 12000. */
diff --git a/core/src/main/java/org/apache/calcite/sql/advise/SqlAdvisor.java b/core/src/main/java/org/apache/calcite/sql/advise/SqlAdvisor.java
index 0b592f9..b15d19a 100644
--- a/core/src/main/java/org/apache/calcite/sql/advise/SqlAdvisor.java
+++ b/core/src/main/java/org/apache/calcite/sql/advise/SqlAdvisor.java
@@ -84,7 +84,7 @@ public class SqlAdvisor {
    * @param validator Validator
    * @deprecated use {@link #SqlAdvisor(SqlValidatorWithHints, SqlParser.Config)}
    */
-  @Deprecated
+  @Deprecated // to be removed before 2.0
   public SqlAdvisor(
       SqlValidatorWithHints validator) {
     this(validator, SqlParser.Config.DEFAULT);
diff --git a/core/src/main/java/org/apache/calcite/sql/advise/SqlSimpleParser.java b/core/src/main/java/org/apache/calcite/sql/advise/SqlSimpleParser.java
index f7a01fb..2b61b6d 100644
--- a/core/src/main/java/org/apache/calcite/sql/advise/SqlSimpleParser.java
+++ b/core/src/main/java/org/apache/calcite/sql/advise/SqlSimpleParser.java
@@ -101,7 +101,7 @@ public class SqlSimpleParser {
    * @param hintToken Hint token
    * @deprecated
    */
-  @Deprecated
+  @Deprecated // to be removed before 2.0
   public SqlSimpleParser(String hintToken) {
     this(hintToken, SqlParser.Config.DEFAULT);
   }
@@ -275,7 +275,7 @@ public class SqlSimpleParser {
     private int pos;
     int start = 0;
 
-    @Deprecated
+    @Deprecated // to be removed before 2.0
     public Tokenizer(String sql, String hintToken) {
       this(sql, hintToken, Quoting.DOUBLE_QUOTE);
     }
diff --git a/core/src/main/java/org/apache/calcite/sql/validate/SqlValidator.java b/core/src/main/java/org/apache/calcite/sql/validate/SqlValidator.java
index 620703c..1f888e2 100644
--- a/core/src/main/java/org/apache/calcite/sql/validate/SqlValidator.java
+++ b/core/src/main/java/org/apache/calcite/sql/validate/SqlValidator.java
@@ -114,17 +114,6 @@ public interface SqlValidator {
   //~ Methods ----------------------------------------------------------------
 
   /**
-   * Returns the dialect of SQL (SQL:2003, etc.) this validator recognizes.
-   * Default is {@link SqlConformanceEnum#DEFAULT}.
-   *
-   * @return dialect of SQL this validator recognizes
-   *
-   * @deprecated Use {@link Config#sqlConformance}
-   */
-  @Deprecated // to be removed before 1.24
-  SqlConformance getConformance();
-
-  /**
    * Returns the catalog reader used by this validator.
    *
    * @return catalog reader
@@ -625,74 +614,6 @@ public interface SqlValidator {
   String getParentCursor(String columnListParamName);
 
   /**
-   * Enables or disables expansion of identifiers other than column
-   * references.
-   *
-   * @param expandIdentifiers new setting
-   *
-   * @deprecated Use {@link Config#withIdentifierExpansion}
-   */
-  @Deprecated // to be removed before 1.24
-  void setIdentifierExpansion(boolean expandIdentifiers);
-
-  /**
-   * Enables or disables expansion of column references. (Currently this does
-   * not apply to the ORDER BY clause; may be fixed in the future.)
-   *
-   * @param expandColumnReferences new setting
-   *
-   * @deprecated Use {@link Config#columnReferenceExpansion}
-   */
-  @Deprecated // to be removed before 1.24
-  void setColumnReferenceExpansion(boolean expandColumnReferences);
-
-  /**
-   * @return whether column reference expansion is enabled
-   *
-   * @deprecated  Use {@link Config#columnReferenceExpansion}
-   */
-  @Deprecated // to be removed before 1.24
-  boolean getColumnReferenceExpansion();
-
-  /**
-   * Sets how NULL values should be collated if an ORDER BY item does not
-   * contain NULLS FIRST or NULLS LAST.
-   *
-   * @deprecated Use {@link Config#defaultNullCollation}
-   */
-  @Deprecated // to be removed before 1.24
-  void setDefaultNullCollation(NullCollation nullCollation);
-
-  /**
-   * Returns how NULL values should be collated if an ORDER BY item does not
-   * contain NULLS FIRST or NULLS LAST.
-   *
-   * @deprecated Use {@link Config#defaultNullCollation}
-   */
-  @Deprecated // to be removed before 1.24
-  NullCollation getDefaultNullCollation();
-
-  /**
-   * Returns expansion of identifiers.
-   *
-   * @return whether this validator should expand identifiers
-   *
-   * @deprecated Use {@link Config#identifierExpansion}
-   */
-  @Deprecated // to be removed before 1.24
-  boolean shouldExpandIdentifiers();
-
-  /**
-   * Enables or disables rewrite of "macro-like" calls such as COALESCE.
-   *
-   * @param rewriteCalls new setting
-   *
-   * @deprecated Use {@link Config#callRewrite}
-   */
-  @Deprecated // to be removed before 1.24
-  void setCallRewrite(boolean rewriteCalls);
-
-  /**
    * Derives the type of a constructor.
    *
    * @param scope                 Scope
@@ -816,85 +737,9 @@ public interface SqlValidator {
 
   SqlValidatorScope getWithScope(SqlNode withItem);
 
-  /**
-   * Sets whether this validator should be lenient upon encountering an unknown
-   * function.
-   *
-   * @param lenient Whether to be lenient when encountering an unknown function
-   *
-   * @deprecated Use {@link Config#withLenientOperatorLookup}
-   */
-  @Deprecated // to be removed before 1.24
-  SqlValidator setLenientOperatorLookup(boolean lenient);
-
-  /** Returns whether this validator should be lenient upon encountering an
-   * unknown function.
-   *
-   * <p>If true, if a statement contains a call to a function that is not
-   * present in the operator table, or if the call does not have the required
-   * number or types of operands, the validator nevertheless regards the
-   * statement as valid. The type of the function call will be
-   * {@link #getUnknownType() UNKNOWN}.
-   *
-   * <p>If false (the default behavior), an unknown function call causes a
-   * validation error to be thrown.
-   *
-   * @deprecated Use {@link Config#lenientOperatorLookup}
-   */
-  @Deprecated // to be removed before 1.24
-  boolean isLenientOperatorLookup();
-
-  /**
-   * Sets enable or disable implicit type coercion when the validator does validation.
-   *
-   * @param enabled if enable the type coercion, default is true
-   *
-   * @see org.apache.calcite.sql.validate.implicit.TypeCoercionImpl TypeCoercionImpl
-   *
-   * @deprecated Use {@link Config#withTypeCoercionEnabled}
-   */
-  @Deprecated // to be removed before 1.24
-  SqlValidator setEnableTypeCoercion(boolean enabled);
-
-  /**
-   * Returns if this validator supports implicit type coercion.
-   *
-   * @deprecated Use {@link Config#typeCoercionEnabled}
-   */
-  @Deprecated // to be removed before 1.24
-  boolean isTypeCoercionEnabled();
-
-  /**
-   * Sets an instance of type coercion, you can customize the coercion rules to
-   * override the default ones defined in
-   * {@link org.apache.calcite.sql.validate.implicit.TypeCoercionImpl}.
-   *
-   * @param typeCoercion {@link TypeCoercion} instance
-   *
-   * @deprecated Use {@link Config#withTypeCoercionFactory}
-   */
-  @Deprecated // to be removed before 1.24
-  void setTypeCoercion(TypeCoercion typeCoercion);
-
   /** Get the type coercion instance. */
   TypeCoercion getTypeCoercion();
 
-  /**
-   * Sets the {@link SqlTypeCoercionRule} instance which defines the type conversion matrix
-   * for the explicit type coercion.
-   *
-   * <p>The {@code typeCoercionRules} setting should be thread safe.
-   * In the default implementation,
-   * the {@code typeCoercionRules} is set to a ThreadLocal variable.
-   *
-   * @param typeCoercionRules The {@link SqlTypeCoercionRule} instance, see its documentation
-   *                          for how to customize the rules.
-   *
-   * @deprecated Use {@link Config#withTypeCoercionRules}
-   */
-  @Deprecated // to be removed before 1.24
-  void setSqlTypeCoercionRules(SqlTypeCoercionRule typeCoercionRules);
-
   /** Returns the config of the validator. */
   Config config();
 
diff --git a/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java b/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
index a8a2d73..8ab958a 100644
--- a/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
+++ b/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
@@ -268,8 +268,6 @@ public class SqlValidatorImpl implements SqlValidatorWithHints {
 
   private SqlNode top;
 
-  private NullCollation nullCollation = NullCollation.HIGH;
-
   // TODO jvs 11-Dec-2008:  make this local to performUnconditionalRewrites
   // if it's OK to expand the signature of that method.
   private boolean validatingSqlMerge;
@@ -320,23 +318,6 @@ public class SqlValidatorImpl implements SqlValidatorWithHints {
     }
   }
 
-  /**
-   * Creates a validator.
-   *
-   * @param opTab         Operator table
-   * @param catalogReader Catalog reader
-   * @param typeFactory   Type factory
-   * @param conformance   Compatibility mode
-   */
-  @Deprecated // to be removed before 1.24
-  protected SqlValidatorImpl(
-      SqlOperatorTable opTab,
-      SqlValidatorCatalogReader catalogReader,
-      RelDataTypeFactory typeFactory,
-      SqlConformance conformance) {
-    this(opTab, catalogReader, typeFactory, Config.DEFAULT.withSqlConformance(conformance));
-  }
-
   //~ Methods ----------------------------------------------------------------
 
   public SqlConformance getConformance() {
diff --git a/core/src/main/java/org/apache/calcite/sql/validate/implicit/AbstractTypeCoercion.java b/core/src/main/java/org/apache/calcite/sql/validate/implicit/AbstractTypeCoercion.java
index ad53825..4ad0c6c 100644
--- a/core/src/main/java/org/apache/calcite/sql/validate/implicit/AbstractTypeCoercion.java
+++ b/core/src/main/java/org/apache/calcite/sql/validate/implicit/AbstractTypeCoercion.java
@@ -349,7 +349,7 @@ public abstract class AbstractTypeCoercion implements TypeCoercion {
       resultType = factory.leastRestrictive(ImmutableList.of(type1, type2));
     }
     // For numeric types: promote to highest type.
-    // i.e. SQL-SERVER/MYSQL supports numeric types cast from/to each other.
+    // i.e. MS-SQL/MYSQL supports numeric types cast from/to each other.
     if (SqlTypeUtil.isNumeric(type1) && SqlTypeUtil.isNumeric(type2)) {
       // For fixed precision decimals casts from(to) each other or other numeric types,
       // we let the operator decide the precision and scale of the result.
@@ -415,7 +415,7 @@ public abstract class AbstractTypeCoercion implements TypeCoercion {
     // 1. Do not distinguish CHAR and VARCHAR, i.e. (INTEGER + CHAR(3))
     //    and (INTEGER + VARCHAR(5)) would both deduce VARCHAR type.
     // 2. VARCHAR has 65536 as default precision.
-    // 3. Following SQL-SERVER: BINARY or BOOLEAN can be casted to VARCHAR.
+    // 3. Following MS-SQL: BINARY or BOOLEAN can be casted to VARCHAR.
     if (SqlTypeUtil.isAtomic(type1) && SqlTypeUtil.isCharacter(type2)) {
       resultType = factory.createSqlType(SqlTypeName.VARCHAR);
     }
@@ -474,7 +474,7 @@ public abstract class AbstractTypeCoercion implements TypeCoercion {
       return SqlTypeUtil.getMaxPrecisionScaleDecimal(factory);
     }
 
-    // Keep sync with SQL-SERVER:
+    // Keep sync with MS-SQL:
     // 1. BINARY/VARBINARY can not cast to FLOAT/REAL/DOUBLE
     // because of precision loss,
     // 2. CHARACTER to TIMESTAMP need explicit cast because of TimeZone.
@@ -598,7 +598,7 @@ public abstract class AbstractTypeCoercion implements TypeCoercion {
   }
 
   /**
-   * Check if the types and families can have implicit type coercion.
+   * Checks if the types and families can have implicit type coercion.
    * We will check the type one by one, that means the 1th type and 1th family,
    * 2th type and 2th family, and the like.
    *
@@ -667,7 +667,7 @@ public abstract class AbstractTypeCoercion implements TypeCoercion {
     }
     // If the function accepts any NUMERIC type and the input is a STRING,
     // returns the expected type family's default type.
-    // REVIEW Danny 2018-05-22: same with SQL-SERVER and MYSQL.
+    // REVIEW Danny 2018-05-22: same with MS-SQL and MYSQL.
     if (SqlTypeUtil.isCharacter(in) && numericFamilies.contains(expected)) {
       return expected.getDefaultConcreteType(factory);
     }
diff --git a/core/src/main/java/org/apache/calcite/sql/validate/implicit/TypeCoercion.java b/core/src/main/java/org/apache/calcite/sql/validate/implicit/TypeCoercion.java
index c418ac9..3b0d064 100644
--- a/core/src/main/java/org/apache/calcite/sql/validate/implicit/TypeCoercion.java
+++ b/core/src/main/java/org/apache/calcite/sql/validate/implicit/TypeCoercion.java
@@ -97,11 +97,10 @@ public interface TypeCoercion {
    * Widen a SqlNode ith column type to target type, mainly used for set
    * operations like UNION, INTERSECT and EXCEPT.
    *
-   * @param scope       scope to query
+   * @param scope       Scope to query
    * @param query       SqlNode which have children nodes as columns
-   * @param columnIndex target column index
-   * @param targetType  target type to cast to
-   * @return true if we add any cast in successfully
+   * @param columnIndex Target column index
+   * @param targetType  Target type to cast to
    */
   boolean rowTypeCoercion(
       SqlValidatorScope scope,
@@ -116,14 +115,14 @@ public interface TypeCoercion {
    */
   boolean inOperationCoercion(SqlCallBinding binding);
 
-  /** Coerce operand of binary arithmetic expressions to Numeric type.*/
+  /** Coerces operand of binary arithmetic expressions to Numeric type.*/
   boolean binaryArithmeticCoercion(SqlCallBinding binding);
 
-  /** Coerce operands in binary comparison expressions. */
+  /** Coerces operands in binary comparison expressions. */
   boolean binaryComparisonCoercion(SqlCallBinding binding);
 
   /**
-   * Coerce CASE WHEN statement branches to one common type.
+   * Coerces CASE WHEN statement branches to one common type.
    *
    * <p>Rules: Find common type for all the then operands and else operands,
    * then try to coerce the then/else operands to the type if needed.
@@ -153,7 +152,6 @@ public interface TypeCoercion {
    * @param binding          Call binding
    * @param operandTypes     Types of the operands passed in
    * @param expectedFamilies Expected SqlTypeFamily list by user specified
-   * @return true if we successfully do any implicit cast
    */
   boolean builtinFunctionCoercion(
       SqlCallBinding binding,
@@ -165,13 +163,11 @@ public interface TypeCoercion {
    * with rules:
    *
    * <ol>
-   * <li>named param: find the desired type by the passed in operand's name
-   * <li>non-named param: find the desired type by formal parameter ordinal
+   * <li>Named param: find the desired type by the passed in operand's name
+   * <li>Non-named param: find the desired type by formal parameter ordinal
    * </ol>
    *
-   * <p>Try to make type coercion only of the desired type is found.
-   *
-   * @return true if any operands is coerced
+   * <p>Try to make type coercion only if the desired type is found.
    */
   boolean userDefinedFunctionCoercion(SqlValidatorScope scope, SqlCall call,
       SqlFunction function);
@@ -186,8 +182,6 @@ public interface TypeCoercion {
    * @param sourceRowType Source row type
    * @param targetRowType Target row type
    * @param query         The query, either an INSERT or UPDATE
-   *
-   * @return True if any type coercion happens
    */
   boolean querySourceCoercion(SqlValidatorScope scope,
       RelDataType sourceRowType, RelDataType targetRowType, SqlNode query);
diff --git a/core/src/main/java/org/apache/calcite/util/ImmutableIntList.java b/core/src/main/java/org/apache/calcite/util/ImmutableIntList.java
index eaa594b..de5d7d4 100644
--- a/core/src/main/java/org/apache/calcite/util/ImmutableIntList.java
+++ b/core/src/main/java/org/apache/calcite/util/ImmutableIntList.java
@@ -16,7 +16,6 @@
  */
 package org.apache.calcite.util;
 
-import org.apache.calcite.linq4j.function.Function1;
 import org.apache.calcite.linq4j.function.Functions;
 import org.apache.calcite.runtime.FlatLists;
 import org.apache.calcite.util.mapping.Mappings;
@@ -242,14 +241,7 @@ public class ImmutableIntList extends FlatLists.AbstractFlatList<Integer> {
    *
    * <p>For example, {@code range(1, 3)} contains [1, 2]. */
   public static List<Integer> range(final int lower, final int upper) {
-    return Functions.generate(upper - lower,
-        new Function1<Integer, Integer>() {
-          /** @see Bug#upgrade(String) Upgrade to {@code IntFunction} when we
-           * drop support for JDK 1.7 */
-          public Integer apply(Integer index) {
-            return lower + index;
-          }
-        });
+    return Functions.generate(upper - lower, index -> lower + index);
   }
 
   /** Returns the identity list [0, ..., count - 1].
diff --git a/core/src/test/java/org/apache/calcite/test/AbstractMaterializedViewTest.java b/core/src/test/java/org/apache/calcite/test/AbstractMaterializedViewTest.java
index 5209bbd..626b9ab 100644
--- a/core/src/test/java/org/apache/calcite/test/AbstractMaterializedViewTest.java
+++ b/core/src/test/java/org/apache/calcite/test/AbstractMaterializedViewTest.java
@@ -107,7 +107,7 @@ public abstract class AbstractMaterializedViewTest {
     if (substitutes.stream().noneMatch(sub -> checker.apply(RelOptUtil.toString(sub)))) {
       StringBuilder substituteMessages = new StringBuilder();
       for (RelNode sub: substitutes) {
-        substituteMessages.append(RelOptUtil.toString(sub) + "\n");
+        substituteMessages.append(RelOptUtil.toString(sub)).append("\n");
       }
       throw new AssertionError("Materialized view failed to be matched by optmized results:\n"
           + substituteMessages.toString());
@@ -127,50 +127,48 @@ public abstract class AbstractMaterializedViewTest {
     final StringBuilder errMsgBuilder = new StringBuilder();
     errMsgBuilder.append("Optmization succeeds out of expectation: ");
     for (RelNode res: results) {
-      errMsgBuilder.append(RelOptUtil.toString(res) + "\n");
+      errMsgBuilder.append(RelOptUtil.toString(res)).append("\n");
     }
     throw new AssertionError(errMsgBuilder.toString());
   }
 
   private TestConfig build(Sql sql) {
     assert sql != null;
-    final TestConfig result =
-        Frameworks.withPlanner((cluster, relOptSchema, rootSchema) -> {
-          cluster.getPlanner().setExecutor(
-              new RexExecutorImpl(Schemas.createDataContext(null, null)));
-          try {
-            final SchemaPlus defaultSchema;
-            if (sql.getDefaultSchemaSpec() == null) {
-              defaultSchema = rootSchema.add("hr",
-                  new ReflectiveSchema(new MaterializationTest.HrFKUKSchema()));
-            } else {
-              defaultSchema = CalciteAssert.addSchema(rootSchema, sql.getDefaultSchemaSpec());
-            }
-            final RelNode queryRel = toRel(cluster, rootSchema, defaultSchema, sql.getQuery());
-            final List<RelOptMaterialization> mvs = new ArrayList<>();
-            final RelBuilder relBuilder =
-                RelFactories.LOGICAL_BUILDER.create(cluster, relOptSchema);
-            final MaterializationService.DefaultTableFactory tableFactory =
-                new MaterializationService.DefaultTableFactory();
-            for (Pair<String, String> pair: sql.getMaterializations()) {
-              final RelNode mvRel = toRel(cluster, rootSchema, defaultSchema, pair.left);
-              final Table table = tableFactory.createTable(CalciteSchema.from(rootSchema),
-                  pair.left, ImmutableList.of(defaultSchema.getName()));
-              defaultSchema.add(pair.right, table);
-              relBuilder.scan(defaultSchema.getName(), pair.right);
-              final LogicalTableScan logicalScan = (LogicalTableScan) relBuilder.build();
-              final EnumerableTableScan replacement =
-                  EnumerableTableScan.create(cluster, logicalScan.getTable());
-              mvs.add(
-                  new RelOptMaterialization(replacement, mvRel, null,
-                      ImmutableList.of(defaultSchema.getName(), pair.right)));
-            }
-            return new TestConfig(defaultSchema.getName(), queryRel, mvs);
-          } catch (Exception e) {
-            throw TestUtil.rethrow(e);
-          }
-        });
-    return result;
+    return Frameworks.withPlanner((cluster, relOptSchema, rootSchema) -> {
+      cluster.getPlanner().setExecutor(
+          new RexExecutorImpl(Schemas.createDataContext(null, null)));
+      try {
+        final SchemaPlus defaultSchema;
+        if (sql.getDefaultSchemaSpec() == null) {
+          defaultSchema = rootSchema.add("hr",
+              new ReflectiveSchema(new MaterializationTest.HrFKUKSchema()));
+        } else {
+          defaultSchema = CalciteAssert.addSchema(rootSchema, sql.getDefaultSchemaSpec());
+        }
+        final RelNode queryRel = toRel(cluster, rootSchema, defaultSchema, sql.getQuery());
+        final List<RelOptMaterialization> mvs = new ArrayList<>();
+        final RelBuilder relBuilder =
+            RelFactories.LOGICAL_BUILDER.create(cluster, relOptSchema);
+        final MaterializationService.DefaultTableFactory tableFactory =
+            new MaterializationService.DefaultTableFactory();
+        for (Pair<String, String> pair: sql.getMaterializations()) {
+          final RelNode mvRel = toRel(cluster, rootSchema, defaultSchema, pair.left);
+          final Table table = tableFactory.createTable(CalciteSchema.from(rootSchema),
+              pair.left, ImmutableList.of(defaultSchema.getName()));
+          defaultSchema.add(pair.right, table);
+          relBuilder.scan(defaultSchema.getName(), pair.right);
+          final LogicalTableScan logicalScan = (LogicalTableScan) relBuilder.build();
+          final EnumerableTableScan replacement =
+              EnumerableTableScan.create(cluster, logicalScan.getTable());
+          mvs.add(
+              new RelOptMaterialization(replacement, mvRel, null,
+                  ImmutableList.of(defaultSchema.getName(), pair.right)));
+        }
+        return new TestConfig(defaultSchema.getName(), queryRel, mvs);
+      } catch (Exception e) {
+        throw TestUtil.rethrow(e);
+      }
+    });
   }
 
   private RelNode toRel(RelOptCluster cluster, SchemaPlus rootSchema,
@@ -199,17 +197,17 @@ public abstract class AbstractMaterializedViewTest {
   }
 
   /** Validator for testing. */
-  private class ValidatorForTest extends SqlValidatorImpl {
+  private static class ValidatorForTest extends SqlValidatorImpl {
     ValidatorForTest(SqlOperatorTable opTab, SqlValidatorCatalogReader catalogReader,
         RelDataTypeFactory typeFactory, SqlConformance conformance) {
-      super(opTab, catalogReader, typeFactory, conformance);
+      super(opTab, catalogReader, typeFactory, Config.DEFAULT.withSqlConformance(conformance));
     }
   }
 
   /**
    * Processed testing definition.
    */
-  protected class TestConfig {
+  protected static class TestConfig {
     public final String defaultSchema;
     public final RelNode queryRel;
     public final List<RelOptMaterialization> materializations;
diff --git a/core/src/test/java/org/apache/calcite/test/CalciteAssert.java b/core/src/test/java/org/apache/calcite/test/CalciteAssert.java
index a6cb7b1..db63828 100644
--- a/core/src/test/java/org/apache/calcite/test/CalciteAssert.java
+++ b/core/src/test/java/org/apache/calcite/test/CalciteAssert.java
@@ -1505,13 +1505,6 @@ public class CalciteAssert {
               hooks, null, checkUpdateCount(count), null));
     }
 
-    @SuppressWarnings("Guava")
-    @Deprecated // to be removed in 2.0
-    public final AssertQuery returns(
-        com.google.common.base.Function<ResultSet, Void> checker) {
-      return returns(sql, checker::apply);
-    }
-
     protected AssertQuery returns(String sql, Consumer<ResultSet> checker) {
       return withConnection(connection -> {
         if (consumer == null) {
@@ -1810,12 +1803,6 @@ public class CalciteAssert {
       return this;
     }
 
-    @SuppressWarnings("Guava")
-    @Deprecated // to be removed in 2.0
-    public <T> AssertQuery withHook(Hook hook, Function<T, Void> handler) {
-      return withHook(hook, (Consumer<T>) handler::apply);
-    }
-
     /** Adds a hook and a handler for that hook. Calcite will create a thread
      * hook (by calling {@link Hook#addThread(Consumer)})
      * just before running the query, and remove the hook afterwards. */
diff --git a/linq4j/src/main/java/org/apache/calcite/linq4j/function/Functions.java b/linq4j/src/main/java/org/apache/calcite/linq4j/function/Functions.java
index 6ef927a..4406bfb 100644
--- a/linq4j/src/main/java/org/apache/calcite/linq4j/function/Functions.java
+++ b/linq4j/src/main/java/org/apache/calcite/linq4j/function/Functions.java
@@ -29,6 +29,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.RandomAccess;
+import java.util.function.IntFunction;
 
 /**
  * Utilities relating to functions.
@@ -373,7 +374,7 @@ public abstract class Functions {
   /** Returns a list generated by applying a function to each index between
    * 0 and {@code size} - 1. */
   public static <E> List<E> generate(final int size,
-      final Function1<Integer, E> fn) {
+      final IntFunction<E> fn) {
     if (size < 0) {
       throw new IllegalArgumentException();
     }
@@ -609,9 +610,9 @@ public abstract class Functions {
   private static class GeneratingList<E> extends AbstractList<E>
       implements RandomAccess {
     private final int size;
-    private final Function1<Integer, E> fn;
+    private final IntFunction<E> fn;
 
-    GeneratingList(int size, Function1<Integer, E> fn) {
+    GeneratingList(int size, IntFunction<E>  fn) {
       this.size = size;
       this.fn = fn;
     }
diff --git a/linq4j/src/test/java/org/apache/calcite/linq4j/function/FunctionTest.java b/linq4j/src/test/java/org/apache/calcite/linq4j/function/FunctionTest.java
index cdf7c69..1e0fd66 100644
--- a/linq4j/src/test/java/org/apache/calcite/linq4j/function/FunctionTest.java
+++ b/linq4j/src/test/java/org/apache/calcite/linq4j/function/FunctionTest.java
@@ -21,6 +21,7 @@ import org.junit.jupiter.api.Test;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+import java.util.function.IntFunction;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -80,9 +81,9 @@ class FunctionTest {
 
   /** Unit test for {@link Functions#generate}. */
   @Test void testGenerate() {
-    final Function1<Integer, String> xx =
-        new Function1<Integer, String>() {
-          public String apply(Integer a0) {
+    final IntFunction<String> xx =
+        new IntFunction<String>() {
+          public String apply(int a0) {
             return a0 == 0 ? "0" : "x" + apply(a0 - 1);
           }
         };