1717 */
1818package org .apache .drill .exec .fn .impl ;
1919
20- import java .math .BigDecimal ;
21- import java .time .LocalDate ;
22- import java .time .LocalDateTime ;
23- import java .time .LocalTime ;
24- import java .util .HashMap ;
25- import java .util .HashSet ;
26- import java .util .List ;
27- import java .util .Map ;
28- import java .util .Set ;
29-
20+ import com .google .common .collect .Lists ;
21+ import com .google .common .collect .Maps ;
3022import org .apache .drill .categories .SqlFunctionTest ;
3123import org .apache .drill .categories .UnlikelyTest ;
3224import org .apache .drill .common .exceptions .UserRemoteException ;
3325import org .apache .drill .common .types .TypeProtos ;
3426import org .apache .drill .common .types .Types ;
3527import org .apache .drill .exec .planner .physical .PlannerSettings ;
3628import org .apache .drill .exec .record .BatchSchema ;
37- import org .apache .drill .exec .record .MaterializedField ;
3829import org .apache .drill .exec .record .BatchSchemaBuilder ;
30+ import org .apache .drill .exec .record .MaterializedField ;
3931import org .apache .drill .exec .record .metadata .SchemaBuilder ;
4032import org .apache .drill .exec .vector .IntervalDayVector ;
4133import org .apache .drill .exec .vector .IntervalYearVector ;
4840import org .junit .experimental .categories .Category ;
4941import org .junit .rules .ExpectedException ;
5042
51- import com .google .common .collect .Lists ;
52- import com .google .common .collect .Maps ;
43+ import java .math .BigDecimal ;
44+ import java .time .LocalDate ;
45+ import java .time .LocalDateTime ;
46+ import java .time .LocalTime ;
47+ import java .util .HashMap ;
48+ import java .util .HashSet ;
49+ import java .util .List ;
50+ import java .util .Map ;
51+ import java .util .Set ;
5352
5453import static org .apache .drill .common .types .TypeProtos .MinorType .BIGINT ;
5554import static org .apache .drill .common .types .TypeProtos .MinorType .BIT ;
@@ -614,9 +613,9 @@ public void testCastNegativeDecimalToVarChar() throws Exception {
614613
615614 @ Test
616615 public void testCastDecimalLiteral () throws Exception {
617- String query =
618- "select case when true then cast(100.0 as decimal(38,2)) else cast('123.0' as decimal(38,2)) end as c1" ;
619-
616+ // String query =
617+ // "select case when true then cast(100.0 as decimal(38,2)) else cast('123.0' as decimal(38,2)) end as c1";
618+ String query = "SELECT CAST(100 AS DECIMAL(38,2)) AS c1" ;
620619 testBuilder ()
621620 .sqlQuery (query )
622621 .ordered ()
@@ -630,7 +629,7 @@ public void testCastDecimalZeroPrecision() throws Exception {
630629 String query = "select cast('123.0' as decimal(0, 5))" ;
631630
632631 thrown .expect (UserRemoteException .class );
633- thrown .expectMessage (containsString ("VALIDATION ERROR: Expected precision greater than 0, but was 0" ));
632+ thrown .expectMessage (containsString ("VALIDATION ERROR: Expected precision greater than 0, but was 0. " ));
634633
635634 run (query );
636635 }
@@ -640,7 +639,7 @@ public void testCastDecimalGreaterScaleThanPrecision() throws Exception {
640639 String query = "select cast('123.0' as decimal(3, 5))" ;
641640
642641 thrown .expect (UserRemoteException .class );
643- thrown .expectMessage (containsString ("VALIDATION ERROR: Expected scale less than or equal to precision, but was precision 3 and scale 5 " ));
642+ thrown .expectMessage (containsString ("VALIDATION ERROR: Expected scale less than or equal to precision, but was scale 5 and precision 3. " ));
644643
645644 run (query );
646645 }
0 commit comments