<commit_before>//===----------------------------------------------------------------------===//
//
//                         PelotonDB
//
// rpc_utils.cpp
//
// Identification: /peloton/src/backend/networking/rpc_utils.cpp
//
// Copyright (c) 2015, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//

#include "rpc_utils.h"
#include "backend/common/cast.h"

namespace peloton {
namespace networking {

//===----------------------------------------------------------------------===//
//   Message Creation Functions
//===----------------------------------------------------------------------===//

/*
 * @brief Create TupleDesc Message from Postgres's TupleDesc
 * @param TupleDesc and TupleDescMsg&
 * @return TupleDescMsg is set on
 */
void SetTupleDescMsg(TupleDesc tuple_desc, TupleDescMsg& tuple_desc_msg) {
    // Convert the basic value type
    tuple_desc_msg.set_natts(tuple_desc->natts);
    tuple_desc_msg.set_tdhasoid(tuple_desc->tdhasoid);
    tuple_desc_msg.set_tdrefcount(tuple_desc->tdrefcount);
    tuple_desc_msg.set_tdtypeid(tuple_desc->tdtypeid);
    tuple_desc_msg.set_tdtypmod(tuple_desc->tdtypmod);

    //===----------------------------------------------------------------------===//
    //    Convert attrs. It is message type and there might be multiple
    //    attrs according to tuple_desc->natts
    //===----------------------------------------------------------------------===//
    for (int it = 0; it < tuple_desc->natts; it++) {
        // Prepare adding a attrs
        FormAttributeMsg* attrs = tuple_desc_msg.add_attrs();
        // Here attalign is char in postgres, so we convert it to int32
        attrs->set_attalign(<commit_msg>add include memory for travisci check<commit_after>//===----------------------------------------------------------------------===//
//
//                         PelotonDB
//
// rpc_utils.cpp
//
// Identification: /peloton/src/backend/networking/rpc_utils.cpp
//
// Copyright (c) 2015, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//

#include "rpc_utils.h"
#include "backend/common/cast.h"

#include <memory>

namespace peloton {
namespace networking {

//===----------------------------------------------------------------------===//
//   Message Creation Functions
//===----------------------------------------------------------------------===//

/*
 * @brief Create TupleDesc Message from Postgres's TupleDesc
 * @param TupleDesc and TupleDescMsg&
 * @return TupleDescMsg is set on
 */
void SetTupleDescMsg(TupleDesc tuple_desc, TupleDescMsg& tuple_desc_msg) {
    // Convert the basic value type
    tuple_desc_msg.set_natts(tuple_desc->natts);
    tuple_desc_msg.set_tdhasoid(tuple_desc->tdhasoid);
    tuple_desc_msg.set_tdrefcount(tuple_desc->tdrefcount);
    tuple_desc_msg.set_tdtypeid(tuple_desc->tdtypeid);
    tuple_desc_msg.set_tdtypmod(tuple_desc->tdtypmod);

    //===----------------------------------------------------------------------===//
    //    Convert attrs. It is message type and there might be multiple
    //    attrs according to tuple_desc->natts
    //===----------------------------------------------------------------------===//
    for (int it = 0; it < tuple_desc->natts; it++) {
        // Prepare adding a attrs
        FormAttributeMsg* attrs = tuple_desc_msg.add_attrs();
        // Here attalign is char in postgres, so we convert it to int32
        attrs->set_attalign(
{'fraction_non_alphanumeric': 0.3438824526702458, 'fraction_numerical': 0.003955919751342187, 'mean_word_length': 1.3552894211576847, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3382090', 'n_tokens_mistral': 911, 'n_tokens_neox': 885, 'n_words': 200}