Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
Require that newlines in Java string literals are
at the end of a fragment. This forces developers
to break string literals over several lines, to
match the contents of the literals, and helps
make long SQL queries and results easier to read
and maintain.

Disallow '.' at the end of a line of Java code.
(If a chain of method calls or field references
is broken over multiple lines, each '.' should
be at the start of or in the middle of a line.)
  • Loading branch information
julianhyde committed Feb 19, 2025
1 parent dd49d9f commit ce64da0
Show file tree
Hide file tree
Showing 76 changed files with 2,719 additions and 1,520 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ static void initializeArrowState(@TempDir Path sharedTempDir)
String sql = "select \"tinyIntField\" from arrowdatatype";
String plan = "PLAN=ArrowToEnumerableConverter\n"
+ " ArrowProject(tinyIntField=[$0])\n"
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n\n";
String result = "tinyIntField=0\ntinyIntField=1\n";
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n"
+ "\n";
String result = "tinyIntField=0\n"
+ "tinyIntField=1\n";
CalciteAssert.that()
.with(arrow)
.query(sql)
Expand All @@ -82,8 +84,10 @@ static void initializeArrowState(@TempDir Path sharedTempDir)
String sql = "select \"smallIntField\" from arrowdatatype";
String plan = "PLAN=ArrowToEnumerableConverter\n"
+ " ArrowProject(smallIntField=[$1])\n"
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n\n";
String result = "smallIntField=0\nsmallIntField=1\n";
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n"
+ "\n";
String result = "smallIntField=0\n"
+ "smallIntField=1\n";
CalciteAssert.that()
.with(arrow)
.query(sql)
Expand All @@ -96,8 +100,10 @@ static void initializeArrowState(@TempDir Path sharedTempDir)
String sql = "select \"intField\" from arrowdatatype";
String plan = "PLAN=ArrowToEnumerableConverter\n"
+ " ArrowProject(intField=[$2])\n"
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n\n";
String result = "intField=0\nintField=1\n";
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n"
+ "\n";
String result = "intField=0\n"
+ "intField=1\n";
CalciteAssert.that()
.with(arrow)
.query(sql)
Expand All @@ -110,8 +116,10 @@ static void initializeArrowState(@TempDir Path sharedTempDir)
String sql = "select \"longField\" from arrowdatatype";
String plan = "PLAN=ArrowToEnumerableConverter\n"
+ " ArrowProject(longField=[$5])\n"
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n\n";
String result = "longField=0\nlongField=1\n";
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n"
+ "\n";
String result = "longField=0\n"
+ "longField=1\n";
CalciteAssert.that()
.with(arrow)
.query(sql)
Expand All @@ -124,8 +132,10 @@ static void initializeArrowState(@TempDir Path sharedTempDir)
String sql = "select \"floatField\" from arrowdatatype";
String plan = "PLAN=ArrowToEnumerableConverter\n"
+ " ArrowProject(floatField=[$4])\n"
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n\n";
String result = "floatField=0.0\nfloatField=1.0\n";
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n"
+ "\n";
String result = "floatField=0.0\n"
+ "floatField=1.0\n";
CalciteAssert.that()
.with(arrow)
.query(sql)
Expand All @@ -138,8 +148,10 @@ static void initializeArrowState(@TempDir Path sharedTempDir)
String sql = "select \"doubleField\" from arrowdatatype";
String plan = "PLAN=ArrowToEnumerableConverter\n"
+ " ArrowProject(doubleField=[$6])\n"
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n\n";
String result = "doubleField=0.0\ndoubleField=1.0\n";
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n"
+ "\n";
String result = "doubleField=0.0\n"
+ "doubleField=1.0\n";
CalciteAssert.that()
.with(arrow)
.query(sql)
Expand All @@ -152,8 +164,10 @@ static void initializeArrowState(@TempDir Path sharedTempDir)
String sql = "select \"decimalField\" from arrowdatatype";
String plan = "PLAN=ArrowToEnumerableConverter\n"
+ " ArrowProject(decimalField=[$8])\n"
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n\n";
String result = "decimalField=0.00\ndecimalField=1.00\n";
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n"
+ "\n";
String result = "decimalField=0.00\n"
+ "decimalField=1.00\n";
CalciteAssert.that()
.with(arrow)
.query(sql)
Expand All @@ -166,7 +180,8 @@ static void initializeArrowState(@TempDir Path sharedTempDir)
String sql = "select \"dateField\" from arrowdatatype";
String plan = "PLAN=ArrowToEnumerableConverter\n"
+ " ArrowProject(dateField=[$9])\n"
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n\n";
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n"
+ "\n";
String result = "dateField=1970-01-01\n"
+ "dateField=1970-01-02\n";
CalciteAssert.that()
Expand All @@ -181,8 +196,11 @@ static void initializeArrowState(@TempDir Path sharedTempDir)
String sql = "select \"booleanField\" from arrowdatatype";
String plan = "PLAN=ArrowToEnumerableConverter\n"
+ " ArrowProject(booleanField=[$7])\n"
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n\n";
String result = "booleanField=null\nbooleanField=true\nbooleanField=false\n";
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n"
+ "\n";
String result = "booleanField=null\n"
+ "booleanField=true\n"
+ "booleanField=false\n";
CalciteAssert.that()
.with(arrow)
.query(sql)
Expand All @@ -198,8 +216,10 @@ static void initializeArrowState(@TempDir Path sharedTempDir)
String sql = "select \"decimalField2\" from arrowdatatype";
String plan = "PLAN=ArrowToEnumerableConverter\n"
+ " ArrowProject(decimalField2=[$10])\n"
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n\n";
String result = "decimalField2=20.000\ndecimalField2=21.000\n";
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n"
+ "\n";
String result = "decimalField2=20.000\n"
+ "decimalField2=21.000\n";
CalciteAssert.that()
.with(arrow)
.query(sql)
Expand All @@ -212,7 +232,8 @@ static void initializeArrowState(@TempDir Path sharedTempDir)
String sql = "select \"timeField\" from arrowdatatype";
String plan = "PLAN=ArrowToEnumerableConverter\n"
+ " ArrowProject(timeField=[$11])\n"
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n\n";
+ " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]])\n"
+ "\n";
String result = "timeField=00:00:00\n"
+ "timeField=00:00:01\n";
CalciteAssert.that()
Expand Down
Loading

0 comments on commit ce64da0

Please sign in to comment.