Uploaded image for project: 'Kylin'
  1. Kylin
  2. KYLIN-3505

DataType.getType wrong usage of cache

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: v2.4.1, v2.5.0
    • Component/s: Metadata
    • Labels:
      None

      Description

      Wrong usage of cache in org.apache.kylin.metadata.datatype.DataType#getType.

      public static DataType getType(String type) {
          if (type == null)
              return null;
      
          DataType dataType = new DataType(type); // <-- Always new
          DataType cached = CACHE.get(dataType); // already has dataType why fetch it from cache?
          if (cached == null) {
              CACHE.put(dataType, dataType); // <-- Seed cache
              cached = dataType;
          }
          return cached;
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hu2008yinxiang Ian Hu
                Reporter:
                hu2008yinxiang Ian Hu
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: