[ 
https://issues.apache.org/jira/browse/DRILL-4047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14994844#comment-14994844
 ] 

ASF GitHub Bot commented on DRILL-4047:
---------------------------------------

Github user julienledem commented on a diff in the pull request:

    https://github.com/apache/drill/pull/246#discussion_r44204861
  
    --- Diff: 
exec/java-exec/src/test/java/org/apache/drill/TestSelectWithOption.java ---
    @@ -0,0 +1,85 @@
    +/**
    + * 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
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill;
    +
    +import static java.lang.String.format;
    +import static org.apache.drill.TestBuilder.listOf;
    +
    +import java.io.File;
    +import java.io.FileWriter;
    +
    +import org.junit.Test;
    +
    +public class TestSelectWithOption extends BaseTestQuery {
    +
    +//  @Test
    +//  public void testBar() throws Exception {
    +//    test("select dfs.`${WORKING_PATH}/some/path`() from 
cp.`tpch/region.parquet`");
    +//  }
    +
    +  @Test
    +  public void testText() throws Exception {
    +    File input = new File("target/" + this.getClass().getName() + ".csv");
    +    String query = "select columns from table(dfs.`${WORKING_PATH}/" + 
input.getPath() +
    +        "`(type => 'TEXT', fieldDelimiter => '%s'))";
    +    String queryComma = format(query, ",");
    +    String queryPipe = format(query, "|");
    +    System.out.println(queryComma);
    +    System.out.println(queryPipe);
    +    TestBuilder builderComma = testBuilder()
    +        .sqlQuery(queryComma)
    +        .ordered()
    +        .baselineColumns("columns");
    +    TestBuilder builderPipe = testBuilder()
    +        .sqlQuery(queryPipe)
    +        .ordered()
    +        .baselineColumns("columns");
    +    try (FileWriter fw = new FileWriter(input)) {
    +//      fw.append("a|b\n");
    +      for (int i = 0; i < 3; i++) {
    +        fw.append("\"b\"|\"" + i + "\"\n");
    +        builderComma = builderComma.baselineValues(listOf("b\"|\"" + i));
    +        builderPipe = builderPipe.baselineValues(listOf("b", 
String.valueOf(i)));
    +      }
    +    }
    +
    +    test("select columns from dfs.`${WORKING_PATH}/" + input.getPath() + 
"`");
    +
    +    builderComma.build().run();
    +    builderPipe.build().run();
    +  }
    +
    +  @Test
    +  public void testParquetFailure() throws Exception {
    +    File input = new File("target/" + this.getClass().getName() + ".csv");
    +    try (FileWriter fw = new FileWriter(input)) {
    +//      fw.append("a|b\n");
    +      for (int i = 0; i < 3; i++) {
    +        fw.append("\"b\"|\"" + i + "\"\n");
    +      }
    +    }
    +
    +    String query = "select columns from table(dfs.`${WORKING_PATH}/" + 
input.getPath() +
    +        "`(type => 'PARQUET'))";
    +    System.out.println(query);
    +
    +    test(query);
    +
    +  }
    --- End diff --
    
    todo more granular tests


> Select with options
> -------------------
>
>                 Key: DRILL-4047
>                 URL: https://issues.apache.org/jira/browse/DRILL-4047
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Execution - Relational Operators
>            Reporter: Julien Le Dem
>            Assignee: Julien Le Dem
>
> Add a mechanism to pass parameters down to the StoragePlugin when writing a 
> Select statement.
> Some discussion here:
> http://mail-archives.apache.org/mod_mbox/drill-dev/201510.mbox/%3CCAO%2Bvc4AcGK3%2B3QYvQV1-xPPdpG3Tc%2BfG%3D0xDGEUPrhd6ktHv5Q%40mail.gmail.com%3E
> http://mail-archives.apache.org/mod_mbox/drill-dev/201511.mbox/%3ccao+vc4clzylvjevisfjqtcyxb-zsmfy4bqrm-jhbidwzgqf...@mail.gmail.com%3E



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to