Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:4paradigm OpenMLDB Table Test

From Leeroopedia
Knowledge Sources
Domains Database, Testing
Last Updated 2026-10-12 00:00 GMT

Overview

Concrete tool for validating the Table and TableIterator implementations through Google Test unit tests covering single-index and multi-index iteration, timestamp seeking, and row insertion.

Description

The table_test.cc file provides unit tests for the Table class from table_impl.cc. Tests verify single-index iteration with timestamp ordering, multi-index table support, traverse iterators for full scans, and correct row encoding/decoding using RowBuilder and RowView. Test fixtures define table schemas with varchar and int64 columns, create indexes with first keys and second keys (timestamps), and validate iterator behavior.

Usage

Run these tests when modifying the table storage implementation to verify correctness of index initialization, row insertion, and all iterator types.

Code Reference

Source Location

Signature

class TableTest : public ::testing::Test { };

TEST_F(TableTest, SingleIndexIterator);
TEST_F(TableTest, SingleIndexIteratorWithDescTs);
TEST_F(TableTest, MultiIndexIterator);
TEST_F(TableTest, TraverseIterator);
TEST_F(TableTest, WindowIterator);

Import

#include "storage/table_impl.h"
#include "codec/fe_row_codec.h"
#include <gtest/gtest.h>

I/O Contract

Inputs

Name Type Required Description
Table instance Table Yes Table with schema and indexes initialized
encoded rows std::string Yes Row data built via RowBuilder
primary keys std::string Yes PK values for iterator creation

Outputs

Name Type Description
TEST results gtest output Pass/fail status for each test case

Usage Examples

Running Table Tests

# Build and run table tests
cd hybridse/examples/toydb
mkdir -p build && cd build
cmake .. && make table_test
./table_test

# Run specific test
./table_test --gtest_filter=TableTest.SingleIndexIterator

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment