| /* |
| * 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. |
| */ |
| |
| package org.apache.datafusion; |
| |
| /** |
| * Configuration knobs for writing parquet, passed to {@link DataFrame#writeParquet(String, |
| * ParquetWriteOptions)}. |
| * |
| * <p>Mirrors a subset of DataFusion's {@code DataFrameWriteOptions} and {@code |
| * TableParquetOptions}. All setters return {@code this} for fluent chaining. Defaults: all fields |
| * {@code null} (meaning the DataFusion default is used). |
| * |
| * <p>Path semantics: when {@link #singleFileOutput(boolean)} is {@code true}, the path passed to |
| * {@code writeParquet} is the literal output filename. When left unset (the default), the path is a |
| * directory that DataFusion populates with one or more part-files. |
| */ |
| public final class ParquetWriteOptions { |
| |
| private String compression; |
| private Boolean singleFileOutput; |
| |
| /** |
| * Compression codec spec, passed verbatim to DataFusion. Examples: {@code "snappy"}, {@code |
| * "zstd(3)"}, {@code "gzip(6)"}, {@code "lz4"}, {@code "uncompressed"}. Invalid values surface as |
| * {@link RuntimeException} at write time. |
| */ |
| public ParquetWriteOptions compression(String spec) { |
| this.compression = spec; |
| return this; |
| } |
| |
| /** |
| * When {@code true}, write to a single file at the supplied path. When left unset (the default), |
| * the path is treated as a directory and DataFusion writes one or more part-files. |
| */ |
| public ParquetWriteOptions singleFileOutput(boolean v) { |
| this.singleFileOutput = v; |
| return this; |
| } |
| |
| String compression() { |
| return compression; |
| } |
| |
| Boolean singleFileOutput() { |
| return singleFileOutput; |
| } |
| } |