void AddTileGroup(UNUSED_ATTRIBUTE uint64_t thread_id) { // TILES std::vector<std::string> tile_column_names; std::vector<std::vector<std::string>> column_names; tile_column_names.push_back("INTEGER COL"); column_names.push_back(tile_column_names); std::vector<catalog::Schema> schemas; std::vector<catalog::Column> columns; // SCHEMA catalog::Column column1(type::TypeId::INTEGER, type::Type::GetTypeSize(type::TypeId::INTEGER), "A", true); columns.push_back(column1); std::unique_ptr<catalog::Schema> schema1(new catalog::Schema(columns)); schemas.push_back(*schema1); std::map<oid_t, std::pair<oid_t, oid_t>> column_map; column_map[0] = std::make_pair(0, 0); for (oid_t txn_itr = 0; txn_itr < 100; txn_itr++) { std::unique_ptr<storage::TileGroup> tile_group(storage::TileGroupFactory::GetTileGroup( INVALID_OID, INVALID_OID, INVALID_OID, nullptr, schemas, column_map, 3)); } }
TEST_F(TupleSchemaTests, TupleSchemaTest) { std::vector<catalog::Column> columns; catalog::Column column1(VALUE_TYPE_INTEGER, GetTypeSize(VALUE_TYPE_INTEGER), "A", true); catalog::Column column2(VALUE_TYPE_INTEGER, GetTypeSize(VALUE_TYPE_INTEGER), "B", true); catalog::Column column3(VALUE_TYPE_TINYINT, GetTypeSize(VALUE_TYPE_TINYINT), "C", true); catalog::Column column4(VALUE_TYPE_VARCHAR, 24, "D", false); columns.push_back(column1); columns.push_back(column2); columns.push_back(column3); columns.push_back(column4); catalog::Schema schema1(columns); LOG_INFO("%s", schema1.GetInfo().c_str()); catalog::Schema schema2(columns); EXPECT_EQ(schema1, schema2); std::vector<oid_t> subset{0, 2}; catalog::Schema *schema3 = catalog::Schema::CopySchema(&schema2, subset); LOG_INFO("%s", schema3->GetInfo().c_str()); EXPECT_NE(schema1, (*schema3)); delete schema3; }
/** * @brief Creates simple tile group for testing purposes. * @param backend Backend for tile group to use. * @param tuple_count Tuple capacity of this tile group. * * Tile group has two tiles, and each of them has two columns. * The first two columns have INTEGER types, the last two have TINYINT * and VARCHAR. * * IMPORTANT: If you modify this function, it is your responsibility to * fix any affected test cases. Test cases may be depending * on things like the specific number of tiles in this group. * * @return Pointer to tile group. */ storage::TileGroup *ExecutorTestsUtil::CreateTileGroup(int tuple_count) { std::vector<catalog::Column> columns; std::vector<catalog::Schema> schemas; columns.push_back(GetColumnInfo(0)); columns.push_back(GetColumnInfo(1)); catalog::Schema schema1(columns); schemas.push_back(schema1); columns.clear(); columns.push_back(GetColumnInfo(2)); columns.push_back(GetColumnInfo(3)); catalog::Schema schema2(columns); schemas.push_back(schema2); std::map<oid_t, std::pair<oid_t, oid_t>> column_map; column_map[0] = std::make_pair(0, 0); column_map[1] = std::make_pair(0, 1); column_map[2] = std::make_pair(1, 0); column_map[3] = std::make_pair(1, 1); storage::TileGroup *tile_group = storage::TileGroupFactory::GetTileGroup( INVALID_OID, INVALID_OID, TestingHarness::GetInstance().GetNextTileGroupId(), nullptr, schemas, column_map, tuple_count); return tile_group; }
//funzione che controlla a che tipo di schema corrisponde la parola e agisce di conseguenza char * onesillaba(char *s){ char* vet; if(schema1(s)) vet=silschema1(s); else if(schema2(s)) vet=silschema2(s); return vet; }
//funzione che ritorna 1 se la stringa s rispetta lo scheva vcvcv int schema2(char *s){ int i=0; for(i;s[i]!='\0';i++){ if(isvocale(s[0])){ if(schema1(s+1)) return 1; else return 0; } else return 0; } }