Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 84E69200B30 for ; Mon, 20 Jun 2016 05:41:58 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8389E160A65; Mon, 20 Jun 2016 03:41:58 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A0668160A53 for ; Mon, 20 Jun 2016 05:41:57 +0200 (CEST) Received: (qmail 68578 invoked by uid 500); 20 Jun 2016 03:41:56 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 68564 invoked by uid 99); 20 Jun 2016 03:41:55 -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; Mon, 20 Jun 2016 03:41:55 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BC27BE02A1; Mon, 20 Jun 2016 03:41:55 +0000 (UTC) From: daveoshinsky To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill issue #517: DRILL-4704 fix Content-Type: text/plain Message-Id: <20160620034155.BC27BE02A1@git1-us-west.apache.org> Date: Mon, 20 Jun 2016 03:41:55 +0000 (UTC) archived-at: Mon, 20 Jun 2016 03:41:58 -0000 Github user daveoshinsky commented on the issue: https://github.com/apache/drill/pull/517 In the mean time, I switched over to a Mac, where all 6 existing TestDecimal unit tests worked.  I added a new unit test testCastFromInt patterned after testCastFromFloat, with some code to print the query that it's sending to the DrillBit.  It's failing as shown below.  What did I do wrong? Query: {  "head" : {    "version" : 1,    "generator" : {      "type" : "org.apache.drill.exec.planner.logical.DrillImplementor",      "info" : ""    },    "type" : "APACHE_DRILL_PHYSICAL",    "resultMode" : "EXEC"  },  graph:[  {      @id:1,      pop:"fs-scan",      format: {type: "json"},      storage:{type: "file", connection: "classpath:///"},      files:["/input_simple_decimal.json"]  }, {    "pop" : "project",    "@id" : 2,    "exprs" : [ {      "ref" : "I4",      "expr" : " (cast(DEC9 as INTEGER)) "    },    { "ref" : "I8", "expr": "(cast(DEC18 as INTEGER))" }    ],     "child" : 1  },{    "pop" : "project",    "@id" : 4,    "exprs" : [ {      "ref" : "DECIMAL_9",      "expr" : " cast(I4 as decimal9(9, 0))  "    },    {"ref": "DECIMAL38", "expr" : "cast(I8 as decimal38sparse(38, 0))"}    ],     "child" : 2  },{    "pop" : "screen",    "@id" : 5,    "child" : 4  } ]} org.apache.drill.exec.rpc.RpcException: org.apache.drill.common.exceptions.UserRemoteException: SYSTEM ERROR: ExpressionParsingException: Expression has syntax error! line 1:15:no viable alternative at input 'INTEGER' [Error Id: a7d6acc9-70ee-4e6d-9002-90715b8de351 on 10.0.0.211:31010] at org.apache.drill.exec.rpc.RpcException.mapException(RpcException.java:60) at org.apache.drill.exec.client.DrillClient$ListHoldingResultsListener.getResults(DrillClient.java:479) at org.apache.drill.exec.client.DrillClient.runQuery(DrillClient.java:329) at org.apache.drill.exec.physical.impl.TestDecimal.runQuery(TestDecimal.java:58) at org.apache.drill.exec.physical.impl.TestDecimal.testCastFromInt(TestDecimal.java:180) Here's the new function in TestDecimal.java:     @Test    public void testCastFromInt() throws Exception {         // Function checks for casting from Float, Double to Decimal data types        try (RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();             Drillbit bit = new Drillbit(CONFIG, serviceSet);             DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator())) {             // run query.            bit.run();            client.connect();            enableDecimalDataType(client);            List results = runQuery(client, "/decimal/cast_int_decimal.json", "/input_simple_decimal.json");             RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());             QueryDataBatch batch = results.get(0);            assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData()));             // the first pair of values in the input consists of integers.  ignore the rest.            String decimal9Output[] = {"99.0000"};            String decimal38Output[] = {"123456789.0000"};             Iterator> itr = batchLoader.iterator();             // Check the output of decimal9            ValueVector.Accessor dec9Accessor = itr.next().getValueVector().getAccessor();            ValueVector.Accessor dec38Accessor = itr.next().getValueVector().getAccessor();             for (int i = 0; i < decimal9Output.length; i++) {                assertEquals(dec9Accessor.getObject(i).toString(), decimal9Output[i]);                assertEquals(dec38Accessor.getObject(i).toString(), decimal38Output[i]);            }            assertEquals(6, dec9Accessor.getValueCount());            assertEquals(6, dec38Accessor.getValueCount());             batchLoader.clear();            for (QueryDataBatch result : results) {              result.release();            }        }    }     public List runQuery(DrillClient client, String cast, String input) throws Exception {        String s1 = Files.toString(FileUtils.getResourceAsFile(cast), Charsets.UTF_8);        String s2 = s1.replace("#{TEST_FILE}", input);        if (isWindows()) {            s2 = s2.replace("\n", "\r\n");        }System.out.println("Query: " + s2);  // DAO DEBUG        List results;        try {            results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL, s2);        }        catch (Exception ex) {            ex.printStackTrace();            Throwable cause = ex.getCause();            if (cause != null) {                System.out.println("Caused by: " + cause.toString());                cause.printStackTrace();             }             throw ex;        }        return results;    } Here's the accompanying new json file cast_int_decimal.json: {  "head" : {    "version" : 1,    "generator" : {      "type" : "org.apache.drill.exec.planner.logical.DrillImplementor",      "info" : ""    },    "type" : "APACHE_DRILL_PHYSICAL",    "resultMode" : "EXEC"  },  graph:[  {      @id:1,      pop:"fs-scan",      format: {type: "json"},      storage:{type: "file", connection: "classpath:///"},      files:["#{TEST_FILE}"]  }, {    "pop" : "project",    "@id" : 2,    "exprs" : [ {      "ref" : "I4",      "expr" : " (cast(DEC9 as INTEGER)) "    },    { "ref" : "I8", "expr": "(cast(DEC18 as INTEGER))" }    ],     "child" : 1  },{    "pop" : "project",    "@id" : 4,    "exprs" : [ {      "ref" : "DECIMAL_9",      "expr" : " cast(I4 as decimal9(9, 0))  "    },    {"ref": "DECIMAL38", "expr" : "cast(I8 as decimal38sparse(38, 0))"}    ],     "child" : 2  },{    "pop" : "screen",    "@id" : 5,    "child" : 4  } ]} On Sunday, June 19, 2016 11:08 PM, Aman Sinha wrote: Sorry for the delay. Can you force the following flag to TRUE to get the more detailed stack trace ? https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/ExecConstants.java#L262 (normally, one would do an 'alter session ...' but TestDecimal is doing a plan submission instead of sql string). — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---