You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2017/06/19 00:28:54 UTC

[3/4] calcite git commit: Cosmetic changes

Cosmetic changes

Problems addressed:
* trailing spaces;
* missing <p> and <blockquote> in javadoc;
* missing newline at ends of files;
* missing space in 'if(', 'switch(' etc.

Change "new BigDecimal" to "BigDecimal.valueOf", now we no longer support JDK 1.4.


Project: http://git-wip-us.apache.org/repos/asf/calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/1855861a
Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/1855861a
Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/1855861a

Branch: refs/heads/master
Commit: 1855861a1a54b450aa72b5ef098fcbd2ce3d430c
Parents: 395d379
Author: Julian Hyde <jh...@apache.org>
Authored: Mon Jun 12 13:38:58 2017 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Sun Jun 18 17:23:21 2017 -0700

----------------------------------------------------------------------
 .../adapter/cassandra/CassandraRules.java       |  2 +-
 .../adapter/cassandra/CassandraSchema.java      |  2 +-
 .../calcite/adapter/clone/CloneSchema.java      |  5 +-
 .../adapter/enumerable/AggResetContext.java     |  2 +-
 .../calcite/adapter/enumerable/PhysType.java    | 20 ++---
 .../org/apache/calcite/model/JsonColumn.java    |  2 +-
 .../calcite/plan/SubstitutionVisitor.java       |  6 +-
 .../apache/calcite/plan/VisitorDataContext.java |  4 +-
 .../apache/calcite/plan/volcano/RuleQueue.java  |  2 +-
 .../calcite/plan/volcano/VolcanoPlanner.java    |  2 -
 .../apache/calcite/rel/core/TableModify.java    |  2 +-
 .../calcite/rel/externalize/RelXmlWriter.java   |  5 +-
 .../calcite/rel/metadata/RelMdPredicates.java   |  8 +-
 .../rel/rules/AbstractMaterializedViewRule.java |  4 +-
 .../rel/rules/IntersectToDistinctRule.java      |  2 +-
 .../rel/rules/JoinPushThroughJoinRule.java      | 13 +--
 .../rules/MultiJoinProjectTransposeRule.java    |  8 +-
 .../apache/calcite/rel/rules/PushProjector.java |  2 +-
 .../calcite/rel/rules/ReduceDecimalsRule.java   | 14 ++--
 .../rel/type/RelDataTypeFactoryImpl.java        |  2 +-
 .../calcite/rel/type/RelDataTypeSystemImpl.java |  6 +-
 .../org/apache/calcite/rel/type/StructKind.java |  8 +-
 .../org/apache/calcite/rex/RexFieldAccess.java  |  8 +-
 .../apache/calcite/rex/RexProgramBuilder.java   | 19 +++--
 .../apache/calcite/rex/RexTableInputRef.java    |  8 +-
 .../calcite/runtime/SocketFactoryImpl.java      |  6 +-
 .../apache/calcite/schema/ModifiableView.java   |  4 +-
 .../apache/calcite/schema/SchemaFactory.java    |  7 +-
 .../org/apache/calcite/schema/TableFactory.java | 13 ++-
 .../calcite/sql/SqlIntervalQualifier.java       |  9 +--
 .../calcite/sql/SqlSplittableAggFunction.java   |  5 +-
 .../org/apache/calcite/sql/SqlStateCodes.java   |  2 +-
 .../java/org/apache/calcite/sql/SqlWindow.java  |  8 +-
 .../java/org/apache/calcite/sql/SqlWriter.java  |  8 +-
 .../calcite/sql/fun/SqlFloorFunction.java       |  4 +-
 .../org/apache/calcite/sql/package-info.java    |  3 +-
 .../calcite/sql/parser/SqlParseException.java   |  2 +-
 .../calcite/sql/pretty/SqlPrettyWriter.java     |  9 ++-
 .../sql/type/CompositeOperandTypeChecker.java   | 23 ++----
 .../apache/calcite/sql/type/ExtraSqlTypes.java  |  4 +-
 .../apache/calcite/sql/type/ReturnTypes.java    |  4 +-
 .../sql/type/SqlSingleOperandTypeChecker.java   |  8 +-
 .../calcite/sql/validate/SqlValidatorUtil.java  |  2 +-
 .../apache/calcite/sql2rel/RelDecorrelator.java |  2 +-
 .../sql2rel/RelStructuredTypeFlattener.java     | 16 ++--
 .../java/org/apache/calcite/util/Glossary.java  | 24 +++---
 .../org/apache/calcite/util/NumberUtil.java     |  4 +-
 .../org/apache/calcite/util/Permutation.java    | 38 ++++-----
 .../org/apache/calcite/util/ReflectUtil.java    |  6 +-
 .../org/apache/calcite/util/StackWriter.java    | 10 +--
 .../apache/calcite/util/mapping/Mappings.java   |  6 +-
 .../calcite/examples/RelBuilderExample.java     | 24 +++---
 .../org/apache/calcite/sql/test/SqlTester.java  |  4 +-
 .../org/apache/calcite/test/DiffRepository.java |  8 +-
 .../calcite/test/MaterializationTest.java       |  2 +-
 .../apache/calcite/test/RelMetadataTest.java    |  4 +-
 .../apache/calcite/test/RelOptRulesTest.java    |  2 -
 .../calcite/test/RexImplicationCheckerTest.java |  2 +-
 .../calcite/test/concurrent/package-info.java   | 85 ++++++++++----------
 .../java/org/apache/calcite/util/TestUtil.java  | 14 ++--
 .../calcite/adapter/druid/DruidRules.java       |  2 +-
 .../calcite/test/ElasticsearchAdapterIT.java    |  2 +-
 .../calcite/adapter/csv/CsvEnumerator.java      |  2 +-
 example/csv/src/test/resources/sales/DEPTS.csv  |  2 +-
 file/src/test/resources/sales-csv/DEPTS.csv     |  2 +-
 .../java/org/apache/calcite/linq4j/Linq4j.java  |  4 +-
 .../calcite/linq4j/function/Deterministic.java  |  2 +-
 .../linq4j/tree/ConstantUntypedNull.java        |  6 +-
 .../calcite/linq4j/tree/OptimizeShuttle.java    |  2 +-
 .../calcite/adapter/pig/PigAggregate.java       |  1 -
 .../java/org/apache/calcite/piglet/Ast.java     |  3 +-
 site/_docs/materialized_views.md                | 26 +++---
 site/_posts/2015-11-10-release-1.5.0.md         |  2 +-
 sqlline                                         |  2 +-
 74 files changed, 277 insertions(+), 309 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraRules.java
----------------------------------------------------------------------
diff --git a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraRules.java b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraRules.java
index 3a9e9e9..095df16 100644
--- a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraRules.java
+++ b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraRules.java
@@ -355,7 +355,7 @@ public class CassandraRules {
      * @return Reverse of the input direction
      */
     private RelFieldCollation.Direction reverseDirection(RelFieldCollation.Direction direction) {
-      switch(direction) {
+      switch (direction) {
       case ASCENDING:
       case STRICTLY_ASCENDING:
         return RelFieldCollation.Direction.DESCENDING;

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSchema.java
----------------------------------------------------------------------
diff --git a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSchema.java b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSchema.java
index 21f37be..b2f5a4e 100644
--- a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSchema.java
+++ b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSchema.java
@@ -210,7 +210,7 @@ public class CassandraSchema extends AbstractSchema {
     int i = 0;
     for (ClusteringOrder order : clusteringOrder) {
       RelFieldCollation.Direction direction;
-      switch(order) {
+      switch (order) {
       case DESC:
         direction = RelFieldCollation.Direction.DESCENDING;
         break;

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/adapter/clone/CloneSchema.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/clone/CloneSchema.java b/core/src/main/java/org/apache/calcite/adapter/clone/CloneSchema.java
index afd3798..fe7cb92 100644
--- a/core/src/main/java/org/apache/calcite/adapter/clone/CloneSchema.java
+++ b/core/src/main/java/org/apache/calcite/adapter/clone/CloneSchema.java
@@ -136,7 +136,7 @@ public class CloneSchema extends AbstractSchema {
    * {@link org.apache.calcite.adapter.clone.CloneSchema}.
    * This allows you to create a clone schema inside a model.json file.
    *
-   * <pre>{@code
+   * <blockquote><pre>
    * {
    *   version: '1.0',
    *   defaultSchema: 'FOODMART_CLONE',
@@ -153,8 +153,7 @@ public class CloneSchema extends AbstractSchema {
    *       }
    *     }
    *   ]
-   * }
-   * }</pre>
+   * }</pre></blockquote>
    */
   public static class Factory implements SchemaFactory {
     public Schema create(

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/adapter/enumerable/AggResetContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/AggResetContext.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/AggResetContext.java
index b3efb21..1718231 100644
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/AggResetContext.java
+++ b/core/src/main/java/org/apache/calcite/adapter/enumerable/AggResetContext.java
@@ -24,7 +24,7 @@ import java.util.List;
  * Information for a call to
  * {@link AggImplementor#implementReset(AggContext, AggResetContext)}.
  *
- * {@link AggResetContext} provides access to the accumulator variables
+ * <p>{@link AggResetContext} provides access to the accumulator variables
  * that should be reset.
  */
 public interface AggResetContext extends NestedBlockBuilder {

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysType.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysType.java
index 20ae559..f44ce9e 100644
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysType.java
+++ b/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysType.java
@@ -66,9 +66,9 @@ public interface PhysType {
   /** Generates a reference to a given field in an expression.
    *
    * <p>For example given {@code expression=employee} and {@code field=2},
-   * generates</p>
+   * generates
    *
-   * <pre>{@code employee.deptno}</pre>
+   * <blockquote><pre>{@code employee.deptno}</pre></blockquote>
    *
    * @param expression Expression
    * @param field Ordinal of field
@@ -79,12 +79,12 @@ public interface PhysType {
   /** Generates a reference to a given field in an expression.
    *
    * <p>This method optimizes for the target storage type (i.e. avoids
-   * casts).</p>
+   * casts).
    *
    * <p>For example given {@code expression=employee} and {@code field=2},
-   * generates</p>
+   * generates
    *
-   * <pre>{@code employee.deptno}</pre>
+   * <blockquote><pre>{@code employee.deptno}</pre></blockquote>
    *
    * @param expression Expression
    * @param field Ordinal of field
@@ -99,15 +99,15 @@ public interface PhysType {
    * {@link Object#equals(Object)} per that interface) and also implements
    * {@link Comparable}.
    *
-   * <p>For example:</p>
+   * <p>For example:
    *
-   * <pre>{@code
-   * new Function1<Employee, Object[]> {
+   * <blockquote><pre>
+   * new Function1&lt;Employee, Object[]&gt; {
    *    public Object[] apply(Employee v1) {
-   *        return FlatLists.of(v1.<fieldN>, v1.<fieldM>);
+   *        return FlatLists.of(v1.&lt;fieldN&gt;, v1.&lt;fieldM&gt;);
    *    }
    * }
-   * }</pre>
+   * }</pre></blockquote>
    */
   Expression generateAccessor(List<Integer> fields);
 

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/model/JsonColumn.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/model/JsonColumn.java b/core/src/main/java/org/apache/calcite/model/JsonColumn.java
index 843610f..c57fd29 100644
--- a/core/src/main/java/org/apache/calcite/model/JsonColumn.java
+++ b/core/src/main/java/org/apache/calcite/model/JsonColumn.java
@@ -26,7 +26,7 @@ package org.apache.calcite.model;
 public class JsonColumn {
   /** Column name.
    *
-   * Required, and must be unique within the table.
+   * <p>Required, and must be unique within the table.
    */
   public String name;
 }

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java b/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
index fca0c56..15cedcb 100644
--- a/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
+++ b/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
@@ -222,9 +222,9 @@ public class SubstitutionVisitor {
    *
    * <p>The terms satisfy the relation</p>
    *
-   * <pre>
-   *     {@code condition = target AND residue}
-   * </pre>
+   * <blockquote>
+   * <pre>{@code condition = target AND residue}</pre>
+   * </blockquote>
    *
    * <p>and {@code residue} must be as weak as possible.</p>
    *

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/plan/VisitorDataContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/VisitorDataContext.java b/core/src/main/java/org/apache/calcite/plan/VisitorDataContext.java
index 38b2ce3..fb7be6a 100644
--- a/core/src/main/java/org/apache/calcite/plan/VisitorDataContext.java
+++ b/core/src/main/java/org/apache/calcite/plan/VisitorDataContext.java
@@ -147,7 +147,7 @@ public class VisitorDataContext implements DataContext {
       case VARCHAR:
         return Pair.of(index, rexLiteral.getValueAs(String.class));
       default:
-        //TODO: Support few more supported cases
+        // TODO: Support few more supported cases
         LOGGER.warn("{} for value of class {} is being handled in default way",
             type.getSqlTypeName(), rexLiteral.getValue().getClass());
         if (rexLiteral.getValue() instanceof NlsString) {
@@ -158,7 +158,7 @@ public class VisitorDataContext implements DataContext {
       }
     }
 
-    //Unsupported Arguments
+    // Unsupported Arguments
     return null;
   }
 

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java b/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
index 439c653..1e2713f 100644
--- a/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
+++ b/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
@@ -371,7 +371,7 @@ class RuleQueue {
    * node's algorithm.</li>
    * </ul>
    *
-   * <p>The formula for the importance I of node n is:
+   * <p>The formula for the importance <i>I</i> of node n is:
    *
    * <blockquote>I<sub>n</sub> = Sum<sub>parents p of n</sub>{I<sub>p</sub> .
    * W <sub>n, p</sub>}</blockquote>

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java
----------------------------------------------------------------------
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 4b43658..1ca7491 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
@@ -1277,8 +1277,6 @@ public class VolcanoPlanner extends AbstractRelOptPlanner {
         // get merged.)
         final RelSubset subset = mapRel2Subset.put(rel, equivRelSubset);
         assert subset != null;
-        //boolean existed = subset.rels.remove(rel);
-        //assert existed : "rel was not known to its subset";
         boolean existed = subset.set.rels.remove(rel);
         assert existed : "rel was not known to its set";
         final RelSubset equivSubset = getSubset(equivRel);

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/rel/core/TableModify.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/core/TableModify.java b/core/src/main/java/org/apache/calcite/rel/core/TableModify.java
index e94ca9a..9dfed22 100644
--- a/core/src/main/java/org/apache/calcite/rel/core/TableModify.java
+++ b/core/src/main/java/org/apache/calcite/rel/core/TableModify.java
@@ -40,7 +40,7 @@ import java.util.List;
 /**
  * Relational expression that modifies a table.
  *
- * It is similar to {@link org.apache.calcite.rel.core.TableScan},
+ * <p>It is similar to {@link org.apache.calcite.rel.core.TableScan},
  * but represents a request to modify a table rather than read from it.
  * It takes one child which produces the modified rows. Those rows are:
  *

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/rel/externalize/RelXmlWriter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/externalize/RelXmlWriter.java b/core/src/main/java/org/apache/calcite/rel/externalize/RelXmlWriter.java
index 12e175c..908eb99 100644
--- a/core/src/main/java/org/apache/calcite/rel/externalize/RelXmlWriter.java
+++ b/core/src/main/java/org/apache/calcite/rel/externalize/RelXmlWriter.java
@@ -93,7 +93,6 @@ public class RelXmlWriter extends RelWriterImpl {
     xmlOutput.beginBeginTag("RelNode");
     xmlOutput.attribute("type", relType);
 
-    //xmlOutput.attribute("id", rel.getId() + "");
     xmlOutput.endBeginTag("RelNode");
 
     final List<RelNode> inputs = new ArrayList<RelNode>();
@@ -125,12 +124,12 @@ public class RelXmlWriter extends RelWriterImpl {
    * Generates specific XML (sometimes called 'attribute-oriented XML'). Like
    * this:
    *
-   * <pre>
+   * <blockquote><pre>
    * &lt;Join condition="EMP.DEPTNO = DEPT.DEPTNO"&gt;
    *   &lt;Project expr1="x + y" expr2="42"&gt;
    *   &lt;TableAccess table="SALES.EMPS"&gt;
    * &lt;/Join&gt;
-   * </pre>
+   * </pre></blockquote>
    *
    * @param rel    Relational expression
    * @param values List of term-value pairs

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdPredicates.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdPredicates.java b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdPredicates.java
index 65071fe..5c3a35e 100644
--- a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdPredicates.java
+++ b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdPredicates.java
@@ -166,11 +166,11 @@ public class RelMdPredicates
    * <li>For e.g. expression 'a + e = 9' below will not be pulled up because 'e'
    * is not in the projection list.
    *
-   * <pre>
+   * <blockquote><pre>
    * inputPullUpExprs:      {a &gt; 7, b + c &lt; 10, a + e = 9}
    * projectionExprs:       {a, b, c, e / 2}
    * projectionPullupExprs: {a &gt; 7, b + c &lt; 10}
-   * </pre>
+   * </pre></blockquote>
    *
    * </ol>
    */
@@ -331,11 +331,11 @@ public class RelMdPredicates
    * <p>Pulls up predicates that only contains references to columns in the
    * GroupSet. For e.g.
    *
-   * <pre>
+   * <blockquote><pre>
    * inputPullUpExprs : { a &gt; 7, b + c &lt; 10, a + e = 9}
    * groupSet         : { a, b}
    * pulledUpExprs    : { a &gt; 7}
-   * </pre>
+   * </pre></blockquote>
    */
   public RelOptPredicateList getPredicates(Aggregate agg, RelMetadataQuery mq) {
     final RelNode input = agg.getInput();

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/rel/rules/AbstractMaterializedViewRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/rules/AbstractMaterializedViewRule.java b/core/src/main/java/org/apache/calcite/rel/rules/AbstractMaterializedViewRule.java
index 9cc8d1d..c1680e2 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/AbstractMaterializedViewRule.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/AbstractMaterializedViewRule.java
@@ -358,8 +358,8 @@ public abstract class AbstractMaterializedViewRule extends RelOptRule {
                     e.getKey().getIndex(), e.getKey().getType());
                 // Add to query equivalence classes and table mapping
                 currQEC.addEquivalenceClass(queryColumnRef, e.getValue());
-                queryToViewTableMapping.put(
-                    e.getValue().getTableRef(), e.getValue().getTableRef()); //identity
+                queryToViewTableMapping.put(e.getValue().getTableRef(),
+                    e.getValue().getTableRef()); // identity
               }
             }
 

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/rel/rules/IntersectToDistinctRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/rules/IntersectToDistinctRule.java b/core/src/main/java/org/apache/calcite/rel/rules/IntersectToDistinctRule.java
index a76a75a..f105c53 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/IntersectToDistinctRule.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/IntersectToDistinctRule.java
@@ -51,7 +51,7 @@ import java.math.BigDecimal;
  *
  * <p><code>R4 = GB(R3 on all attributes, count(c) as cnt, min(c) as m)</code>
  *
- * Note that we do not need <code>min(c)</code> in intersect distinct.
+ * <p>Note that we do not need <code>min(c)</code> in intersect distinct.
  *
  * <p><code>R5 = Filter(cnt == #branch)</code>
  *

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/rel/rules/JoinPushThroughJoinRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/rules/JoinPushThroughJoinRule.java b/core/src/main/java/org/apache/calcite/rel/rules/JoinPushThroughJoinRule.java
index 5894130..96b6c84 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/JoinPushThroughJoinRule.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/JoinPushThroughJoinRule.java
@@ -46,17 +46,18 @@ import java.util.List;
  * advantage of applying this rule is that it may be possible to apply
  * conditions earlier. For instance,</p>
  *
- * <pre>{@code
- * (sales as s join product_class as pc on true)
+ * <blockquote>
+ * <pre>(sales as s join product_class as pc on true)
  * join product as p
  * on s.product_id = p.product_id
- * and p.product_class_id = pc.product_class_id}</pre>
+ * and p.product_class_id = pc.product_class_id</pre></blockquote>
  *
- * becomes
+ * <p>becomes
  *
- * <pre>{@code (sales as s join product as p on s.product_id = p.product_id)
+ * <blockquote>
+ * <pre>(sales as s join product as p on s.product_id = p.product_id)
  * join product_class as pc
- * on p.product_class_id = pc.product_class_id}</pre>
+ * on p.product_class_id = pc.product_class_id</pre></blockquote>
  *
  * <p>Before the rule, one join has two conditions and the other has none
  * ({@code ON TRUE}). After the rule, each join has one condition.</p>

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/rel/rules/MultiJoinProjectTransposeRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/rules/MultiJoinProjectTransposeRule.java b/core/src/main/java/org/apache/calcite/rel/rules/MultiJoinProjectTransposeRule.java
index 4feb04e..4c254fb 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/MultiJoinProjectTransposeRule.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/MultiJoinProjectTransposeRule.java
@@ -37,11 +37,11 @@ import org.apache.calcite.rel.logical.LogicalProject;
  * {@link org.apache.calcite.rel.logical.LogicalProject} we're pulling up, as
  * well as the join condition, in the resultant {@link MultiJoin}s
  *
- * <p>For example, if we have the following subselect:
+ * <p>For example, if we have the following sub-query:
  *
- * <pre>
- *      (select X.x1, Y.y1 from X, Y
- *          where X.x2 = Y.y2 and X.x3 = 1 and Y.y3 = 2)</pre>
+ * <blockquote><pre>
+ * (select X.x1, Y.y1 from X, Y
+ *  where X.x2 = Y.y2 and X.x3 = 1 and Y.y3 = 2)</pre></blockquote>
  *
  * <p>The {@link MultiJoin} associated with (X, Y) associates x1 with X and
  * y1 with Y. Although x3 and y3 need to be read due to the filters, they are

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/rel/rules/PushProjector.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/rules/PushProjector.java b/core/src/main/java/org/apache/calcite/rel/rules/PushProjector.java
index 8b5f83e..2d239db 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/PushProjector.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/PushProjector.java
@@ -126,7 +126,7 @@ public class PushProjector {
    * | nSysFields | nFields | nFieldsRight |
    * </pre></blockquote>
    *
-   * The output of a single-input rel looks like this:
+   * <p>The output of a single-input rel looks like this:
    *
    * <blockquote><pre>
    * | nSysFields | nFields |

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/rel/rules/ReduceDecimalsRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/rules/ReduceDecimalsRule.java b/core/src/main/java/org/apache/calcite/rel/rules/ReduceDecimalsRule.java
index 5154a15..3dac4ed 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/ReduceDecimalsRule.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/ReduceDecimalsRule.java
@@ -1002,12 +1002,12 @@ public class ReduceDecimalsRule extends RelOptRule {
   /**
    * Expander that rewrites floor(decimal) expressions:
    *
-   * <pre>
+   * <blockquote><pre>
    * if (value &lt; 0)
    *     (value - 0.99...) / (10^scale)
    * else
    *     value / (10 ^ scale)
-   * </pre>
+   * </pre></blockquote>
    */
   private class FloorExpander extends RexExpander {
     private FloorExpander(RexBuilder rexBuilder) {
@@ -1051,12 +1051,12 @@ public class ReduceDecimalsRule extends RelOptRule {
   /**
    * Expander that rewrites ceiling(decimal) expressions:
    *
-   * <pre>
+   * <blockquote><pre>
    * if (value &gt; 0)
    *     (value + 0.99...) / (10 ^ scale)
    * else
    *     value / (10 ^ scale)
-   * </pre>
+   * </pre></blockquote>
    */
   private class CeilExpander extends RexExpander {
     private CeilExpander(RexBuilder rexBuilder) {
@@ -1100,14 +1100,14 @@ public class ReduceDecimalsRule extends RelOptRule {
   /**
    * Expander that rewrites case expressions, in place. Starting from:
    *
-   * <pre>(when $cond then $val)+ else $default</pre>
+   * <blockquote><pre>(when $cond then $val)+ else $default</pre></blockquote>
    *
-   * this expander casts all values to the return type. If the target type is
+   * <p>this expander casts all values to the return type. If the target type is
    * a decimal, then the values are then decoded. The result of expansion is
    * that the case operator no longer deals with decimals args. (The return
    * value is encoded if necessary.)
    *
-   * <p>Note: a decimal type is returned iff arguments have decimals
+   * <p>Note: a decimal type is returned iff arguments have decimals.
    */
   private class CaseExpander extends RexExpander {
     private CaseExpander(RexBuilder rexBuilder) {

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java b/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java
index 5457289..cc6f982 100644
--- a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java
+++ b/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java
@@ -454,7 +454,7 @@ public abstract class RelDataTypeFactoryImpl implements RelDataTypeFactory {
    * <li>s = s1 + s2</li>
    * </ul>
    *
-   * p and s are capped at their maximum values
+   * <p>p and s are capped at their maximum values
    *
    * @see Glossary#SQL2003 SQL:2003 Part 2 Section 6.26
    */

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeSystemImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeSystemImpl.java b/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeSystemImpl.java
index 5382649..65c32ab 100644
--- a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeSystemImpl.java
+++ b/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeSystemImpl.java
@@ -57,7 +57,7 @@ public abstract class RelDataTypeSystemImpl implements RelDataTypeSystem {
   }
 
   @Override public int getDefaultPrecision(SqlTypeName typeName) {
-    //Following BasicSqlType precision as the default
+    // Following BasicSqlType precision as the default
     switch (typeName) {
     case CHAR:
     case BINARY:
@@ -150,7 +150,7 @@ public abstract class RelDataTypeSystemImpl implements RelDataTypeSystem {
   }
 
   @Override public String getLiteral(SqlTypeName typeName, boolean isPrefix) {
-    switch(typeName) {
+    switch (typeName) {
     case VARBINARY:
     case VARCHAR:
     case CHAR:
@@ -186,7 +186,7 @@ public abstract class RelDataTypeSystemImpl implements RelDataTypeSystem {
   }
 
   @Override public boolean isCaseSensitive(SqlTypeName typeName) {
-    switch(typeName) {
+    switch (typeName) {
     case CHAR:
     case VARCHAR:
       return true;

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/rel/type/StructKind.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/type/StructKind.java b/core/src/main/java/org/apache/calcite/rel/type/StructKind.java
index b10f816..e15ae74 100644
--- a/core/src/main/java/org/apache/calcite/rel/type/StructKind.java
+++ b/core/src/main/java/org/apache/calcite/rel/type/StructKind.java
@@ -28,12 +28,12 @@ package org.apache.calcite.rel.type;
  *
  * <p>SQL usually disallows a record type. For instance,
  *
- * <blockquote>SELECT address.zip FROM Emp AS e</blockquote>
+ * <blockquote><pre>SELECT address.zip FROM Emp AS e</pre></blockquote>
  *
- * is disallowed because {@code address} "looks like" a table alias. You'd have
- * to write
+ * <p>is disallowed because {@code address} "looks like" a table alias. You'd
+ * have to write
  *
- * <blockquote>SELECT e.address.zip FROM Emp AS e</blockquote>
+ * <blockquote><pre>SELECT e.address.zip FROM Emp AS e</pre></blockquote>
  *
  * <p>But if a table has one or more columns that are record-typed and are
  * labeled {@link #PEEK_FIELDS} or {@link #PEEK_FIELDS_DEFAULT} we suspend that

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/rex/RexFieldAccess.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rex/RexFieldAccess.java b/core/src/main/java/org/apache/calcite/rex/RexFieldAccess.java
index 658ffc5..cf731d2 100644
--- a/core/src/main/java/org/apache/calcite/rex/RexFieldAccess.java
+++ b/core/src/main/java/org/apache/calcite/rex/RexFieldAccess.java
@@ -31,10 +31,10 @@ import org.apache.calcite.sql.SqlKind;
  * <pre>SELECT emp.empno FROM emp</pre>
  * </blockquote>
  *
- * but there is a specialized expression {@link RexInputRef} for this purpose.
- * So in practice, <code>RexFieldAccess</code> is usually used to access fields
- * of correlating variables, for example the expression <code>emp.deptno</code>
- * in
+ * <p>but there is a specialized expression {@link RexInputRef} for this
+ * purpose. So in practice, <code>RexFieldAccess</code> is usually used to
+ * access fields of correlating variables, for example the expression
+ * <code>emp.deptno</code> in
  *
  * <blockquote>
  * <pre>SELECT ename

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/rex/RexProgramBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rex/RexProgramBuilder.java b/core/src/main/java/org/apache/calcite/rex/RexProgramBuilder.java
index 8371d77..afd24b2 100644
--- a/core/src/main/java/org/apache/calcite/rex/RexProgramBuilder.java
+++ b/core/src/main/java/org/apache/calcite/rex/RexProgramBuilder.java
@@ -500,7 +500,7 @@ public class RexProgramBuilder {
    * expressions must have maximum depth 1)
    * </ul>
    *
-   * there are additional constraints:
+   * <p>there are additional constraints:
    *
    * <ul>
    * <li>Expressions appear in the left-deep order they are needed by
@@ -693,15 +693,14 @@ public class RexProgramBuilder {
    *
    * <p>All expressions become common sub-expressions. For example, the query
    *
-   * <pre>{@code
-   * SELECT x + 1 AS p, x + y AS q FROM (
+   * <blockquote><pre>SELECT x + 1 AS p, x + y AS q FROM (
    *   SELECT a + b AS x, c AS y
    *   FROM t
-   *   WHERE c = 6)}</pre>
+   *   WHERE c = 6)}</pre></blockquote>
    *
-   * would be represented as the programs
+   * <p>would be represented as the programs
    *
-   * <pre>
+   * <blockquote><pre>
    *   Calc:
    *       Projects={$2, $3},
    *       Condition=null,
@@ -710,11 +709,11 @@ public class RexProgramBuilder {
    *       Projects={$3, $2},
    *       Condition={$4}
    *       Exprs={$0, $1, $2, $0 + $1, $2 = 6}
-   * </pre>
+   * </pre></blockquote>
    *
    * <p>The merged program is
    *
-   * <pre>
+   * <blockquote><pre>
    *   Calc(
    *      Projects={$4, $5}
    *      Condition=$6
@@ -725,7 +724,7 @@ public class RexProgramBuilder {
    *             4: ($3 + 1)  // p = x + 1
    *             5: ($3 + $2) // q = x + y
    *             6: ($2 = 6)  // c = 6
-   * </pre>
+   * </pre></blockquote>
    *
    * <p>Another example:</p>
    *
@@ -738,7 +737,7 @@ public class RexProgramBuilder {
    * WHERE x = 5</pre>
    * </blockquote>
    *
-   * becomes
+   * <p>becomes
    *
    * <blockquote>
    * <pre>SELECT a + b AS x, c AS y

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/rex/RexTableInputRef.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rex/RexTableInputRef.java b/core/src/main/java/org/apache/calcite/rex/RexTableInputRef.java
index 20762c1..6376d11 100644
--- a/core/src/main/java/org/apache/calcite/rex/RexTableInputRef.java
+++ b/core/src/main/java/org/apache/calcite/rex/RexTableInputRef.java
@@ -33,11 +33,11 @@ import java.util.List;
  * the provenance of a given expression. For that, it uses a unique table reference
  * (contained in a {@link RelTableRef}) and an column index within the table.
  *
- * <p>For example, {@code A.#0.$3 + 2} column {@code $3} in the {@code 0} occurrence of
- * table {@code A} in the plan.
+ * <p>For example, {@code A.#0.$3 + 2} column {@code $3} in the {@code 0}
+ * occurrence of table {@code A} in the plan.
  *
- * Note that this kind of {@link RexNode} is an auxiliary data structure with a very
- * specific purpose and should not be used in relational expressions.
+ * <p>Note that this kind of {@link RexNode} is an auxiliary data structure with
+ * a very specific purpose and should not be used in relational expressions.
  */
 public class RexTableInputRef extends RexInputRef {
 

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/runtime/SocketFactoryImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/runtime/SocketFactoryImpl.java b/core/src/main/java/org/apache/calcite/runtime/SocketFactoryImpl.java
index 16413c7..e68a6ca 100644
--- a/core/src/main/java/org/apache/calcite/runtime/SocketFactoryImpl.java
+++ b/core/src/main/java/org/apache/calcite/runtime/SocketFactoryImpl.java
@@ -28,7 +28,7 @@ import javax.net.SocketFactory;
  * created sockets inherit a set of options whose values are set in the
  * SocketFactoryImpl.
  *
- * <pre>
+ * <blockquote><pre>
  * 1.  SO_KEEPALIVE          - is keepalive enabled?
  * 2.  OOBINLINE             - is out of band in-line enabled?
  * 3.  SO_REUSEADDR          - should the address be reused?
@@ -39,9 +39,7 @@ import javax.net.SocketFactory;
  * 8.  SO_CONNECT_TIMEOUT    - connect timeout (millisecs)
  * 9.  SO_LINGER             - is lingering enabled?
  * 10. LINGER                - amount of time to linger (seconds)
- *
- *
- * </pre>
+ * </pre></blockquote>
  */
 public class SocketFactoryImpl extends SocketFactory {
   /**

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/schema/ModifiableView.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/ModifiableView.java b/core/src/main/java/org/apache/calcite/schema/ModifiableView.java
index c1a2d81..a1aaf5b 100644
--- a/core/src/main/java/org/apache/calcite/schema/ModifiableView.java
+++ b/core/src/main/java/org/apache/calcite/schema/ModifiableView.java
@@ -35,7 +35,7 @@ import org.apache.calcite.util.ImmutableIntList;
  *     SELECT empno, deptno FROM emps WHERE gender = 'F';
  * </pre></blockquote>
  *
- * constraint is {@code $1 = 'F'}
+ * <p>constraint is {@code $1 = 'F'}
  * and column mapping is {@code [0, 2]}.
  *
  * <p>NOTE: The current API is inefficient and experimental. It will change
@@ -53,7 +53,7 @@ public interface ModifiableView extends Table {
 
   /** Returns the column mapping onto another table.
    *
-   * {@code mapping[i]} contains the column of the underlying table that the
+   * <p>{@code mapping[i]} contains the column of the underlying table that the
    * {@code i}th column of the view comes from, or -1 if it is based on an
    * expression.
    */

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/schema/SchemaFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/SchemaFactory.java b/core/src/main/java/org/apache/calcite/schema/SchemaFactory.java
index 89f8496..e9f1b10 100644
--- a/core/src/main/java/org/apache/calcite/schema/SchemaFactory.java
+++ b/core/src/main/java/org/apache/calcite/schema/SchemaFactory.java
@@ -27,8 +27,7 @@ import java.util.Map;
  * <a href="http://calcite.apache.org/apidocs/org/apache/calcite/adapter/csv/package-summary.html">example CSV adapter</a>
  * for more details about this particular adapter.)
  *
- * <pre>{@code
- * {
+ * <blockquote><pre>{
  *   "version": "1.0",
  *   "defaultSchema": "SALES",
  *   "schemas": [
@@ -49,9 +48,7 @@ import java.util.Map;
  *       ]
  *     }
  *   ]
- * }
- * }
- * </pre>
+ * }</pre></blockquote>
  *
  * <p>If you do not wish to allow model authors to add additional tables
  * (including views) to an instance of your schema, specify

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/schema/TableFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/TableFactory.java b/core/src/main/java/org/apache/calcite/schema/TableFactory.java
index ec0321a..ec8ceb2 100644
--- a/core/src/main/java/org/apache/calcite/schema/TableFactory.java
+++ b/core/src/main/java/org/apache/calcite/schema/TableFactory.java
@@ -27,8 +27,7 @@ import java.util.Map;
  * For example, here is a model that contains a custom table that generates
  * a range of integers.</p>
  *
- * <pre>{@code
- * {
+ * <blockquote><pre>{
  *   version: '1.0',
  *   defaultSchema: 'MATH',
  *   schemas: [
@@ -48,17 +47,15 @@ import java.util.Map;
  *       ]
  *     }
  *   ]
- * }
- * }
- * </pre>
+ * }</pre></blockquote>
  *
  * <p>Given that schema, the query</p>
  *
- * <pre>{@code SELECT * FROM math.integers}</pre>
+ * <blockquote><pre>SELECT * FROM math.integers</pre></blockquote>
  *
  * <p>returns</p>
  *
- * <pre>{@code
+ * <blockquote><pre>
  * +---+
  * | N |
  * +---+
@@ -67,7 +64,7 @@ import java.util.Map;
  * | 5 |
  * | 6 |
  * +---+
- * }</pre>
+ * </pre></blockquote>
  *
  * <p>A class that implements TableFactory specified in a schema must have a
  * public default constructor.</p>

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/sql/SqlIntervalQualifier.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlIntervalQualifier.java b/core/src/main/java/org/apache/calcite/sql/SqlIntervalQualifier.java
index b27c5b8..45e128f 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlIntervalQualifier.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlIntervalQualifier.java
@@ -43,7 +43,6 @@ import static org.apache.calcite.util.Static.RESOURCE;
  * <p>INTERVAL qualifier is defined as follows:
  *
  * <blockquote><code>
- *
  * &lt;interval qualifier&gt; ::=<br>
  * &nbsp;&nbsp; &lt;start field&gt; TO &lt;end field&gt;<br>
  * &nbsp;&nbsp;| &lt;single datetime field&gt;<br>
@@ -71,7 +70,6 @@ import static org.apache.calcite.util.Static.RESOURCE;
  * &lt;interval fractional seconds precision&gt; ::=
  * &lt;unsigned integer&gt;<br>
  * &lt;interval leading field precision&gt; ::= &lt;unsigned integer&gt;
- *
  * </code></blockquote>
  *
  * <p>Examples include:
@@ -82,7 +80,7 @@ import static org.apache.calcite.util.Static.RESOURCE;
  * <li><code>INTERVAL '1 2:3:4' DAY(4) TO SECOND(4)</code></li>
  * </ul>
  *
- * An instance of this class is immutable.
+ * <p>An instance of this class is immutable.
  */
 public class SqlIntervalQualifier extends SqlNode {
   //~ Static fields/initializers ---------------------------------------------
@@ -354,9 +352,10 @@ public class SqlIntervalQualifier extends SqlNode {
   }
 
   /**
-   * Does this interval have a single datetime field
+   * Returns whether this interval has a single datetime field.
    *
-   * Return true not of form unit TO unit.
+   * <p>Returns {@code true} if it is of the form {@code unit},
+   * {@code false} if it is of the form {@code unit TO unit}.
    */
   public boolean isSingleDatetimeField() {
     return timeUnitRange.endUnit == null;

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/sql/SqlSplittableAggFunction.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlSplittableAggFunction.java b/core/src/main/java/org/apache/calcite/sql/SqlSplittableAggFunction.java
index 465a4d6..78b400d 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlSplittableAggFunction.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlSplittableAggFunction.java
@@ -152,8 +152,9 @@ public interface SqlSplittableAggFunction {
     /**
      * {@inheritDoc}
      *
-     * COUNT(*) and COUNT applied to all NOT NULL arguments become {@code 1};
-     * otherwise {@code CASE WHEN arg0 IS NOT NULL THEN 1 ELSE 0 END}.
+     * <p>{@code COUNT(*)}, and {@code COUNT} applied to all NOT NULL arguments,
+     * become {@code 1}; otherwise
+     * {@code CASE WHEN arg0 IS NOT NULL THEN 1 ELSE 0 END}.
      */
     public RexNode singleton(RexBuilder rexBuilder, RelDataType inputRowType,
         AggregateCall aggregateCall) {

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/sql/SqlStateCodes.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlStateCodes.java b/core/src/main/java/org/apache/calcite/sql/SqlStateCodes.java
index d4fe7e9..1b4e773 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlStateCodes.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlStateCodes.java
@@ -21,7 +21,7 @@ package org.apache.calcite.sql;
  *
  * <p>SQL State codes are defined in
  *
- * <pre><code> &#64;sql.2003 Part 2 Section 23.1</code></pre>
+ * <blockquote><pre>&#64;sql.2003 Part 2 Section 23.1</pre></blockquote>
  *
  * @deprecated Use {@code org.apache.calcite.avatica.SqlState}
  */

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/sql/SqlWindow.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlWindow.java b/core/src/main/java/org/apache/calcite/sql/SqlWindow.java
index d280ac2..dc6b34c 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlWindow.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlWindow.java
@@ -386,13 +386,13 @@ public class SqlWindow extends SqlCall {
    *
    * <p>For example,
    *
-   * <pre>WINDOW (w PARTITION BY x ORDER BY y)
+   * <blockquote><pre>WINDOW (w PARTITION BY x ORDER BY y)
    *   overlay
-   *   WINDOW w AS (PARTITION BY z)</pre>
+   *   WINDOW w AS (PARTITION BY z)</pre></blockquote>
    *
-   * yields
+   * <p>yields
    *
-   * <pre>WINDOW (PARTITION BY z ORDER BY y)</pre>
+   * <blockquote><pre>WINDOW (PARTITION BY z ORDER BY y)</pre></blockquote>
    *
    * <p>Does not alter this or the other window.
    *

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/sql/SqlWriter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlWriter.java b/core/src/main/java/org/apache/calcite/sql/SqlWriter.java
index 3d09138..c5d4dab 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlWriter.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlWriter.java
@@ -34,24 +34,24 @@ public interface SqlWriter {
     /**
      * Julian's style of sub-query nesting. Like this:
      *
-     * <pre>SELECT *
+     * <blockquote><pre>SELECT *
      * FROM (
      *     SELECT *
      *     FROM t
      * )
-     * WHERE condition</pre>
+     * WHERE condition</pre></blockquote>
      */
     HYDE,
 
     /**
      * Damian's style of sub-query nesting. Like this:
      *
-     * <pre>SELECT *
+     * <blockquote><pre>SELECT *
      * FROM
      * (   SELECT *
      *     FROM t
      * )
-     * WHERE condition</pre>
+     * WHERE condition</pre></blockquote>
      */
     BLACK
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/sql/fun/SqlFloorFunction.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/fun/SqlFloorFunction.java b/core/src/main/java/org/apache/calcite/sql/fun/SqlFloorFunction.java
index 02b4abe..4038efb 100644
--- a/core/src/main/java/org/apache/calcite/sql/fun/SqlFloorFunction.java
+++ b/core/src/main/java/org/apache/calcite/sql/fun/SqlFloorFunction.java
@@ -164,7 +164,7 @@ public class SqlFloorFunction extends SqlMonotonicUnaryFunction {
     SqlLiteral node = call.operand(1);
     TimeUnitRange unit = (TimeUnitRange) node.getValue();
 
-    switch(unit) {
+    switch (unit) {
     case YEAR:
       unparseMssql(writer, call, 4, "-01-01");
       break;
@@ -255,7 +255,7 @@ public class SqlFloorFunction extends SqlMonotonicUnaryFunction {
     }
 
     String format;
-    switch(unit) {
+    switch (unit) {
     case YEAR:
       format = "%Y-01-01";
       break;

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/sql/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/package-info.java b/core/src/main/java/org/apache/calcite/sql/package-info.java
index 887ebf0..104a6e9 100644
--- a/core/src/main/java/org/apache/calcite/sql/package-info.java
+++ b/core/src/main/java/org/apache/calcite/sql/package-info.java
@@ -63,8 +63,7 @@
  *     {@link org.apache.calcite.sql.SqlBinaryOperator},
  *     {@link org.apache.calcite.sql.SqlPrefixOperator},
  *     {@link org.apache.calcite.sql.SqlPostfixOperator}.
- *
- *     And there are singleton classes for special syntactic constructs
+ * And there are singleton classes for special syntactic constructs
  *     {@link org.apache.calcite.sql.SqlSelectOperator}
  *     and {@link org.apache.calcite.sql.SqlJoin.SqlJoinOperator}. (These
  *     special operators even have their own sub-types of

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/sql/parser/SqlParseException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/parser/SqlParseException.java b/core/src/main/java/org/apache/calcite/sql/parser/SqlParseException.java
index 62af5d9..9900200 100644
--- a/core/src/main/java/org/apache/calcite/sql/parser/SqlParseException.java
+++ b/core/src/main/java/org/apache/calcite/sql/parser/SqlParseException.java
@@ -104,7 +104,7 @@ public class SqlParseException extends Exception
    * </pre>
    * </blockquote>
    *
-   * returns
+   * <p>returns
    *
    * <blockquote>
    * <pre>

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/sql/pretty/SqlPrettyWriter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/pretty/SqlPrettyWriter.java b/core/src/main/java/org/apache/calcite/sql/pretty/SqlPrettyWriter.java
index ec78b04..dde8d28 100644
--- a/core/src/main/java/org/apache/calcite/sql/pretty/SqlPrettyWriter.java
+++ b/core/src/main/java/org/apache/calcite/sql/pretty/SqlPrettyWriter.java
@@ -363,22 +363,23 @@ public class SqlPrettyWriter implements SqlWriter {
    * <ul>
    * <li>If set to "false":
    *
-   * <pre>
+   * <blockquote><pre>
    * SELECT
    *     A as A
    *         B as B
    *         C as C
    *     D
-   * </pre>
+   * </pre></blockquote>
+   *
    * <li>If set to "true":
    *
-   * <pre>
+   * <blockquote><pre>
    * SELECT
    *     A as A
    *     B as B
    *     C as C
    *     D
-   * </pre>
+   * </pre></blockquote>
    * </ul>
    */
   public void setSelectListExtraIndentFlag(boolean b) {

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/sql/type/CompositeOperandTypeChecker.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/type/CompositeOperandTypeChecker.java b/core/src/main/java/org/apache/calcite/sql/type/CompositeOperandTypeChecker.java
index cb88823..c8b7f13 100644
--- a/core/src/main/java/org/apache/calcite/sql/type/CompositeOperandTypeChecker.java
+++ b/core/src/main/java/org/apache/calcite/sql/type/CompositeOperandTypeChecker.java
@@ -36,25 +36,19 @@ import javax.annotation.Nullable;
  *
  * <blockquote>
  * <pre><code>
- *
  * CompositeOperandsTypeChecking newCompositeRule =
- *  new CompositeOperandsTypeChecking(
- *    Composition.OR,
- *    new SqlOperandTypeChecker[]{stringRule, numericRule});
- *
+ *     new CompositeOperandsTypeChecking(Composition.OR,
+ *         new SqlOperandTypeChecker[]{stringRule, numericRule});
  * </code></pre>
  * </blockquote>
  *
- * Similary a rule that would only allow a numeric literal can be done by:
+ * <p>Similarly a rule that would only allow a numeric literal can be done by:
  *
  * <blockquote>
  * <pre><code>
- *
  * CompositeOperandsTypeChecking newCompositeRule =
- *  new CompositeOperandsTypeChecking(
- *    Composition.AND,
- *    new SqlOperandTypeChecker[]{numericRule, literalRule});
- *
+ *     new CompositeOperandsTypeChecking(Composition.AND,
+ *         new SqlOperandTypeChecker[]{numericRule, literalRule});
  * </code></pre>
  * </blockquote>
  *
@@ -63,12 +57,9 @@ import javax.annotation.Nullable;
  *
  * <blockquote>
  * <pre><code>
- *
  * CompositeOperandsTypeChecking newCompositeRule =
- *  new CompositeOperandsTypeChecking(
- *    Composition.SEQUENCE,
- *    new SqlOperandTypeChecker[]{stringRule, numericRule});
- *
+ *     new CompositeOperandsTypeChecking(Composition.SEQUENCE,
+ *         new SqlOperandTypeChecker[]{stringRule, numericRule});
  * </code></pre>
  * </blockquote>
  *

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/sql/type/ExtraSqlTypes.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/type/ExtraSqlTypes.java b/core/src/main/java/org/apache/calcite/sql/type/ExtraSqlTypes.java
index 1774625..c9d775d 100644
--- a/core/src/main/java/org/apache/calcite/sql/type/ExtraSqlTypes.java
+++ b/core/src/main/java/org/apache/calcite/sql/type/ExtraSqlTypes.java
@@ -21,11 +21,11 @@ package org.apache.calcite.sql.type;
  * version of Java supported by Farrago (this currently means anything
  * introduced in JDK 1.6 or later).
  *
- * Allows us to deal sanely with type constants returned by newer JDBC
+ * <p>Allows us to deal sanely with type constants returned by newer JDBC
  * drivers when running a version of Farrago compiled under an old
  * version of the JDK (i.e. 1.5).
  *
- * By itself, the presence of a constant here doesn't imply that farrago
+ * <p>By itself, the presence of a constant here doesn't imply that farrago
  * fully supports the associated type.  This is simply a mirror of the
  * missing constant values.
  */

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/sql/type/ReturnTypes.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/type/ReturnTypes.java b/core/src/main/java/org/apache/calcite/sql/type/ReturnTypes.java
index f3ab09e..b8ec91e 100644
--- a/core/src/main/java/org/apache/calcite/sql/type/ReturnTypes.java
+++ b/core/src/main/java/org/apache/calcite/sql/type/ReturnTypes.java
@@ -496,7 +496,7 @@ public abstract class ReturnTypes {
    * <li>p = max(p1 - s1, p2 - s2) + s + 1</li>
    * </ul>
    *
-   * p and s are capped at their maximum values
+   * <p>p and s are capped at their maximum values
    *
    * @see Glossary#SQL2003 SQL:2003 Part 2 Section 6.26
    */
@@ -563,7 +563,7 @@ public abstract class ReturnTypes {
    * <li>result is varying if either input is; otherwise fixed
    * </ul>
    *
-   * Pre-requisites:
+   * <p>Pre-requisites:
    *
    * <ul>
    * <li>input types must be of the same string type

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/sql/type/SqlSingleOperandTypeChecker.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/type/SqlSingleOperandTypeChecker.java b/core/src/main/java/org/apache/calcite/sql/type/SqlSingleOperandTypeChecker.java
index e1b4b09..5b194d0 100644
--- a/core/src/main/java/org/apache/calcite/sql/type/SqlSingleOperandTypeChecker.java
+++ b/core/src/main/java/org/apache/calcite/sql/type/SqlSingleOperandTypeChecker.java
@@ -41,10 +41,10 @@ public interface SqlSingleOperandTypeChecker extends SqlOperandTypeChecker {
    * <pre>C(X, Y, Z)</pre>
    * </blockquote>
    *
-   * the strategy for validating the operand Z might involve checking its type
-   * against the formal signature OP(W). In this case, <code>
-   * iFormalOperand</code> would be zero, even though the position of Z within
-   * call C is two.
+   * <p>the strategy for validating the operand Z might involve checking its
+   * type against the formal signature OP(W). In this case,
+   * <code>iFormalOperand</code> would be zero, even though the position of Z
+   * within call C is two.
    *
    * @param callBinding    description of the call being checked; this is only
    *                       provided for context when throwing an exception; the

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorUtil.java b/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorUtil.java
index 8a2b84d..5fd15b4 100644
--- a/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorUtil.java
+++ b/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorUtil.java
@@ -242,7 +242,7 @@ public class SqlValidatorUtil {
 
   public static void checkCharsetAndCollateConsistentIfCharType(
       RelDataType type) {
-    //(every charset must have a default collation)
+    // (every charset must have a default collation)
     if (SqlTypeUtil.inCharFamily(type)) {
       Charset strCharset = type.getCharset();
       Charset colCharset = type.getCollation().getCharset();

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java b/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java
index 6e63528..bec1205 100644
--- a/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java
+++ b/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java
@@ -2733,7 +2733,7 @@ public class RelDecorrelator implements ReflectiveVisitor {
           if (ref instanceof RexCorrelVariable) {
             final RexCorrelVariable var = (RexCorrelVariable) ref;
             if (mapFieldAccessToCorVar.containsKey(fieldAccess)) {
-              //for cases where different Rel nodes are referring to
+              // for cases where different Rel nodes are referring to
               // same correlation var (e.g. in case of NOT IN)
               // avoid generating another correlation var
               // and record the 'rel' is using the same correlation

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/sql2rel/RelStructuredTypeFlattener.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql2rel/RelStructuredTypeFlattener.java b/core/src/main/java/org/apache/calcite/sql2rel/RelStructuredTypeFlattener.java
index e6e0ee0..f07d665 100644
--- a/core/src/main/java/org/apache/calcite/sql2rel/RelStructuredTypeFlattener.java
+++ b/core/src/main/java/org/apache/calcite/sql2rel/RelStructuredTypeFlattener.java
@@ -100,27 +100,27 @@ import java.util.SortedSet;
  * select t.c2, t.c1.a2 from t</code>. After SqlToRelConverter executes, the
  * unflattened tree looks like:
  *
- * <pre><code>
+ * <blockquote><pre><code>
  * LogicalProject(C2=[$1], A2=[$0.A2])
  *   LogicalTableScan(table=[T])
- * </code></pre>
+ * </code></pre></blockquote>
  *
- * After flattening, the resulting tree looks like
+ * <p>After flattening, the resulting tree looks like
  *
- * <pre><code>
+ * <blockquote><pre><code>
  * LogicalProject(C2=[$3], A2=[$2])
  *   FtrsIndexScanRel(table=[T], index=[clustered])
- * </code></pre>
+ * </code></pre></blockquote>
  *
- * The index scan produces a flattened row type <code>(boolean, smallint,
+ * <p>The index scan produces a flattened row type <code>(boolean, smallint,
  * bigint, double)</code> (the boolean is a null indicator for c1), and the
  * projection picks out the desired attributes (omitting <code>$0</code> and
  * <code>$1</code> altogether). After optimization, the projection might be
  * pushed down into the index scan, resulting in a final tree like
  *
- * <pre><code>
+ * <blockquote><pre><code>
  * FtrsIndexScanRel(table=[T], index=[clustered], projection=[3, 2])
- * </code></pre>
+ * </code></pre></blockquote>
  */
 public class RelStructuredTypeFlattener implements ReflectiveVisitor {
   //~ Instance fields --------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/util/Glossary.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/Glossary.java b/core/src/main/java/org/apache/calcite/util/Glossary.java
index b390293..65ffd73 100644
--- a/core/src/main/java/org/apache/calcite/util/Glossary.java
+++ b/core/src/main/java/org/apache/calcite/util/Glossary.java
@@ -510,12 +510,12 @@ public interface Glossary {
    * <li><code>ItemId</code> is a dotted path expression to the specific item
    * </ul>
    *
-   * For example,
+   * <p>For example,
    *
-   * <pre><code>&#64;sql.92 Section 11.4 Syntax Rule 7.c
-   * </code></pre>
+   * <blockquote><pre><code>&#64;sql.92 Section 11.4 Syntax Rule 7.c
+   * </code></pre></blockquote>
    *
-   * is a well-formed reference to the rule for the default character set to
+   * <p>is a well-formed reference to the rule for the default character set to
    * use for column definitions of character type.
    *
    * <p>Note that this tag is a block tag (like &#64;see) and cannot be used
@@ -539,12 +539,12 @@ public interface Glossary {
    * <li><code>ItemId</code> is a dotted path expression to the specific item
    * </ul>
    *
-   * For example,
+   * <p>For example,
    *
-   * <pre><code>&#64;sql.99 Part 2 Section 11.4 Syntax Rule 7.b
-   * </code></pre>
+   * <blockquote><pre><code>&#64;sql.99 Part 2 Section 11.4 Syntax Rule 7.b
+   * </code></pre></blockquote>
    *
-   * is a well-formed reference to the rule for the default character set to
+   * <p>is a well-formed reference to the rule for the default character set to
    * use for column definitions of character type.
    *
    * <p>Note that this tag is a block tag (like &#64;see) and cannot be used
@@ -568,12 +568,12 @@ public interface Glossary {
    * <li><code>ItemId</code> is a dotted path expression to the specific item
    * </ul>
    *
-   * For example,
+   * <p>For example,
    *
-   * <pre><code>&#64;sql.2003 Part 2 Section 11.4 Syntax Rule 10.b
-   * </code></pre>
+   * <blockquote><pre><code>&#64;sql.2003 Part 2 Section 11.4 Syntax Rule 10.b
+   * </code></pre></blockquote>
    *
-   * is a well-formed reference to the rule for the default character set to
+   * <p>is a well-formed reference to the rule for the default character set to
    * use for column definitions of character type.
    *
    * <p>Note that this tag is a block tag (like &#64;see) and cannot be used

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/util/NumberUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/NumberUtil.java b/core/src/main/java/org/apache/calcite/util/NumberUtil.java
index d0e2d84..2a4b903 100644
--- a/core/src/main/java/org/apache/calcite/util/NumberUtil.java
+++ b/core/src/main/java/org/apache/calcite/util/NumberUtil.java
@@ -106,9 +106,7 @@ public class NumberUtil {
       return (BigDecimal) number;
     } else if ((number instanceof Double)
         || (number instanceof Float)) {
-      // For JDK 1.4 compatibility
-      return new BigDecimal(number.doubleValue());
-      //return BigDecimal.valueOf(((Number) number).doubleValue());
+      return BigDecimal.valueOf(number.doubleValue());
     } else if (number instanceof BigInteger) {
       return new BigDecimal((BigInteger) number);
     } else {

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/util/Permutation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/Permutation.java b/core/src/main/java/org/apache/calcite/util/Permutation.java
index 4cbff86..1a2ede1 100644
--- a/core/src/main/java/org/apache/calcite/util/Permutation.java
+++ b/core/src/main/java/org/apache/calcite/util/Permutation.java
@@ -145,7 +145,7 @@ public class Permutation implements Mapping, Mappings.TargetMapping {
    * </tr>
    * </table>
    *
-   * is represented by the string "[2, 0, 1, 3]".
+   * <p>is represented by the string "[2, 0, 1, 3]".
    */
   public String toString() {
     StringBuilder buf = new StringBuilder();
@@ -168,23 +168,23 @@ public class Permutation implements Mapping, Mappings.TargetMapping {
    *
    * <p>For example, given the permutation
    *
-   * <pre>[3, 2, 0, 1]</pre>
+   * <blockquote><pre>[3, 2, 0, 1]</pre></blockquote>
    *
-   * suppose we map position 2 to target 1. Position 2 currently has target 0,
-   * and the source of position 1 is position 3. We preserve the permutation
-   * property by mapping the previous source 3 to the previous target 0. The
-   * new permutation is
+   * <p>suppose we map position 2 to target 1. Position 2 currently has target
+   * 0, and the source of position 1 is position 3. We preserve the permutation
+   * property by mapping the previous source 3 to the previous target 0. The new
+   * permutation is
    *
-   * <pre>[3, 2, 1, 0].</pre>
+   * <blockquote><pre>[3, 2, 1, 0].</pre></blockquote>
    *
    * <p>Another example. Again starting from
    *
-   * <pre>[3, 2, 0, 1]</pre>
+   * <blockquote><pre>[3, 2, 0, 1]</pre></blockquote>
    *
-   * suppose we map position 2 to target 3. We map the previous source 0 to
+   * <p>suppose we map position 2 to target 3. We map the previous source 0 to
    * the previous target 0, which gives
    *
-   * <pre>[0, 2, 3, 1].</pre>
+   * <blockquote><pre>[0, 2, 3, 1].</pre></blockquote>
    *
    * @param source Source position
    * @param target Target position
@@ -205,23 +205,23 @@ public class Permutation implements Mapping, Mappings.TargetMapping {
    *
    * <p>For example, given the permutation
    *
-   * <pre>[3, 2, 0, 1]</pre>
+   * <blockquote><pre>[3, 2, 0, 1]</pre></blockquote>
    *
-   * suppose we map position 2 to target 1. Position 2 currently has target 0,
-   * and the source of position 1 is position 3. We preserve the permutation
-   * property by mapping the previous source 3 to the previous target 0. The
-   * new permutation is
+   * <p>suppose we map position 2 to target 1. Position 2 currently has target
+   * 0, and the source of position 1 is position 3. We preserve the permutation
+   * property by mapping the previous source 3 to the previous target 0. The new
+   * permutation is
    *
-   * <pre>[3, 2, 1, 0].</pre>
+   * <blockquote><pre>[3, 2, 1, 0].</pre></blockquote>
    *
    * <p>Another example. Again starting from
    *
-   * <pre>[3, 2, 0, 1]</pre>
+   * <blockquote><pre>[3, 2, 0, 1]</pre></blockquote>
    *
-   * suppose we map position 2 to target 3. We map the previous source 0 to
+   * <p>suppose we map position 2 to target 3. We map the previous source 0 to
    * the previous target 0, which gives
    *
-   * <pre>[0, 2, 3, 1].</pre>
+   * <blockquote><pre>[0, 2, 3, 1].</pre></blockquote>
    *
    * @param source      Source position
    * @param target      Target position

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/util/ReflectUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/ReflectUtil.java b/core/src/main/java/org/apache/calcite/util/ReflectUtil.java
index 04b8a7e..57fbe6a 100644
--- a/core/src/main/java/org/apache/calcite/util/ReflectUtil.java
+++ b/core/src/main/java/org/apache/calcite/util/ReflectUtil.java
@@ -484,17 +484,17 @@ public abstract class ReflectUtil {
    *
    * <blockquote>String foo(Vehicle, int, List)</blockquote>
    *
-   * could be used to call the methods
+   * <p>could be used to call the methods
    *
    * <blockquote>String foo(Car, int, List)<br>
    * String foo(Bus, int, List)</blockquote>
    *
-   * (because Car and Bus are subclasses of Vehicle, and they occur in the
+   * <p>(because Car and Bus are subclasses of Vehicle, and they occur in the
    * polymorphic first argument) but not the method
    *
    * <blockquote>String foo(Car, int, ArrayList)</blockquote>
    *
-   * (only the first argument is polymorphic).
+   * <p>(only the first argument is polymorphic).
    *
    * <p>You must create an implementation of the method for the base class.
    * Otherwise throws {@link IllegalArgumentException}.

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/util/StackWriter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/StackWriter.java b/core/src/main/java/org/apache/calcite/util/StackWriter.java
index 3e42f50..ccf73cc 100644
--- a/core/src/main/java/org/apache/calcite/util/StackWriter.java
+++ b/core/src/main/java/org/apache/calcite/util/StackWriter.java
@@ -30,7 +30,7 @@ import java.util.Deque;
  * passed straight through the PrintWriter via the write method, as in the
  * following example:
  *
- * <pre><code>
+ * <blockquote><pre><code>
  *    StringWriter sw = new StringWriter();
  *    StackWriter stackw = new StackWriter(sw, StackWriter.INDENT_SPACE4);
  *    PrintWriter pw = new PrintWriter(stackw);
@@ -46,15 +46,15 @@ import java.util.Deque;
  *    pw.write(StackWriter.OUTDENT);
  *    pw.close();
  *    System.out.println(sw.toString());
- * </code></pre>
+ * </code></pre></blockquote>
  *
- * which produces the following output:
+ * <p>which produces the following output:
  *
- * <pre><code>
+ * <blockquote><pre><code>
  *      execute remote(link_name,'
  *          select * from t where c &gt; ''alabama''
  *      ');
- * </code></pre>
+ * </code></pre></blockquote>
  */
 public class StackWriter extends FilterWriter {
   //~ Static fields/initializers ---------------------------------------------

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/main/java/org/apache/calcite/util/mapping/Mappings.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/mapping/Mappings.java b/core/src/main/java/org/apache/calcite/util/mapping/Mappings.java
index 83b34ab..8303bf8 100644
--- a/core/src/main/java/org/apache/calcite/util/mapping/Mappings.java
+++ b/core/src/main/java/org/apache/calcite/util/mapping/Mappings.java
@@ -430,10 +430,10 @@ public abstract class Mappings {
    *
    * <p>For example,</p>
    *
-   * <pre>createShiftMapping(60,
+   * <blockquote><pre>createShiftMapping(60,
    *     100, 0, 3,
    *     200, 50, 5);
-   * </pre>
+   * </pre></blockquote>
    *
    * <p>creates</p>
    *
@@ -950,7 +950,7 @@ public abstract class Mappings {
      * </tr>
      * </table>
      *
-     * is represented by the string "[1:3, 2:2]".
+     * <p>is represented by the string "[1:3, 2:2]".
      *
      * <p>This method relies upon the optional method {@link #iterator()}.
      */

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/test/java/org/apache/calcite/examples/RelBuilderExample.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/examples/RelBuilderExample.java b/core/src/test/java/org/apache/calcite/examples/RelBuilderExample.java
index fcf6a52..f3c132f 100644
--- a/core/src/test/java/org/apache/calcite/examples/RelBuilderExample.java
+++ b/core/src/test/java/org/apache/calcite/examples/RelBuilderExample.java
@@ -74,9 +74,8 @@ public class RelBuilderExample {
    * Creates a relational expression for a table scan.
    * It is equivalent to
    *
-   * <pre>
-   * SELECT *
-   * FROM emp</pre>
+   * <blockquote><pre>SELECT *
+   * FROM emp</pre></blockquote>
    */
   private RelBuilder example0(RelBuilder builder) {
     return builder
@@ -87,9 +86,8 @@ public class RelBuilderExample {
    * Creates a relational expression for a table scan.
    * It is equivalent to
    *
-   * <pre>
-   * SELECT *
-   * FROM emp</pre>
+   * <blockquote><pre>SELECT *
+   * FROM emp</pre></blockquote>
    */
   private RelBuilder example1(RelBuilder builder) {
     return builder
@@ -100,9 +98,8 @@ public class RelBuilderExample {
    * Creates a relational expression for a table scan and project.
    * It is equivalent to
    *
-   * <pre>
-   * SELECT deptno, ename
-   * FROM emp</pre>
+   * <blockquote><pre>SELECT deptno, ename
+   * FROM emp</pre></blockquote>
    */
   private RelBuilder example2(RelBuilder builder) {
     return builder
@@ -114,11 +111,10 @@ public class RelBuilderExample {
    * Creates a relational expression for a table scan, aggregate, filter.
    * It is equivalent to
    *
-   * <pre>
-   * SELECT deptno, count(*) AS c, sum(sal) AS s
+   * <blockquote><pre>SELECT deptno, count(*) AS c, sum(sal) AS s
    * FROM emp
    * GROUP BY deptno
-   * HAVING count(*) &gt; 10</pre>
+   * HAVING count(*) &gt; 10</pre></blockquote>
    */
   private RelBuilder example3(RelBuilder builder) {
     return builder
@@ -136,13 +132,13 @@ public class RelBuilderExample {
    * things straight, you can remove expressions from the stack. For example,
    * here we are building a bushy join:
    *
-   * <pre>
+   * <blockquote><pre>
    *                join
    *              /      \
    *         join          join
    *       /      \      /      \
    * CUSTOMERS ORDERS LINE_ITEMS PRODUCTS
-   * </pre>
+   * </pre></blockquote>
    *
    * <p>We build it in three stages. Store the intermediate results in variables
    * `left` and `right`, and use `push()` to put them back on the stack when it

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/test/java/org/apache/calcite/sql/test/SqlTester.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/sql/test/SqlTester.java b/core/src/test/java/org/apache/calcite/sql/test/SqlTester.java
index 95a02d4..196911b 100644
--- a/core/src/test/java/org/apache/calcite/sql/test/SqlTester.java
+++ b/core/src/test/java/org/apache/calcite/sql/test/SqlTester.java
@@ -166,7 +166,7 @@ public interface SqlTester extends AutoCloseable, SqlValidatorTestCase.Tester {
    * <pre>checkScalarExact("TRUE AND FALSE", Boolean.TRUE);</pre>
    * </blockquote>
    *
-   * The expected result can be null:
+   * <p>The expected result can be null:
    *
    * <blockquote>
    * <pre>checkScalarExact("NOT UNKNOWN", null);</pre>
@@ -215,7 +215,7 @@ public interface SqlTester extends AutoCloseable, SqlValidatorTestCase.Tester {
    * "VARCHAR(3) NOT NULL");</code>
    * </blockquote>
    *
-   * This method checks length/precision, scale, and whether the type allows
+   * <p>This method checks length/precision, scale, and whether the type allows
    * NULL values, so is more precise than the type-checking done by methods
    * such as {@link #checkScalarExact}.
    *

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/test/java/org/apache/calcite/test/DiffRepository.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/DiffRepository.java b/core/src/test/java/org/apache/calcite/test/DiffRepository.java
index ee48d9d..ffd3fa6 100644
--- a/core/src/test/java/org/apache/calcite/test/DiffRepository.java
+++ b/core/src/test/java/org/apache/calcite/test/DiffRepository.java
@@ -54,18 +54,17 @@ import javax.xml.parsers.ParserConfigurationException;
  * <p>Typical usage is as follows. A test case class defines a method
  *
  * <blockquote><pre><code>
- *
  * package com.acme.test;
- *
+ * &nbsp;
  * public class MyTest extends TestCase {
  *   public DiffRepository getDiffRepos() {
  *     return DiffRepository.lookup(MyTest.class);
  *   }
- *
+ * &nbsp;
  *   &#64;Test public void testToUpper() {
  *     getDiffRepos().assertEquals("${result}", "${string}");
  *   }
- *
+ * &nbsp;
  *   &#64;Test public void testToLower() {
  *     getDiffRepos().assertEquals("Multi-line\nstring", "${string}");
  *   }
@@ -76,7 +75,6 @@ import javax.xml.parsers.ParserConfigurationException;
  * <code>src/test/resources/com/acme/test/MyTest.xml</code>:</p>
  *
  * <blockquote><pre><code>
- *
  * &lt;Root&gt;
  *     &lt;TestCase name="testToUpper"&gt;
  *         &lt;Resource name="string"&gt;

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/test/java/org/apache/calcite/test/MaterializationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/MaterializationTest.java b/core/src/test/java/org/apache/calcite/test/MaterializationTest.java
index 685f290..a5ffc58 100644
--- a/core/src/test/java/org/apache/calcite/test/MaterializationTest.java
+++ b/core/src/test/java/org/apache/calcite/test/MaterializationTest.java
@@ -1442,7 +1442,7 @@ public class MaterializationTest {
   @Ignore
   @Test public void testJoinAggregateMaterializationAggregateFuncs6() {
     // This rewriting would be possible if planner generates a pre-aggregation,
-    // since the materialized view would match the subquery.
+    // since the materialized view would match the sub-query.
     // Initial investigation after enabling AggregateJoinTransposeRule.EXTENDED
     // shows that the rewriting with pre-aggregations is generated and the
     // materialized view rewriting happens.

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java b/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
index 79b985a..6f9af88 100644
--- a/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
+++ b/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
@@ -2192,8 +2192,8 @@ public class RelMetadataTest extends SqlToRelTestBase {
    *
    * <p>For example:
    *
-   * <pre>List&lt;Integer&gt; ints = Arrays.asList(2, 500, 12);
-   * assertThat(ints, sortsAs("[12, 2, 500]");</pre>
+   * <blockquote><pre>List&lt;Integer&gt; ints = Arrays.asList(2, 500, 12);
+   * assertThat(ints, sortsAs("[12, 2, 500]");</pre></blockquote>
    */
   static <T> Matcher<Iterable<? extends T>> sortsAs(final String value) {
     return new CustomTypeSafeMatcher<Iterable<? extends T>>(value) {

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java b/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java
index 0fe5939..eb209e5 100644
--- a/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java
+++ b/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java
@@ -1049,8 +1049,6 @@ public class RelOptRulesTest extends RelOptTestBase {
         .addRuleInstance(JoinExtractFilterRule.INSTANCE)
         .addRuleInstance(FilterToCalcRule.INSTANCE)
         .addRuleInstance(CalcMergeRule.INSTANCE)
-            //.addRuleInstance(FennelCalcRule.instance);
-            //.addRuleInstance(FennelCartesianJoinRule.instance);
         .addRuleInstance(ProjectToCalcRule.INSTANCE)
         .build();
 

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/test/java/org/apache/calcite/test/RexImplicationCheckerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/RexImplicationCheckerTest.java b/core/src/test/java/org/apache/calcite/test/RexImplicationCheckerTest.java
index 331fb06..4fb7369 100644
--- a/core/src/test/java/org/apache/calcite/test/RexImplicationCheckerTest.java
+++ b/core/src/test/java/org/apache/calcite/test/RexImplicationCheckerTest.java
@@ -135,7 +135,7 @@ public class RexImplicationCheckerTest {
     final RexNode bEqTrue = f.eq(f.bl, f.rexBuilder.makeLiteral(true));
     final RexNode bEqFalse = f.eq(f.bl, f.rexBuilder.makeLiteral(false));
 
-    //TODO: Need to support false => true
+    // TODO: Need to support false => true
     //f.checkImplies(bEqFalse, bEqTrue);
     f.checkNotImplies(bEqTrue, bEqFalse);
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/1855861a/core/src/test/java/org/apache/calcite/test/concurrent/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/concurrent/package-info.java b/core/src/test/java/org/apache/calcite/test/concurrent/package-info.java
index c779728..317a030 100644
--- a/core/src/test/java/org/apache/calcite/test/concurrent/package-info.java
+++ b/core/src/test/java/org/apache/calcite/test/concurrent/package-info.java
@@ -31,31 +31,29 @@
  * <code>mtsql</code> format, as described below. An instance of
  * <code>ConcurrentCommandScript</code> parses and executes a script.</p>
  *
- * <hr>
- *
  * <h3>Script Format</h3>
  *
  * <h4>Syntax:</h4>
  *
  * <p>The syntactic structure of an <i>mtsql</i> script is:
  *
- * <pre>
+ * <blockquote><pre>
  *     &lt;directive&gt;*
  *     &lt;setup section&gt;?
  *     &lt;cleanup section&gt;?
  *     &lt;thread section&gt;+
- *
+ * &nbsp;
  *     &lt;directive&gt;       := &#64;[no]lockstep | &#64;enable | &#64;disable
  *     &lt;setup section&gt;   := &#64;setup &lt;basic command&gt;* &#64;end
  *     &lt;cleanup section&gt; := &#64;setup &lt;basic command&gt;* &#64;end
  *     &lt;thread section&gt;  := &#64;thread &lt;thread-name&gt;?
  *                                &lt;command&gt;* &#64;end
- *
+ * &nbsp;
  *     &lt;command&gt; :=
  *       &lt;basic command&gt; |
  *       &lt;command prefix&gt;? &lt;threadly command&gt; |
  *       &lt;synchronization point&gt;
- * </pre>
+ * </pre></blockquote>
  *
  * <p>Blank lines and comments are allowed anywhere.
  *     A comment starts with two hyphens and runs to the end of the line.
@@ -107,34 +105,35 @@
  *
  * <h4>Basic Commands (allowed in any section):</h4>
  *
- * <pre>
+ * <blockquote><pre>
  * &lt;SQL statement&gt;:
  *     An SQL statement terminated by a semicolon. The statement can span lines.
- * </pre>
- * <pre>
+ * </pre></blockquote>
+ *
+ * <blockquote><pre>
  * &#64;include FILE
  *   Reads and executes the contents of FILE, another mtsql script.
  *   Inclusions may nest.
- * </pre>
+ * </pre></blockquote>
  *
  * <h4>Threaded Commands (allowed only in a &#64;thread section):</h4>
  *
- * <pre>
+ * <blockquote><pre>
  * &#64;sleep N        -- thread sleeps for N milliseconds
  * &#64;echo MESSAGE   -- prints the message to stdout
- *
+ * &nbsp;
  * &lt;SQL statement&gt; ';' -- executes the SQL
  * &#64;timeout N &lt;SQL&gt; ';' -- executes the SQL with the given ms timeout
  * &#64;rowlimit N &lt;SQL&gt; ';' -- executes the SQL, stops after N rows
  * &#64;err &lt;SQL&gt; ';' -- executes the SQL, expecting it to fail
- *
+ * &nbsp;
  * &#64;repeat N &lt;command&gt;+ &#64;end
  *     Denotes a repeated block of commands, with repeat count = N.
  *     N must be positive.
- *
+ * &nbsp;
  * &#64;prepare SQL-STATEMENT ';'
  *     Prepares the sql. A thread has at most one prepared statement at a time.
- *
+ * &nbsp;
  * &#64;print FORMAT
  *     Sets the result-printing format for the current prepared statement.
  *     FORMAT is a sequence of the phrases:
@@ -145,24 +144,24 @@
  *         time             -- means print the time each printed row was fetched
  *         total            -- means print a final summary, with row count and
  *                             net fetch time (not including any timeout).
- *
+ * &nbsp;
  * (Sorry, no way yet to print selected columns, to print time in a special way,
  * etc.)
- *
+ * &nbsp;
  * &#64;fetch &lt;timeout&gt;?
  *     Starts fetching and printing result rows, with an optional timeout (in
  *     msecs).  Stop on EOD or on timeout.
- *
+ * &nbsp;
  * &#64;close
  *     Closes the current prepared statement. However that an open prepared
  *     statement will be closed automatically at the end of its thread.
- *
+ * &nbsp;
  * &#64;shell &lt;Shell Command&gt;
  *     Runs the command in a spawned subshell, proceeds after it concludes, but
  *     quits if it fails.  For &#64;shell and &#64;echo, the command or message
  *     runs to the end of the line in the script, but can be continued if the
  *     line ends with a single '\'.
- * </pre>
+ * </pre></blockquote>
  *
  * <h4>Substituted Variables</h4>
  *
@@ -180,12 +179,12 @@
  *         by a &#64;var command.</li>
  * </ul>
  *
- * <pre>
+ * <blockquote><pre>
  * &#64;var VAR
  *     Declares a variable VAR
  * &#64;var VAR1  VAR2 ... VARn
  *     Declares n variables.
- * </pre>
+ * </pre></blockquote>
  *
  * <p>The initial value of a script variable VAR is taken from the shell
  *     environment variable of the same name.  The value can be set to a
@@ -211,23 +210,23 @@
  *
  * <h4>Example Script</h4>
  *
- * <pre>-- redundant:
+ * <blockquote><pre>-- redundant:
  * &#64;nolockstep
- *
+ * &nbsp;
  * -- Two threads reading the same data.
  * &#64;thread 1,2
  *         -- pre execute the SQL to prime the pumps
  *         &#64;timeout 1000 select * from sales.bids;
- *
+ * &nbsp;
  *         &#64;prepare select * from sales.bids;
- *
+ * &nbsp;
  *         -- rendezvous with writer thread
  *         &#64;sync
  *         &#64;fetch 15000
  *         &#64;sync
  *         &#64;close
  * &#64;end
- *
+ * &nbsp;
  * &#64;thread writer
  *         -- rendezvous with reader threads
  *         &#64;sync
@@ -238,21 +237,21 @@
  *         insert into sales.bids
  *                 values(2,  'MSFT', 101, 23.45, 20000, 'Microsoft at 23.45');
  *         commit;
- *
+ * &nbsp;
  *         -- real test has more inserts here
- *
+ * &nbsp;
  *         &#64;sync
- * &#64;end</pre>
+ * &#64;end</pre></blockquote>
  *
- *         <h3>Example Output File</h3>
+ * <h3>Example Output File</h3>
  *
- *         The output from each thread is stored in a temporary file until the
- *         test completes. At that point, the files are merged together into a
- *         single <tt>.log</tt> file containing the results of each thread, in
- *         the order the threads were defined. The output for the example script
- *         looks like:
+ * <p>The output from each thread is stored in a temporary file until
+ * the test completes. At that point, the files are merged together
+ * into a single <tt>.log</tt> file containing the results of each
+ * thread, in the order the threads were defined. The output for the
+ * example script looks like:
  *
- * <pre>-- thread 1
+ * <blockquote><pre>-- thread 1
  * &gt; select * from sales.bids;
  * +---------+------------+
  * | DEPTNO  |    NAME    |
@@ -270,9 +269,9 @@
  * | 20      | Marketing  |
  * | 30      | Accounts   |
  * +---------+------------+
- *
+ * &nbsp;
  * -- end of thread 1
- *
+ * &nbsp;
  * -- thread 2
  * &gt; select * from sales.bids;
  * +---------+------------+
@@ -291,9 +290,9 @@
  * | 20      | Marketing  |
  * | 30      | Accounts   |
  * +---------+------------+
- *
+ * &nbsp;
  * -- end of thread 2
- *
+ * &nbsp;
  * -- thread writer
  * &gt; insert into sales.bids
  * &gt;    values(1,  'ORCL', 100, 12.34,     10000, 'Oracle at 12.34');
@@ -303,9 +302,9 @@
  * &gt;    values(2,  'MSFT', 101, 23.45,     20000, 'Microsoft at 23.45');
  * 1 row affected.
  * &gt; commit;
- * -- end of thread writer</pre>
+ * -- end of thread writer</pre></blockquote>
  *
- *         (Yes the results of the select statements are obviously wrong.)
+ * <p>(Yes the results of the select statements are obviously wrong.)
  *
  *         <h3>Open Issues</h3>
  *