Skip to content

Commit

Permalink
fix false positive page index indication
Browse files Browse the repository at this point in the history
  • Loading branch information
XiangpengHao committed Dec 23, 2024
1 parent d2ca256 commit e69b4a2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
8 changes: 5 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use schema::SchemaSection;

mod file_reader;
mod query_results;
mod row_group;
mod row_group_column;

mod metadata;
use metadata::MetadataSection;
Expand Down Expand Up @@ -70,6 +70,8 @@ impl ParquetInfo {
let first_row_group = metadata.row_groups().first();
let first_column = first_row_group.and_then(|rg| rg.columns().first());

let has_column_index = metadata.column_index().map(|ci| ci.first().map(|c| c.len()> 0)).flatten().unwrap_or(false);
let has_page_index = metadata.offset_index().map(|ci| ci.first().map(|c| c.len()> 0)).flatten().unwrap_or(false);
Ok(Self {
file_size: compressed_size,
uncompressed_size,
Expand All @@ -80,8 +82,8 @@ impl ParquetInfo {
has_row_group_stats: first_column
.map(|c| c.statistics().is_some())
.unwrap_or(false),
has_column_index: metadata.column_index().is_some(),
has_page_index: metadata.offset_index().is_some(),
has_column_index,
has_page_index,
has_bloom_filter: first_column
.map(|c| c.bloom_filter_offset().is_some())
.unwrap_or(false),
Expand Down
10 changes: 2 additions & 8 deletions src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ pub fn MetadataSection(parquet_info: super::ParquetInfo) -> impl IntoView {
let has_column_index = parquet_info.has_column_index;
let has_row_group_stats = parquet_info.has_row_group_stats;

// Create a signal for the selected row group
let (selected_row_group, set_selected_row_group) = signal(0);

view! {
<div class="bg-white rounded-lg border border-gray-300 p-6">
<div class="grid grid-cols-2 gap-6">
Expand Down Expand Up @@ -111,11 +108,8 @@ pub fn MetadataSection(parquet_info: super::ParquetInfo) -> impl IntoView {
Some(
view! {
<div>
<super::row_group::RowGroupSection
parquet_info=parquet_info.clone()
selected_row_group=selected_row_group
set_selected_row_group=set_selected_row_group
/>
<super::row_group_column::RowGroupColumn parquet_info=parquet_info
.clone() />
</div>
},
)
Expand Down
8 changes: 3 additions & 5 deletions src/row_group.rs → src/row_group_column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,8 @@ fn stats_to_string(stats: Option<Statistics>) -> String {
}

#[component]
pub fn RowGroupSection(
parquet_info: super::ParquetInfo,
selected_row_group: ReadSignal<usize>,
set_selected_row_group: WriteSignal<usize>,
) -> impl IntoView {
pub fn RowGroupColumn(parquet_info: super::ParquetInfo) -> impl IntoView {
let (selected_row_group, set_selected_row_group) = signal(0);
let (selected_column, set_selected_column) = signal(0);

let parquet_info_clone = parquet_info.clone();
Expand All @@ -132,6 +129,7 @@ pub fn RowGroupSection(
let statistics = col.statistics().cloned();
let has_bloom_filter = col.bloom_filter_offset().is_some();
let encodings = col.encodings().clone();

(
compressed_size,
uncompressed_size,
Expand Down

0 comments on commit e69b4a2

Please sign in to comment.