Return-Path: X-Original-To: apmail-tajo-commits-archive@minotaur.apache.org Delivered-To: apmail-tajo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 171AE1809C for ; Tue, 4 Aug 2015 01:31:27 +0000 (UTC) Received: (qmail 24806 invoked by uid 500); 4 Aug 2015 01:31:27 -0000 Delivered-To: apmail-tajo-commits-archive@tajo.apache.org Received: (qmail 24755 invoked by uid 500); 4 Aug 2015 01:31:26 -0000 Mailing-List: contact commits-help@tajo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tajo.apache.org Delivered-To: mailing list commits@tajo.apache.org Received: (qmail 24745 invoked by uid 99); 4 Aug 2015 01:31:26 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Aug 2015 01:31:26 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C26DFE0922; Tue, 4 Aug 2015 01:31:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: hyunsik@apache.org To: commits@tajo.apache.org Date: Tue, 04 Aug 2015 01:31:26 -0000 Message-Id: <9eb79d91b57c46a4bd60c04b655b965f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/4] tajo git commit: TAJO-1699: Tajo Java Client version 2. Repository: tajo Updated Branches: refs/heads/master d8ce56263 -> 4253f1b60 http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-core/src/test/java/org/apache/tajo/engine/function/TestStringOperatorsAndFunctions.java ---------------------------------------------------------------------- diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/function/TestStringOperatorsAndFunctions.java b/tajo-core/src/test/java/org/apache/tajo/engine/function/TestStringOperatorsAndFunctions.java index 7f402a1..366d8ed 100644 --- a/tajo-core/src/test/java/org/apache/tajo/engine/function/TestStringOperatorsAndFunctions.java +++ b/tajo-core/src/test/java/org/apache/tajo/engine/function/TestStringOperatorsAndFunctions.java @@ -22,16 +22,15 @@ package org.apache.tajo.engine.function; import org.apache.commons.lang.StringEscapeUtils; import org.apache.tajo.catalog.Schema; import org.apache.tajo.engine.eval.ExprTestBase; +import org.apache.tajo.exception.TajoException; import org.junit.Test; -import java.io.IOException; - import static org.apache.tajo.common.TajoDataTypes.Type.*; public class TestStringOperatorsAndFunctions extends ExprTestBase { @Test - public void testConcatenateOnLiteral() throws IOException { + public void testConcatenateOnLiteral() throws TajoException { testSimpleEval("select ('abc' || 'def') col1 ", new String[]{"abcdef"}); testSimpleEval("select 'abc' || 'def' as col1 ", new String[]{"abcdef"}); testSimpleEval("select 1 || 'def' as col1 ", new String[]{"1def"}); @@ -39,7 +38,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testConcatenateOnExpressions() throws IOException { + public void testConcatenateOnExpressions() throws TajoException { Schema schema = new Schema(); schema.addColumn("col1", TEXT); schema.addColumn("col2", INT4); @@ -52,7 +51,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testFunctionCallIngoreCases() throws IOException { + public void testFunctionCallIngoreCases() throws TajoException { testSimpleEval("select ltrim(' trim') ", new String[]{"trim"}); testSimpleEval("select LTRIM(' trim') ", new String[]{"trim"}); testSimpleEval("select lTRim(' trim') ", new String[]{"trim"}); @@ -60,7 +59,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testLTrim() throws IOException { + public void testLTrim() throws TajoException { Schema schema = new Schema(); schema.addColumn("col1", TEXT); schema.addColumn("col2", TEXT); @@ -81,7 +80,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testRTrim() throws IOException { + public void testRTrim() throws TajoException { Schema schema = new Schema(); schema.addColumn("col1", TEXT); schema.addColumn("col2", TEXT); @@ -102,7 +101,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testTrim() throws IOException { + public void testTrim() throws TajoException { Schema schema = new Schema(); schema.addColumn("col1", TEXT); schema.addColumn("col2", TEXT); @@ -123,7 +122,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testRegexReplace() throws IOException { + public void testRegexReplace() throws TajoException { testSimpleEval("select regexp_replace('abcdef','bc','--') as col1 ", new String[]{"a--def"}); // null test @@ -148,7 +147,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testLeft() throws IOException { + public void testLeft() throws TajoException { testSimpleEval("select left('abcdef',1) as col1 ", new String[]{"a"}); testSimpleEval("select left('abcdef',2) as col1 ", new String[]{"ab"}); testSimpleEval("select left('abcdef',3) as col1 ", new String[]{"abc"}); @@ -177,7 +176,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testRight() throws IOException { + public void testRight() throws TajoException { testSimpleEval("select right('abcdef',1) as col1 ", new String[]{"f"}); testSimpleEval("select right('abcdef',2) as col1 ", new String[]{"ef"}); testSimpleEval("select right('abcdef',3) as col1 ", new String[]{"def"}); @@ -206,7 +205,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testReverse() throws IOException { + public void testReverse() throws TajoException { testSimpleEval("select reverse('abcdef') as col1 ", new String[]{"fedcba"}); testSimpleEval("select reverse('가') as col1 ", new String[]{"가"}); @@ -219,7 +218,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testRepeat() throws IOException { + public void testRepeat() throws TajoException { testSimpleEval("select repeat('ab',4) as col1 ", new String[]{"abababab"}); testSimpleEval("select repeat('가',3) as col1 ", new String[]{"가가가"}); testSimpleEval("select repeat('a',2) as col1 ", new String[]{"aa"}); @@ -233,7 +232,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { @Test - public void testUpper() throws IOException { + public void testUpper() throws TajoException { testSimpleEval("select upper('abcdef') as col1 ", new String[]{"ABCDEF"}); Schema schema = new Schema(); @@ -246,7 +245,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testLower() throws IOException { + public void testLower() throws TajoException { testSimpleEval("select lower('ABCdEF') as col1 ", new String[]{"abcdef"}); Schema schema = new Schema(); @@ -259,7 +258,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testCharLength() throws IOException { + public void testCharLength() throws TajoException { testSimpleEval("select char_length('123456') as col1 ", new String[]{"6"}); Schema schema = new Schema(); @@ -271,7 +270,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testLength() throws IOException { + public void testLength() throws TajoException { testSimpleEval("select length('123456') as col1 ", new String[]{"6"}); Schema schema = new Schema(); @@ -283,7 +282,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testMd5() throws IOException { + public void testMd5() throws TajoException { testSimpleEval("select md5('1') as col1 ", new String[]{"c4ca4238a0b923820dcc509a6f75849b"}); testSimpleEval("select md5('tajo') as col1 ", new String[]{"742721b3a79f71a9491681b8e8a7ce85"}); @@ -296,7 +295,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testDigest() throws IOException { + public void testDigest() throws TajoException { testSimpleEval("select digest('tajo', 'md2') as col1 ", new String[]{"bf523bce8241982f6bea9af0f7fd37ff"}); testSimpleEval("select digest('tajo', 'md5') as col1 ", new String[]{"742721b3a79f71a9491681b8e8a7ce85"}); testSimpleEval("select digest('tajo', 'sha1') as col1 ", new String[]{"02b0e20540b89f0b735092bbac8093eb2e3804cf"}); @@ -310,7 +309,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testHex() throws IOException { + public void testHex() throws TajoException { testSimpleEval("select to_hex(1) as col1 ", new String[]{"1"}); testSimpleEval("select to_hex(10) as col1 ", new String[]{"a"}); testSimpleEval("select to_hex(1234) as col1 ", new String[]{"4d2"}); @@ -325,7 +324,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testBin() throws IOException { + public void testBin() throws TajoException { testSimpleEval("select to_bin(1) as col1 ", new String[]{"1"}); testSimpleEval("select to_bin(10) as col1 ", new String[]{"1010"}); testSimpleEval("select to_bin(1234) as col1 ", new String[]{"10011010010"}); @@ -339,7 +338,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testOctetLength() throws IOException { + public void testOctetLength() throws TajoException { testSimpleEval("select octet_length('123456') as col1 ", new String[]{"6"}); testSimpleEval("select octet_length('1') as col1 ", new String[]{"1"}); testSimpleEval("select octet_length('가') as col1 ", new String[]{"3"}); @@ -353,7 +352,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testSplitPart() throws IOException { + public void testSplitPart() throws TajoException { testSimpleEval("select split_part('1386577650.123', '.', 1) as col1 ", new String[]{"1386577650"}); testSimpleEval("select split_part('1386577650.123', '.', 2) as col1 ", new String[]{"123"}); // If part is larger than the number of string portions, it will returns NULL. @@ -372,7 +371,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testSubstr() throws IOException { + public void testSubstr() throws TajoException { testSimpleEval("select substr('abcdef', 3, 2) as col1 ", new String[]{"cd"}); testSimpleEval("select substr('abcdef', 3) as col1 ", new String[]{"cdef"}); testSimpleEval("select substr('abcdef', 1, 1) as col1 ", new String[]{"a"}); @@ -398,7 +397,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testLocate() throws IOException { + public void testLocate() throws TajoException { // normal case testSimpleEval("select locate('abcdef', 'a') as col1 ", new String[]{"1"}); testSimpleEval("select locate('abcdef', 'a', 0) as col1 ", new String[]{"1"}); @@ -447,7 +446,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testBitLength() throws IOException { + public void testBitLength() throws TajoException { testSimpleEval("select bit_length('123456') as col1 ", new String[]{"48"}); Schema schema = new Schema(); @@ -459,7 +458,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testStrpos() throws IOException { + public void testStrpos() throws TajoException { testSimpleEval("select strpos('tajo','jo') as col1 ", new String[]{"3"}); testSimpleEval("select strpos('tajo','') as col1 ", new String[]{"1"}); testSimpleEval("select strpos('tajo','abcdef') as col1 ", new String[]{"0"}); @@ -475,7 +474,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testStrposb() throws IOException { + public void testStrposb() throws TajoException { testSimpleEval("select strposb('tajo','jo') as col1 ", new String[]{"3"}); testSimpleEval("select strposb('tajo','') as col1 ", new String[]{"1"}); testSimpleEval("select strposb('tajo','abcdef') as col1 ", new String[]{"0"}); @@ -491,13 +490,13 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testInitcap() throws IOException { + public void testInitcap() throws TajoException { testSimpleEval("select initcap('hi bro') ", new String[]{"Hi Bro"}); testSimpleEval("select initcap('HI BRO') ", new String[]{"Hi Bro"}); } @Test - public void testAscii() throws IOException { + public void testAscii() throws TajoException { testSimpleEval("select ascii('abc') as col1 ", new String[]{"97"}); Schema schema = new Schema(); @@ -510,7 +509,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testChr() throws IOException { + public void testChr() throws TajoException { testSimpleEval("select chr(48) as col1 ", new String[]{"0"}); testSimpleEval("select chr(49) as col1 ", new String[]{"1"}); testSimpleEval("select chr(50) as col1 ", new String[]{"2"}); @@ -524,7 +523,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testLpad() throws IOException { + public void testLpad() throws TajoException { testSimpleEval("select lpad('hi', 5, 'xy') ", new String[]{"xyxhi"}); testSimpleEval("select LPAD('hello', 7, 'xy') ", new String[]{"xyhello"}); testSimpleEval("select LPAD('hello', 3, 'xy') ", new String[]{"hel"}); @@ -534,7 +533,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testRpad() throws IOException { + public void testRpad() throws TajoException { testSimpleEval("select rpad('hi', 5, 'xy') ", new String[]{"hixyx"}); testSimpleEval("select RPAD('hello', 7, 'xy') ", new String[]{"helloxy"}); testSimpleEval("select RPAD('hello', 3, 'xy') ", new String[]{"hel"}); @@ -544,13 +543,13 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testQuote_ident() throws IOException { + public void testQuote_ident() throws TajoException { testSimpleEval("select quote_ident('Foo bar') ", new String[]{"\"Foo bar\""}); testSimpleEval("select QUOTE_IDENT('Tajo Function') ", new String[]{"\"Tajo Function\""}); } @Test - public void testEncode() throws IOException { + public void testEncode() throws TajoException { testSimpleEval("select encode('Hello\nworld', 'base64') ", new String[]{"SGVsbG8Kd29ybGQ="}); testSimpleEval("select encode('Hello\nworld', 'hex') ", new String[]{"0x480x650x6c0x6c0x6f0x0a0x770x6f0x720x6c0x64"}); @@ -562,7 +561,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { @Test - public void testDecode() throws IOException { + public void testDecode() throws TajoException { testSimpleEval("select decode('SGVsbG8Kd29ybGQ=', 'base64') ", new String[]{StringEscapeUtils.escapeJava("Hello\nworld")}); testSimpleEval("select decode('0x480x650x6c0x6c0x6f0x0a0x770x6f0x720x6c0x64', 'hex') ", @@ -574,7 +573,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testFindInSet() throws IOException { + public void testFindInSet() throws TajoException { // abnormal cases testSimpleEval("select find_in_set('cr','crt') as col1 ", new String[]{"0"}); // there is no matched string testSimpleEval("select find_in_set('c,r','crt,c,cr,c,def') as col1 ", new String[]{"0"}); // abnormal parameter @@ -597,7 +596,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testConcat() throws IOException { + public void testConcat() throws TajoException { testSimpleEval("select concat('333', '22') ", new String[]{"33322"}); testSimpleEval("select concat('한글', '22') ", new String[]{"한글22"}); testSimpleEval("select concat(null, '22') ", new String[]{"22"}); @@ -606,7 +605,7 @@ public class TestStringOperatorsAndFunctions extends ExprTestBase { } @Test - public void testConcat_ws() throws IOException { + public void testConcat_ws() throws TajoException { testSimpleEval("select concat_ws(',', '333', '22') ", new String[]{"333,22"}); testSimpleEval("select concat_ws(',', '한글', '22') ", new String[]{"한글,22"}); testSimpleEval("select concat_ws(',', '22', null) ", new String[]{"22"}); http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-core/src/test/java/org/apache/tajo/engine/query/TestIndexScan.java ---------------------------------------------------------------------- diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestIndexScan.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestIndexScan.java index 75127d2..a255c6d 100644 --- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestIndexScan.java +++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestIndexScan.java @@ -23,6 +23,7 @@ import org.apache.tajo.IntegrationTest; import org.apache.tajo.QueryTestCaseBase; import org.apache.tajo.SessionVars; import org.apache.tajo.TajoConstants; +import org.apache.tajo.exception.NoSuchSessionVariableException; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -34,7 +35,7 @@ import java.util.Map; @Category(IntegrationTest.class) public class TestIndexScan extends QueryTestCaseBase { - public TestIndexScan() throws ServiceException, SQLException { + public TestIndexScan() throws ServiceException, SQLException, NoSuchSessionVariableException { super(TajoConstants.DEFAULT_DATABASE_NAME); Map sessionVars = new HashMap(); sessionVars.put(SessionVars.INDEX_ENABLED.keyname(), "true"); http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java ---------------------------------------------------------------------- diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java index 4ef5e9b..4fb2d31 100644 --- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java +++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java @@ -31,11 +31,13 @@ import org.apache.tajo.catalog.Column; import org.apache.tajo.catalog.Schema; import org.apache.tajo.catalog.TableDesc; import org.apache.tajo.catalog.TableMeta; +import org.apache.tajo.catalog.exception.UndefinedTableException; import org.apache.tajo.common.TajoDataTypes; import org.apache.tajo.conf.TajoConf.ConfVars; import org.apache.tajo.datum.Datum; import org.apache.tajo.datum.Int4Datum; import org.apache.tajo.datum.TextDatum; +import org.apache.tajo.exception.TajoException; import org.apache.tajo.storage.*; import org.apache.tajo.util.FileUtil; import org.apache.tajo.util.KeyValueSet; @@ -211,7 +213,7 @@ public class TestJoinQuery extends QueryTestCaseBase { Tuple createTuple(String[] columnDatas); } - private static String buildSchemaString(String tableName) throws ServiceException, SQLException { + private static String buildSchemaString(String tableName) throws TajoException { TableDesc desc = client.getTableDesc(tableName); StringBuffer sb = new StringBuffer(); for (Column column : desc.getSchema().getRootColumns()) { @@ -226,7 +228,7 @@ public class TestJoinQuery extends QueryTestCaseBase { return sb.toString(); } - private static String buildMultifileDDlString(String tableName) throws ServiceException, SQLException { + private static String buildMultifileDDlString(String tableName) throws TajoException { String multiTableName = tableName + "_multifile"; StringBuilder sb = new StringBuilder("create table ").append(multiTableName).append(" ("); sb.append(buildSchemaString(tableName)).append(" )"); http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-core/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java ---------------------------------------------------------------------- diff --git a/tajo-core/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java b/tajo-core/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java index 1adad41..acbc1a8 100644 --- a/tajo-core/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java +++ b/tajo-core/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java @@ -401,96 +401,6 @@ public class TestTajoJdbc extends QueryTestCaseBase { } @Test - public void testSetStatement() throws Exception { - assertTrue(TajoStatement.isSetVariableQuery("Set JOIN_TASK_INPUT_SIZE 123")); - assertTrue(TajoStatement.isSetVariableQuery("SET JOIN_TASK_INPUT_SIZE 123")); - assertFalse(TajoStatement.isSetVariableQuery("--SET JOIN_TASK_INPUT_SIZE 123")); - - String connUri = buildConnectionUri(tajoMasterAddress.getHostName(), tajoMasterAddress.getPort(), - DEFAULT_DATABASE_NAME); - - Connection conn = DriverManager.getConnection(connUri); - - Statement stmt = null; - ResultSet res = null; - try { - stmt = conn.createStatement(); - res = stmt.executeQuery("Set JOIN_TASK_INPUT_SIZE 123"); - assertFalse(res.next()); - ResultSetMetaData rsmd = res.getMetaData(); - assertNotNull(rsmd); - assertEquals(0, rsmd.getColumnCount()); - - QueryClient connTajoClient = ((JdbcConnection) stmt.getConnection()).getQueryClient(); - Map variables = connTajoClient.getAllSessionVariables(); - String value = variables.get("JOIN_TASK_INPUT_SIZE"); - assertNotNull(value); - assertEquals("123", value); - - res.close(); - - res = stmt.executeQuery("unset JOIN_TASK_INPUT_SIZE"); - variables = connTajoClient.getAllSessionVariables(); - value = variables.get("JOIN_TASK_INPUT_SIZE"); - assertNull(value); - } finally { - if (res != null) { - res.close(); - } - if (stmt != null) { - stmt.close(); - } - if (conn != null) { - conn.close(); - } - } - } - - @Test - public void testSetPreparedStatement() throws Exception { - String connUri = buildConnectionUri(tajoMasterAddress.getHostName(), tajoMasterAddress.getPort(), - DEFAULT_DATABASE_NAME); - - Connection conn = DriverManager.getConnection(connUri); - - PreparedStatement stmt = null; - ResultSet res = null; - try { - stmt = conn.prepareStatement("Set JOIN_TASK_INPUT_SIZE 123"); - res = stmt.executeQuery(); - assertFalse(res.next()); - ResultSetMetaData rsmd = res.getMetaData(); - assertNotNull(rsmd); - assertEquals(0, rsmd.getColumnCount()); - - QueryClient connTajoClient = ((JdbcConnection) stmt.getConnection()).getQueryClient(); - Map variables = connTajoClient.getAllSessionVariables(); - String value = variables.get("JOIN_TASK_INPUT_SIZE"); - assertNotNull(value); - assertEquals("123", value); - - res.close(); - stmt.close(); - - stmt = conn.prepareStatement("unset JOIN_TASK_INPUT_SIZE"); - res = stmt.executeQuery(); - variables = connTajoClient.getAllSessionVariables(); - value = variables.get("JOIN_TASK_INPUT_SIZE"); - assertNull(value); - } finally { - if (res != null) { - res.close(); - } - if (stmt != null) { - stmt.close(); - } - if (conn != null) { - conn.close(); - } - } - } - - @Test public void testCreateTableWithDateAndTimestamp() throws Exception { String tableName = CatalogUtil.normalizeIdentifier("testCreateTableWithDateAndTimestamp"); http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryAsync.result ---------------------------------------------------------------------- diff --git a/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryAsync.result b/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryAsync.result new file mode 100644 index 0000000..ec6b911 --- /dev/null +++ b/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryAsync.result @@ -0,0 +1,7 @@ +l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment +------------------------------- +1,1,7706,1,17.0,21168.23,0.04,0.02,N,O,1996-03-13,1996-02-12,1996-03-22,DELIVER IN PERSON,TRUCK,egular courts above the +1,1,7311,2,36.0,45983.16,0.09,0.06,N,O,1996-04-12,1996-02-28,1996-04-20,TAKE BACK RETURN,MAIL,ly final dependencies: slyly bold +2,2,1191,1,38.0,44694.46,0.0,0.05,N,O,1997-01-28,1997-01-14,1997-02-02,TAKE BACK RETURN,RAIL,ven requests. deposits breach a +3,2,1798,1,45.0,54058.05,0.06,0.0,R,F,1994-02-02,1994-01-04,1994-02-23,NONE,AIR,ongside of the furiously brave acco +3,3,6540,2,49.0,46796.47,0.1,0.0,R,F,1993-11-09,1993-12-20,1993-11-24,TAKE BACK RETURN,RAIL, unusual accounts. eve \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryAsyncWithListener.result ---------------------------------------------------------------------- diff --git a/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryAsyncWithListener.result b/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryAsyncWithListener.result new file mode 100644 index 0000000..7a51ca3 --- /dev/null +++ b/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryAsyncWithListener.result @@ -0,0 +1,2 @@ +l_orderkey,?sleep +------------------------------- \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryType1.result ---------------------------------------------------------------------- diff --git a/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryType1.result b/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryType1.result new file mode 100644 index 0000000..ec6b911 --- /dev/null +++ b/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryType1.result @@ -0,0 +1,7 @@ +l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment +------------------------------- +1,1,7706,1,17.0,21168.23,0.04,0.02,N,O,1996-03-13,1996-02-12,1996-03-22,DELIVER IN PERSON,TRUCK,egular courts above the +1,1,7311,2,36.0,45983.16,0.09,0.06,N,O,1996-04-12,1996-02-28,1996-04-20,TAKE BACK RETURN,MAIL,ly final dependencies: slyly bold +2,2,1191,1,38.0,44694.46,0.0,0.05,N,O,1997-01-28,1997-01-14,1997-02-02,TAKE BACK RETURN,RAIL,ven requests. deposits breach a +3,2,1798,1,45.0,54058.05,0.06,0.0,R,F,1994-02-02,1994-01-04,1994-02-23,NONE,AIR,ongside of the furiously brave acco +3,3,6540,2,49.0,46796.47,0.1,0.0,R,F,1993-11-09,1993-12-20,1993-11-24,TAKE BACK RETURN,RAIL, unusual accounts. eve \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryType2.result ---------------------------------------------------------------------- diff --git a/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryType2.result b/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryType2.result new file mode 100644 index 0000000..fd79944 --- /dev/null +++ b/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryType2.result @@ -0,0 +1,4 @@ +l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment +------------------------------- +3,2,1798,1,45.0,54058.05,0.06,0.0,R,F,1994-02-02,1994-01-04,1994-02-23,NONE,AIR,ongside of the furiously brave acco +3,3,6540,2,49.0,46796.47,0.1,0.0,R,F,1993-11-09,1993-12-20,1993-11-24,TAKE BACK RETURN,RAIL, unusual accounts. eve \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryType3.result ---------------------------------------------------------------------- diff --git a/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryType3.result b/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryType3.result new file mode 100644 index 0000000..5407d9d --- /dev/null +++ b/tajo-core/src/test/resources/results/TestTajoClientV2/testExecuteQueryType3.result @@ -0,0 +1,4 @@ +table_name +------------------------------- +t1 +t2 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/JdbcConnection.java ---------------------------------------------------------------------- diff --git a/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/JdbcConnection.java b/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/JdbcConnection.java index 6db1447..b098b16 100644 --- a/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/JdbcConnection.java +++ b/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/JdbcConnection.java @@ -28,6 +28,8 @@ import org.apache.tajo.client.QueryClient; import org.apache.tajo.client.TajoClient; import org.apache.tajo.client.TajoClientImpl; import org.apache.tajo.conf.TajoConf; +import org.apache.tajo.exception.SQLExceptionUtil; +import org.apache.tajo.exception.TajoException; import org.apache.tajo.jdbc.util.QueryStringDecoder; import org.apache.tajo.rpc.RpcUtils; import org.apache.tajo.util.KeyValueSet; @@ -267,14 +269,18 @@ public class JdbcConnection implements Connection { @Override public boolean isValid(int timeout) throws SQLException { - if (tajoClient.isConnected()) { - ResultSet resultSet = tajoClient.executeQueryAndGetResult("SELECT 1;"); - boolean next = resultSet.next(); - boolean valid = next && resultSet.getLong(1) == 1; - resultSet.close(); - return valid; - } else { - return false; + try { + if (tajoClient.isConnected()) { + ResultSet resultSet = tajoClient.executeQueryAndGetResult("SELECT 1;"); + boolean next = resultSet.next(); + boolean valid = next && resultSet.getLong(1) == 1; + resultSet.close(); + return valid; + } else { + return false; + } + } catch (TajoException e) { + throw SQLExceptionUtil.toSQLException(e); } } @@ -357,7 +363,11 @@ public class JdbcConnection implements Connection { @Override public void setCatalog(String catalog) throws SQLException { - tajoClient.selectDatabase(catalog); + try { + tajoClient.selectDatabase(catalog); + } catch (TajoException e) { + throw SQLExceptionUtil.toSQLException(e); + } } @Override http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/MetaDataTuple.java ---------------------------------------------------------------------- diff --git a/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/MetaDataTuple.java b/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/MetaDataTuple.java index fad285c..28b6b3c 100644 --- a/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/MetaDataTuple.java +++ b/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/MetaDataTuple.java @@ -23,6 +23,7 @@ import org.apache.tajo.datum.Datum; import org.apache.tajo.datum.IntervalDatum; import org.apache.tajo.datum.NullDatum; import org.apache.tajo.datum.ProtobufDatum; +import org.apache.tajo.exception.TajoRuntimeException; import org.apache.tajo.exception.UnsupportedException; import org.apache.tajo.storage.Tuple; import org.apache.tajo.util.datetime.TimeMeta; @@ -94,7 +95,7 @@ public class MetaDataTuple implements Tuple { @Override public void clearOffset() { - throw new UnsupportedException("clearOffset"); + throw new UnsupportedException(); } @Override @@ -104,12 +105,12 @@ public class MetaDataTuple implements Tuple { @Override public void setOffset(long offset) { - throw new UnsupportedException("setOffset"); + throw new UnsupportedException(); } @Override public long getOffset() { - throw new UnsupportedException("getOffset"); + throw new UnsupportedException(); } @Override @@ -129,7 +130,7 @@ public class MetaDataTuple implements Tuple { @Override public byte [] getBytes(int fieldId) { - throw new UnsupportedException("BlobDatum"); + throw new UnsupportedException(); } @Override @@ -174,12 +175,12 @@ public class MetaDataTuple implements Tuple { @Override public ProtobufDatum getProtobufDatum(int fieldId) { - throw new UnsupportedException("getProtobufDatum"); + throw new UnsupportedException(); } @Override public IntervalDatum getInterval(int fieldId) { - throw new UnsupportedException("getInterval"); + throw new UnsupportedException(); } @Override @@ -189,11 +190,11 @@ public class MetaDataTuple implements Tuple { @Override public Tuple clone() throws CloneNotSupportedException { - throw new UnsupportedException("clone"); + throw new UnsupportedException(); } @Override public Datum[] getValues(){ - throw new UnsupportedException("getValues"); + throw new UnsupportedException(); } } http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoStatement.java ---------------------------------------------------------------------- diff --git a/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoStatement.java b/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoStatement.java index 22a4817..5354e60 100644 --- a/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoStatement.java +++ b/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoStatement.java @@ -148,17 +148,9 @@ public class TajoStatement implements Statement { public ResultSet executeQuery(String sql) throws SQLException { checkConnection("Can't execute"); return executeSQL(sql); - } protected ResultSet executeSQL(String sql) throws SQLException { - if (isSetVariableQuery(sql)) { - return setSessionVariable(tajoClient, sql); - } - if (isUnSetVariableQuery(sql)) { - return unSetSessionVariable(tajoClient, sql); - } - ClientProtos.SubmitQueryResponse response = tajoClient.executeQuery(sql); SQLExceptionUtil.throwIfError(response.getState()); @@ -187,53 +179,6 @@ public class TajoStatement implements Statement { } } - public static boolean isSetVariableQuery(String sql) { - if (sql == null || sql.trim().isEmpty()) { - return false; - } - - return sql.trim().toLowerCase().startsWith("set"); - } - - public static boolean isUnSetVariableQuery(String sql) { - if (sql == null || sql.trim().isEmpty()) { - return false; - } - - return sql.trim().toLowerCase().startsWith("unset"); - } - - private ResultSet setSessionVariable(TajoClient client, String sql) throws SQLException { - int index = sql.toLowerCase().indexOf("set"); - if (index < 0) { - throw new SQLException("SET statement should be started 'SET' keyword: " + sql); - } - - String[] tokens = sql.substring(index + 3).trim().split(" "); - if (tokens.length != 2) { - throw new SQLException("SET statement should be : " + sql); - } - Map variable = new HashMap(); - variable.put(tokens[0].trim(), tokens[1].trim()); - client.updateSessionVariables(variable); - return NULL_RESULT_SET; - } - - private ResultSet unSetSessionVariable(TajoClient client, String sql) throws SQLException { - int index = sql.toLowerCase().indexOf("unset"); - if (index < 0) { - throw new SQLException("UNSET statement should be started 'UNSET' keyword: " + sql); - } - - String key = sql.substring(index + 5).trim(); - if (key.isEmpty()) { - throw new SQLException("UNSET statement should be : " + sql); - } - client.unsetSessionVariables(Lists.newArrayList(key)); - - return NULL_RESULT_SET; - } - @Override public int executeUpdate(String sql) throws SQLException { checkConnection("Can't execute update"); http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BasicEvalNodeVisitor.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BasicEvalNodeVisitor.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BasicEvalNodeVisitor.java index 81b0f8e..128cc7c 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BasicEvalNodeVisitor.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BasicEvalNodeVisitor.java @@ -18,6 +18,7 @@ package org.apache.tajo.plan.expr; +import org.apache.tajo.exception.TajoInternalError; import org.apache.tajo.exception.UnsupportedException; import java.util.Stack; http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-plan/src/main/java/org/apache/tajo/plan/expr/SimpleEvalNodeVisitor.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/SimpleEvalNodeVisitor.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/SimpleEvalNodeVisitor.java index e706391..61a25a9 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/SimpleEvalNodeVisitor.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/SimpleEvalNodeVisitor.java @@ -19,6 +19,7 @@ package org.apache.tajo.plan.expr; import com.google.common.base.Preconditions; +import org.apache.tajo.exception.TajoInternalError; import org.apache.tajo.exception.UnsupportedException; import java.util.Stack; @@ -76,7 +77,7 @@ public abstract class SimpleEvalNodeVisitor { break; default: - throw new UnsupportedException("Unknown EvalType: " + evalNode); + throw new TajoInternalError("Unknown EvalType: " + evalNode); } } http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/CSVLineSerializer.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/CSVLineSerializer.java b/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/CSVLineSerializer.java index 78404b0..77f0a03 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/CSVLineSerializer.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/CSVLineSerializer.java @@ -110,7 +110,6 @@ public class CSVLineSerializer extends TextLineSerializer { @Override public void release() { - } public static String getTypeString(Datum val) { http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/NameResolver.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/NameResolver.java b/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/NameResolver.java index 392d308..a6f3d35 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/NameResolver.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/NameResolver.java @@ -149,7 +149,9 @@ public abstract class NameResolver { * @throws PlanningException */ static Column resolveFromRelsWithinBlock(LogicalPlan plan, LogicalPlan.QueryBlock block, - ColumnReferenceExpr columnRef) throws AmbiguousColumnException { + ColumnReferenceExpr columnRef) + throws AmbiguousColumnException, AmbiguousTableException, UndefinedColumnException, UndefinedTableException { + String qualifier; String canonicalName; @@ -306,7 +308,7 @@ public abstract class NameResolver { */ static Pair lookupQualifierAndCanonicalName(LogicalPlan.QueryBlock block, ColumnReferenceExpr columnRef) - throws AmbiguousColumnException { + throws AmbiguousColumnException, AmbiguousTableException, UndefinedColumnException { Preconditions.checkArgument(columnRef.hasQualifier(), "ColumnReferenceExpr must be qualified."); http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverByLegacy.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverByLegacy.java b/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverByLegacy.java index aa0d7f5..3bbb2be 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverByLegacy.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverByLegacy.java @@ -99,7 +99,8 @@ public class ResolverByLegacy extends NameResolver { } static Column resolveColumnWithoutQualifier(LogicalPlan plan, LogicalPlan.QueryBlock block, - ColumnReferenceExpr columnRef) throws AmbiguousColumnException { + ColumnReferenceExpr columnRef) + throws AmbiguousColumnException, UndefinedColumnException { Column found = lookupColumnFromAllRelsInBlock(block, columnRef.getName()); if (found != null) { http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverByRels.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverByRels.java b/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverByRels.java index fa9fe84..aee131b 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverByRels.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverByRels.java @@ -20,7 +20,9 @@ package org.apache.tajo.plan.nameresolver; import org.apache.tajo.algebra.ColumnReferenceExpr; import org.apache.tajo.catalog.Column; +import org.apache.tajo.catalog.exception.AmbiguousTableException; import org.apache.tajo.catalog.exception.UndefinedColumnException; +import org.apache.tajo.catalog.exception.UndefinedTableException; import org.apache.tajo.exception.AmbiguousColumnException; import org.apache.tajo.plan.LogicalPlan; import org.apache.tajo.plan.PlanningException; @@ -28,7 +30,7 @@ import org.apache.tajo.plan.PlanningException; public class ResolverByRels extends NameResolver { @Override public Column resolve(LogicalPlan plan, LogicalPlan.QueryBlock block, ColumnReferenceExpr columnRef) - throws AmbiguousColumnException { + throws AmbiguousColumnException, AmbiguousTableException, UndefinedColumnException, UndefinedTableException { Column column = resolveFromRelsWithinBlock(plan, block, columnRef); if (column == null) { http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverByRelsAndSubExprs.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverByRelsAndSubExprs.java b/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverByRelsAndSubExprs.java index cafba7d..560ae50 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverByRelsAndSubExprs.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverByRelsAndSubExprs.java @@ -20,7 +20,9 @@ package org.apache.tajo.plan.nameresolver; import org.apache.tajo.algebra.ColumnReferenceExpr; import org.apache.tajo.catalog.Column; +import org.apache.tajo.catalog.exception.AmbiguousTableException; import org.apache.tajo.catalog.exception.UndefinedColumnException; +import org.apache.tajo.catalog.exception.UndefinedTableException; import org.apache.tajo.exception.AmbiguousColumnException; import org.apache.tajo.plan.LogicalPlan; import org.apache.tajo.plan.PlanningException; @@ -28,7 +30,7 @@ import org.apache.tajo.plan.PlanningException; public class ResolverByRelsAndSubExprs extends NameResolver { @Override public Column resolve(LogicalPlan plan, LogicalPlan.QueryBlock block, ColumnReferenceExpr columnRef) - throws AmbiguousColumnException { + throws AmbiguousColumnException, AmbiguousTableException, UndefinedColumnException, UndefinedTableException { Column column = resolveFromRelsWithinBlock(plan, block, columnRef); if (column == null) { http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverBySubExprsAndRels.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverBySubExprsAndRels.java b/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverBySubExprsAndRels.java index c16bbe2..39458ec 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverBySubExprsAndRels.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/ResolverBySubExprsAndRels.java @@ -20,7 +20,9 @@ package org.apache.tajo.plan.nameresolver; import org.apache.tajo.algebra.ColumnReferenceExpr; import org.apache.tajo.catalog.Column; +import org.apache.tajo.catalog.exception.AmbiguousTableException; import org.apache.tajo.catalog.exception.UndefinedColumnException; +import org.apache.tajo.catalog.exception.UndefinedTableException; import org.apache.tajo.exception.AmbiguousColumnException; import org.apache.tajo.plan.LogicalPlan; import org.apache.tajo.plan.PlanningException; @@ -28,7 +30,7 @@ import org.apache.tajo.plan.PlanningException; public class ResolverBySubExprsAndRels extends NameResolver { @Override public Column resolve(LogicalPlan plan, LogicalPlan.QueryBlock block, ColumnReferenceExpr columnRef) - throws AmbiguousColumnException{ + throws AmbiguousColumnException, AmbiguousTableException, UndefinedColumnException, UndefinedTableException { Column column = resolveFromCurrentAndChildNode(block, columnRef); if (column == null) { http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/ProjectionPushDownRule.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/ProjectionPushDownRule.java b/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/ProjectionPushDownRule.java index 78a5dad..18e001e 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/ProjectionPushDownRule.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/ProjectionPushDownRule.java @@ -21,7 +21,6 @@ package org.apache.tajo.plan.rewrite.rules; import com.google.common.collect.*; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.tajo.OverridableConf; import org.apache.tajo.annotation.Nullable; import org.apache.tajo.catalog.Column; import org.apache.tajo.catalog.Schema; @@ -197,7 +196,7 @@ public class ProjectionPushDownRule extends * Add an expression with a specified name, which is usually an alias. * Later, you can refer this expression by the specified name. */ - private String add(String specifiedName, EvalNode evalNode) { + private String add(String specifiedName, EvalNode evalNode) throws DuplicateColumnException { // if a name already exists, it only just keeps an actual // expression instead of a column reference. @@ -255,7 +254,7 @@ public class ProjectionPushDownRule extends * Adds an expression without any name. It returns an automatically * generated name. It can be also used for referring this expression. */ - public String add(EvalNode evalNode) { + public String add(EvalNode evalNode) throws DuplicateColumnException { String name; if (evalNode.getType() == EvalType.FIELD) { @@ -285,7 +284,7 @@ public class ProjectionPushDownRule extends return nameToIdBiMap.keySet(); } - public String add(Target target) { + public String add(Target target) throws DuplicateColumnException { return add(target.getCanonicalName(), target.getEvalTree()); } @@ -421,13 +420,13 @@ public class ProjectionPushDownRule extends targetListMgr = upperContext.targetListMgr; } - public String addExpr(Target target) { + public String addExpr(Target target) throws DuplicateColumnException { String reference = targetListMgr.add(target); addNecessaryReferences(target.getEvalTree()); return reference; } - public String addExpr(EvalNode evalNode) { + public String addExpr(EvalNode evalNode) throws DuplicateColumnException { String reference = targetListMgr.add(evalNode); addNecessaryReferences(evalNode); return reference; http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeDeserializer.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeDeserializer.java b/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeDeserializer.java index 05f95df..73a07d5 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeDeserializer.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeDeserializer.java @@ -33,6 +33,7 @@ import org.apache.tajo.catalog.proto.CatalogProtos.FunctionSignatureProto; import org.apache.tajo.common.TajoDataTypes.DataType; import org.apache.tajo.datum.*; import org.apache.tajo.exception.InternalException; +import org.apache.tajo.exception.TajoInternalError; import org.apache.tajo.plan.expr.*; import org.apache.tajo.plan.function.python.PythonScriptEngine; import org.apache.tajo.plan.logical.WindowSpec; @@ -237,10 +238,10 @@ public class EvalNodeDeserializer { parameterTypes = funcSignatureProto.getParameterTypesList().toArray( new DataType[funcSignatureProto.getParameterTypesCount()]); } - throw new UndefinedFunctionException(functionName, parameterTypes); + throw new TajoInternalError(new UndefinedFunctionException(functionName, parameterTypes)); } } else { - throw new RuntimeException("Unknown EvalType: " + type.name()); + throw new TajoInternalError("Unknown EvalType: " + type.name()); } evalNodeMap.put(protoNode.getId(), current); http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/VerificationState.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/VerificationState.java b/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/VerificationState.java index d20f8f9..fd16d11 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/VerificationState.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/VerificationState.java @@ -21,6 +21,7 @@ package org.apache.tajo.plan.verifier; import com.google.common.collect.Lists; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.tajo.exception.TajoError; import org.apache.tajo.exception.TajoException; import org.apache.tajo.exception.TajoExceptionInterface; import org.apache.tajo.exception.TajoRuntimeException; @@ -32,6 +33,11 @@ public class VerificationState { private static final Log LOG = LogFactory.getLog(VerificationState.class); List errorMessages = Lists.newArrayList(); + public void addVerification(TajoError error) { + LOG.warn(TUtil.getCurrentCodePoint(1) + " causes: " + error.getMessage()); + errorMessages.add(error); + } + public void addVerification(TajoException error) { LOG.warn(TUtil.getCurrentCodePoint(1) + " causes: " + error.getMessage()); errorMessages.add(error); http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/NullScanner.java ---------------------------------------------------------------------- diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/NullScanner.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/NullScanner.java index 83d8e24..46b1726 100644 --- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/NullScanner.java +++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/NullScanner.java @@ -1,4 +1,4 @@ -package org.apache.tajo.storage; /** +/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -16,6 +16,8 @@ package org.apache.tajo.storage; /** * limitations under the License. */ +package org.apache.tajo.storage; + import org.apache.hadoop.conf.Configuration; import org.apache.tajo.catalog.Column; import org.apache.tajo.catalog.Schema; http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/RowStoreUtil.java ---------------------------------------------------------------------- diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/RowStoreUtil.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/RowStoreUtil.java index 51cedb2..bfe4e55 100644 --- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/RowStoreUtil.java +++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/RowStoreUtil.java @@ -381,7 +381,7 @@ public class RowStoreUtil { writer.skipField(); break; default: - throw new UnsupportedException("Unknown data type: " + writer.dataTypes()[i]); + throw new UnsupportedException("data type " + writer.dataTypes()[i]); } } writer.endRow(); http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java ---------------------------------------------------------------------- diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java index 4d7fac4..968601c 100644 --- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java +++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java @@ -107,8 +107,7 @@ public abstract class Tablespace { * @return Root URI */ public URI getRootUri() { - throw new UnsupportedException( - String.format("Tablespace '%s' does not allow the use of artibrary paths", uri.toString())); + throw new UnsupportedException(String.format("artibrary path '%s'", uri.toString())); } /** http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/tuple/offheap/HeapTuple.java ---------------------------------------------------------------------- diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/tuple/offheap/HeapTuple.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/tuple/offheap/HeapTuple.java index 8f36b35..97be316 100644 --- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/tuple/offheap/HeapTuple.java +++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/tuple/offheap/HeapTuple.java @@ -20,7 +20,6 @@ package org.apache.tajo.tuple.offheap; import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.Message; - import org.apache.tajo.common.TajoDataTypes; import org.apache.tajo.datum.*; import org.apache.tajo.exception.UnsupportedException; @@ -29,7 +28,6 @@ import org.apache.tajo.storage.VTuple; import org.apache.tajo.util.SizeOf; import org.apache.tajo.util.StringUtils; import org.apache.tajo.util.UnsafeUtil; - import org.apache.tajo.util.datetime.TimeMeta; import sun.misc.Unsafe; http://git-wip-us.apache.org/repos/asf/tajo/blob/4253f1b6/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/tuple/offheap/UnSafeTuple.java ---------------------------------------------------------------------- diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/tuple/offheap/UnSafeTuple.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/tuple/offheap/UnSafeTuple.java index fd427ca..167519b 100644 --- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/tuple/offheap/UnSafeTuple.java +++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/tuple/offheap/UnSafeTuple.java @@ -21,7 +21,6 @@ package org.apache.tajo.tuple.offheap; import com.google.common.base.Preconditions; import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.Message; - import org.apache.tajo.common.TajoDataTypes; import org.apache.tajo.datum.*; import org.apache.tajo.exception.UnsupportedException; @@ -30,7 +29,6 @@ import org.apache.tajo.storage.VTuple; import org.apache.tajo.util.SizeOf; import org.apache.tajo.util.StringUtils; import org.apache.tajo.util.UnsafeUtil; - import org.apache.tajo.util.datetime.TimeMeta; import sun.misc.Unsafe; import sun.nio.ch.DirectBuffer;