mirror of
https://github.com/apache/arrow.git
synced 2026-10-29 00:56:31 +08:00
PARQUET-1426: [C++] Improve parquet-dump-schema usability
This commit is contained in:
1 parent
bcd372bff2
commit
a94387d774
1 file changed
+26
-1
@@ -15,13 +15,38 @@
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
#include <getopt.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "parquet/api/reader.h"
|
||||
#include "parquet/api/schema.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
std::string filename = argv[1];
|
||||
static struct option options[] = {
|
||||
{"help", no_argument, nullptr, 'h'}
|
||||
};
|
||||
bool help_flag = false;
|
||||
int opt_index;
|
||||
do {
|
||||
opt_index = getopt_long(argc, argv, "h", options, nullptr);
|
||||
switch (opt_index) {
|
||||
case '?':
|
||||
case 'h':
|
||||
help_flag = true;
|
||||
opt_index = -1;
|
||||
break;
|
||||
}
|
||||
} while (opt_index != -1);
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc != 1 || help_flag) {
|
||||
std::cerr << "Usage: parquet-dump-schema [-h] [--help]"
|
||||
<< " <filename>" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::string filename = argv[0];
|
||||
|
||||
try {
|
||||
std::unique_ptr<parquet::ParquetFileReader> reader =
|
||||
|
||||
Reference in new issue
Block a user