You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by cg...@apache.org on 2021/02/23 14:59:36 UTC

[drill] branch master updated: Revert "Merge branch 'master' of https://github.com/apache/drill into DRILL-7863"

This is an automated email from the ASF dual-hosted git repository.

cgivre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git


The following commit(s) were added to refs/heads/master by this push:
     new 76d5654  Revert "Merge branch 'master' of https://github.com/apache/drill into DRILL-7863"
76d5654 is described below

commit 76d5654b34c4c42b078662e55a693f60d12b35ac
Author: luocooong <lu...@apache.org>
AuthorDate: Tue Feb 23 15:40:10 2021 +0800

    Revert "Merge branch 'master' of https://github.com/apache/drill into DRILL-7863"
    
    This reverts commit 54a0ec6225ff275844ab055cfc8af1db2c429904.
---
 .../drill/exec/store/mongo/MongoTestSuite.java     |  13 +--
 contrib/udfs/README.md                             |  37 -------
 .../drill/exec/udfs/ComplexSchemaFunctions.java    |  69 ------------
 .../apache/drill/exec/udfs/ComplexSchemaUtils.java |  68 ------------
 .../exec/udfs/TestComplexSchemaFunctions.java      | 119 ---------------------
 .../udfs/src/test/resources/json/nestedSchema.json |  21 ----
 .../base/AbstractGroupScanWithMetadata.java        |   2 +-
 .../planner/logical/DrillPushLimitToScanRule.java  |   4 +-
 .../drill/exec/server/rest/StorageResources.java   |   3 +-
 .../exec/store/StoragePluginRegistryImpl.java      |   4 -
 .../drill/exec/store/dfs/easy/EasyGroupScan.java   |  12 +--
 .../store/parquet/AbstractParquetGroupScan.java    |   1 -
 12 files changed, 12 insertions(+), 341 deletions(-)

diff --git a/contrib/storage-mongo/src/test/java/org/apache/drill/exec/store/mongo/MongoTestSuite.java b/contrib/storage-mongo/src/test/java/org/apache/drill/exec/store/mongo/MongoTestSuite.java
index b779c9a..680281e 100644
--- a/contrib/storage-mongo/src/test/java/org/apache/drill/exec/store/mongo/MongoTestSuite.java
+++ b/contrib/storage-mongo/src/test/java/org/apache/drill/exec/store/mongo/MongoTestSuite.java
@@ -53,6 +53,7 @@ import org.junit.BeforeClass;
 import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -66,15 +67,9 @@ import java.util.Map;
 import java.util.concurrent.atomic.AtomicInteger;
 
 @RunWith(Suite.class)
-@Suite.SuiteClasses({
-  TestMongoFilterPushDown.class,
-  TestMongoProjectPushDown.class,
-  TestMongoQueries.class,
-  TestMongoChunkAssignment.class,
-  TestMongoStoragePluginUsesCredentialsStore.class,
-  TestMongoDrillIssue.class
-})
-
+@SuiteClasses({TestMongoFilterPushDown.class, TestMongoProjectPushDown.class,
+    TestMongoQueries.class, TestMongoChunkAssignment.class,
+    TestMongoStoragePluginUsesCredentialsStore.class})
 @Category({SlowTest.class, MongoStorageTest.class})
 public class MongoTestSuite extends BaseTest implements MongoTestConstants {
 
diff --git a/contrib/udfs/README.md b/contrib/udfs/README.md
index ae65e1d..3ef761c 100644
--- a/contrib/udfs/README.md
+++ b/contrib/udfs/README.md
@@ -272,40 +272,3 @@ The function can also be called with an optional field as an argument. IE:
 SELECT parse_user_agent( `user_agent`, 'AgentName` ) as AgentName ...
 ```
 which will just return the requested field. If the user agent string is empty, all fields will have the value of `Hacker`.  
-
-## Map Schema Function
-This function allows you to drill down into the schema of maps.  The REST API and JDBC interfaces will only return `MAP`, `LIST` for the MAP, however, it is not possible to get 
-the schema of the inner map. The function `getMapSchema(<MAP>)` will return a `MAP` of the fields and datatypes.
-
-### Example Usage
-
-Using the data below, the query below will return the schema as shown below.
-```bash
-apache drill> SELECT getMapSchema(record) AS schema FROM dfs.test.`schema_test.json`;
-+----------------------------------------------------------------------------------+
-|                                      schema                                      |
-+----------------------------------------------------------------------------------+
-| {"int_field":"BIGINT","double_field":"FLOAT8","string_field":"VARCHAR","int_list":"REPEATED_BIGINT","double_list":"REPEATED_FLOAT8","map":"MAP"} |
-+----------------------------------------------------------------------------------+
-1 row selected (0.298 seconds)
-```
-
-```json
-{
-  "record" : {
-    "int_field": 1,
-    "double_field": 2.0,
-    "string_field": "My string",
-    "int_list": [1,2,3],
-    "double_list": [1.0,2.0,3.0],
-    "map": {
-      "nested_int_field" : 5,
-      "nested_double_field": 5.0,
-      "nested_string_field": "5.0"
-    }
-  },
-  "single_field": 10
-}
-```
-
-The function returns an empty map if the row is `null`.
diff --git a/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/ComplexSchemaFunctions.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/ComplexSchemaFunctions.java
deleted file mode 100644
index 50fef82..0000000
--- a/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/ComplexSchemaFunctions.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.udfs;
-
-import io.netty.buffer.DrillBuf;
-import org.apache.drill.exec.expr.DrillSimpleFunc;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling;
-import org.apache.drill.exec.expr.annotations.Output;
-import org.apache.drill.exec.expr.annotations.Param;
-import org.apache.drill.exec.vector.complex.reader.FieldReader;
-import org.apache.drill.exec.vector.complex.writer.BaseWriter;
-
-import javax.inject.Inject;
-
-public class ComplexSchemaFunctions {
-
-  /**
-   * This function exists to help the user understand the inner schemata of maps
-   * It is NOT recursive (yet).
-   */
-  @FunctionTemplate(names = {"get_map_schema", "getMapSchema"},
-    scope = FunctionTemplate.FunctionScope.SIMPLE,
-    nulls = NullHandling.INTERNAL)
-  public static class GetMapSchemaFunction implements DrillSimpleFunc {
-
-    @Param
-    FieldReader reader;
-
-    @Output
-    BaseWriter.ComplexWriter outWriter;
-
-    @Inject
-    DrillBuf outBuffer;
-
-    @Override
-    public void setup() {
-      // Nothing to see here...
-    }
-
-    @Override
-    public void eval() {
-      if (reader.isSet()) {
-        org.apache.drill.exec.udfs.ComplexSchemaUtils.getFields(reader, outWriter, outBuffer);
-      } else {
-        org.apache.drill.exec.vector.complex.writer.BaseWriter.MapWriter queryMapWriter = outWriter.rootAsMap();
-        // Return empty map
-        queryMapWriter.start();
-        queryMapWriter.end();
-      }
-    }
-  }
-}
diff --git a/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/ComplexSchemaUtils.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/ComplexSchemaUtils.java
deleted file mode 100644
index 7f027aa..0000000
--- a/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/ComplexSchemaUtils.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.udfs;
-
-import io.netty.buffer.DrillBuf;
-import org.apache.drill.common.types.TypeProtos.DataMode;
-import org.apache.drill.common.types.TypeProtos.MinorType;
-import org.apache.drill.exec.expr.holders.VarCharHolder;
-import org.apache.drill.exec.vector.complex.reader.FieldReader;
-import org.apache.drill.exec.vector.complex.writer.BaseWriter;
-
-import java.util.Iterator;
-
-public class ComplexSchemaUtils {
-
-  public static void getFields(FieldReader reader, BaseWriter.ComplexWriter outWriter, DrillBuf buffer) {
-
-    BaseWriter.MapWriter queryMapWriter = outWriter.rootAsMap();
-
-    if (reader.getType().getMinorType() != MinorType.MAP) {
-      // If the field is not a map, return an empty map
-      queryMapWriter.start();
-      queryMapWriter.end();
-    }
-
-    Iterator<String> fieldIterator = reader.iterator();
-    queryMapWriter.start();
-
-    while (fieldIterator.hasNext()) {
-      String fieldName = fieldIterator.next();
-      FieldReader fieldReader = reader.reader(fieldName);
-      String dataType = fieldReader.getType().getMinorType().toString();
-
-      DataMode dataMode = fieldReader.getType().getMode();
-      if (dataMode == DataMode.REPEATED) {
-        dataType = dataMode + "_" + dataType;
-      }
-
-      VarCharHolder rowHolder = new VarCharHolder();
-      byte[] rowStringBytes = dataType.getBytes();
-      buffer.reallocIfNeeded(rowStringBytes.length);
-      buffer.setBytes(0, rowStringBytes);
-
-      rowHolder.start = 0;
-      rowHolder.end = rowStringBytes.length;
-      rowHolder.buffer = buffer;
-
-      queryMapWriter.varChar(fieldName).write(rowHolder);
-    }
-    queryMapWriter.end();
-  }
-}
diff --git a/contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestComplexSchemaFunctions.java b/contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestComplexSchemaFunctions.java
deleted file mode 100644
index bf453ef..0000000
--- a/contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestComplexSchemaFunctions.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.udfs;
-
-import org.apache.drill.categories.SqlFunctionTest;
-import org.apache.drill.categories.UnlikelyTest;
-import org.apache.drill.common.types.TypeProtos.MinorType;
-import org.apache.drill.exec.physical.rowSet.RowSet;
-import org.apache.drill.exec.record.metadata.SchemaBuilder;
-import org.apache.drill.exec.record.metadata.TupleMetadata;
-import org.apache.drill.exec.rpc.RpcException;
-import org.apache.drill.test.ClusterFixture;
-import org.apache.drill.test.ClusterFixtureBuilder;
-import org.apache.drill.test.ClusterTest;
-import org.apache.drill.test.QueryBuilder;
-import org.apache.drill.test.rowSet.RowSetComparison;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import static org.apache.drill.test.rowSet.RowSetUtilities.mapArray;
-import static org.apache.drill.test.rowSet.RowSetUtilities.strArray;
-import static org.junit.Assert.assertEquals;
-
-@Category({UnlikelyTest.class, SqlFunctionTest.class})
-public class TestComplexSchemaFunctions extends ClusterTest {
-
-  @BeforeClass
-  public static void setup() throws Exception {
-    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher);
-    startCluster(builder);
-  }
-
-  @Test
-  public void testMapSchemaFunction() throws RpcException {
-    String sql = "SELECT getMapSchema(record) AS schema FROM cp.`json/nestedSchema.json`";
-
-    QueryBuilder q = client.queryBuilder().sql(sql);
-    RowSet results = q.rowSet();
-    assertEquals(results.rowCount(), 1);
-
-    TupleMetadata expectedSchema = new SchemaBuilder()
-      .addMap("schema")
-          .addNullable("int_field", MinorType.VARCHAR)
-          .addNullable("double_field", MinorType.VARCHAR)
-          .addNullable("string_field", MinorType.VARCHAR)
-          .addNullable("boolean_field", MinorType.VARCHAR)
-          .addNullable("int_list", MinorType.VARCHAR)
-          .addNullable("double_list", MinorType.VARCHAR)
-          .addNullable("boolean_list", MinorType.VARCHAR)
-          .addNullable("map", MinorType.VARCHAR)
-          .addNullable("repeated_map", MinorType.VARCHAR)
-        .resumeSchema()
-      .build();
-
-    RowSet expected = client.rowSetBuilder(expectedSchema)
-      .addRow((Object)strArray("BIGINT", "FLOAT8", "VARCHAR", "BIT", "REPEATED_BIGINT", "REPEATED_FLOAT8", "REPEATED_BIT", "MAP", "REPEATED_MAP"))
-      .build();
-
-    new RowSetComparison(expected).verifyAndClearAll(results);
-  }
-
-  @Test
-  public void testMapSchemaFunctionWithInnerMap() throws RpcException {
-    String sql = "SELECT getMapSchema(t1.record.map) AS schema FROM cp.`json/nestedSchema.json` AS t1";
-
-    QueryBuilder q = client.queryBuilder().sql(sql);
-    RowSet results = q.rowSet();
-    assertEquals(results.rowCount(), 1);
-
-    TupleMetadata expectedSchema = new SchemaBuilder()
-      .addMap("schema")
-          .addNullable("nested_int_field", MinorType.VARCHAR)
-          .addNullable("nested_double_field", MinorType.VARCHAR)
-          .addNullable("nested_string_field", MinorType.VARCHAR)
-        .resumeSchema()
-      .build();
-
-    RowSet expected = client.rowSetBuilder(expectedSchema)
-      .addRow((Object)strArray("BIGINT", "FLOAT8", "VARCHAR"))
-      .build();
-
-    new RowSetComparison(expected).verifyAndClearAll(results);
-  }
-
-  @Test
-  public void testMapSchemaFunctionWithNull() throws RpcException {
-    String sql = "SELECT getMapSchema(null) AS schema FROM cp.`json/nestedSchema.json` AS t1";
-
-    QueryBuilder q = client.queryBuilder().sql(sql);
-    RowSet results = q.rowSet();
-
-    TupleMetadata expectedSchema = new SchemaBuilder()
-      .add("schema", MinorType.MAP)
-      .build();
-
-    RowSet expected = client.rowSetBuilder(expectedSchema)
-      .addRow((Object) mapArray())
-      .build();
-
-    new RowSetComparison(expected).verifyAndClearAll(results);
-  }
-}
diff --git a/contrib/udfs/src/test/resources/json/nestedSchema.json b/contrib/udfs/src/test/resources/json/nestedSchema.json
deleted file mode 100644
index 22abcc2..0000000
--- a/contrib/udfs/src/test/resources/json/nestedSchema.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
-  "record" : {
-    "int_field": 1,
-    "double_field": 2.0,
-    "string_field": "My string",
-    "boolean_field": true,
-    "int_list": [1,2,3],
-    "double_list": [1.0,2.0,3.0],
-    "boolean_list": [true, false, true],
-    "map": {
-      "nested_int_field" : 5,
-      "nested_double_field": 5.0,
-      "nested_string_field": "5.0"
-    },
-    "repeated_map": [
-      { "a" : 1 },
-      { "b" : "abc" }
-    ]
-  },
-  "single_field": 10
-}
\ No newline at end of file
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractGroupScanWithMetadata.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractGroupScanWithMetadata.java
index c36ba67..a5330dd 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractGroupScanWithMetadata.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractGroupScanWithMetadata.java
@@ -777,7 +777,7 @@ public abstract class AbstractGroupScanWithMetadata<P extends TableMetadataProvi
     }
 
     public B limit(int maxRecords) {
-      this.maxRecords = maxRecords;
+      source.maxRecords = maxRecords;
       return self();
     }
 
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillPushLimitToScanRule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillPushLimitToScanRule.java
index 9e2c0e5..e046563 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillPushLimitToScanRule.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillPushLimitToScanRule.java
@@ -111,10 +111,10 @@ public abstract class DrillPushLimitToScanRule extends RelOptRule {
 
       final RelNode newLimit;
       if (projectRel != null) {
-        final RelNode newProject = projectRel.copy(projectRel.getTraitSet(), ImmutableList.of(newScanRel));
+        final RelNode newProject = projectRel.copy(projectRel.getTraitSet(), ImmutableList.of((RelNode) newScanRel));
         newLimit = limitRel.copy(limitRel.getTraitSet(), ImmutableList.of(newProject));
       } else {
-        newLimit = limitRel.copy(limitRel.getTraitSet(), ImmutableList.of(newScanRel));
+        newLimit = limitRel.copy(limitRel.getTraitSet(), ImmutableList.of((RelNode) newScanRel));
       }
 
       call.transformTo(newLimit);
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java
index 0a8e66a..85709b0 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java
@@ -246,9 +246,8 @@ public class StorageResources {
       return message("Success");
     } catch (PluginEncodingException e) {
       logger.warn("Error in JSON mapping: {}", storagePluginConfig, e);
-      return message("Invalid JSON: " + e.getMessage());
+      return message("Invalid JSON");
     } catch (PluginException e) {
-      logger.error("Error while saving plugin", e);
       return message(e.getMessage());
     }
   }
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java
index 38a489e..390a32c 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java
@@ -49,8 +49,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.exc.InvalidTypeIdException;
-import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException;
 
 /**
  * Plugin registry. Caches plugin instances which correspond to configurations
@@ -512,8 +510,6 @@ public class StoragePluginRegistryImpl implements StoragePluginRegistry {
       return context.mapper().reader()
           .forType(StoragePluginConfig.class)
           .readValue(json);
-    } catch (InvalidTypeIdException | UnrecognizedPropertyException e) {
-      throw new PluginEncodingException(e.getMessage(), e);
     } catch (IOException e) {
       throw new PluginEncodingException("Failure when decoding plugin JSON", e);
     }
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyGroupScan.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyGroupScan.java
index 580cc6c..928ebac 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyGroupScan.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyGroupScan.java
@@ -20,7 +20,6 @@ package org.apache.drill.exec.store.dfs.easy;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.collections.MapUtils;
 import org.apache.drill.common.PlanStringBuilder;
@@ -43,7 +42,6 @@ import org.apache.drill.exec.metastore.MetadataProviderManager;
 import org.apache.drill.exec.physical.base.PhysicalOperator;
 import org.apache.drill.exec.physical.base.ScanStats;
 import org.apache.drill.exec.metastore.store.FileTableMetadataProviderBuilder;
-import org.apache.drill.metastore.metadata.FileMetadata;
 import org.apache.drill.metastore.metadata.LocationProvider;
 import org.apache.drill.metastore.metadata.TableMetadataProvider;
 import org.apache.drill.exec.planner.physical.PlannerSettings;
@@ -89,6 +87,7 @@ public class EasyGroupScan extends AbstractGroupScanWithMetadata<TableMetadataPr
   private List<CompleteFileWork> chunks;
   private List<EndpointAffinity> endpointAffinities;
   private final Path selectionRoot;
+  private final int maxRecords;
 
   @JsonCreator
   public EasyGroupScan(
@@ -178,6 +177,7 @@ public class EasyGroupScan extends AbstractGroupScanWithMetadata<TableMetadataPr
     mappings = that.mappings;
     partitionDepth = that.partitionDepth;
     metadataProvider = that.metadataProvider;
+    maxRecords = getMaxRecords();
   }
 
   @JsonIgnore
@@ -407,13 +407,9 @@ public class EasyGroupScan extends AbstractGroupScanWithMetadata<TableMetadataPr
       newScan.files = files;
       newScan.matchAllMetadata = matchAllMetadata;
       newScan.nonInterestingColumnsMetadata = nonInterestingColumnsMetadata;
-      newScan.maxRecords = maxRecords;
 
-      Map<Path, FileMetadata> filesMetadata = newScan.getFilesMetadata();
-      if (MapUtils.isNotEmpty(filesMetadata)) {
-        newScan.fileSet = filesMetadata.keySet();
-        newScan.selection = FileSelection.create(null, new ArrayList<>(newScan.fileSet), newScan.selectionRoot);
-      }
+      newScan.fileSet = newScan.getFilesMetadata().keySet();
+      newScan.selection = FileSelection.create(null, new ArrayList<>(newScan.fileSet), newScan.selectionRoot);
       try {
         newScan.initFromSelection(newScan.selection, newScan.formatPlugin);
       } catch (IOException e) {
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/AbstractParquetGroupScan.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/AbstractParquetGroupScan.java
index 2923bd2..c13846d 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/AbstractParquetGroupScan.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/AbstractParquetGroupScan.java
@@ -538,7 +538,6 @@ public abstract class AbstractParquetGroupScan extends AbstractGroupScanWithMeta
       newScan.rowGroups = rowGroups;
       newScan.matchAllMetadata = matchAllMetadata;
       newScan.nonInterestingColumnsMetadata = nonInterestingColumnsMetadata;
-      newScan.maxRecords = maxRecords;
       // since builder is used when pruning happens, entries and fileSet should be expanded
       if (!newScan.getFilesMetadata().isEmpty()) {
         newScan.entries = newScan.getFilesMetadata().keySet().stream()