code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
@Test(enabled = false) public void testMapSelection() { // TODO: This statement does not parse in calcite Sql. Fix syntax String sql = "SELECT MAP(ARRAY['a', 'b'], ARRAY[1, 2])"; String expected = "SELECT MAP(ARRAY['a', 'b'], ARRAY[1, 2])\nFROM (VALUES (0))"; testConversion(sql, expected); }
Tests conversion from Calcite RelNode to Trino's SQL
testMapSelection
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testConstantExpressions() { { String sql = "SELECT 1"; String expected = formatSql("SELECT 1 FROM (VALUES (0)) AS \"t\" (\"ZERO\")"); testConversion(sql, expected); } { String sql = "SELECT 5 + 2 * 10 / 4"; String expected = formatSql("SELECT 5 + 2 * 10 / 4...
Tests conversion from Calcite RelNode to Trino's SQL
testConstantExpressions
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test(enabled = false) public void testIsNull() { { String sql = "SELECT icol from tableOne where icol is not null"; String expected = formatSql("select icol from tableOne where icol IS NOT NULL"); testConversion(sql, expected); } }
Tests conversion from Calcite RelNode to Trino's SQL
testIsNull
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testWindowClause() { }
Tests conversion from Calcite RelNode to Trino's SQL
testWindowClause
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testExists() { String sql = "SELECT icol from test.tableOne where exists (select ifield from test.tableTwo where dfield > 32.00)"; String expected = "SELECT \"tableone\".\"icol\" AS \"icol\"\n" + "FROM \"test\".\"tableone\" AS \"tableone\"\n" + "LEFT JOIN (SELECT MIN(TRUE) AS \"$f0\"...
Tests conversion from Calcite RelNode to Trino's SQL
testExists
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testNotExists() { String sql = "SELECT icol from test.tableOne where not exists (select ifield from test.tableTwo where dfield > 32.00)"; String expected = "SELECT \"tableone\".\"icol\" AS \"icol\"\n" + "FROM \"test\".\"tableone\" AS \"tableone\"\n" + "LEFT JOIN (SELECT MIN(T...
Tests conversion from Calcite RelNode to Trino's SQL
testNotExists
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testInOperator() { String sql = "SELECT tcol, scol\n" + "FROM test.tableOne" + " WHERE icol IN ( " + " SELECT ifield from test.tableTwo" + " WHERE ifield < 10)"; String expectedSql = "SELECT \"tableone\".\"tcol\" AS \"tcol\", \"tableone\".\"scol\" AS \"scol\"\n" + "FROM \"...
Tests conversion from Calcite RelNode to Trino's SQL
testInOperator
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test(enabled = false) public void testNotIn() { String sql = "SELECT tcol, scol\n" + "FROM test.tableOne" + " WHERE icol NOT IN ( " + " SELECT ifield from test.tableTwo" + " WHERE ifield < 10)"; String s = "select tableOne.tcol as tcol, tableOne.scol as scol\n" + "FROM test.tableOne" + "\n" ...
Tests conversion from Calcite RelNode to Trino's SQL
testNotIn
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test(enabled = false) public void testScalarSubquery() { String sql = "SELECT icol from test.tableOne where icol > (select sum(ifield) from tableTwo)"; testConversion(sql, ""); }
Tests conversion from Calcite RelNode to Trino's SQL
testScalarSubquery
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test(enabled = false) public void testCorrelatedSubquery() { String sql = "select dcol from test.tableOne where dcol > (select sum(dfield) from tableTwo where dfield < test.tableOne.icol)"; testConversion(sql, ""); }
Tests conversion from Calcite RelNode to Trino's SQL
testCorrelatedSubquery
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testLateralView() { // we need multiple lateral clauses and projection of columns // other than those from lateral view for more robust testing final String sql = "SELECT t.icol, dt1.i_plusOne, dt2.d_plusTen, t.tcol, t.acol\n" + "FROM test.tableOne t\n" + "JOIN (SELECT t.icol + 1...
Tests conversion from Calcite RelNode to Trino's SQL
testLateralView
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testUnnestConstant() { final String sql = "SELECT c1 + 2\n" + "FROM (SELECT 1 as c1, 1 as c2 UNION ALL" + " SELECT 2 as c1, 2 as c2 UNION ALL" + " SELECT 3 as c1, 3 as c2) t"; final String expected = "SELECT \"t6\".\"c1\" + 2\n" + "FROM (SELECT *\n" + "FROM (SELECT 1 AS \"c1...
Tests conversion from Calcite RelNode to Trino's SQL
testUnnestConstant
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testLateralViewUnnest() { String sql = "select icol, acol_elem from test.tableOne LATERAL VIEW explode(acol) t1 AS acol_elem"; String expectedSql = "SELECT \"tableone\".\"icol\" AS \"icol\", \"t0\".\"acol_elem\" AS \"acol_elem\"\n" + "FROM \"test\".\"tableone\" AS \"tableone\"\n" ...
Tests conversion from Calcite RelNode to Trino's SQL
testLateralViewUnnest
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test(enabled = false) public void testMultipleNestedQueries() { String sql = "select icol from tableOne where dcol > (select avg(dfield) from tableTwo where dfield > " + " (select sum(ifield) from tableOne) )"; }
Tests conversion from Calcite RelNode to Trino's SQL
testMultipleNestedQueries
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testUnion() { testSetQueries("UNION ALL"); }
Tests conversion from Calcite RelNode to Trino's SQL
testUnion
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
private void testSetQueries(String operator) { String sql = "SELECT icol FROM test.tableOne" + " " + operator + "\n" + "SELECT ifield FROM test.tableTwo" + " WHERE sfield = 'abc'"; String expectedSql = "SELECT \"tableone\".\"icol\" AS \"icol\"\n" + "FROM \"test\".\"tableone\" AS \"tableone\"\n" ...
Tests conversion from Calcite RelNode to Trino's SQL
testSetQueries
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testCast() { String sql = "SELECT cast(dcol as int) as d, cast(icol as double) as i FROM test.tableOne"; String expectedSql = "SELECT CAST(\"tableone\".\"dcol\" AS INTEGER) AS \"d\", CAST(\"tableone\".\"icol\" AS DOUBLE) AS \"i\"\n" + "FROM \"test\".\"tableone\" AS \"tabl...
Tests conversion from Calcite RelNode to Trino's SQL
testCast
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testVarcharCast() { final String sql = "SELECT cast(icol as varchar(1000)) FROM test.tableOne"; testConversion(sql, "SELECT CAST(\"tableone\".\"icol\" AS VARCHAR(65535))\n" + "FROM \"test\".\"tableone\" AS \"tableone\""); }
Tests conversion from Calcite RelNode to Trino's SQL
testVarcharCast
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testRand() { String sql1 = "SELECT icol, rand() " + "FROM test.tableOne"; String expectedSql1 = "SELECT \"tableone\".\"icol\" AS \"icol\", \"RANDOM\"()\n" + "FROM \"test\".\"tableone\" AS \"tableone\""; testConversion(sql1, expectedSql1); String sql2 = "SELECT icol, rand(1) ...
Tests conversion from Calcite RelNode to Trino's SQL
testRand
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testRandInteger() { String sql1 = "SELECT floor(rand() * (icol - 2 + 1) + 2) FROM test.tableOne"; String expectedSql1 = "SELECT CAST(FLOOR(\"RANDOM\"() * (\"tableone\".\"icol\" - 2 + 1) + 2) AS BIGINT)\n" + "FROM \"test\".\"tableone\" AS \"tableone\""; testConversion(sql1, expect...
Tests conversion from Calcite RelNode to Trino's SQL
testRandInteger
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testTruncate() { String sql1 = "SELECT floor(dcol) FROM test.tableOne"; String expectedSql1 = "SELECT CAST(FLOOR(\"tableone\".\"dcol\") AS BIGINT)\n" + "FROM \"test\".\"tableone\" AS \"tableone\""; testConversion(sql1, expectedSql1); String sql2 = "SELECT round(dcol, 2 - flo...
Tests conversion from Calcite RelNode to Trino's SQL
testTruncate
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testSubString1() { String sql = "SELECT SUBSTRING(scol, 0) FROM test.tableOne"; // Trino is 1-based String expectedSql = "SELECT \"substr\"(\"tableone\".\"scol\", 1)\n" + "FROM \"test\".\"tableone\" AS \"tableone\""; testConversion(sql, expectedSql); }
Tests conversion from Calcite RelNode to Trino's SQL
testSubString1
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testSubStr1() { String sql = "SELECT SUBSTR(scol, 0) FROM test.tableOne"; // Trino is 1-based String expectedSql = "SELECT \"substr\"(\"tableone\".\"scol\", 1)\n" + "FROM \"test\".\"tableone\" AS \"tableone\""; testConversion(sql, expectedSql); }
Tests conversion from Calcite RelNode to Trino's SQL
testSubStr1
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testSubStr2() { String sql = "SELECT SUBSTR(scol, 1) FROM test.tableOne"; String expectedSql = "SELECT \"substr\"(\"tableone\".\"scol\", 1)\n" + "FROM \"test\".\"tableone\" AS \"tableone\""; testConversion(sql, expectedSql); }
Tests conversion from Calcite RelNode to Trino's SQL
testSubStr2
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testSubString2() { String sql = "SELECT SUBSTRING(scol, 1) FROM test.tableOne"; String expectedSql = "SELECT \"substr\"(\"tableone\".\"scol\", 1)\n" + "FROM \"test\".\"tableone\" AS \"tableone\""; testConversion(sql, expectedSql); }
Tests conversion from Calcite RelNode to Trino's SQL
testSubString2
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testSubStr3() { String sql = "SELECT SUBSTR(scol, icol, 3) FROM test.tableOne"; String expectedSql = "SELECT \"substr\"(\"tableone\".\"scol\", CASE WHEN \"tableone\".\"icol\" = 0 THEN 1 ELSE \"tableone\".\"icol\" END, 3)\n" + "FROM \"test\".\"tableone\" AS \"tableone\""; ...
Tests conversion from Calcite RelNode to Trino's SQL
testSubStr3
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testSubString3() { String sql = "SELECT SUBSTRING(scol, icol, 3) FROM test.tableOne"; String expectedSql = "SELECT \"substr\"(\"tableone\".\"scol\", CASE WHEN \"tableone\".\"icol\" = 0 THEN 1 ELSE \"tableone\".\"icol\" END, 3)\n" + "FROM \"test\".\"tableone\" AS \"tableon...
Tests conversion from Calcite RelNode to Trino's SQL
testSubString3
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testSubStr4() { String sql = "SELECT SUBSTR('123', 0, 3)"; String expectedSql = "SELECT \"substr\"('123', 1, 3)\n" + "FROM (VALUES (0)) AS \"t\" (\"ZERO\")"; testConversion(sql, expectedSql); }
Tests conversion from Calcite RelNode to Trino's SQL
testSubStr4
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testSubString4() { String sql = "SELECT SUBSTRING('123', 0, 3)"; String expectedSql = "SELECT \"substr\"('123', 1, 3)\n" + "FROM (VALUES (0)) AS \"t\" (\"ZERO\")"; testConversion(sql, expectedSql); }
Tests conversion from Calcite RelNode to Trino's SQL
testSubString4
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testLimit() { String sql = "SELECT icol " + "FROM test.tableOne" + " LIMIT 100"; String expectedSql = "SELECT \"tableone\".\"icol\" AS \"icol\"\n" + "FROM \"test\".\"tableone\" AS \"tableone\"\n" + "LIMIT 100"; testConversion(sql, expectedSql); }
Tests conversion from Calcite RelNode to Trino's SQL
testLimit
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testDistinct() { String sql = "SELECT distinct icol FROM test.tableOne"; String expectedSql = "SELECT \"tableone\".\"icol\" AS \"icol\"\n" + "FROM \"test\".\"tableone\" AS \"tableone\"\n" + "GROUP BY \"tableone\".\"icol\""; testConversion(sql, expectedSql); }
Tests conversion from Calcite RelNode to Trino's SQL
testDistinct
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testGroupDistinct() { String sql = "SELECT scol, count(distinct icol) FROM test.tableOne" + " GROUP BY scol"; String expectedSql = "SELECT \"tableone\".\"scol\" AS \"scol\", COUNT(DISTINCT \"tableone\".\"icol\")\n" + "FROM \"test\".\"tableone\" AS \"tableone\"\n" + "GROUP BY \"tableo...
Tests conversion from Calcite RelNode to Trino's SQL
testGroupDistinct
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testJoin() { String sql = "SELECT a.icol, b.dfield FROM test.tableOne" + " a JOIN test.tableTwo" + " b ON a.scol = b.sfield"; String expectedSql = "SELECT \"tableone\".\"icol\" AS \"icol\", \"tabletwo\".\"dfield\" AS \"dfield\"\n" + "FROM \"test\".\"tableone\" AS \"tableone\"\n" ...
Tests conversion from Calcite RelNode to Trino's SQL
testJoin
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testLeftJoin() { String sql = "SELECT a.icol, b.dfield FROM test.tableOne" + " a LEFT JOIN test.tableTwo" + " b ON a.scol = b.sfield"; String expectedSql = "SELECT \"tableone\".\"icol\" AS \"icol\", \"tabletwo\".\"dfield\" AS \"dfield\"\n" + "FROM \"test\".\"tableone\" AS \"...
Tests conversion from Calcite RelNode to Trino's SQL
testLeftJoin
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testRightJoin() { String sql = "SELECT a.icol, b.dfield FROM test.tableOne" + " a RIGHT JOIN test.tableTwo" + " b ON a.scol = b.sfield"; String expectedSql = "SELECT \"tableone\".\"icol\" AS \"icol\", \"tabletwo\".\"dfield\" AS \"dfield\"\n" + "FROM \"test\".\"tableone\" AS ...
Tests conversion from Calcite RelNode to Trino's SQL
testRightJoin
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testOuterJoin() { String sql = "SELECT a.icol, b.dfield FROM test.tableOne" + " a FULL OUTER JOIN test.tableTwo" + " b ON a.scol = b.sfield"; String expectedSql = "SELECT \"tableone\".\"icol\" AS \"icol\", \"tabletwo\".\"dfield\" AS \"dfield\"\n" + "FROM \"test\".\"tableone\...
Tests conversion from Calcite RelNode to Trino's SQL
testOuterJoin
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testTryCastIntTrino() { String sql = "SELECT CASE WHEN a.scol= 0 THEN TRUE ELSE FALSE END AS testcol FROM test.tableOne a WHERE a.scol = 1"; String expectedSql = "SELECT CASE WHEN CAST(\"tableone\".\"scol\" AS INTEGER) = 0 THEN TRUE ELSE FALSE END AS \"testcol\"\n" + "FRO...
Tests conversion from Calcite RelNode to Trino's SQL
testTryCastIntTrino
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testTryCastBooleanTrino() { String sql = "SELECT CASE WHEN a.scol= TRUE THEN TRUE ELSE FALSE END AS testcol FROM test.tableOne" + " a WHERE a.scol = FALSE"; String expectedSql = "SELECT CASE WHEN CAST(\"tableone\".\"scol\" AS BOOLEAN) = TRUE THEN TRUE ELSE FALSE END AS \"test...
Tests conversion from Calcite RelNode to Trino's SQL
testTryCastBooleanTrino
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testCase() { String sql = "SELECT case when icol = 0 then scol else 'other' end from test.tableOne"; String expected = "SELECT CASE WHEN \"tableone\".\"icol\" = 0 THEN \"tableone\".\"scol\" ELSE 'other' END\n" + "FROM \"test\".\"tableone\" AS \"tableone\""; testConversion(sql, ex...
Tests conversion from Calcite RelNode to Trino's SQL
testCase
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testDataTypeSpecRewrite() { String sql1 = "SELECT CAST(icol AS FLOAT) FROM test.tableOne"; String expectedSql1 = "SELECT CAST(\"tableone\".\"icol\" AS REAL)\n" + "FROM \"test\".\"tableone\" AS \"tableone\""; testConversion(sql1, expectedSql1); String sql2 = "SELECT CAST(binaryfield ...
Tests conversion from Calcite RelNode to Trino's SQL
testDataTypeSpecRewrite
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testCurrentUser() { String sql = "SELECT current_user"; String expected = formatSql("SELECT CURRENT_USER AS \"current_user\"\nFROM (VALUES (0)) AS \"t\" (\"ZERO\")"); testConversion(sql, expected); }
Tests conversion from Calcite RelNode to Trino's SQL
testCurrentUser
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testCurrentTimestamp() { String sql = "SELECT current_timestamp"; String expected = formatSql("SELECT CAST(CURRENT_TIMESTAMP AS TIMESTAMP(3))\nFROM (VALUES (0)) AS \"t\" (\"ZERO\")"); testConversion(sql, expected); }
Tests conversion from Calcite RelNode to Trino's SQL
testCurrentTimestamp
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testCurrentDate() { String sql = "SELECT current_date"; String expected = formatSql("SELECT CURRENT_DATE\nFROM (VALUES (0)) AS \"t\" (\"ZERO\")"); testConversion(sql, expected); }
Tests conversion from Calcite RelNode to Trino's SQL
testCurrentDate
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
public String getTableName() { return tableName; }
Test utility class to create a calcite table to add to a Schema class
getTableName
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
BSD-2-Clause
public RelDataType getRowType(RelDataTypeFactory typeFactory) { ImmutableList<String> fields = columns.keySet().asList(); List<RelDataType> fieldTypes = columns.values().stream().map(s -> getRelType(typeFactory, s)).collect(Collectors.toList()); RelDataType rowType = typeFactory.createStructType(fi...
Test utility class to create a calcite table to add to a Schema class
getRowType
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
BSD-2-Clause
public static RelDataType getRelType(RelDataTypeFactory typeFactory, SqlTypeName type) { if (type.equals(SqlTypeName.ARRAY)) { // TODO: default array type... return typeFactory.createArrayType(typeFactory.createSqlType(SqlTypeName.INTEGER), -1); } if (type.equals(SqlTypeName.MAP)) { RelDat...
Test utility class to create a calcite table to add to a Schema class
getRelType
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
BSD-2-Clause
private static RelDataType createStructType(RelDataTypeFactory typeFactory) { List<RelDataType> fieldTypes = ImmutableList.of(typeFactory.createSqlType(SqlTypeName.INTEGER), typeFactory.createSqlType(SqlTypeName.VARCHAR)); List<String> fieldNames = ImmutableList.of("IFIELD", "SFIELD"); return typeFa...
Test utility class to create a calcite table to add to a Schema class
createStructType
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
BSD-2-Clause
public Statistic getStatistic() { return Statistics.UNKNOWN; }
Test utility class to create a calcite table to add to a Schema class
getStatistic
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
BSD-2-Clause
public Schema.TableType getJdbcTableType() { return Schema.TableType.TABLE; }
Test utility class to create a calcite table to add to a Schema class
getJdbcTableType
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
BSD-2-Clause
@Override public boolean isRolledUp(String s) { return false; }
Test utility class to create a calcite table to add to a Schema class
isRolledUp
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
BSD-2-Clause
@Override public boolean rolledUpColumnValidInsideAgg(String s, SqlCall sqlCall, SqlNode sqlNode, CalciteConnectionConfig calciteConnectionConfig) { return true; }
Test utility class to create a calcite table to add to a Schema class
rolledUpColumnValidInsideAgg
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
BSD-2-Clause
public ImmutableList<String> getColumnNames() { return columns.keySet().asList(); }
Test utility class to create a calcite table to add to a Schema class
getColumnNames
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestTable.java
BSD-2-Clause
public static String formatSql(String sql) { String s = upcaseKeywords(sql); s = quoteColumns(s); s = addLineBreaks(s); return s; }
Utility to conveniently format sql string just like Calcite formatting. This is used to conveniently generate expected string without having to type all formatting each time. WARNING: This is not generic method but utility method for common cases for testing. There are bugs. Use at your own risk or, better yet, fix it ...
formatSql
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
BSD-2-Clause
private static String addLineBreaks(String s) { ImmutableList<String> lineBreakKeywords = ImmutableList.copyOf("SELECT FROM WHERE GROUP HAVING ORDER OVER IN EXCEPT UNION INTERSECT".split("\\s+")); Pattern pattern = Pattern.compile("\\s" + String.join("\\b|\\s", lineBreakKeywords) + "\\b"); Matcher m...
Utility to conveniently format sql string just like Calcite formatting. This is used to conveniently generate expected string without having to type all formatting each time. WARNING: This is not generic method but utility method for common cases for testing. There are bugs. Use at your own risk or, better yet, fix it ...
addLineBreaks
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
BSD-2-Clause
public static String quoteColumns(String sql) { Iterable<String> concat = Iterables.concat(TABLE_ONE.getColumnNames(), TABLE_TWO.getColumnNames(), TABLE_THREE.getColumnNames(), TABLE_FOUR.getColumnNames(), ImmutableList.of(TABLE_ONE.getTableName(), TABLE_TWO.getTableName(), TABLE_THREE.getTableN...
Utility to conveniently format sql string just like Calcite formatting. This is used to conveniently generate expected string without having to type all formatting each time. WARNING: This is not generic method but utility method for common cases for testing. There are bugs. Use at your own risk or, better yet, fix it ...
quoteColumns
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
BSD-2-Clause
public String quoteColumns(String sql, List<String> columns) { return quoteColumns(sql, Pattern.compile(String.join("|", columns))); }
Utility to conveniently format sql string just like Calcite formatting. This is used to conveniently generate expected string without having to type all formatting each time. WARNING: This is not generic method but utility method for common cases for testing. There are bugs. Use at your own risk or, better yet, fix it ...
quoteColumns
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
BSD-2-Clause
public static String quoteColumns(String sql, Pattern pattern) { String s = quoteAliases(sql); Matcher m = pattern.matcher(s); StringBuffer sb = new StringBuffer(); while (m.find()) { m.appendReplacement(sb, "\"" + m.group() + "\""); } m.appendTail(sb); return sb.toString(); }
Utility to conveniently format sql string just like Calcite formatting. This is used to conveniently generate expected string without having to type all formatting each time. WARNING: This is not generic method but utility method for common cases for testing. There are bugs. Use at your own risk or, better yet, fix it ...
quoteColumns
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
BSD-2-Clause
public static String quoteAliases(String input) { Pattern pattern = Pattern.compile("AS (\\w+)"); Matcher m = pattern.matcher(input); StringBuffer sb = new StringBuffer(); while (m.find()) { String replacement = null; String alias = m.group(1); if (alias.equalsIgnoreCase("integer") || ...
Utility to conveniently format sql string just like Calcite formatting. This is used to conveniently generate expected string without having to type all formatting each time. WARNING: This is not generic method but utility method for common cases for testing. There are bugs. Use at your own risk or, better yet, fix it ...
quoteAliases
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
BSD-2-Clause
public static String upcaseKeywords(String sql) { Matcher matcher = KW_PATTERN.matcher(sql); StringBuffer sb = new StringBuffer(); while (matcher.find()) { matcher.appendReplacement(sb, matcher.group().toUpperCase()); } matcher.appendTail(sb); return sb.toString(); }
Utility to conveniently format sql string just like Calcite formatting. This is used to conveniently generate expected string without having to type all formatting each time. WARNING: This is not generic method but utility method for common cases for testing. There are bugs. Use at your own risk or, better yet, fix it ...
upcaseKeywords
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
BSD-2-Clause
static void run(Driver driver, String sql) { while (true) { try { CommandProcessorResponse result = driver.run(sql); if (result.getException() != null) { throw new RuntimeException("Execution failed for: " + sql, result.getException()); } } catch (CommandNeedRetryExcept...
Utility to conveniently format sql string just like Calcite formatting. This is used to conveniently generate expected string without having to type all formatting each time. WARNING: This is not generic method but utility method for common cases for testing. There are bugs. Use at your own risk or, better yet, fix it ...
run
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
BSD-2-Clause
static void turnOffRelSimplification() { // Rel simplification can statically interpret boolean conditions in // OR, AND, CASE clauses and simplify those. This has two problems: // 1. Our type system is not perfect replication of Hive so this can be incorrect // 2. Converted expression is harder to vali...
Utility to conveniently format sql string just like Calcite formatting. This is used to conveniently generate expected string without having to type all formatting each time. WARNING: This is not generic method but utility method for common cases for testing. There are bugs. Use at your own risk or, better yet, fix it ...
turnOffRelSimplification
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
BSD-2-Clause
public static HiveToRelConverter getHiveToRelConverter() { return new HiveToRelConverter(hiveMetastoreClient); }
Utility to conveniently format sql string just like Calcite formatting. This is used to conveniently generate expected string without having to type all formatting each time. WARNING: This is not generic method but utility method for common cases for testing. There are bugs. Use at your own risk or, better yet, fix it ...
getHiveToRelConverter
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
BSD-2-Clause
public static RelToTrinoConverter getRelToTrinoConverter() { return new RelToTrinoConverter(hiveMetastoreClient); }
Utility to conveniently format sql string just like Calcite formatting. This is used to conveniently generate expected string without having to type all formatting each time. WARNING: This is not generic method but utility method for common cases for testing. There are bugs. Use at your own risk or, better yet, fix it ...
getRelToTrinoConverter
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
BSD-2-Clause
public static RelToTrinoConverter getRelToTrinoConverter(Map<String, Boolean> configs) { return new RelToTrinoConverter(hiveMetastoreClient, configs); }
Utility to conveniently format sql string just like Calcite formatting. This is used to conveniently generate expected string without having to type all formatting each time. WARNING: This is not generic method but utility method for common cases for testing. There are bugs. Use at your own risk or, better yet, fix it ...
getRelToTrinoConverter
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
BSD-2-Clause
public static void initializeTablesAndViews(HiveConf conf) throws HiveException, MetaException, IOException { String testDir = conf.get(CORAL_TRINO_TEST_DIR); System.out.println("Test Workspace: " + testDir); FileUtils.deleteDirectory(new File(testDir)); SessionState.start(conf); Driver driver = new...
Utility to conveniently format sql string just like Calcite formatting. This is used to conveniently generate expected string without having to type all formatting each time. WARNING: This is not generic method but utility method for common cases for testing. There are bugs. Use at your own risk or, better yet, fix it ...
initializeTablesAndViews
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
BSD-2-Clause
public static HiveConf loadResourceHiveConf() { InputStream hiveConfStream = TestUtils.class.getClassLoader().getResourceAsStream("hive.xml"); HiveConf hiveConf = new HiveConf(); hiveConf.set(CORAL_TRINO_TEST_DIR, System.getProperty("java.io.tmpdir") + "/coral/trino/" + UUID.randomUUID().toString())...
Utility to conveniently format sql string just like Calcite formatting. This is used to conveniently generate expected string without having to type all formatting each time. WARNING: This is not generic method but utility method for common cases for testing. There are bugs. Use at your own risk or, better yet, fix it ...
loadResourceHiveConf
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java
BSD-2-Clause
@Override public Node visit(SqlLiteral literal) { return node(literal.toString()); }
A visitor that converts a SqlNode tree to a graphviz node.
visit
java
linkedin/coral
coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
https://github.com/linkedin/coral/blob/master/coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
BSD-2-Clause
@Override public Node visit(SqlCall call) { if (call instanceof SqlSelect) { SqlSelect sqlSelect = (SqlSelect) call; List<LinkTarget> edges = new ArrayList<>(); if (sqlSelect.getFrom() != null) { edges.add(edge(sqlSelect.getFrom(), "from")); } if (sqlSelect.getWhere() != null...
A visitor that converts a SqlNode tree to a graphviz node.
visit
java
linkedin/coral
coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
https://github.com/linkedin/coral/blob/master/coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
BSD-2-Clause
@Override public Node visit(SqlNodeList nodeList) { List<LinkTarget> edges = new ArrayList<>(); int i = 0; for (SqlNode node : nodeList.getList()) { edges.add(edge(node, "list_item_" + i++)); } return node("LIST").link(edges.toArray(new LinkTarget[0])); }
A visitor that converts a SqlNode tree to a graphviz node.
visit
java
linkedin/coral
coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
https://github.com/linkedin/coral/blob/master/coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
BSD-2-Clause
@Override public Node visit(SqlIdentifier id) { return node(id.toString()); }
A visitor that converts a SqlNode tree to a graphviz node.
visit
java
linkedin/coral
coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
https://github.com/linkedin/coral/blob/master/coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
BSD-2-Clause
@Override public Node visit(SqlDataTypeSpec type) { return node("TBD"); }
A visitor that converts a SqlNode tree to a graphviz node.
visit
java
linkedin/coral
coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
https://github.com/linkedin/coral/blob/master/coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
BSD-2-Clause
@Override public Node visit(SqlDynamicParam param) { return node("TBD"); }
A visitor that converts a SqlNode tree to a graphviz node.
visit
java
linkedin/coral
coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
https://github.com/linkedin/coral/blob/master/coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
BSD-2-Clause
@Override public Node visit(SqlIntervalQualifier intervalQualifier) { return node("TBD"); }
A visitor that converts a SqlNode tree to a graphviz node.
visit
java
linkedin/coral
coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
https://github.com/linkedin/coral/blob/master/coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
BSD-2-Clause
private Link edge(SqlNode target, String label) { return to(target.accept(this)).with(Label.of(label)); }
A visitor that converts a SqlNode tree to a graphviz node.
edge
java
linkedin/coral
coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
https://github.com/linkedin/coral/blob/master/coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
BSD-2-Clause
private static Node node(String label) { return Factory.node(UUID.randomUUID().toString()).with(Label.of(label)); }
A visitor that converts a SqlNode tree to a graphviz node.
node
java
linkedin/coral
coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
https://github.com/linkedin/coral/blob/master/coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
BSD-2-Clause
private static SqlNodeList createSelectStarSqlNodeList() { Collection<SqlNode> sqlNodeList = new ArrayList(); sqlNodeList.add(createStarIdentifier(SqlParserPos.ZERO)); SqlNodeList selectStar = createSqlNodeList(sqlNodeList); return selectStar; }
A visitor that converts a SqlNode tree to a graphviz node.
createSelectStarSqlNodeList
java
linkedin/coral
coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
https://github.com/linkedin/coral/blob/master/coral-visualization/src/main/java/com/linkedin/coral/vis/SqlNodeVisualizationVisitor.java
BSD-2-Clause
public static VisualizationUtil create(File outputDirectory) { return new VisualizationUtil(outputDirectory); }
Create a visualization util. @param outputDirectory directory to write the visualization files to. @return a visualization util.
create
java
linkedin/coral
coral-visualization/src/main/java/com/linkedin/coral/vis/VisualizationUtil.java
https://github.com/linkedin/coral/blob/master/coral-visualization/src/main/java/com/linkedin/coral/vis/VisualizationUtil.java
BSD-2-Clause
public void visualizeSqlNodeToFile(SqlNode sqlNode, String fileName) { SqlVisitor<Node> sqlVisitor = new SqlNodeVisualizationVisitor(); Node node = sqlNode.accept(sqlVisitor); Graph graph = Factory.graph("SqlNode").directed().nodeAttr().with(Font.name("Courier"), Font.size(10)).linkAttr() .with(Font...
Visualize the coral sql node to a file. @param sqlNode root of the SqlNode tree to visualize. @param fileName name of the file to write the visualization to.
visualizeSqlNodeToFile
java
linkedin/coral
coral-visualization/src/main/java/com/linkedin/coral/vis/VisualizationUtil.java
https://github.com/linkedin/coral/blob/master/coral-visualization/src/main/java/com/linkedin/coral/vis/VisualizationUtil.java
BSD-2-Clause
public void visualizeRelNodeToFile(RelNode relNode, String fileName) { RelNodeVisualizationShuttle relNodeVisualizationShuttle = new RelNodeVisualizationShuttle(); relNode.accept(relNodeVisualizationShuttle); Node node = relNodeVisualizationShuttle.getNode(relNode); Graph graph = Factory.graph("...
Visualize a RelNode to a file. @param relNode root of the RelNode tree to visualize. @param fileName name of the file to write the visualization to.
visualizeRelNodeToFile
java
linkedin/coral
coral-visualization/src/main/java/com/linkedin/coral/vis/VisualizationUtil.java
https://github.com/linkedin/coral/blob/master/coral-visualization/src/main/java/com/linkedin/coral/vis/VisualizationUtil.java
BSD-2-Clause
private String[] getProxyImports() { List<String> result = new ArrayList<String>(); result.add(AutoProxyRegistrar.class.getName()); result.add(JetCacheProxyConfiguration.class.getName()); return result.toArray(new String[result.size()]); }
Return the imports to use if the {@link AdviceMode} is set to {@link AdviceMode#PROXY}. <p>Take care of adding the necessary JSR-107 import if it is available.
getProxyImports
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/config/ConfigSelector.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/config/ConfigSelector.java
Apache-2.0
@Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { super.setBeanFactory(beanFactory); if (!(beanFactory instanceof ConfigurableListableBeanFactory)) { throw new IllegalArgumentException( "AutowiredAnnotationBeanPostProcessor requires...
Created on 2016/12/9. @author huangli @see org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor
setBeanFactory
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
Apache-2.0
public PropertyValues postProcessPropertyValues( PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws BeanCreationException { return postProcessProperties(pvs, bean, beanName); }
Created on 2016/12/9. @author huangli @see org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor
postProcessPropertyValues
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
Apache-2.0
@SuppressWarnings("AliMissingOverrideAnnotation") public PropertyValues postProcessProperties(PropertyValues pvs, Object bean, String beanName) { InjectionMetadata metadata = findAutowiringMetadata(beanName, bean.getClass(), pvs); try { metadata.inject(bean, beanName, pvs); } cat...
Created on 2016/12/9. @author huangli @see org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor
postProcessProperties
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
Apache-2.0
private InjectionMetadata findAutowiringMetadata(String beanName, Class<?> clazz, PropertyValues pvs) { // Fall back to class name as cache key, for backwards compatibility with custom callers. String cacheKey = (StringUtils.hasLength(beanName) ? beanName : clazz.getName()); // Quick check on th...
Created on 2016/12/9. @author huangli @see org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor
findAutowiringMetadata
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
Apache-2.0
private void clear(InjectionMetadata obj, PropertyValues param) { if(!clearInited){ try { cleanMethod = InjectionMetadata.class.getMethod("clear", PropertyValues.class); } catch (NoSuchMethodException e) { } clearInited = true; } if...
clear method not found in Spring 4.0. @param obj @param param
clear
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
Apache-2.0
private InjectionMetadata buildAutowiringMetadata(final Class<?> clazz) { LinkedList<InjectionMetadata.InjectedElement> elements = new LinkedList<InjectionMetadata.InjectedElement>(); Class<?> targetClass = clazz; do { final LinkedList<InjectionMetadata.InjectedElement> currElements...
clear method not found in Spring 4.0. @param obj @param param
buildAutowiringMetadata
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
Apache-2.0
@Override public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException { CreateCache ann = field.getAnnotation(CreateCache.class); if (ann != null) { if (Modifier.isStatic(field.getModifiers())) { ...
clear method not found in Spring 4.0. @param obj @param param
doWith
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
Apache-2.0
private void doWithLocalFields(Class clazz, ReflectionUtils.FieldCallback fieldCallback) { Field fs[] = clazz.getDeclaredFields(); for (Field field : fs) { try { fieldCallback.doWith(field); } catch (IllegalAccessException ex) { throw new IllegalSt...
clear method not found in Spring 4.0. @param obj @param param
doWithLocalFields
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
Apache-2.0
@Override protected void inject(Object bean, String beanName, PropertyValues pvs) throws Throwable { beanFactory.registerDependentBean(beanName, "globalCacheConfig"); CreateCacheWrapper wrapper = new CreateCacheWrapper(beanFactory, ann, field); field.setAccessible(true); ...
clear method not found in Spring 4.0. @param obj @param param
inject
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/field/CreateCacheAnnotationBeanPostProcessor.java
Apache-2.0
public static <T> T enableCache(Supplier<T> callback) { CacheThreadLocal var = cacheThreadLocal.get(); try { var.setEnabledCount(var.getEnabledCount() + 1); return callback.get(); } finally { var.setEnabledCount(var.getEnabledCount() - 1); } }
Enable cache in current thread, for @Cached(enabled=false). @param callback @see EnableCache
enableCache
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/CacheContext.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/CacheContext.java
Apache-2.0
protected static void enable() { CacheThreadLocal var = cacheThreadLocal.get(); var.setEnabledCount(var.getEnabledCount() + 1); }
Enable cache in current thread, for @Cached(enabled=false). @param callback @see EnableCache
enable
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/CacheContext.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/CacheContext.java
Apache-2.0
protected static void disable() { CacheThreadLocal var = cacheThreadLocal.get(); var.setEnabledCount(var.getEnabledCount() - 1); }
Enable cache in current thread, for @Cached(enabled=false). @param callback @see EnableCache
disable
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/CacheContext.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/CacheContext.java
Apache-2.0
protected static boolean isEnabled() { return cacheThreadLocal.get().getEnabledCount() > 0; }
Enable cache in current thread, for @Cached(enabled=false). @param callback @see EnableCache
isEnabled
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/CacheContext.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/CacheContext.java
Apache-2.0
public Function<Object, byte[]> parseValueEncoder(String valueEncoder) { return encoderParser.parseEncoder(valueEncoder); }
Keep this method for backward compatibility. NOTICE: there is no getter for encoderParser.
parseValueEncoder
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/ConfigProvider.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/ConfigProvider.java
Apache-2.0
public Function<byte[], Object> parseValueDecoder(String valueDecoder) { return encoderParser.parseDecoder(valueDecoder); }
Keep this method for backward compatibility. NOTICE: there is no getter for encoderParser.
parseValueDecoder
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/ConfigProvider.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/ConfigProvider.java
Apache-2.0
public Function<Object, Object> parseKeyConvertor(String convertor) { return keyConvertorParser.parseKeyConvertor(convertor); }
Keep this method for backward compatibility. NOTICE: there is no getter for keyConvertorParser.
parseKeyConvertor
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/ConfigProvider.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/ConfigProvider.java
Apache-2.0
public CacheNameGenerator createCacheNameGenerator(String[] hiddenPackages) { return new DefaultCacheNameGenerator(hiddenPackages); }
Keep this method for backward compatibility. NOTICE: there is no getter for keyConvertorParser.
createCacheNameGenerator
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/ConfigProvider.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/ConfigProvider.java
Apache-2.0
public CacheContext newContext(CacheManager cacheManager) { return new CacheContext(cacheManager, this, globalCacheConfig); }
Keep this method for backward compatibility. NOTICE: there is no getter for keyConvertorParser.
newContext
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/ConfigProvider.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/ConfigProvider.java
Apache-2.0
public void setEncoderParser(EncoderParser encoderParser) { this.encoderParser = encoderParser; }
Keep this method for backward compatibility. NOTICE: there is no getter for keyConvertorParser.
setEncoderParser
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/ConfigProvider.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/ConfigProvider.java
Apache-2.0
public void setKeyConvertorParser(KeyConvertorParser keyConvertorParser) { this.keyConvertorParser = keyConvertorParser; }
Keep this method for backward compatibility. NOTICE: there is no getter for keyConvertorParser.
setKeyConvertorParser
java
alibaba/jetcache
jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/ConfigProvider.java
https://github.com/alibaba/jetcache/blob/master/jetcache-anno/src/main/java/com/alicp/jetcache/anno/support/ConfigProvider.java
Apache-2.0