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

    https://github.com/apache/incubator-quickstep/pull/291#discussion_r136156631
  
    --- Diff: utility/BulkIOConfiguration.hpp ---
    @@ -0,0 +1,198 @@
    +/**
    + * 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.
    + **/
    +
    +#ifndef QUICKSTEP_UTILITY_BULK_IO_CONFIGURATION_HPP_
    +#define QUICKSTEP_UTILITY_BULK_IO_CONFIGURATION_HPP_
    +
    +#include <memory>
    +#include <string>
    +
    +#include "utility/Macros.hpp"
    +
    +#include "glog/logging.h"
    +
    +namespace quickstep {
    +
    +/**
    + * @brief External file format for bulk I/O.
    + */
    +enum class BulkIOFormat {
    +  kCSV,
    +  kText
    +};
    +
    +class BulkIOConfiguration;
    +typedef std::shared_ptr<const BulkIOConfiguration> BulkIOConfigurationPtr;
    +
    +/**
    + * @brief Detailed file format configuration for bulk I/O (i.e. COPY 
operations)
    + *        that moves data between Quickstep tables and external files.
    + */
    +class BulkIOConfiguration {
    + public:
    +  /**
    +   * @brief Constructor.
    +   *
    +   * @param format External file format.
    +   */
    +  BulkIOConfiguration(const BulkIOFormat format)
    +      : format_(format) {
    +    initializeDefaultParameters(format);
    +  }
    +
    +  /**
    +   * @brief Get the external file format.
    +   *
    +   * @return The external file format.
    +   */
    +  inline BulkIOFormat getFormat() const {
    +    return format_;
    +  }
    +
    +  /**
    +   * @brief Get the external file format's name.
    +   *
    +   * @return The external file format's name.
    +   */
    +  inline std::string getFormatName() const {
    +    switch (format_) {
    +      case BulkIOFormat::kCSV:
    +        return "CSV";
    +      case BulkIOFormat::kText:
    +        return "TEXT";
    +      default:
    +        break;
    +    }
    +    LOG(FATAL) << "Unexpected format in 
BulkIOConfiguration::getFormatName()";
    +  }
    +
    +  /**
    +   * @brief Get the delimiter character (which is the character that 
separates
    +   *        attribute values in external files).
    +   *
    +   * @return The delimiter character.
    +   */
    +  inline char getDelimiter() const {
    +    return delimiter_;
    +  }
    +
    +  /**
    +   * @brief Set the delimiter character.
    +   *
    +   * @param delimiter The delimiter character to set.
    +   */
    +  inline void setDelimiter(const char delimiter) {
    +    delimiter_ = delimiter;
    +  }
    +
    +  /**
    +   * @brief Check whether to encode/decode between special characters and 
escape
    +   *        sequences.
    +   *
    +   * @return Whether to encode/decode between special characters and escape
    +   *         sequences.
    +   */
    +  inline bool escapeStrings() const {
    --- End diff --
    
    Optionally, change to `escape_strings()` and `set_escape_strings()`, 
according to [code 
style](https://google.github.io/styleguide/cppguide.html#Function_Names).
    
    Same for `delimiter()`, `header()`, `quote()`, and `null_string()`.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to