This is an automated email from the ASF dual-hosted git repository.
jhyde 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 41b00ba More compiler fixes, and cosmetic changes
41b00ba is described below
commit 41b00bab339a5f5fd514ab873c926cdede37b544
Author: Julian Hyde <[email protected]>
AuthorDate: Wed Jul 31 17:01:36 2019 -0700
More compiler fixes, and cosmetic changes
---
.../apache/calcite/rel/type/RelDataTypeSystem.java | 19 +++++++------------
.../calcite/rel/rel2sql/RelToSqlConverterTest.java | 8 +++-----
.../calcite/sql/type/RelDataTypeSystemTest.java | 1 +
.../java/org/apache/calcite/test/RelOptRulesTest.java | 4 ++--
.../test/catalog/VirtualColumnsExpressionFactory.java | 1 -
.../org/apache/calcite/test/RelOptRulesTest.xml | 4 ++--
core/src/test/resources/sql/sub-query.iq | 4 ++--
.../java/org/apache/calcite/adapter/file/SqlTest.java | 12 ++----------
file/src/test/resources/sales-json/DEPTS.json | 2 +-
file/src/test/resources/sales-json/EMPTY.json | 2 +-
file/src/test/resources/sales-json/SDEPTS.json | 2 +-
site/_docs/history.md | 6 +++---
12 files changed, 25 insertions(+), 40 deletions(-)
diff --git
a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeSystem.java
b/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeSystem.java
index bc9ded5..4b1f51d 100644
--- a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeSystem.java
+++ b/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeSystem.java
@@ -108,12 +108,7 @@ public interface RelDataTypeSystem {
* at least one decimal operand and requires both operands to have exact
* numeric types.
*
- * Default implementation is SQL 2003 compliant. Let p1, s1 be the precision
- * and scale of the first operand Let p2, s2 be the precision and scale of
the
- * second operand Let p, s be the precision and scale of the result, Then the
- * result type is a decimal with:
- *
- * Rules:
+ * <p>Rules:
*
* <ul>
* <li>Let p1, s1 be the precision and scale of the first operand</li>
@@ -183,9 +178,9 @@ public interface RelDataTypeSystem {
* multiplication involves at least one decimal operand and requires both
* operands to have exact numeric types.
*
- * Default implementation is SQL 2003 compliant.
+ * <p>The default implementation is SQL:2003 compliant.
*
- * Rules:
+ * <p>Rules:
*
* <ul>
* <li>Let p1, s1 be the precision and scale of the first operand</li>
@@ -248,9 +243,9 @@ public interface RelDataTypeSystem {
* at least one decimal operand and requires both operands to have exact
* numeric types.
*
- * Default implementation is SQL 2003 compliant.
+ * <p>The default implementation is SQL:2003 compliant.
*
- * Rules:
+ * <p>Rules:
*
* <ul>
* <li>Let p1, s1 be the precision and scale of the first operand</li>
@@ -323,8 +318,8 @@ public interface RelDataTypeSystem {
* involves at least one decimal operand and requires both operands to have
* exact numeric types.
*
- * Default implementation is SQL 2003 compliant: the declared type of the
- * result is the declared type of the second operand (expression divisor).
+ * <p>The default implementation is SQL:2003 compliant: the declared type of
+ * the result is the declared type of the second operand (expression
divisor).
*
* @see Glossary#SQL2003 SQL:2003 Part 2 Section 6.27
*
diff --git
a/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java
b/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java
index 9bf1b01..a1fcc8b 100644
---
a/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java
+++
b/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java
@@ -628,13 +628,11 @@ public class RelToSqlConverterTest {
builder.and(
builder.call(SqlStdOperatorTable.EQUALS,
builder.field(2, 0, "DEPTNO"),
- builder.field(2, 1, "DEPTNO")
- ),
+ builder.field(2, 1, "DEPTNO")),
builder.call(SqlStdOperatorTable.LIKE,
builder.field(2, 1, "DNAME"),
- builder.literal("ACCOUNTING")
- )
- )).build();
+ builder.literal("ACCOUNTING"))))
+ .build();
final String sql = toSql(rel);
final String expectedSql = "SELECT *\n"
+ "FROM \"scott\".\"EMP\"\n"
diff --git
a/core/src/test/java/org/apache/calcite/sql/type/RelDataTypeSystemTest.java
b/core/src/test/java/org/apache/calcite/sql/type/RelDataTypeSystemTest.java
index 2f09cc9..4bd5ebf 100644
--- a/core/src/test/java/org/apache/calcite/sql/type/RelDataTypeSystemTest.java
+++ b/core/src/test/java/org/apache/calcite/sql/type/RelDataTypeSystemTest.java
@@ -199,4 +199,5 @@ public class RelDataTypeSystemTest {
Assert.assertEquals(10, dataType.getScale());
}
}
+
// End RelDataTypeSystemTest.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 507d7a3..d95cbb7 100644
--- a/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java
+++ b/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java
@@ -5135,7 +5135,7 @@ public class RelOptRulesTest extends RelOptTestBase {
@Test public void testSelectAnyCorrelated() {
final String sql = "select empno > ANY (\n"
- + " select deptno from dept where emp.job = dept.name) \n"
+ + " select deptno from dept where emp.job = dept.name)\n"
+ "from emp\n";
checkSubQuery(sql).withLateDecorrelation(true).check();
}
@@ -5143,7 +5143,7 @@ public class RelOptRulesTest extends RelOptTestBase {
@Test public void testWhereAnyCorrelatedInSelect() {
final String sql =
"select * from emp where empno > ANY (\n"
- + " select deptno from dept where emp.job = dept.name) \n";
+ + " select deptno from dept where emp.job = dept.name)\n";
checkSubQuery(sql).withLateDecorrelation(true).check();
}
diff --git
a/core/src/test/java/org/apache/calcite/test/catalog/VirtualColumnsExpressionFactory.java
b/core/src/test/java/org/apache/calcite/test/catalog/VirtualColumnsExpressionFactory.java
index 13031c2..78b78f5 100644
---
a/core/src/test/java/org/apache/calcite/test/catalog/VirtualColumnsExpressionFactory.java
+++
b/core/src/test/java/org/apache/calcite/test/catalog/VirtualColumnsExpressionFactory.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.calcite.test.catalog;
import org.apache.calcite.plan.RelOptTable;
diff --git
a/core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml
b/core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml
index 7127189..79aa0ea 100644
--- a/core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml
+++ b/core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml
@@ -9602,7 +9602,7 @@ LogicalProject(EMPNO=[$0])
<TestCase name="testSelectAnyCorrelated">
<Resource name="sql">
<![CDATA[select empno > ANY (
- select deptno from dept where emp.job = dept.name)
+ select deptno from dept where emp.job = dept.name)
from emp
]]>
</Resource>
@@ -11210,7 +11210,7 @@ MultiJoin(joinFilter=[true], isFullOuterJoin=[false],
joinTypes=[[INNER, LEFT]],
<TestCase name="testWhereAnyCorrelatedInSelect">
<Resource name="sql">
<![CDATA[select * from emp where empno > ANY (
- select deptno from dept where emp.job = dept.name)
+ select deptno from dept where emp.job = dept.name)
]]>
</Resource>
<Resource name="planBefore">
diff --git a/core/src/test/resources/sql/sub-query.iq
b/core/src/test/resources/sql/sub-query.iq
index 432f604..3629fb5 100644
--- a/core/src/test/resources/sql/sub-query.iq
+++ b/core/src/test/resources/sql/sub-query.iq
@@ -2063,8 +2063,8 @@ EnumerableAggregate(group=[{}], C=[COUNT()])
EnumerableTableScan(table=[[scott, DEPT]])
!plan
-# Correlated ANY sub-query
-select empno from "scott".emp as e
+# Correlated ANY sub-query
+select empno from "scott".emp as e
where e.empno > ANY(
select 2 from "scott".dept e2 where e2.deptno = e.deptno) ;
EnumerableCalc(expr#0..6=[{inputs}], expr#7=[>($t0, $t2)], expr#8=[IS
NULL($t5)], expr#9=[0], expr#10=[=($t3, $t9)], expr#11=[OR($t8, $t10)],
expr#12=[IS NOT TRUE($t11)], expr#13=[AND($t7, $t12)], expr#14=[IS NOT
TRUE($t7)], expr#15=[>($t3, $t4)], expr#16=[IS NOT TRUE($t15)],
expr#17=[AND($t7, $t12, $t14, $t16)], expr#18=[OR($t13, $t17)], EMPNO=[$t0],
$condition=[$t18])
diff --git a/file/src/test/java/org/apache/calcite/adapter/file/SqlTest.java
b/file/src/test/java/org/apache/calcite/adapter/file/SqlTest.java
index bc443cc..36f9dd8 100644
--- a/file/src/test/java/org/apache/calcite/adapter/file/SqlTest.java
+++ b/file/src/test/java/org/apache/calcite/adapter/file/SqlTest.java
@@ -388,11 +388,7 @@ public class SqlTest {
});
}
- /**
- * Test returns the result of two json file joins.
- *
- * @throws SQLException
- */
+ /** Test returns the result of two json file joins. */
@Test public void testJsonJoinOnString() throws SQLException {
final String sql = "select emps.EMPNO, emps.NAME, depts.deptno from emps\n"
+ "join depts on emps.deptno = depts.deptno";
@@ -404,11 +400,7 @@ public class SqlTest {
sql("sales-json", sql).returns(lines).ok();
}
- /**
- * The folder contains both JSON files and CSV files joins.
- *
- * @throws SQLException
- */
+ /** The folder contains both JSON files and CSV files joins. */
@Test public void testJsonWithCsvJoin() throws SQLException {
final String sql = "select emps.empno,\n"
+ " NAME,\n"
diff --git a/file/src/test/resources/sales-json/DEPTS.json
b/file/src/test/resources/sales-json/DEPTS.json
index 999f645..1b8def5 100644
--- a/file/src/test/resources/sales-json/DEPTS.json
+++ b/file/src/test/resources/sales-json/DEPTS.json
@@ -27,4 +27,4 @@
"DEPTNO": 30,
"NAME": "Accounts"
}
-]
\ No newline at end of file
+]
diff --git a/file/src/test/resources/sales-json/EMPTY.json
b/file/src/test/resources/sales-json/EMPTY.json
index dcc7541..2a42971 100644
--- a/file/src/test/resources/sales-json/EMPTY.json
+++ b/file/src/test/resources/sales-json/EMPTY.json
@@ -13,4 +13,4 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
\ No newline at end of file
+ */
diff --git a/file/src/test/resources/sales-json/SDEPTS.json
b/file/src/test/resources/sales-json/SDEPTS.json
index c58b29b..d1f0719 100644
--- a/file/src/test/resources/sales-json/SDEPTS.json
+++ b/file/src/test/resources/sales-json/SDEPTS.json
@@ -39,4 +39,4 @@
"DEPTNO": 60,
"NAME": "60"
}
-]
\ No newline at end of file
+]
diff --git a/site/_docs/history.md b/site/_docs/history.md
index 995159b..37fe973 100644
--- a/site/_docs/history.md
+++ b/site/_docs/history.md
@@ -158,9 +158,9 @@ other software versions as specified in `pom.xml`.
* [<a
href='https://issues.apache.org/jira/browse/CALCITE-2993'>CALCITE-2993</a>]
`ParseException` may be thrown for legal SQL queries due to incorrect
"LOOKAHEAD(1)" hints
* [<a
href='https://issues.apache.org/jira/browse/CALCITE-3010'>CALCITE-3010</a>] In
SQL parser, move `JsonValueExpression` into Expression
* [<a
href='https://issues.apache.org/jira/browse/CALCITE-3009'>CALCITE-3009</a>]
`DiffRepository` should ensure that XML resource file does not contain
duplicate test names
-* [<a
href='https://issues.apache.org/jira/browse/CALCITE-2986'>CALCITE-2986</a>]
Wrong results with =ANY subquery (Vineet Garg)
+* [<a
href='https://issues.apache.org/jira/browse/CALCITE-2986'>CALCITE-2986</a>]
Wrong results with `= ANY` sub-query (Vineet Garg)
* [<a
href='https://issues.apache.org/jira/browse/CALCITE-2962'>CALCITE-2962</a>]
`RelStructuredTypeFlattener` generates wrong types for nested column when
`flattenProjection` (Will Yu)
-* [<a
href='https://issues.apache.org/jira/browse/CALCITE-3007'>CALCITE-3007</a>]
Type mismatch for ANY subquery in project (Vineet Garg)
+* [<a
href='https://issues.apache.org/jira/browse/CALCITE-3007'>CALCITE-3007</a>]
Type mismatch for `ANY` sub-query in project (Vineet Garg)
* [<a
href='https://issues.apache.org/jira/browse/CALCITE-2865'>CALCITE-2865</a>]
`FilterProjectTransposeRule` generates wrong `traitSet` when
`copyFilter`/`Project` is true (Ruben Quesada Lopez)
* [<a
href='https://issues.apache.org/jira/browse/CALCITE-2343'>CALCITE-2343</a>]
`PushProjector` with OVER expression causes infinite loop (Chunwei Lei)
* [<a
href='https://issues.apache.org/jira/browse/CALCITE-2994'>CALCITE-2994</a>]
Least restrictive type among structs does not consider nullability
@@ -186,7 +186,7 @@ other software versions as specified in `pom.xml`.
* In `RelFieldCollation`, add a `withX` copy method
* [<a
href='https://issues.apache.org/jira/browse/CALCITE-2953'>CALCITE-2953</a>]
`LatticeTest.testTileAlgorithm2` and `LatticeTest.testTileAlgorithm3` fail
intermittently
* [<a
href='https://issues.apache.org/jira/browse/CALCITE-574'>CALCITE-574</a>]
Remove `org.apache.calcite.util.Bug.CALCITE_461_FIXED`
-* [<a
href='https://issues.apache.org/jira/browse/CALCITE-2951'>CALCITE-2951</a>]
Support decorrelate subquery that has aggregate with grouping sets (Haisheng
Yuan)
+* [<a
href='https://issues.apache.org/jira/browse/CALCITE-2951'>CALCITE-2951</a>]
Support decorrelate sub-query that has aggregate with grouping sets (Haisheng
Yuan)
* [<a
href='https://issues.apache.org/jira/browse/CALCITE-2946'>CALCITE-2946</a>]
`RelBuilder` wrongly skips creation of Aggregate that prunes columns if input
produces one row at most
* [<a
href='https://issues.apache.org/jira/browse/CALCITE-2942'>CALCITE-2943</a>]
Materialized view rewriting logic calls `getApplicableMaterializations` each
time the rule is triggered
* [<a
href='https://issues.apache.org/jira/browse/CALCITE-2942'>CALCITE-2942</a>]
Materialized view rewriting logic instantiates `RelMetadataQuery` each time the
rule is triggered