drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkorukanti <...@git.apache.org>
Subject [GitHub] drill pull request: DRILL-4603: Refactor FileSystem plugin code to...
Date Thu, 21 Apr 2016 18:28:05 GMT
Github user vkorukanti commented on a diff in the pull request:

    https://github.com/apache/drill/pull/476#discussion_r60631846
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSystemPluginImplementationProvider.java
---
    @@ -0,0 +1,141 @@
    +/**
    + * 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
    + * <p/>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p/>
    + * 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.store.dfs;
    +
    +import com.google.common.collect.ImmutableMap;
    +import com.google.common.collect.Lists;
    +import org.apache.drill.common.exceptions.ExecutionSetupException;
    +import org.apache.drill.exec.server.DrillbitContext;
    +import org.apache.drill.exec.store.ClassPathFileSystem;
    +import org.apache.drill.exec.store.LocalSyncableFileSystem;
    +import org.apache.hadoop.conf.Configuration;
    +import org.apache.hadoop.fs.FileSystem;
    +
    +import java.io.IOException;
    +import java.util.List;
    +import java.util.Map;
    +
    +import static org.apache.drill.exec.store.dfs.FileSystemSchemaFactory.DEFAULT_WS_NAME;
    +
    +/**
    + * Provides needed component by the {@link FileSystemPlugin}. This can be overridden
to supply customized components
    + * (such as custom schema factory) to {@link FileSystemPlugin}.
    + */
    +public class FileSystemPluginImplementationProvider {
    +
    +  protected final FileSystemConfig fsConfig;
    +  protected final String fsPluginName;
    +  protected final DrillbitContext dContext;
    +
    +  private FormatCreator formatCreator; /** Don't use this directly, use {@link #getFormatCreator(Configuration)}
*/
    +
    +  /**
    +   * Instantiate an object
    +   * @param dContext {@link DrillbitContext} instance.
    +   * @param fsPluginName Name of the FileSystemPlugin storage
    +   * @param fsConfig FileSystemPlugin configuration
    +   */
    +  public FileSystemPluginImplementationProvider(
    +      final DrillbitContext dContext,
    +      final String fsPluginName,
    +      final FileSystemConfig fsConfig) {
    +    this.dContext = dContext;
    +    this.fsConfig = fsConfig;
    +    this.fsPluginName = fsPluginName;
    +  }
    +
    +  /**
    +   * @return Return any properties needed for {@link Configuration} object that are not
set in
    +   * {@link FileSystemPlugin}'s configuration.
    +   */
    +  public Map<String, String> getFsProps() {
    +    return ImmutableMap.of(
    +        "fs.classpath.impl", ClassPathFileSystem.class.getName(),
    +        "fs.drill-local.impl", LocalSyncableFileSystem.class.getName()
    +    );
    +  }
    +
    +  /**
    +   * @return Create and return {@link FormatCreator} based on the storage plugin configuration.
    +   */
    +  public FormatCreator getFormatCreator(final Configuration fsConf) {
    +    if (formatCreator == null) {
    --- End diff --
    
    It was an optimization made based on the assumption, Configuration is not going to change
within FileSystemPlugin. Changed few APIs so that we pass the FormatCreator directly instead
of calling getFormatCreator() multiple times.


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