@@ -262,7 +262,7 @@ void addToMap(FunctionDefinition...functions) {
262262 for (String alias : f .aliases ()) {
263263 Object old = batchMap .put (alias , f );
264264 if (old != null || defs .containsKey (alias )) {
265- throw new IllegalArgumentException ("alias [" + alias + "] is used by "
265+ throw new SqlIllegalArgumentException ("alias [" + alias + "] is used by "
266266 + "[" + (old != null ? old : defs .get (alias ).name ()) + "] and [" + f .name () + "]" );
267267 }
268268 aliases .put (alias , f .name ());
@@ -321,10 +321,10 @@ static <T extends Function> FunctionDefinition def(Class<T> function,
321321 java .util .function .Function <Source , T > ctorRef , String ... names ) {
322322 FunctionBuilder builder = (source , children , distinct , cfg ) -> {
323323 if (false == children .isEmpty ()) {
324- throw new IllegalArgumentException ("expects no arguments" );
324+ throw new SqlIllegalArgumentException ("expects no arguments" );
325325 }
326326 if (distinct ) {
327- throw new IllegalArgumentException ("does not support DISTINCT yet it was specified" );
327+ throw new SqlIllegalArgumentException ("does not support DISTINCT yet it was specified" );
328328 }
329329 return ctorRef .apply (source );
330330 };
@@ -341,10 +341,10 @@ static <T extends Function> FunctionDefinition def(Class<T> function,
341341 ConfigurationAwareFunctionBuilder <T > ctorRef , String ... names ) {
342342 FunctionBuilder builder = (source , children , distinct , cfg ) -> {
343343 if (false == children .isEmpty ()) {
344- throw new IllegalArgumentException ("expects no arguments" );
344+ throw new SqlIllegalArgumentException ("expects no arguments" );
345345 }
346346 if (distinct ) {
347- throw new IllegalArgumentException ("does not support DISTINCT yet it was specified" );
347+ throw new SqlIllegalArgumentException ("does not support DISTINCT yet it was specified" );
348348 }
349349 return ctorRef .build (source , cfg );
350350 };
@@ -365,10 +365,10 @@ static <T extends Function> FunctionDefinition def(Class<T> function,
365365 UnaryConfigurationAwareFunctionBuilder <T > ctorRef , String ... names ) {
366366 FunctionBuilder builder = (source , children , distinct , cfg ) -> {
367367 if (children .size () > 1 ) {
368- throw new IllegalArgumentException ("expects exactly one argument" );
368+ throw new SqlIllegalArgumentException ("expects exactly one argument" );
369369 }
370370 if (distinct ) {
371- throw new IllegalArgumentException ("does not support DISTINCT yet it was specified" );
371+ throw new SqlIllegalArgumentException ("does not support DISTINCT yet it was specified" );
372372 }
373373 Expression ex = children .size () == 1 ? children .get (0 ) : null ;
374374 return ctorRef .build (source , ex , cfg );
@@ -390,10 +390,10 @@ static <T extends Function> FunctionDefinition def(Class<T> function,
390390 BiFunction <Source , Expression , T > ctorRef , String ... names ) {
391391 FunctionBuilder builder = (source , children , distinct , cfg ) -> {
392392 if (children .size () != 1 ) {
393- throw new IllegalArgumentException ("expects exactly one argument" );
393+ throw new SqlIllegalArgumentException ("expects exactly one argument" );
394394 }
395395 if (distinct ) {
396- throw new IllegalArgumentException ("does not support DISTINCT yet it was specified" );
396+ throw new SqlIllegalArgumentException ("does not support DISTINCT yet it was specified" );
397397 }
398398 return ctorRef .apply (source , children .get (0 ));
399399 };
@@ -409,7 +409,7 @@ static <T extends Function> FunctionDefinition def(Class<T> function,
409409 MultiFunctionBuilder <T > ctorRef , String ... names ) {
410410 FunctionBuilder builder = (source , children , distinct , cfg ) -> {
411411 if (distinct ) {
412- throw new IllegalArgumentException ("does not support DISTINCT yet it was specified" );
412+ throw new SqlIllegalArgumentException ("does not support DISTINCT yet it was specified" );
413413 }
414414 return ctorRef .build (source , children );
415415 };
@@ -429,7 +429,7 @@ static <T extends Function> FunctionDefinition def(Class<T> function,
429429 DistinctAwareUnaryFunctionBuilder <T > ctorRef , String ... names ) {
430430 FunctionBuilder builder = (source , children , distinct , cfg ) -> {
431431 if (children .size () != 1 ) {
432- throw new IllegalArgumentException ("expects exactly one argument" );
432+ throw new SqlIllegalArgumentException ("expects exactly one argument" );
433433 }
434434 return ctorRef .build (source , children .get (0 ), distinct );
435435 };
@@ -449,10 +449,10 @@ static <T extends Function> FunctionDefinition def(Class<T> function,
449449 DatetimeUnaryFunctionBuilder <T > ctorRef , String ... names ) {
450450 FunctionBuilder builder = (source , children , distinct , cfg ) -> {
451451 if (children .size () != 1 ) {
452- throw new IllegalArgumentException ("expects exactly one argument" );
452+ throw new SqlIllegalArgumentException ("expects exactly one argument" );
453453 }
454454 if (distinct ) {
455- throw new IllegalArgumentException ("does not support DISTINCT yet it was specified" );
455+ throw new SqlIllegalArgumentException ("does not support DISTINCT yet it was specified" );
456456 }
457457 return ctorRef .build (source , children .get (0 ), cfg .zoneId ());
458458 };
@@ -471,10 +471,10 @@ interface DatetimeUnaryFunctionBuilder<T> {
471471 static <T extends Function > FunctionDefinition def (Class <T > function , DatetimeBinaryFunctionBuilder <T > ctorRef , String ... names ) {
472472 FunctionBuilder builder = (source , children , distinct , cfg ) -> {
473473 if (children .size () != 2 ) {
474- throw new IllegalArgumentException ("expects exactly two arguments" );
474+ throw new SqlIllegalArgumentException ("expects exactly two arguments" );
475475 }
476476 if (distinct ) {
477- throw new IllegalArgumentException ("does not support DISTINCT yet it was specified" );
477+ throw new SqlIllegalArgumentException ("does not support DISTINCT yet it was specified" );
478478 }
479479 return ctorRef .build (source , children .get (0 ), children .get (1 ), cfg .zoneId ());
480480 };
@@ -496,13 +496,13 @@ static <T extends Function> FunctionDefinition def(Class<T> function,
496496 boolean isBinaryOptionalParamFunction = function .isAssignableFrom (Round .class ) || function .isAssignableFrom (Truncate .class )
497497 || TopHits .class .isAssignableFrom (function );
498498 if (isBinaryOptionalParamFunction && (children .size () > 2 || children .size () < 1 )) {
499- throw new IllegalArgumentException ("expects one or two arguments" );
499+ throw new SqlIllegalArgumentException ("expects one or two arguments" );
500500 } else if (!isBinaryOptionalParamFunction && children .size () != 2 ) {
501- throw new IllegalArgumentException ("expects exactly two arguments" );
501+ throw new SqlIllegalArgumentException ("expects exactly two arguments" );
502502 }
503503
504504 if (distinct ) {
505- throw new IllegalArgumentException ("does not support DISTINCT yet it was specified" );
505+ throw new SqlIllegalArgumentException ("does not support DISTINCT yet it was specified" );
506506 }
507507 return ctorRef .build (source , children .get (0 ), children .size () == 2 ? children .get (1 ) : null );
508508 };
@@ -527,7 +527,7 @@ private static FunctionDefinition def(Class<? extends Function> function, Functi
527527 FunctionDefinition .Builder realBuilder = (uf , distinct , cfg ) -> {
528528 try {
529529 return builder .build (uf .source (), uf .children (), distinct , cfg );
530- } catch (IllegalArgumentException e ) {
530+ } catch (SqlIllegalArgumentException e ) {
531531 throw new ParsingException (uf .source (), "error building [" + primaryName + "]: " + e .getMessage (), e );
532532 }
533533 };
@@ -544,12 +544,12 @@ static <T extends Function> FunctionDefinition def(Class<T> function,
544544 FunctionBuilder builder = (source , children , distinct , cfg ) -> {
545545 boolean isLocateFunction = function .isAssignableFrom (Locate .class );
546546 if (isLocateFunction && (children .size () > 3 || children .size () < 2 )) {
547- throw new IllegalArgumentException ("expects two or three arguments" );
547+ throw new SqlIllegalArgumentException ("expects two or three arguments" );
548548 } else if (!isLocateFunction && children .size () != 3 ) {
549- throw new IllegalArgumentException ("expects exactly three arguments" );
549+ throw new SqlIllegalArgumentException ("expects exactly three arguments" );
550550 }
551551 if (distinct ) {
552- throw new IllegalArgumentException ("does not support DISTINCT yet it was specified" );
552+ throw new SqlIllegalArgumentException ("does not support DISTINCT yet it was specified" );
553553 }
554554 return ctorRef .build (source , children .get (0 ), children .get (1 ), children .size () == 3 ? children .get (2 ) : null );
555555 };
@@ -565,10 +565,10 @@ static <T extends Function> FunctionDefinition def(Class<T> function,
565565 FourParametersFunctionBuilder <T > ctorRef , String ... names ) {
566566 FunctionBuilder builder = (source , children , distinct , cfg ) -> {
567567 if (children .size () != 4 ) {
568- throw new IllegalArgumentException ("expects exactly four arguments" );
568+ throw new SqlIllegalArgumentException ("expects exactly four arguments" );
569569 }
570570 if (distinct ) {
571- throw new IllegalArgumentException ("does not support DISTINCT yet it was specified" );
571+ throw new SqlIllegalArgumentException ("does not support DISTINCT yet it was specified" );
572572 }
573573 return ctorRef .build (source , children .get (0 ), children .get (1 ), children .get (2 ), children .get (3 ));
574574 };
0 commit comments