Skip to content

Commit

Permalink
Merge pull request #1126 from PsiACE/comfy-table
Browse files Browse the repository at this point in the history
[deps] switch to comfy-table from prettytable
  • Loading branch information
databend-bot authored Jul 21, 2021
2 parents 8147540 + 236e282 commit 3948c1e
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 114 deletions.
186 changes: 88 additions & 98 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/datablocks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ common-infallible = {path = "../infallible"}

# Crates.io dependencies
ahash = "0.7.4"
prettytable-rs = { version = "0.8.0"}
comfy-table = "4.0.1"
12 changes: 5 additions & 7 deletions common/datablocks/src/data_block_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
//
// SPDX-License-Identifier: Apache-2.0.

use comfy_table::Cell;
use comfy_table::Table;
use common_exception::Result;
use prettytable::format;
use prettytable::Cell;
use prettytable::Row;
use prettytable::Table;

use crate::DataBlock;

Expand Down Expand Up @@ -68,7 +66,7 @@ pub fn assert_blocks_sorted_eq_with_name(test_name: &str, expect: Vec<&str>, blo
///! Convert a series of record batches into a table
fn create_table(results: &[DataBlock]) -> Result<Table> {
let mut table = Table::new();
table.set_format(*format::consts::FORMAT_NO_LINESEP_WITH_TITLE);
table.load_preset("||--+-++| ++++++");

if results.is_empty() {
return Ok(table);
Expand All @@ -80,7 +78,7 @@ fn create_table(results: &[DataBlock]) -> Result<Table> {
for field in schema.fields() {
header.push(Cell::new(field.name()));
}
table.set_titles(Row::new(header));
table.set_header(header);

for batch in results {
for row in 0..batch.num_rows() {
Expand All @@ -90,7 +88,7 @@ fn create_table(results: &[DataBlock]) -> Result<Table> {
let str = format!("{}", series.try_get(row)?);
cells.push(Cell::new(&str));
}
table.add_row(Row::new(cells));
table.add_row(cells);
}
}

Expand Down
2 changes: 1 addition & 1 deletion common/datavalues/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ unsafe_unwrap = "^0.1.0"
ordered-float = "2.7"
serde = { version = "1.0", features = ["derive"] }
ahash = "0.7.4"
prettytable-rs = { version = "0.8.0"}
comfy-table = "4.0.1"


[dev-dependencies]
Expand Down
Loading

0 comments on commit 3948c1e

Please sign in to comment.