@@ -45,10 +45,7 @@ public final class QualifiedName implements Serializable {
45
45
private final String partitionName ;
46
46
private final String tableName ;
47
47
private final String viewName ;
48
- private String qualifiedName ;
49
- private Map <String , String > qualifiedNameMap ;
50
- private Map <String , String > parts ;
51
- private Type type ;
48
+ private final Type type ;
52
49
53
50
private QualifiedName (
54
51
@ NonNull final String catalogName ,
@@ -471,31 +468,27 @@ private static String standardizeRequired(final String name, @Nullable final Str
471
468
*/
472
469
@ JsonValue
473
470
public Map <String , String > toJson () {
474
- if (qualifiedNameMap == null ) {
475
- final Map <String , String > map = new HashMap <>(5 );
476
- map .put ("qualifiedName" , toString ());
477
- map .put ("catalogName" , catalogName );
471
+ final Map <String , String > map = new HashMap <>(5 );
472
+ map .put ("qualifiedName" , toString ());
473
+ map .put ("catalogName" , catalogName );
478
474
479
- if (!databaseName .isEmpty ()) {
480
- map .put ("databaseName" , databaseName );
481
- }
482
-
483
- if (!tableName .isEmpty ()) {
484
- map .put ("tableName" , tableName );
485
- }
475
+ if (!databaseName .isEmpty ()) {
476
+ map .put ("databaseName" , databaseName );
477
+ }
486
478
487
- if (!partitionName .isEmpty ()) {
488
- map .put ("partitionName " , partitionName );
489
- }
479
+ if (!tableName .isEmpty ()) {
480
+ map .put ("tableName " , tableName );
481
+ }
490
482
491
- if (!viewName .isEmpty ()) {
492
- map .put ("viewName " , viewName );
493
- }
483
+ if (!partitionName .isEmpty ()) {
484
+ map .put ("partitionName " , partitionName );
485
+ }
494
486
495
- qualifiedNameMap = map ;
487
+ if (!viewName .isEmpty ()) {
488
+ map .put ("viewName" , viewName );
496
489
}
497
490
498
- return qualifiedNameMap ;
491
+ return map ;
499
492
}
500
493
501
494
/**
@@ -504,30 +497,26 @@ public Map<String, String> toJson() {
504
497
* @return parts of the qualified name as a Map
505
498
*/
506
499
public Map <String , String > parts () {
507
- if (parts == null ) {
508
- final Map <String , String > map = new HashMap <>(4 );
509
- map .put ("catalogName" , catalogName );
510
-
511
- if (!databaseName .isEmpty ()) {
512
- map .put ("databaseName" , databaseName );
513
- }
500
+ final Map <String , String > map = new HashMap <>(5 );
501
+ map .put ("catalogName" , catalogName );
514
502
515
- if (!tableName .isEmpty ()) {
516
- map .put ("tableName " , tableName );
517
- }
503
+ if (!databaseName .isEmpty ()) {
504
+ map .put ("databaseName " , databaseName );
505
+ }
518
506
519
- if (!partitionName .isEmpty ()) {
520
- map .put ("partitionName " , partitionName );
521
- }
507
+ if (!tableName .isEmpty ()) {
508
+ map .put ("tableName " , tableName );
509
+ }
522
510
523
- if (!viewName .isEmpty ()) {
524
- map .put ("viewName " , viewName );
525
- }
511
+ if (!partitionName .isEmpty ()) {
512
+ map .put ("partitionName " , partitionName );
513
+ }
526
514
527
- parts = map ;
515
+ if (!viewName .isEmpty ()) {
516
+ map .put ("viewName" , viewName );
528
517
}
529
518
530
- return parts ;
519
+ return map ;
531
520
}
532
521
533
522
public boolean isViewDefinition () {
@@ -568,32 +557,29 @@ public int hashCode() {
568
557
*/
569
558
@ Override
570
559
public String toString () {
571
- if (qualifiedName == null ) {
572
- final StringBuilder sb = new StringBuilder (catalogName );
560
+ final StringBuilder sb = new StringBuilder (catalogName );
573
561
574
- if (!databaseName .isEmpty ()) {
575
- sb .append ('/' );
576
- sb .append (databaseName );
577
- }
562
+ if (!databaseName .isEmpty ()) {
563
+ sb .append ('/' );
564
+ sb .append (databaseName );
565
+ }
578
566
579
- if (!tableName .isEmpty ()) {
580
- sb .append ('/' );
581
- sb .append (tableName );
582
- }
567
+ if (!tableName .isEmpty ()) {
568
+ sb .append ('/' );
569
+ sb .append (tableName );
570
+ }
583
571
584
- if (!partitionName .isEmpty ()) {
585
- sb .append ('/' );
586
- sb .append (partitionName );
587
- }
572
+ if (!partitionName .isEmpty ()) {
573
+ sb .append ('/' );
574
+ sb .append (partitionName );
575
+ }
588
576
589
- if (!viewName .isEmpty ()) {
590
- sb .append ('/' );
591
- sb .append (viewName );
592
- }
593
- qualifiedName = sb .toString ();
577
+ if (!viewName .isEmpty ()) {
578
+ sb .append ('/' );
579
+ sb .append (viewName );
594
580
}
595
581
596
- return qualifiedName ;
582
+ return sb . toString () ;
597
583
}
598
584
599
585
0 commit comments