CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-com-dmetasoul--lakesoul-common

Core utilities and metadata management library for the LakeSoul lakehouse framework providing database connection management, RBAC authorization, protobuf serialization, and native library integration.

Pending
Overview
Eval results
Files

metadata-management.mddocs/

Metadata Management

The metadata management system provides comprehensive operations for managing tables, partitions, namespaces, and data commits in the LakeSoul lakehouse framework. The central DBManager class serves as the primary interface for all metadata operations.

Capabilities

DBManager Class

The main entry point for all metadata operations, providing high-level methods for table lifecycle, partition management, and data commit operations.

/**
 * Central metadata management class providing high-level operations
 * for tables, partitions, and data commits
 */
public class DBManager {
    /** 
     * Create new DBManager instance with default DAO configuration
     */
    public DBManager();
}

Table Operations

Comprehensive table management including creation, querying, listing, and deletion operations.

/**
 * Check if table exists by table path
 * @param tablePath Full path to the table
 * @return true if table exists, false otherwise
 */
public boolean isTableExists(String tablePath);

/**
 * Check if table exists by table name and namespace
 * @param tableName Short table name
 * @param tableNamespace Table namespace (defaults to "default" if null)
 * @return true if table exists, false otherwise
 */
public boolean isTableExistsByTableName(String tableName, String tableNamespace);

/**
 * Check if table exists by table name in default namespace
 * @param tableName Short table name
 * @return true if table exists, false otherwise
 */
public boolean isTableExistsByTableName(String tableName);

/**
 * Check if specific table ID exists for given table path
 * @param tablePath Full path to the table
 * @param tableId Unique table identifier
 * @return true if table ID exists for path, false otherwise
 */
public boolean isTableIdExists(String tablePath, String tableId);

/**
 * Create a new table with comprehensive metadata
 * @param tableId Unique table identifier
 * @param namespace Table namespace
 * @param tableName Short table name (can be empty)
 * @param tablePath Full table storage path
 * @param tableSchema JSON schema definition
 * @param properties Table properties as JSONObject
 * @param partitions Partition configuration string
 */
public void createNewTable(String tableId, String namespace, String tableName, 
                          String tablePath, String tableSchema, JSONObject properties, 
                          String partitions);

/**
 * Get table information by unique table ID
 * @param tableId Unique table identifier
 * @return TableInfo object or null if not found
 */
public TableInfo getTableInfoByTableId(String tableId);

/**
 * Get table information by table path
 * @param tablePath Full path to the table
 * @return TableInfo object or null if not found
 */
public TableInfo getTableInfoByPath(String tablePath);

/**
 * Get table information by table name in default namespace
 * @param tableName Short table name
 * @return TableInfo object or null if not found
 */
public TableInfo getTableInfoByName(String tableName);

/**
 * Get table information by table name and namespace
 * @param tableName Short table name
 * @param namespace Table namespace
 * @return TableInfo object or null if not found
 */
public TableInfo getTableInfoByNameAndNamespace(String tableName, String namespace);

/**
 * List all table paths in the system
 * @return List of all table paths
 */
public List<String> listTables();

/**
 * List table names in specific namespace
 * @param tableNamespace Target namespace
 * @return List of table names in the namespace
 */
public List<String> listTableNamesByNamespace(String tableNamespace);

/**
 * List table paths in specific namespace
 * @param tableNamespace Target namespace
 * @return List of table paths in the namespace
 */
public List<String> listTablePathsByNamespace(String tableNamespace);

/**
 * Get all table information objects in specific namespace
 * @param tableNamespace Target namespace
 * @return List of TableInfo objects
 */
public List<TableInfo> getTableInfosByNamespace(String tableNamespace);

/**
 * Update table schema for existing table
 * @param tableId Unique table identifier
 * @param tableSchema New JSON schema definition
 */
public void updateTableSchema(String tableId, String tableSchema);

/**
 * Update table properties
 * @param tableId Unique table identifier
 * @param properties New properties as JSON string
 */
public void updateTableProperties(String tableId, String properties);

/**
 * Update table short name mapping
 * @param tablePath Full table path
 * @param tableId Unique table identifier
 * @param tableName Short table name
 * @param tableNamespace Table namespace
 */
public void updateTableShortName(String tablePath, String tableId, String tableName, 
                                String tableNamespace);

/**
 * Delete table and all associated metadata
 * @param tablePath Full table path
 * @param tableId Unique table identifier
 * @param tableNamespace Table namespace
 */
public void deleteTableInfo(String tablePath, String tableId, String tableNamespace);

/**
 * Get table path from short table name
 * @param tableName Short table name
 * @param tableNamespace Table namespace
 * @return Full table path or null if not found
 */
public String getTablePathFromShortTableName(String tableName, String tableNamespace);

Partition Operations

Comprehensive partition management including version control, snapshot handling, and incremental operations.

/**
 * Get latest partition information for specific partition
 * @param tableId Unique table identifier
 * @param partitionDesc Partition description/key
 * @return Latest PartitionInfo or null if not found
 */
public PartitionInfo getSinglePartitionInfo(String tableId, String partitionDesc);

/**
 * Get partition information for specific version
 * @param tableId Unique table identifier
 * @param partitionDesc Partition description/key
 * @param version Specific partition version
 * @return PartitionInfo for the version or null if not found
 */
public PartitionInfo getSinglePartitionInfo(String tableId, String partitionDesc, int version);

/**
 * Get all partition information for a table
 * @param tableId Unique table identifier
 * @return List of all PartitionInfo objects for the table
 */
public List<PartitionInfo> getAllPartitionInfo(String tableId);

/**
 * Get all versions of a specific partition
 * @param tableId Unique table identifier
 * @param partitionDesc Partition description/key
 * @return List of PartitionInfo objects for all versions
 */
public List<PartitionInfo> getOnePartitionVersions(String tableId, String partitionDesc);

/**
 * Get all partition descriptions for a table
 * @param tableId Unique table identifier
 * @return List of partition description strings
 */
public List<String> getTableAllPartitionDesc(String tableId);

/**
 * Get latest timestamp for specific partition
 * @param tableId Unique table identifier
 * @param partitionDesc Partition description/key
 * @return Latest timestamp in milliseconds
 */
public long getLastedTimestamp(String tableId, String partitionDesc);

/**
 * Get latest version up to specific time
 * @param tableId Unique table identifier
 * @param partitionDesc Partition description/key
 * @param utcMills Timestamp in UTC milliseconds
 * @return Latest version number up to the specified time
 */
public int getLastedVersionUptoTime(String tableId, String partitionDesc, long utcMills);

/**
 * Get timestamp of latest version up to specific time
 * @param tableId Unique table identifier
 * @param partitionDesc Partition description/key
 * @param utcMills Timestamp in UTC milliseconds
 * @return Timestamp of latest version up to specified time
 */
public long getLastedVersionTimestampUptoTime(String tableId, String partitionDesc, long utcMills);

/**
 * Get incremental partitions between version range
 * @param tableId Unique table identifier
 * @param partitionDesc Partition description/key
 * @param startVersion Starting version (inclusive)
 * @param endVersion Ending version (inclusive)
 * @return List of PartitionInfo objects in version range
 */
public List<PartitionInfo> getIncrementalPartitions(String tableId, String partitionDesc, 
                                                   int startVersion, int endVersion);

/**
 * Get incremental partitions between timestamp range
 * @param tableId Unique table identifier
 * @param partitionDesc Partition description/key
 * @param startTimestamp Starting timestamp (inclusive)
 * @param endTimestamp Ending timestamp (inclusive)
 * @return List of PartitionInfo objects in timestamp range
 */
public List<PartitionInfo> getIncrementalPartitionsFromTimestamp(String tableId, String partitionDesc,
                                                                long startTimestamp, long endTimestamp);

/**
 * Delete all partition metadata for table
 * @param tableId Unique table identifier
 */
public void deletePartitionInfoByTableId(String tableId);

/**
 * Delete specific partition metadata
 * @param tableId Unique table identifier
 * @param partitionDesc Partition description/key
 */
public void deletePartitionInfoByTableAndPartition(String tableId, String partitionDesc);

/**
 * Logically delete all partitions (mark as deleted)
 * @param tableId Unique table identifier
 */
public void logicDeletePartitionInfoByTableId(String tableId);

/**
 * Logically delete specific partition (mark as deleted)
 * @param tableId Unique table identifier
 * @param partitionDesc Partition description/key
 */
public void logicDeletePartitionInfoByRangeId(String tableId, String partitionDesc);

/**
 * Rollback partition to specific version
 * @param tableId Unique table identifier
 * @param partitionDesc Partition description/key
 * @param version Target version to rollback to
 */
public void rollbackPartitionByVersion(String tableId, String partitionDesc, int version);

Namespace Operations

Namespace management for organizing tables and implementing multi-tenancy.

/**
 * Check if namespace exists
 * @param table_namespace Namespace name
 * @return true if namespace exists, false otherwise
 */
public boolean isNamespaceExists(String table_namespace);

/**
 * List all namespaces in the system
 * @return List of namespace names
 */
public List<String> listNamespaces();

/**
 * Create new namespace
 * @param name Namespace name
 * @param properties Namespace properties as JSON string
 * @param comment Optional comment (can be null)
 */
public void createNewNamespace(String name, String properties, String comment);

/**
 * Get namespace information by name
 * @param namespace Namespace name
 * @return Namespace object or null if not found
 */
public Namespace getNamespaceByNamespace(String namespace);

/**
 * Update namespace properties
 * @param namespace Namespace name
 * @param properties New properties as JSON string
 */
public void updateNamespaceProperties(String namespace, String properties);

/**
 * Delete namespace
 * @param namespace Namespace name to delete
 */
public void deleteNamespace(String namespace);

Data Commit Operations

High-level data commit operations supporting ACID transactions and conflict resolution.

/**
 * Commit data changes with comprehensive conflict resolution
 * @param metaInfo Metadata information containing partition and table info
 * @param changeSchema Whether schema changes are included
 * @param commitOp Type of commit operation
 * @return true if commit successful, false if conflicts occurred
 */
public boolean commitData(MetaInfo metaInfo, boolean changeSchema, CommitOp commitOp);

/**
 * Batch commit multiple data commit information
 * @param listData List of DataCommitInfo objects to commit
 * @return true if batch commit successful, false otherwise
 */
public boolean batchCommitDataCommitInfo(List<DataCommitInfo> listData);

/**
 * Commit single data commit with read partition info
 * @param dataCommitInfo Data commit information
 * @param readPartitionInfoList List of partitions read during operation
 */
public void commitDataCommitInfo(DataCommitInfo dataCommitInfo, 
                                List<PartitionInfo> readPartitionInfoList);

/**
 * Get all data file information for a partition
 * @param partitionInfo Partition information object
 * @return List of DataCommitInfo objects containing file operations
 */
public List<DataCommitInfo> getTableSinglePartitionDataInfo(PartitionInfo partitionInfo);

/**
 * Get partition snapshot for specific version
 * @param tableId Unique table identifier
 * @param partitionDesc Partition description/key
 * @param version Specific version number
 * @return List of DataCommitInfo objects for the snapshot
 */
public List<DataCommitInfo> getPartitionSnapshot(String tableId, String partitionDesc, int version);

/**
 * Get data commit information from UUIDs
 * @param tableId Unique table identifier
 * @param partitionDesc Partition description/key
 * @param dataCommitUUIDs List of commit UUIDs
 * @return List of DataCommitInfo objects
 */
public List<DataCommitInfo> getDataCommitInfosFromUUIDs(String tableId, String partitionDesc,
                                                        List<Uuid> dataCommitUUIDs);

/**
 * Delete data commit information
 * @param tableId Unique table identifier
 * @param partitionDesc Partition description/key
 * @param commitId Specific commit ID to delete
 */
public void deleteDataCommitInfo(String tableId, String partitionDesc, UUID commitId);

/**
 * Delete all data commit information for partition
 * @param tableId Unique table identifier
 * @param partitionDesc Partition description/key
 */
public void deleteDataCommitInfo(String tableId, String partitionDesc);

/**
 * Delete all data commit information for table
 * @param tableId Unique table identifier
 */
public void deleteDataCommitInfo(String tableId);

Utility Operations

Utility operations for testing, cleanup, and metadata management.

/**
 * Clean all metadata (for testing purposes only)
 * WARNING: This will delete all metadata in the system
 */
public void cleanMeta();

/**
 * Get file paths that should be deleted up to specific time
 * @param tableId Unique table identifier
 * @param partitionDesc Partition description/key (can be empty for all partitions)
 * @param utcMills Timestamp in UTC milliseconds
 * @return List of file paths that can be safely deleted
 */
public List<String> getDeleteFilePath(String tableId, String partitionDesc, long utcMills);

/**
 * Delete partition metadata and get associated file paths
 * @param tableId Unique table identifier
 * @param partitionDesc Partition description/key
 * @return List of file paths associated with deleted partition
 */
public List<String> deleteMetaPartitionInfo(String tableId, String partitionDesc);

/**
 * Logically drop columns from table
 * @param tableId Unique table identifier
 * @param droppedColumn List of column names to mark as dropped
 */
public void logicallyDropColumn(String tableId, List<String> droppedColumn);

/**
 * Remove logically dropped column information
 * @param tableId Unique table identifier
 */
public void removeLogicallyDropColumn(String tableId);

Usage Examples:

import com.dmetasoul.lakesoul.meta.DBManager;
import com.dmetasoul.lakesoul.meta.entity.*;
import com.alibaba.fastjson.JSONObject;
import java.util.List;

// Initialize DBManager
DBManager dbManager = new DBManager();

// Create namespace
dbManager.createNewNamespace("analytics", "{\"owner\":\"data_team\"}", "Analytics namespace");

// Create table
JSONObject props = new JSONObject();
props.put("format", "parquet");
props.put("compression", "snappy");

dbManager.createNewTable(
    "tbl_001",
    "analytics", 
    "user_events",
    "/data/analytics/user_events",
    "{\"type\":\"struct\",\"fields\":[...]}",
    props,
    "date,hour"
);

// Check table existence
boolean exists = dbManager.isTableExists("/data/analytics/user_events");
if (exists) {
    // Get table info
    TableInfo tableInfo = dbManager.getTableInfoByPath("/data/analytics/user_events");
    System.out.println("Table schema: " + tableInfo.getTableSchema());
    
    // List partitions
    List<PartitionInfo> partitions = dbManager.getAllPartitionInfo("tbl_001");
    for (PartitionInfo partition : partitions) {
        System.out.println("Partition: " + partition.getPartitionDesc() + 
                          ", Version: " + partition.getVersion());
    }
}

// List tables in namespace
List<String> tables = dbManager.listTablePathsByNamespace("analytics");
System.out.println("Tables in analytics: " + tables);

Install with Tessl CLI

npx tessl i tessl/maven-com-dmetasoul--lakesoul-common

docs

authorization-security.md

configuration-management.md

database-connection.md

entity-models.md

index.md

metadata-management.md

native-operations.md

scala-functional-api.md

tile.json