Skip to content

Commit 9e59782

Browse files
authored
chore: remove useless allow dead code (#206)
1 parent 587389b commit 9e59782

12 files changed

Lines changed: 6 additions & 53 deletions

File tree

bindings/c/src/error.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use crate::types::paimon_bytes;
2121

2222
/// Error codes for paimon C API.
2323
#[repr(i32)]
24-
#[allow(dead_code)]
2524
pub enum PaimonErrorCode {
2625
Unexpected = 0,
2726
Unsupported = 1,

crates/paimon/src/catalog/filesystem.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ pub struct FileSystemCatalog {
6767
warehouse: String,
6868
}
6969

70-
#[allow(dead_code)]
7170
impl FileSystemCatalog {
7271
/// Create a new filesystem catalog from configuration options.
7372
///

crates/paimon/src/catalog/mod.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,18 @@ pub use rest::*;
3535
use serde::{Deserialize, Serialize};
3636

3737
/// Splitter for system table names (e.g. `table$snapshots`).
38-
#[allow(dead_code)]
3938
pub const SYSTEM_TABLE_SPLITTER: &str = "$";
4039
/// Prefix for branch in object name (e.g. `table$branch_foo`).
41-
#[allow(dead_code)]
4240
pub const SYSTEM_BRANCH_PREFIX: &str = "branch_";
4341
/// Default main branch name.
44-
#[allow(dead_code)]
4542
pub const DEFAULT_MAIN_BRANCH: &str = "main";
4643
/// Database value when the database is not known; [`Identifier::full_name`] returns only the object.
4744
pub const UNKNOWN_DATABASE: &str = "unknown";
4845
/// Database property key for custom location. Not allowed for filesystem catalog.
4946
/// See [Catalog.DB_LOCATION_PROP](https://github.com/apache/paimon/blob/release-1.3/paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java).
50-
#[allow(dead_code)] // Public API - allow unused until used by external code
5147
pub const DB_LOCATION_PROP: &str = "location";
5248
/// Suffix for database directory names in the filesystem (e.g. `mydb.db`).
5349
/// See [Catalog.DB_SUFFIX](https://github.com/apache/paimon/blob/release-1.3/paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java).
54-
#[allow(dead_code)] // Public API - allow unused until used by external code
5550
pub const DB_SUFFIX: &str = ".db";
5651

5752
// ======================= Identifier ===============================
@@ -70,7 +65,6 @@ pub struct Identifier {
7065
object: String,
7166
}
7267

73-
#[allow(dead_code)]
7468
impl Identifier {
7569
/// Create an identifier from database and object name.
7670
pub fn new(database: impl Into<String>, object: impl Into<String>) -> Self {
@@ -128,7 +122,6 @@ use crate::Result;
128122
///
129123
/// Corresponds to [org.apache.paimon.catalog.Catalog](https://github.com/apache/paimon/blob/release-1.3/paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java).
130124
#[async_trait]
131-
#[allow(dead_code)]
132125
pub trait Catalog: Send + Sync {
133126
// ======================= database methods ===============================
134127

crates/paimon/src/deletion_vector/core.rs

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
// KIND, either express or implied. See the License for the
1515
// specific language governing permissions and limitations
1616
// under the License.
17-
#![allow(dead_code)]
1817

1918
use roaring::RoaringBitmap;
2019
use std::sync::Arc;
@@ -50,18 +49,6 @@ impl DeletionVector {
5049
}
5150
}
5251

53-
/// Check if a row at the given position is deleted
54-
pub fn is_deleted(&self, row_position: u64) -> crate::Result<bool> {
55-
// RoaringBitmap32 in Java supports up to 2^31-1, so we check i32 range
56-
if row_position > i32::MAX as u64 {
57-
return Err(crate::Error::UnexpectedError {
58-
message: format!("The file has too many rows, RoaringBitmap32 only supports files with row count not exceeding {}.", i32::MAX),
59-
source: None,
60-
});
61-
}
62-
Ok(self.bitmap.contains(row_position as u32))
63-
}
64-
6552
/// Returns an iterator over deleted positions that supports [DeletionVectorIterator::advance_to].
6653
/// Required for efficient row selection building when skipping row groups (avoid re-scanning
6754
/// deletes in skipped ranges).
@@ -74,18 +61,14 @@ impl DeletionVector {
7461
DeletionVectorIterator::new(self.bitmap.iter().map(u64::from).collect())
7562
}
7663

77-
/// Get the number of deleted rows (cardinality)
78-
pub fn deleted_count(&self) -> u64 {
79-
self.bitmap.len()
80-
}
81-
8264
/// Check if the deletion vector is empty (no deleted rows)
8365
pub fn is_empty(&self) -> bool {
8466
self.bitmap.is_empty()
8567
}
8668

8769
/// Get the underlying bitmap (read-only)
88-
pub fn bitmap(&self) -> &RoaringBitmap {
70+
#[cfg(test)]
71+
fn bitmap(&self) -> &RoaringBitmap {
8972
&self.bitmap
9073
}
9174

@@ -225,9 +208,5 @@ mod tests {
225208

226209
let expected_bitmap = RoaringBitmap::from_iter([1u32, 2u32]);
227210
assert_eq!(dv.bitmap(), &expected_bitmap, "bitmap should be [1, 2]");
228-
assert_eq!(dv.deleted_count(), 2);
229-
assert!(dv.is_deleted(1).unwrap());
230-
assert!(dv.is_deleted(2).unwrap());
231-
assert!(!dv.is_deleted(0).unwrap());
232211
}
233212
}

crates/paimon/src/deletion_vector/factory.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
#![allow(dead_code)]
19-
2018
use crate::deletion_vector::core::DeletionVector;
2119
use crate::io::{FileIO, FileRead};
2220
use crate::spec::DataFileMeta;

crates/paimon/src/spec/data_file.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,6 @@ impl Display for DataFileMeta {
428428
}
429429
}
430430

431-
#[allow(dead_code)]
432431
impl DataFileMeta {
433432
/// Returns the row ID range `[first_row_id, first_row_id + row_count - 1]` if `first_row_id` is set.
434433
pub fn row_id_range(&self) -> Option<(i64, i64)> {

crates/paimon/src/spec/index_manifest.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use crate::Result;
2828
/// Manifest entry for index file.
2929
///
3030
/// Impl Reference: <https://github.com/apache/paimon/blob/release-0.8.2/paimon-core/src/main/java/org/apache/paimon/manifest/IndexManifestEntry.java>
31-
#[allow(dead_code)] // Part of spec; used when index manifest is implemented.
3231
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
3332
pub struct IndexManifestEntry {
3433
#[serde(rename = "_KIND")]

crates/paimon/src/spec/manifest.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ use crate::Result;
3030
/// Impl Reference: <https://github.com/apache/paimon/blob/release-1.3/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestFile.java>
3131
pub struct Manifest;
3232

33-
#[allow(dead_code)]
3433
impl Manifest {
3534
/// Read manifest entries from a file.
3635
///

crates/paimon/src/spec/objects_file.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use serde::de::DeserializeOwned;
1919
use serde_avro_fast::object_container_file_encoding::Reader;
2020
use snafu::ResultExt;
2121

22-
#[allow(dead_code)]
2322
pub fn from_avro_bytes<T: DeserializeOwned>(bytes: &[u8]) -> crate::Result<Vec<T>> {
2423
let mut reader = Reader::from_slice(bytes)
2524
.whatever_context::<_, crate::Error>("read avro object container")?;

crates/paimon/src/table/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ pub struct Table {
5050
schema_manager: SchemaManager,
5151
}
5252

53-
#[allow(dead_code)]
5453
impl Table {
5554
/// Create a new table.
5655
pub fn new(

0 commit comments

Comments
 (0)