This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch branch-1.9
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/branch-1.9 by this push:
new f4abc8253 ORC-1607: Fix `testDoubleNaNAndInfinite` to use
`TestFileDump.checkOutput`
f4abc8253 is described below
commit f4abc82530672801ad530b9ba060229ffa05f559
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Sat Feb 3 13:37:18 2024 -0800
ORC-1607: Fix `testDoubleNaNAndInfinite` to use `TestFileDump.checkOutput`
This PR aims to fix a unit test failure.
```
[ERROR] Failures:
[ERROR] TestJsonFileDump.testDoubleNaNAndInfinite:167
expected:
<{"fileName":"TestFileDump.testDump.orc","fileVersion":"0.12","writerVersion":"ORC_14","softwareVersion":"ORC
Java
unknown","numberOfRows":3,"compression":"ZSTD","compressionBufferSize":262144,"schemaString":"struct<x:double>","schema":{"columnId":0,"columnType":"STRUCT","children":{"x":{"columnId":1,"columnType":"DOUBLE"}}},"calendar":"Julian/Gregorian","stripeStatistics":[{"stripeNumber":1,"columnStatistics":[{"columnId":0,"count":3,"hasNull":false},{"columnId":1,"count":3
[...]
but was:
<{"fileName":"TestFileDump.testDump.orc","fileVersion":"0.12","writerVersion":"ORC_14","softwareVersion":"ORC
Java
2.1.0-SNAPSHOT","numberOfRows":3,"compression":"ZSTD","compressionBufferSize":262144,"schemaString":"struct<x:double>","schema":{"columnId":0,"columnType":"STRUCT","children":{"x":{"columnId":1,"columnType":"DOUBLE"}}},"calendar":"Julian/Gregorian","stripeStatistics":[{"stripeNumber":1,"columnStatistics":[{"columnId":0,"count":3,"hasNull":false},{"columnId":1,"c
[...]
[INFO]
[ERROR] Tests run: 51, Failures: 1, Errors: 0, Skipped: 0
```
Manually check on Apple Silicon MacOS.
No.
Closes #1781 from dongjoon-hyun/ORC-1607.
Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 0dee94741da24220c7a9cc978665aa7402c85c7d)
Signed-off-by: Dongjoon Hyun <[email protected]>
---
.../org/apache/orc/tools/TestJsonFileDump.java | 11 +--
.../resources/orc-file-dump-nan-and-infinite.json | 106 +++++++++++++++++++++
2 files changed, 111 insertions(+), 6 deletions(-)
diff --git a/java/tools/src/test/org/apache/orc/tools/TestJsonFileDump.java
b/java/tools/src/test/org/apache/orc/tools/TestJsonFileDump.java
index b5eebe606..225d7c34d 100644
--- a/java/tools/src/test/org/apache/orc/tools/TestJsonFileDump.java
+++ b/java/tools/src/test/org/apache/orc/tools/TestJsonFileDump.java
@@ -33,7 +33,6 @@ import org.apache.orc.Writer;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintStream;
@@ -156,14 +155,14 @@ public class TestJsonFileDump {
assertEquals(3, writer.getNumberOfRows());
PrintStream origOut = System.out;
- ByteArrayOutputStream myOut = new ByteArrayOutputStream();
+ String outputFilename = "orc-file-dump-nan-and-infinite.json";
+ FileOutputStream myOut = new FileOutputStream(workDir + File.separator +
outputFilename);
// replace stdout and run command
- System.setOut(new PrintStream(myOut, false,
StandardCharsets.UTF_8.toString()));
- FileDump.main(new String[]{testFilePath.toString(), "-j"});
+ System.setOut(new PrintStream(myOut, true, StandardCharsets.UTF_8));
+ FileDump.main(new String[]{testFilePath.toString(), "-j", "-p"});
System.out.flush();
System.setOut(origOut);
- String[] lines =
myOut.toString(StandardCharsets.UTF_8.toString()).split("\n");
-
assertEquals("{\"fileName\":\"TestFileDump.testDump.orc\",\"fileVersion\":\"0.12\",\"writerVersion\":\"ORC_14\",\"softwareVersion\":\"ORC
Java
unknown\",\"numberOfRows\":3,\"compression\":\"ZLIB\",\"compressionBufferSize\":262144,\"schemaString\":\"struct<x:double>\",\"schema\":{\"columnId\":0,\"columnType\":\"STRUCT\",\"children\":{\"x\":{\"columnId\":1,\"columnType\":\"DOUBLE\"}}},\"calendar\":\"Julian/Gregorian\",\"stripeStatistics\":[{\"stripeNumber\":1,\"columnStatistics\":[{\"c
[...]
+ TestFileDump.checkOutput(outputFilename, workDir + File.separator +
outputFilename);
}
}
diff --git a/java/tools/src/test/resources/orc-file-dump-nan-and-infinite.json
b/java/tools/src/test/resources/orc-file-dump-nan-and-infinite.json
new file mode 100644
index 000000000..08ba4c866
--- /dev/null
+++ b/java/tools/src/test/resources/orc-file-dump-nan-and-infinite.json
@@ -0,0 +1,106 @@
+{
+ "fileName": "TestFileDump.testDump.orc",
+ "fileVersion": "0.12",
+ "writerVersion": "ORC_14",
+ "softwareVersion": "ORC Java 2.1.0-SNAPSHOT",
+ "numberOfRows": 3,
+ "compression": "ZLIB",
+ "compressionBufferSize": 262144,
+ "schemaString": "struct<x:double>",
+ "schema": {
+ "columnId": 0,
+ "columnType": "STRUCT",
+ "children": {
+ "x": {
+ "columnId": 1,
+ "columnType": "DOUBLE"
+ }
+ }
+ },
+ "calendar": "Julian/Gregorian",
+ "stripeStatistics": [
+ {
+ "stripeNumber": 1,
+ "columnStatistics": [
+ {
+ "columnId": 0,
+ "count": 3,
+ "hasNull": false
+ },
+ {
+ "columnId": 1,
+ "count": 3,
+ "hasNull": false,
+ "bytesOnDisk": 23,
+ "min": NaN,
+ "max": NaN,
+ "sum": NaN,
+ "type": "DOUBLE"
+ }
+ ]
+ }
+ ],
+ "fileStatistics": [
+ {
+ "columnId": 0,
+ "count": 3,
+ "hasNull": false
+ },
+ {
+ "columnId": 1,
+ "count": 3,
+ "hasNull": false,
+ "bytesOnDisk": 23,
+ "min": NaN,
+ "max": NaN,
+ "sum": NaN,
+ "type": "DOUBLE"
+ }
+ ],
+ "stripes": [
+ {
+ "stripeNumber": 1,
+ "stripeInformation": {
+ "offset": 3,
+ "indexLength": 41,
+ "dataLength": 23,
+ "footerLength": 29,
+ "rowCount": 3
+ },
+ "streams": [
+ {
+ "columnId": 0,
+ "section": "ROW_INDEX",
+ "startOffset": 3,
+ "length": 11
+ },
+ {
+ "columnId": 1,
+ "section": "ROW_INDEX",
+ "startOffset": 14,
+ "length": 30
+ },
+ {
+ "columnId": 1,
+ "section": "DATA",
+ "startOffset": 44,
+ "length": 23
+ }
+ ],
+ "encodings": [
+ {
+ "columnId": 0,
+ "kind": "DIRECT"
+ },
+ {
+ "columnId": 1,
+ "kind": "DIRECT"
+ }
+ ]
+ }
+ ],
+ "fileLength": 293,
+ "paddingLength": 0,
+ "paddingRatio": 0.0,
+ "status": "OK"
+}