Skip to content

Commit

Permalink
Spark: Replace spec.fields().isEmpty() to isUnpartitioned() (apache#2114
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Fokko authored Jan 21, 2021
1 parent 88191c8 commit 868cb76
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private List<DataFile> rewriteDataForTask(CombinedScanTask task) throws Exceptio
spec, format, locations, io.value(), encryptionManager.value(), partitionId, taskId);

TaskWriter<InternalRow> writer;
if (spec.fields().isEmpty()) {
if (spec.isUnpartitioned()) {
writer = new UnpartitionedWriter<>(spec, format, appenderFactory, fileFactory, io.value(),
Long.MAX_VALUE);
} else if (PropertyUtil.propertyAsBoolean(properties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public DataWriter<InternalRow> createDataWriter(int partitionId, long taskId, lo
spec, format, locations, io.value(), encryptionManager.value(), partitionId, taskId);
SparkAppenderFactory appenderFactory = new SparkAppenderFactory(properties, writeSchema, dsSchema, spec);

if (spec.fields().isEmpty()) {
if (spec.isUnpartitioned()) {
return new Unpartitioned24Writer(spec, format, appenderFactory, fileFactory, io.value(), targetFileSize);
} else if (partitionedFanoutEnabled) {
return new PartitionedFanout24Writer(spec, format, appenderFactory, fileFactory, io.value(), targetFileSize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ public DataWriter<InternalRow> createWriter(int partitionId, long taskId, long e
OutputFileFactory fileFactory = new OutputFileFactory(
spec, format, locations, io.value(), encryptionManager.value(), partitionId, taskId);
SparkAppenderFactory appenderFactory = new SparkAppenderFactory(properties, writeSchema, dsSchema, spec);
if (spec.fields().isEmpty()) {
if (spec.isUnpartitioned()) {
return new Unpartitioned3Writer(spec, format, appenderFactory, fileFactory, io.value(), targetFileSize);
} else if (partitionedFanoutEnabled) {
return new PartitionedFanout3Writer(
Expand Down

0 comments on commit 868cb76

Please sign in to comment.