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

    https://github.com/apache/drill/pull/1214#discussion_r183646149
  
    --- Diff: 
contrib/storage-hive/core/src/test/java/org/apache/drill/exec/TestHiveDrillNativeParquetReader.java
 ---
    @@ -0,0 +1,247 @@
    +/*
    +* 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.exec;
    +
    +import org.apache.drill.PlanTestBase;
    +import org.apache.drill.categories.HiveStorageTest;
    +import org.apache.drill.categories.SlowTest;
    +import org.apache.drill.common.exceptions.UserRemoteException;
    +import org.apache.drill.exec.hive.HiveTestBase;
    +import org.apache.drill.exec.planner.physical.PlannerSettings;
    +import org.hamcrest.CoreMatchers;
    +import org.joda.time.DateTime;
    +import org.junit.AfterClass;
    +import org.junit.BeforeClass;
    +import org.junit.Rule;
    +import org.junit.Test;
    +import org.junit.experimental.categories.Category;
    +import org.junit.rules.ExpectedException;
    +
    +import java.math.BigDecimal;
    +import java.sql.Date;
    +import java.sql.Timestamp;
    +
    +import static org.hamcrest.CoreMatchers.containsString;
    +import static org.junit.Assert.assertEquals;
    +
    +@Category({SlowTest.class, HiveStorageTest.class})
    +public class TestHiveDrillNativeParquetReader extends HiveTestBase {
    +
    +  @BeforeClass
    +  public static void init() {
    +    setSessionOption(ExecConstants.HIVE_OPTIMIZE_SCAN_WITH_NATIVE_READERS, 
true);
    +    setSessionOption(PlannerSettings.ENABLE_DECIMAL_DATA_TYPE_KEY, true);
    +  }
    +
    +  @AfterClass
    +  public static void cleanup() {
    +    
resetSessionOption(ExecConstants.HIVE_OPTIMIZE_SCAN_WITH_NATIVE_READERS);
    +    resetSessionOption(PlannerSettings.ENABLE_DECIMAL_DATA_TYPE_KEY);
    +  }
    +
    +  @Rule
    +  public ExpectedException thrown = ExpectedException.none();
    +
    +  @Test
    +  public void testFilterPushDownForManagedTable() throws Exception {
    +    String query = "select * from hive.kv_native where key > 1";
    +
    +    int actualRowCount = testSql(query);
    +    assertEquals("Expected and actual row count should match", 2, 
actualRowCount);
    +
    +    testPlanMatchingPatterns(query,
    +        new String[]{"HiveDrillNativeParquetScan", "numFiles=1"}, new 
String[]{});
    +  }
    +
    +  @Test
    +  public void testFilterPushDownForExternalTable() throws Exception {
    +    String query = "select * from hive.kv_native_ext where key = 1";
    +
    +    int actualRowCount = testSql(query);
    +    assertEquals("Expected and actual row count should match", 1, 
actualRowCount);
    +
    +    testPlanMatchingPatterns(query,
    +        new String[]{"HiveDrillNativeParquetScan", "numFiles=1"}, new 
String[]{});
    --- End diff --
    
    I have added method without `excludedPatterns`, when it is not necessary. 
But it is not merged for now.
    Is it better to pass null, than to create empty String?


---

Reply via email to