sql-cli 1.67.2

SQL query tool for CSV/JSON with both interactive TUI and non-interactive CLI modes - perfect for exploration and automation
Documentation
use crate::data::datatable::{DataColumn, DataRow, DataTable, DataValue};

fn create_test_table() -> DataTable {
    let mut table = DataTable::new("test");
    table.add_column(DataColumn::new("id"));
    table.add_column(DataColumn::new("quantity"));
    table.add_column(DataColumn::new("price"));

    table
        .add_row(DataRow::new(vec![
            DataValue::Integer(1),
            DataValue::Integer(10),
            DataValue::Float(100.5),
        ]))
        .unwrap();
    table
        .add_row(DataRow::new(vec![
            DataValue::Integer(2),
            DataValue::Integer(5),
            DataValue::Float(200.25),
        ]))
        .unwrap();

    table
}

#[test]
#[ignore = "Need to test through execute method with proper SQL"]
fn test_duplicate_columns_get_aliased() {
    // The duplicate column handling is implemented in query_engine.rs
    // in the apply_select_items method.
    // When duplicate columns are selected, they get auto-aliased:
    // - First occurrence: "quantity"
    // - Second occurrence: "quantity_1"
    // - Third occurrence: "quantity_2"
    // This allows queries like: SELECT quantity, quantity * price as total, quantity
}

#[test]
#[ignore = "Need to test through execute method with proper SQL"]
fn test_duplicate_with_computed_columns() {
    // The duplicate column handling also works with computed columns.
    // A query like: SELECT quantity * price as total, quantity, total
    // Would create columns: total, quantity, total_1
    // This ensures users can select the same column multiple times
    // especially when using computed expressions.
}