BitMatrix is a Java-based relational database management system. It provides functionalities for creating tables with defined schemas, inserting, deleting, and looking up data. The system supports both in-memory and file-backed tables, along with indexing for faster data retrieval.
BitMatrix_extracted/
└── BitMatrix
├── .mvn
│ └── wrapper
│ └── maven-wrapper.properties
├── src
│ ├── main
│ │ └── java
│ │ └── bitmatrix
│ │ ├── resource
│ │ │ ├── AndCondition.java
│ │ │ ├── Condition.java
│ │ │ ├── EqCondition.java
│ │ │ ├── OrCondition.java
│ │ │ └── SelectQuery.java
│ │ ├── BitMap.java
│ │ ├── BlockedFile.java
│ │ ├── Constants.java
│ │ ├── Index.java
│ │ ├── ITable.java
│ │ ├── IType.java
│ │ ├── MainApplication.java
│ │ ├── OrderedIndex.java
│ │ ├── Schema.java
│ │ ├── Table.java
│ │ ├── TableHeap.java
│ │ ├── Tuple.java
│ │ ├── TypeInt.java
│ │ └── TypeVarchar.java
│ └── test
│ └── java
│ └── bitmatrix
│ ├── IndexPerformance.java
│ ├── IndexTableTest.java
│ ├── IndexTest.java
│ ├── JoinTest.java
│ ├── ManyRowsTest.java
│ ├── QueryTest.java
│ ├── TableHeapTest.java
│ ├── TableTest.java
│ └── TupleTest.java
├── insertMany
├── mvnw
├── mvnw.cmd
├── pom.xml
├── rows1000
└── test.db
This project is built using Apache Maven.
- Java Development Kit (JDK) version 17 or later.
- Build system: Maven (optional)
# from repo root
find . -name "*.java" > sources.txt
mkdir -p out
javac -d out @sources.txt
# run a main class (if present)
java -cp out bitmatrix.MainApplication
To build the project and run the tests, execute the following command in the root directory:
./mvnw clean install
The MainApplication
class provides a simple demonstration of the database's features. To run it, execute the following command after building the project:
java -cp target/classes bitmatrix.MainApplication
This library provides a bit-matrix (boolean matrix backed by bits) with typical operations:
- Set/clear/get bits
- Row/column operations
- Logical operations (AND/OR/XOR)
- Transpose, population count, serialization
Explore classes under
src/
for the API (e.g.,BitMatrix
,BitVector
, and utilities).
- Schema Definition: Create tables with a defined schema, specifying column names, data types (integer and varchar), and primary keys.
- Data Manipulation: Insert, delete, and look up data in tables.
- In-Memory and File-Backed Tables: Choose between
Table
for in-memory operations andTableHeap
for file-backed storage. - Indexing: Create indexes on integer columns to speed up data retrieval.
- Querying: Perform select queries with conditions (e.g., equality, AND, OR) and projections.
- Natural Joins: Join tables based on common column names.
The project includes a comprehensive suite of JUnit tests to ensure the correctness of the database's functionality. The tests cover various aspects of the system, including:
- Tuple and schema creation.
- Data insertion, deletion, and lookup.
- Indexing.
- Querying with different conditions.
- Table joins.
bitmatrix
bitmatrix.resource