[
https://issues.apache.org/jira/browse/GOBBLIN-1951?focusedWorklogId=889334&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-889334
]
ASF GitHub Bot logged work on GOBBLIN-1951:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 07/Nov/23 19:56
Start Date: 07/Nov/23 19:56
Worklog Time Spent: 10m
Work Description: homatthew commented on code in PR #3821:
URL: https://github.com/apache/gobblin/pull/3821#discussion_r1385481332
##########
gobblin-modules/gobblin-orc/src/test/java/org/apache/gobblin/writer/GobblinBaseOrcWriterTest.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * 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.gobblin.writer;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.orc.FileFormatException;
+import org.apache.orc.OrcFile;
+import org.mockito.Mockito;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.google.common.io.Files;
+
+import org.apache.gobblin.metrics.MetricContext;
+import org.apache.gobblin.metrics.event.GobblinEventBuilder;
+
+import static
org.apache.gobblin.writer.GobblinBaseOrcWriter.CORRUPTED_ORC_FILE_DELETION_EVENT;
+
+
+public class GobblinBaseOrcWriterTest {
+
+ @Test
+ public void testOrcValidation()
+ throws IOException {
+ Configuration conf = new Configuration();
+ FileSystem fs = FileSystem.getLocal(conf);
+ File tmpDir = Files.createTempDir();
+ File corruptedOrcFile = new File(tmpDir, "test.orc");
+ try (FileWriter writer = new FileWriter(corruptedOrcFile)) {
+ // write a corrupted ORC file that only contains the header but without
content
+ writer.write(OrcFile.MAGIC);
+ }
+
+ OrcFile.ReaderOptions readerOptions = new OrcFile.ReaderOptions(conf);
+
+ MetricContext mockContext = Mockito.mock(MetricContext.class);
+ Path p = new Path(corruptedOrcFile.getAbsolutePath());
+ Assert.assertThrows(FileFormatException.class,
+ () -> GobblinBaseOrcWriter.assertOrcFileIsValid(fs, p, readerOptions,
mockContext));
+
+ GobblinEventBuilder eventBuilder = new
GobblinEventBuilder(CORRUPTED_ORC_FILE_DELETION_EVENT,
GobblinBaseOrcWriter.ORC_WRITER_NAMESPACE);
Review Comment:
Do you think the warning was coming from the tests? The warning came from
the impl and not the test.
Issue Time Tracking
-------------------
Worklog Id: (was: 889334)
Time Spent: 50m (was: 40m)
> GTE emission when deleting a corrupted ORC file written by the OrcWriter
> ------------------------------------------------------------------------
>
> Key: GOBBLIN-1951
> URL: https://issues.apache.org/jira/browse/GOBBLIN-1951
> Project: Apache Gobblin
> Issue Type: Improvement
> Reporter: Matthew Ho
> Priority: Major
> Time Spent: 50m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)