Github user zuyu commented on a diff in the pull request: https://github.com/apache/incubator-quickstep/pull/291#discussion_r136149449 --- Diff: parser/ParseStatement.hpp --- @@ -898,24 +916,53 @@ class ParseStatementCopyFrom : public ParseStatement { std::vector<const ParseTreeNode*> *non_container_child_fields, std::vector<std::string> *container_child_field_names, std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override { - inline_field_names->push_back("relation_name"); - inline_field_values->push_back(relation_name_->value()); + inline_field_names->push_back("direction"); + inline_field_values->push_back(direction_ == kFrom ? "FROM" : "TO"); - inline_field_names->push_back("source_file"); - inline_field_values->push_back(source_filename_->value()); + inline_field_names->push_back("file"); + inline_field_values->push_back(file_name_->value()); + + if (relation_name_ != nullptr) { + inline_field_names->push_back("relation_name"); + inline_field_values->push_back(relation_name_->value()); + } + + if (set_operation_query_ != nullptr) { + non_container_child_field_names->push_back("set_operation_query"); + non_container_child_fields->push_back(set_operation_query_.get()); + } + + if (with_clause_ != nullptr && !with_clause_->empty()) { + container_child_field_names->push_back("with_clause"); + container_child_fields->emplace_back(); + for (const ParseSubqueryTableReference &common_subquery : *with_clause_) { + container_child_fields->back().push_back(&common_subquery); + } + } if (params_ != nullptr) { - non_container_child_field_names->push_back("params"); - non_container_child_fields->push_back(params_.get()); + container_child_field_names->push_back("params"); + container_child_fields->emplace_back(); + for (const ParseKeyValue ¶m : *params_) { + container_child_fields->back().push_back(¶m); + } } } private: + const CopyDirection direction_; + + // NOTE(jianqiao): + // (1) Either relation_name_ or set_operation_query_ has non-null value. + // (2) set_operation_query_ must be null for COPY FROM statement. --- End diff -- Question: do we have these checks enforced in the constructors?
--- 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. ---