use of org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo in project hive by apache.
the class TestTypeInfoUtils method testDecimal.
public void testDecimal() {
DecimalTestCase[] testCases = { new DecimalTestCase("decimal", 10, 0), new DecimalTestCase("decimal(1)", 1, 0), new DecimalTestCase("decimal(25)", 25, 0), new DecimalTestCase("decimal(2,0)", 2, 0), new DecimalTestCase("decimal(2,1)", 2, 1), new DecimalTestCase("decimal(25,10)", 25, 10), new DecimalTestCase("decimal(38,20)", 38, 20) };
for (DecimalTestCase testCase : testCases) {
TypeInfo typeInfo = TypeInfoUtils.getTypeInfoFromTypeString(testCase.typeString);
DecimalTypeInfo decimalType = (DecimalTypeInfo) typeInfo;
assertEquals("Failed for " + testCase.typeString, testCase.expectedPrecision, decimalType.getPrecision());
assertEquals("Failed for " + testCase.typeString, testCase.expectedScale, decimalType.getScale());
}
}
Aggregations