JingsongLi commented on code in PR #66:
URL: https://github.com/apache/paimon-mosaic/pull/66#discussion_r3490699483


##########
cli/src/main.rs:
##########
@@ -0,0 +1,823 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+mod filter;
+mod fmt;
+mod input;
+mod jsonout;
+
+use std::path::{Path, PathBuf};
+use std::process::ExitCode;
+
+use arrow::array::RecordBatch;
+use clap::{Parser, Subcommand};
+use paimon_mosaic_core::reader::{MosaicReader, ReaderAccess};
+
+use crate::input::FileInput;
+
+/// Mosaic file inspector — the cat/meta/schema/pages toolkit (cf. 
parquet-cli).
+#[derive(Parser)]
+#[command(name = "mosaic", version, about)]
+struct Cli {
+    #[command(subcommand)]
+    cmd: Cmd,
+}
+
+#[derive(Subcommand)]
+enum Cmd {
+    /// Print the column names, types, nullability and bucket assignment.
+    Schema {
+        file: PathBuf,
+        #[arg(long)]
+        json: bool,
+    },
+    /// Print row-group / bucket / stats metadata.
+    Meta {
+        file: PathBuf,
+        #[arg(long)]
+        json: bool,
+    },
+    /// Print per-column encoding and slot size for each row group.
+    Pages {
+        file: PathBuf,
+        /// Comma-separated columns to show (default: all).
+        #[arg(short, long)]
+        columns: Option<String>,
+        #[arg(long)]
+        json: bool,
+    },
+    /// Print rows as a table (default: first 10; use --all to scan all).

Review Comment:
   This reintroduces the Parquet CLI mismatch we fixed earlier. In parquet-cli, 
`cat` defaults to no row limit and `head` is the preview command with default 
10 rows; adding `--all` makes `mosaic cat file` behave like `head`, so users 
coming from parquet-cli will silently see only a preview. Please keep `cat` 
unbounded by default and address memory usage by streaming/bounded table 
formatting rather than changing the command semantics. The docs/tests added in 
this commit should be updated accordingly too.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to