drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arina-ielchiieva <...@git.apache.org>
Subject [GitHub] drill pull request #610: DRILL-4674: Allow casting to boolean the same liter...
Date Tue, 01 Nov 2016 16:05:26 GMT
Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/610#discussion_r85948565
  
    --- Diff: exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestSimpleCastFunctions.java
---
    @@ -18,18 +18,108 @@
     package org.apache.drill.exec.sql;
     
     import org.apache.drill.BaseTestQuery;
    +import org.apache.drill.common.exceptions.UserRemoteException;
     import org.junit.Test;
     
    +import java.util.Arrays;
    +import java.util.List;
    +
    +import static org.hamcrest.CoreMatchers.containsString;
    +import static org.junit.Assert.assertThat;
    +
     public class TestSimpleCastFunctions extends BaseTestQuery {
    -  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestSimpleCastFunctions.class);
     
       @Test
    -  public void castFromBoolean() throws Exception {
    -    test("select cast(false as varchar(5)), cast(true as varchar(4)), cast((1 < 5)
as varchar(4)) from sys.options limit 1;");
    +  public void testCastFromBooleanToString() throws Exception {
    +    testBuilder()
    +        .sqlQuery("select" +
    +            " cast(false as varchar(5)) c1," +
    +            " cast(true as varchar(4)) c2," +
    +            " cast((1 < 5) as varchar(4)) c3," +
    +            " cast((1 > 5) as varchar(5)) c4" +
    +            " from (values(1))")
    +        .unOrdered()
    +        .baselineColumns("c1", "c2", "c3", "c4")
    +        .baselineValues("false", "true", "true", "false")
    +        .go();
    +  }
    +
    +  @Test
    +  public void testCastStringToBooleanTrueValue() throws Exception {
    +    List<String> literals =  Arrays.asList("t", "true", "y", "yes", "on", "1");
    --- End diff --
    
    Agree. Also added check for leading and trailing spaces.


---
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.
---

Mime
View raw message