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

#include "storage/temp_table.h"

#include "catalog/schema.h"
#include "common/exception.h"
#include "common/logger.h"
#include "storage/tile_group.h"
#include "storage/tile_group_header.h"
#include "storage/tuple.h"

namespace peloton {
namespace storage {

TempTable::TempTable(const oid_t &table_oid, catalog::Schema *schema,
                     const bool own_schema)
    : AbstractTable(table_oid, schema, own_schema) {
  // We only want to instantiate a single TileGroup
  AddDefaultTileGroup();
}

TempTable::~TempTable() {
  // Nothing to see, nothing to do
}

ItemPointer TempTable::InsertTuple(
    const Tuple *tuple, UNUSED_ATTRIBUTE concurrency::Transaction *transaction,
    UNUSED_ATTRIBUTE ItemPointer **index_entry_ptr) {
  PL_ASSERT(tuple != nullptr);

  std::shared_ptr<storage::TileGroup> tile_group;
  oid_t tuple_slot = INVALID_OID;
  oid_t tile_group_id = INVALID_OID;

  for (int i = 0, cnt = (int)tile_groups_.size(); i < cnt; i++) {
    tile_group = tile_groups_[i];
    tuple_slot = tile_group->InsertTuple(tuple);

    // now we have already obtained a new tuple slot.
    if (tuple_slot != INVALID_OID) {
      tile_group_id = tile_group->GetTileGroupId();
      LOG_TRACE("Inserted tuple into %s", GetName().c_str());
      break;
    }
  }
  // if this is the last tuple slot we can get<commit_msg>Throwing back the asserts in TempTable::InsertTuple()...<commit_after>
//===----------------------------------------------------------------------===//
//
//                         PelotonDB
//
// temp_table.cpp
//
// Identification: /peloton/src/storage/temp_table.cpp
//
// Copyright (c) 2015, 2016 Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//

#include "storage/temp_table.h"

#include "catalog/schema.h"
#include "common/exception.h"
#include "common/logger.h"
#include "storage/tile_group.h"
#include "storage/tile_group_header.h"
#include "storage/tuple.h"

namespace peloton {
namespace storage {

TempTable::TempTable(const oid_t &table_oid, catalog::Schema *schema,
                     const bool own_schema)
    : AbstractTable(table_oid, schema, own_schema) {
  // We only want to instantiate a single TileGroup
  AddDefaultTileGroup();
}

TempTable::~TempTable() {
  // Nothing to see, nothing to do
}

ItemPointer TempTable::InsertTuple(
    const Tuple *tuple, UNUSED_ATTRIBUTE concurrency::Transaction *transaction,
    UNUSED_ATTRIBUTE ItemPointer **index_entry_ptr) {
  PL_ASSERT(tuple != nullptr);
  PL_ASSERT(transaction == nullptr);
  PL_ASSERT(index_entry_ptr == nullptr);

  std::shared_ptr<storage::TileGroup> tile_group;
  oid_t tuple_slot = INVALID_OID;
  oid_t tile_group_id = INVALID_OID;

  for (int i = 0, cnt = (int)tile_groups_.size(); i < cnt; i++) {
    tile_group = tile_groups_[i];
    tuple_slot = tile_group->InsertTuple(tuple);

    // now we have already obtained a new tuple slot.
    if (tuple_slot != INVALID_OID) {
      tile_group_id = tile_group->GetTileGroupId();
      LOG_TRACE("Inserted tuple into %s", GetName().c_str());
      break;
    }
  }
  // if this is the last tuple slot we can get
{'fraction_non_alphanumeric': 0.20102069747660903, 'fraction_numerical': 0.005103487383045081, 'mean_word_length': 2.5890132248219735, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '2330715', 'n_tokens_mistral': 1096, 'n_tokens_neox': 1052, 'n_words': 254}