dongjoon-hyun commented on a change in pull request #568:
URL: https://github.com/apache/orc/pull/568#discussion_r519490307



##########
File path: 
java/core/src/test/org/apache/orc/impl/TestConvertTreeReaderFactory.java
##########
@@ -65,30 +143,163 @@ public void 
testArraySizeBiggerThan1024AndConvertToDecimal() throws Exception {
     assertEquals(batch.cols.length, 1);
     assertTrue(batch.cols[0] instanceof ListColumnVector);
     assertEquals(((ListColumnVector) batch.cols[0]).child.getClass(), 
expectedColumnType);
-    return (TExpectedColumn) ((ListColumnVector) batch.cols[0]).child;
+    return (TExpectedColumnVector) ((ListColumnVector) batch.cols[0]).child;
+  }
+
+  public void testConvertToDecimal() throws Exception {
+    Decimal64ColumnVector columnVector =
+        readORCFileWithLargeArray("decimal(6,1)", Decimal64ColumnVector.class);
+    assertEquals(LARGE_BATCH_SIZE, columnVector.vector.length);
+  }
+
+  public void testConvertToVarchar() throws Exception {
+    BytesColumnVector columnVector = readORCFileWithLargeArray("varchar(10)", 
BytesColumnVector.class);
+    assertEquals(LARGE_BATCH_SIZE, columnVector.vector.length);
+  }
+
+  public void testConvertToDouble() throws Exception {
+    DoubleColumnVector columnVector = readORCFileWithLargeArray("double", 
DoubleColumnVector.class);
+    assertEquals(LARGE_BATCH_SIZE, columnVector.vector.length);
+  }
+
+  public void testConvertToInteger() throws Exception {
+    LongColumnVector columnVector = readORCFileWithLargeArray("int", 
LongColumnVector.class);
+    assertEquals(LARGE_BATCH_SIZE, columnVector.vector.length);
+  }
+
+  public void testConvertToTimestamp() throws Exception {
+    TimestampColumnVector columnVector =
+        readORCFileWithLargeArray("timestamp", TimestampColumnVector.class);
+    assertEquals(LARGE_BATCH_SIZE, columnVector.time.length);
+  }
+
+  public void testConvertToDate() throws Exception {
+    DateColumnVector columnVector = readORCFileWithLargeArray("date", 
DateColumnVector.class);
+    assertEquals(LARGE_BATCH_SIZE, columnVector.vector.length);
   }
 
   @Test
-  public void testArraySizeBiggerThan1024AndConvertToVarchar() throws 
Exception {
-    BytesColumnVector columnVector = 
testArraySizeBiggerThan1024("varchar(10)", BytesColumnVector.class);
-    assertEquals(columnVector.vector.length, 1025);
+  public void testDecimalArrayBiggerThanDefault() throws Exception {
+    String typeStr = "decimal(6,1)";
+    Class typeClass = DecimalColumnVector.class;
+
+    TypeDescription schema = TypeDescription.fromString("struct<col1:array<" + 
typeStr + ">>");
+    createORCFileWithLargeArray(schema, typeClass, 
typeClass.equals(Decimal64ColumnVector.class));
+    // Test all possible conversions
+    testConvertToDecimal();
+    testConvertToVarchar();
+    testConvertToDouble();
+    testConvertToInteger();
+    testConvertToTimestamp();
+
+    // Make sure we delete file across tests

Review comment:
       Without `try ... catch .. finally`, this will fail when one of the test 
fails.

##########
File path: 
java/core/src/test/org/apache/orc/impl/TestConvertTreeReaderFactory.java
##########
@@ -65,30 +143,163 @@ public void 
testArraySizeBiggerThan1024AndConvertToDecimal() throws Exception {
     assertEquals(batch.cols.length, 1);
     assertTrue(batch.cols[0] instanceof ListColumnVector);
     assertEquals(((ListColumnVector) batch.cols[0]).child.getClass(), 
expectedColumnType);
-    return (TExpectedColumn) ((ListColumnVector) batch.cols[0]).child;
+    return (TExpectedColumnVector) ((ListColumnVector) batch.cols[0]).child;
+  }
+
+  public void testConvertToDecimal() throws Exception {
+    Decimal64ColumnVector columnVector =
+        readORCFileWithLargeArray("decimal(6,1)", Decimal64ColumnVector.class);
+    assertEquals(LARGE_BATCH_SIZE, columnVector.vector.length);
+  }
+
+  public void testConvertToVarchar() throws Exception {
+    BytesColumnVector columnVector = readORCFileWithLargeArray("varchar(10)", 
BytesColumnVector.class);
+    assertEquals(LARGE_BATCH_SIZE, columnVector.vector.length);
+  }
+
+  public void testConvertToDouble() throws Exception {
+    DoubleColumnVector columnVector = readORCFileWithLargeArray("double", 
DoubleColumnVector.class);
+    assertEquals(LARGE_BATCH_SIZE, columnVector.vector.length);
+  }
+
+  public void testConvertToInteger() throws Exception {
+    LongColumnVector columnVector = readORCFileWithLargeArray("int", 
LongColumnVector.class);
+    assertEquals(LARGE_BATCH_SIZE, columnVector.vector.length);
+  }
+
+  public void testConvertToTimestamp() throws Exception {
+    TimestampColumnVector columnVector =
+        readORCFileWithLargeArray("timestamp", TimestampColumnVector.class);
+    assertEquals(LARGE_BATCH_SIZE, columnVector.time.length);
+  }
+
+  public void testConvertToDate() throws Exception {
+    DateColumnVector columnVector = readORCFileWithLargeArray("date", 
DateColumnVector.class);
+    assertEquals(LARGE_BATCH_SIZE, columnVector.vector.length);
   }
 
   @Test
-  public void testArraySizeBiggerThan1024AndConvertToVarchar() throws 
Exception {
-    BytesColumnVector columnVector = 
testArraySizeBiggerThan1024("varchar(10)", BytesColumnVector.class);
-    assertEquals(columnVector.vector.length, 1025);
+  public void testDecimalArrayBiggerThanDefault() throws Exception {
+    String typeStr = "decimal(6,1)";
+    Class typeClass = DecimalColumnVector.class;
+
+    TypeDescription schema = TypeDescription.fromString("struct<col1:array<" + 
typeStr + ">>");
+    createORCFileWithLargeArray(schema, typeClass, 
typeClass.equals(Decimal64ColumnVector.class));
+    // Test all possible conversions
+    testConvertToDecimal();
+    testConvertToVarchar();
+    testConvertToDouble();
+    testConvertToInteger();
+    testConvertToTimestamp();
+
+    // Make sure we delete file across tests

Review comment:
       Without `try ... catch .. finally`, this will fail when one of the tests 
fails.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to