| 76 | import static org.junit.jupiter.api.Assumptions.assumeTrue; |
| 77 | |
| 78 | public class TestFileDump implements TestConf { |
| 79 | |
| 80 | Path workDir = new Path(System.getProperty("test.tmp.dir")); |
| 81 | FileSystem fs; |
| 82 | Path testFilePath; |
| 83 | |
| 84 | @BeforeEach |
| 85 | public void openFileSystem () throws Exception { |
| 86 | conf.setFloat(OrcConf.STRIPE_SIZE_CHECKRATIO.getAttribute(), 0.0f); |
| 87 | fs = FileSystem.getLocal(conf); |
| 88 | testFilePath = new Path(workDir + File.separator + "TestFileDump.testDump.orc"); |
| 89 | fs.delete(testFilePath, false); |
| 90 | } |
| 91 | |
| 92 | static TypeDescription getMyRecordType() { |
| 93 | return TypeDescription.createStruct() |
| 94 | .addField("i", TypeDescription.createInt()) |
| 95 | .addField("l", TypeDescription.createLong()) |
| 96 | .addField("s", TypeDescription.createString()); |
| 97 | } |
| 98 | |
| 99 | static void appendMyRecord(VectorizedRowBatch batch, |
| 100 | int i, |
| 101 | long l, |
| 102 | String str) { |
| 103 | ((LongColumnVector) batch.cols[0]).vector[batch.size] = i; |
| 104 | ((LongColumnVector) batch.cols[1]).vector[batch.size] = l; |
| 105 | if (str == null) { |
| 106 | batch.cols[2].noNulls = false; |
| 107 | batch.cols[2].isNull[batch.size] = true; |
| 108 | } else { |
| 109 | ((BytesColumnVector) batch.cols[2]).setVal(batch.size, |
| 110 | str.getBytes(StandardCharsets.UTF_8)); |
| 111 | } |
| 112 | batch.size += 1; |
| 113 | } |
| 114 | |
| 115 | static TypeDescription getAllTypesType() { |
| 116 | return TypeDescription.createStruct() |
| 117 | .addField("b", TypeDescription.createBoolean()) |
| 118 | .addField("bt", TypeDescription.createByte()) |
| 119 | .addField("s", TypeDescription.createShort()) |
| 120 | .addField("i", TypeDescription.createInt()) |
| 121 | .addField("l", TypeDescription.createLong()) |
| 122 | .addField("f", TypeDescription.createFloat()) |
| 123 | .addField("d", TypeDescription.createDouble()) |
| 124 | .addField("de", TypeDescription.createDecimal()) |
| 125 | .addField("t", TypeDescription.createTimestamp()) |
| 126 | .addField("dt", TypeDescription.createDate()) |
| 127 | .addField("str", TypeDescription.createString()) |
| 128 | .addField("c", TypeDescription.createChar().withMaxLength(5)) |
| 129 | .addField("vc", TypeDescription.createVarchar().withMaxLength(10)) |
| 130 | .addField("m", TypeDescription.createMap( |
| 131 | TypeDescription.createString(), |
| 132 | TypeDescription.createString())) |
| 133 | .addField("a", TypeDescription.createList(TypeDescription.createInt())) |
| 134 | .addField("st", TypeDescription.createStruct() |
| 135 | .addField("i", TypeDescription.createInt()) |
nothing calls this directly
no outgoing calls
no test coverage detected