hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amareshw...@apache.org
Subject svn commit: r1460595 - in /hive/branches/HIVE-4115/ql/src: java/org/apache/hadoop/hive/ql/cube/metadata/ test/org/apache/hadoop/hive/ql/cube/metadata/
Date Mon, 25 Mar 2013 10:30:42 GMT
Author: amareshwari
Date: Mon Mar 25 10:30:41 2013
New Revision: 1460595

URL: http://svn.apache.org/r1460595
Log:
Make CubeMeasure and CubeDimension abstract classes, add HierarchicalDimension which extends
CubeDimnsion

Added:
    hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/HierarchicalDimension.java
Modified:
    hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/BaseDimension.java
    hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/ColumnMeasure.java
    hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/Cube.java
    hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/CubeDimension.java
    hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/CubeMeasure.java
    hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/CubeMetastoreClient.java
    hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/ExprMeasure.java
    hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/MetastoreUtil.java
    hive/branches/HIVE-4115/ql/src/test/org/apache/hadoop/hive/ql/cube/metadata/TestCubeMetastoreClient.java

Modified: hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/BaseDimension.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/BaseDimension.java?rev=1460595&r1=1460594&r2=1460595&view=diff
==============================================================================
--- hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/BaseDimension.java
(original)
+++ hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/BaseDimension.java
Mon Mar 25 10:30:41 2013
@@ -4,36 +4,28 @@ import java.util.Map;
 
 import org.apache.hadoop.hive.metastore.api.FieldSchema;
 
-public class BaseDimension {
-  private final FieldSchema column;
+public class BaseDimension extends CubeDimension {
+  private final String type;
 
   public BaseDimension(FieldSchema column) {
-    this.column = column;
-    assert (column != null);
-    assert (column.getName() != null);
-    assert (column.getType() != null);
-  }
-
-  public FieldSchema getColumn() {
-    return column;
-  }
-
-  public String getName() {
-    return column.getName();
+    super(column.getName());
+    this.type = column.getType();
+    assert (type != null);
   }
 
   public String getType() {
-    return column.getType();
+    return type;
   }
 
+  @Override
   public void addProperties(Map<String, String> props) {
-    props.put(MetastoreUtil.getDimTypePropertyKey(column.getName()),
-        column.getType());
+    super.addProperties(props);
+    props.put(MetastoreUtil.getDimTypePropertyKey(getName()), type);
   }
 
   public BaseDimension(String name, Map<String, String> props) {
-    String type = getDimType(name, props);
-    this.column = new FieldSchema(name, type, "");
+    super(name);
+    this.type = getDimType(name, props);
   }
 
   public static String getDimType(String name, Map<String, String> props) {
@@ -43,9 +35,7 @@ public class BaseDimension {
   @Override
   public int hashCode() {
     final int prime = 31;
-    int result = 1;
-    result = prime * result + ((getName() == null) ? 0 :
-      getName().toLowerCase().hashCode());
+    int result = super.hashCode();
     result = prime * result + ((getType() == null) ? 0 :
       getType().toLowerCase().hashCode());
     return result;
@@ -53,14 +43,10 @@ public class BaseDimension {
 
   @Override
   public boolean equals(Object obj) {
-    BaseDimension other = (BaseDimension)obj;
-    if (this.getName() == null) {
-      if (other.getName() != null) {
-        return false;
-      }
-    } else if (!this.getName().equalsIgnoreCase(other.getName())) {
+    if (!super.equals(obj)) {
       return false;
     }
+    BaseDimension other = (BaseDimension)obj;
     if (this.getType() == null) {
       if (other.getType() != null) {
         return false;

Modified: hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/ColumnMeasure.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/ColumnMeasure.java?rev=1460595&r1=1460594&r2=1460595&view=diff
==============================================================================
--- hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/ColumnMeasure.java
(original)
+++ hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/ColumnMeasure.java
Mon Mar 25 10:30:41 2013
@@ -21,8 +21,6 @@ public final class ColumnMeasure extends
   @Override
   public void addProperties(Map<String, String> props) {
     super.addProperties(props);
-    props.put(MetastoreUtil.getMeasureClassPropertyKey(getName()),
-        this.getClass().getCanonicalName());
   }
 
   @Override

Modified: hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/Cube.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/Cube.java?rev=1460595&r1=1460594&r2=1460595&view=diff
==============================================================================
--- hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/Cube.java
(original)
+++ hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/Cube.java
Mon Mar 25 10:30:41 2013
@@ -118,7 +118,30 @@ public final class Cube extends Abstract
     String dimStr = props.get(MetastoreUtil.getCubeDimensionListKey(name));
     String[] names = dimStr.split(",");
     for (String dimName : names) {
-      CubeDimension dim = new CubeDimension(dimName, props);
+      String className = props.get(MetastoreUtil.getDimensionClassPropertyKey(
+          dimName));
+      CubeDimension dim;
+      try {
+        Class<?> clazz = Class.forName(className);
+        Constructor<?> constructor;
+          constructor = clazz.getConstructor(String.class, Map.class);
+        dim = (CubeDimension) constructor.newInstance(new Object[]
+           {dimName, props});
+      } catch (ClassNotFoundException e) {
+        throw new IllegalArgumentException("Invalid dimension", e);
+      } catch (SecurityException e) {
+        throw new IllegalArgumentException("Invalid dimension", e);
+      } catch (NoSuchMethodException e) {
+        throw new IllegalArgumentException("Invalid dimension", e);
+      } catch (IllegalArgumentException e) {
+        throw new IllegalArgumentException("Invalid dimension", e);
+      } catch (InstantiationException e) {
+        throw new IllegalArgumentException("Invalid dimension", e);
+      } catch (IllegalAccessException e) {
+        throw new IllegalArgumentException("Invalid dimension", e);
+      } catch (InvocationTargetException e) {
+        throw new IllegalArgumentException("Invalid dimension", e);
+      }
       dimensions.add(dim);
     }
     return dimensions;

Modified: hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/CubeDimension.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/CubeDimension.java?rev=1460595&r1=1460594&r2=1460595&view=diff
==============================================================================
--- hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/CubeDimension.java
(original)
+++ hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/CubeDimension.java
Mon Mar 25 10:30:41 2013
@@ -1,100 +1,25 @@
 package org.apache.hadoop.hive.ql.cube.metadata;
 
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
-public class CubeDimension implements Named {
+public abstract class CubeDimension implements Named {
   private final String name;
-  private final List<BaseDimension> hierarchy;
 
-  public CubeDimension(String name, List<BaseDimension> hierarchy) {
+  public CubeDimension(String name) {
     this.name = name;
-    this.hierarchy = hierarchy;
     assert (name != null);
-    assert (hierarchy != null);
   }
 
   public String getName() {
     return name;
   }
 
-  public List<BaseDimension> getHierarchy() {
-    return hierarchy;
-  }
-
-  public void addProperties(Map<String, String> props) {
-    for (int i =0; i < hierarchy.size(); i++) {
-      BaseDimension dim = hierarchy.get(i);
-      props.put(MetastoreUtil.getHierachyElementKeyName(name, i),
-          getHierarchyElement(dim));
-      dim.addProperties(props);
-    }
-  }
-
-  public static String getHierarchyElement(BaseDimension dim) {
-    return dim.getName() + "," + dim.getClass().getCanonicalName();
-  }
-
-  public CubeDimension(String name, Map<String, String> props) {
-    this.name = name;
-    this.hierarchy = getHiearachy(name, props);
-  }
-
-  public static List<BaseDimension> getHiearachy(String name,
-      Map<String, String> props) {
-    Map<Integer, String> hierarchyElements = new HashMap<Integer, String>();
-    for (String param : props.keySet()) {
-      if (param.startsWith(MetastoreUtil.getHierachyElementKeyPFX(name))) {
-        hierarchyElements.put(MetastoreUtil.getHierachyElementIndex(name, param),
-            props.get(param));
-      }
-    }
-    List<BaseDimension> hierarchy = new ArrayList<BaseDimension>(
-        hierarchyElements.size());
-    for (int i = 0; i < hierarchyElements.size(); i++) {
-      String hierarchyElement = hierarchyElements.get(i);
-      String[] elements = hierarchyElement.split(",");
-      String dimName = elements[0];
-      String className = elements[1];
-      BaseDimension dim;
-      try {
-        Class<?> clazz = Class.forName(className);
-        Constructor<?> constructor;
-        constructor = clazz.getConstructor(String.class, Map.class);
-        dim = (BaseDimension) constructor.newInstance(new Object[]
-            {dimName, props});
-      } catch (ClassNotFoundException e) {
-        throw new IllegalArgumentException("Invalid Dimension", e);
-      } catch (SecurityException e) {
-        throw new IllegalArgumentException("Invalid Dimension", e);
-      } catch (NoSuchMethodException e) {
-        throw new IllegalArgumentException("Invalid Dimension", e);
-      } catch (IllegalArgumentException e) {
-        throw new IllegalArgumentException("Invalid Dimension", e);
-      } catch (InstantiationException e) {
-        throw new IllegalArgumentException("Invalid Dimension", e);
-      } catch (IllegalAccessException e) {
-        throw new IllegalArgumentException("Invalid Dimension", e);
-      } catch (InvocationTargetException e) {
-        throw new IllegalArgumentException("Invalid Dimension", e);
-      }
-      hierarchy.add(dim);
-    }
-    return hierarchy;
-  }
-
   @Override
   public int hashCode() {
     final int prime = 31;
     int result = 1;
     result = prime * result + ((getName() == null) ? 0 :
       getName().toLowerCase().hashCode());
-    result = prime * result + ((getHierarchy() == null) ? 0 :
-      getHierarchy().hashCode());
     return result;
   }
 
@@ -108,20 +33,16 @@ public class CubeDimension implements Na
     } else if (!this.getName().equalsIgnoreCase(other.getName())) {
       return false;
     }
-    if (this.getHierarchy() == null) {
-      if (other.getHierarchy() != null) {
-        return false;
-      }
-    } else if (!this.getHierarchy().equals(other.getHierarchy())) {
-      return false;
-    }
     return true;
   }
 
+  public void addProperties(Map<String, String> props) {
+    props.put(MetastoreUtil.getDimensionClassPropertyKey(getName()),
+        getClass().getName());
+  }
+
   @Override
   public String toString() {
-    String str = name;
-    str += ", hierarchy:" + MetastoreUtil.getObjectStr(hierarchy);
-    return str;
+    return name;
   }
 }

Modified: hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/CubeMeasure.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/CubeMeasure.java?rev=1460595&r1=1460594&r2=1460595&view=diff
==============================================================================
--- hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/CubeMeasure.java
(original)
+++ hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/CubeMeasure.java
Mon Mar 25 10:30:41 2013
@@ -4,7 +4,7 @@ import java.util.Map;
 
 import org.apache.hadoop.hive.metastore.api.FieldSchema;
 
-public class CubeMeasure implements Named {
+public abstract class CubeMeasure implements Named {
   private final String formatString;
   private final String aggregate;
   private final String unit;
@@ -130,6 +130,8 @@ public class CubeMeasure implements Name
   }
 
   public void addProperties(Map<String, String> props) {
+    props.put(MetastoreUtil.getMeasureClassPropertyKey(getName()),
+        getClass().getName());
     props.put(MetastoreUtil.getMeasureTypePropertyKey(getName()), getType());
     if (unit != null) {
       props.put(MetastoreUtil.getMeasureUnitPropertyKey(getName()), unit);

Modified: hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/CubeMetastoreClient.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/CubeMetastoreClient.java?rev=1460595&r1=1460594&r2=1460595&view=diff
==============================================================================
--- hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/CubeMetastoreClient.java
(original)
+++ hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/CubeMetastoreClient.java
Mon Mar 25 10:30:41 2013
@@ -408,11 +408,24 @@ public class CubeMetastoreClient {
 
   public boolean isFactTable(String tableName) throws HiveException {
     Table tbl = getTable(tableName);
+    return isFactTable(tbl);
+  }
+
+  private boolean isFactTable(Table tbl) {
     String tableType = tbl.getParameters().get(
         MetastoreConstants.TABLE_TYPE_KEY);
     return CubeTableType.FACT.equals(tableType);
   }
 
+  private boolean isFactTableForCube(Table tbl, Cube cube) {
+    if (isFactTable(tbl)) {
+      String cubeName = tbl.getParameters().get(
+          MetastoreUtil.getFactCubeNameKey(tbl.getTableName()));
+      return cube.getName().equals(cubeName);
+    }
+    return false;
+  }
+
   public boolean isDimensionTable(String tableName) throws HiveException {
     Table tbl = getTable(tableName);
     String tableType = tbl.getParameters().get(
@@ -429,8 +442,11 @@ public class CubeMetastoreClient {
 
   public CubeFactTable getFactTable(String tableName) throws HiveException {
     Table tbl = getTable(tableName);
-    if (CubeTableType.FACT.equals(tbl.getParameters().get(
-        MetastoreConstants.TABLE_TYPE_KEY))) {
+    return getFactTable(tbl);
+  }
+
+  private CubeFactTable getFactTable(Table tbl) throws HiveException {
+    if (isFactTable(tbl)) {
       return new CubeFactTable(tbl);
     }
     return null;
@@ -470,12 +486,13 @@ public class CubeMetastoreClient {
     return dimTables;
   }
 
-  public List<CubeFactTable> getAllFactTables() throws HiveException {
+  public List<CubeFactTable> getAllFactTables(Cube cube) throws HiveException {
     List<CubeFactTable> factTables = new ArrayList<CubeFactTable>();
     try {
-      for (String table : getClient().getAllTables()) {
-        if (isFactTable(table)) {
-          factTables.add(getFactTable(table));
+      for (String tableName : getClient().getAllTables()) {
+        Table tbl = getTable(tableName);
+        if (isFactTableForCube(tbl, cube)) {
+          factTables.add(new CubeFactTable(tbl));
         }
       }
     } catch (HiveException e) {
@@ -506,5 +523,4 @@ public class CubeMetastoreClient {
     }
     return columns;
   }
-
 }

Modified: hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/ExprMeasure.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/ExprMeasure.java?rev=1460595&r1=1460594&r2=1460595&view=diff
==============================================================================
--- hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/ExprMeasure.java
(original)
+++ hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/ExprMeasure.java
Mon Mar 25 10:30:41 2013
@@ -30,8 +30,6 @@ public final class ExprMeasure extends C
   @Override
   public void addProperties(Map<String, String> props) {
     super.addProperties(props);
-    props.put(MetastoreUtil.getMeasureClassPropertyKey(getName()),
-        this.getClass().getCanonicalName());
     props.put(MetastoreUtil.getMeasureExprPropertyKey(getName()), expr);
   }
 

Added: hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/HierarchicalDimension.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/HierarchicalDimension.java?rev=1460595&view=auto
==============================================================================
--- hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/HierarchicalDimension.java
(added)
+++ hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/HierarchicalDimension.java
Mon Mar 25 10:30:41 2013
@@ -0,0 +1,118 @@
+package org.apache.hadoop.hive.ql.cube.metadata;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class HierarchicalDimension extends CubeDimension {
+  private final List<CubeDimension> hierarchy;
+
+  public HierarchicalDimension(String name, List<CubeDimension> hierarchy) {
+    super(name);
+    this.hierarchy = hierarchy;
+    assert (name != null);
+    assert (hierarchy != null);
+  }
+
+  public List<CubeDimension> getHierarchy() {
+    return hierarchy;
+  }
+
+  @Override
+  public void addProperties(Map<String, String> props) {
+    super.addProperties(props);
+    for (int i =0; i < hierarchy.size(); i++) {
+      CubeDimension dim = hierarchy.get(i);
+      props.put(MetastoreUtil.getHierachyElementKeyName(getName(), i),
+          getHierarchyElement(dim));
+      dim.addProperties(props);
+    }
+  }
+
+  public static String getHierarchyElement(CubeDimension dim) {
+    return dim.getName() + "," + dim.getClass().getCanonicalName();
+  }
+
+  public HierarchicalDimension(String name, Map<String, String> props) {
+    super(name);
+    this.hierarchy = getHiearachy(name, props);
+  }
+
+  public static List<CubeDimension> getHiearachy(String name,
+      Map<String, String> props) {
+    Map<Integer, String> hierarchyElements = new HashMap<Integer, String>();
+    for (String param : props.keySet()) {
+      if (param.startsWith(MetastoreUtil.getHierachyElementKeyPFX(name))) {
+        hierarchyElements.put(MetastoreUtil.getHierachyElementIndex(name, param),
+            props.get(param));
+      }
+    }
+    List<CubeDimension> hierarchy = new ArrayList<CubeDimension>(
+        hierarchyElements.size());
+    for (int i = 0; i < hierarchyElements.size(); i++) {
+      String hierarchyElement = hierarchyElements.get(i);
+      String[] elements = hierarchyElement.split(",");
+      String dimName = elements[0];
+      String className = elements[1];
+      CubeDimension dim;
+      try {
+        Class<?> clazz = Class.forName(className);
+        Constructor<?> constructor;
+        constructor = clazz.getConstructor(String.class, Map.class);
+        dim = (CubeDimension) constructor.newInstance(new Object[]
+            {dimName, props});
+      } catch (ClassNotFoundException e) {
+        throw new IllegalArgumentException("Invalid Dimension", e);
+      } catch (SecurityException e) {
+        throw new IllegalArgumentException("Invalid Dimension", e);
+      } catch (NoSuchMethodException e) {
+        throw new IllegalArgumentException("Invalid Dimension", e);
+      } catch (IllegalArgumentException e) {
+        throw new IllegalArgumentException("Invalid Dimension", e);
+      } catch (InstantiationException e) {
+        throw new IllegalArgumentException("Invalid Dimension", e);
+      } catch (IllegalAccessException e) {
+        throw new IllegalArgumentException("Invalid Dimension", e);
+      } catch (InvocationTargetException e) {
+        throw new IllegalArgumentException("Invalid Dimension", e);
+      }
+      hierarchy.add(dim);
+    }
+    return hierarchy;
+  }
+
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = super.hashCode();
+    result = prime * result + ((getHierarchy() == null) ? 0 :
+      getHierarchy().hashCode());
+    return result;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (!super.equals(obj)) {
+      return false;
+    }
+    HierarchicalDimension other = (HierarchicalDimension)obj;
+    if (this.getHierarchy() == null) {
+      if (other.getHierarchy() != null) {
+        return false;
+      }
+    } else if (!this.getHierarchy().equals(other.getHierarchy())) {
+      return false;
+    }
+    return true;
+  }
+
+  @Override
+  public String toString() {
+    String str = super.toString();
+    str += ", hierarchy:" + MetastoreUtil.getObjectStr(hierarchy);
+    return str;
+  }
+}

Modified: hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/MetastoreUtil.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/MetastoreUtil.java?rev=1460595&r1=1460594&r2=1460595&view=diff
==============================================================================
--- hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/MetastoreUtil.java
(original)
+++ hive/branches/HIVE-4115/ql/src/java/org/apache/hadoop/hive/ql/cube/metadata/MetastoreUtil.java
Mon Mar 25 10:30:41 2013
@@ -87,6 +87,10 @@ public class MetastoreUtil implements Me
     return getDimensionKeyPrefix(name) +  STORAGE_LIST_SFX;
   }
 
+  public static final String getDimensionClassPropertyKey(String dimName) {
+    return getDimensionKeyPrefix(dimName) + CLASS_SFX;
+  }
+
   ////////////////////////////
   // Measure properties  ///
   ///////////////////////////

Modified: hive/branches/HIVE-4115/ql/src/test/org/apache/hadoop/hive/ql/cube/metadata/TestCubeMetastoreClient.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-4115/ql/src/test/org/apache/hadoop/hive/ql/cube/metadata/TestCubeMetastoreClient.java?rev=1460595&r1=1460594&r2=1460595&view=diff
==============================================================================
--- hive/branches/HIVE-4115/ql/src/test/org/apache/hadoop/hive/ql/cube/metadata/TestCubeMetastoreClient.java
(original)
+++ hive/branches/HIVE-4115/ql/src/test/org/apache/hadoop/hive/ql/cube/metadata/TestCubeMetastoreClient.java
Mon Mar 25 10:30:41 2013
@@ -68,7 +68,7 @@ public class TestCubeMetastoreClient {
         "(msr1 + msr2)/ msr4", "", "SUM", "RS"));
 
     cubeDimensions = new HashSet<CubeDimension>();
-    List<BaseDimension> locationHierarchy = new ArrayList<BaseDimension>();
+    List<CubeDimension> locationHierarchy = new ArrayList<CubeDimension>();
     locationHierarchy.add(new ReferencedDimension(new FieldSchema("zipcode",
         "int", "zip"), new TableReference("ziptable", "zipcode")));
     locationHierarchy.add(new ReferencedDimension(new FieldSchema("cityid",
@@ -81,16 +81,14 @@ public class TestCubeMetastoreClient {
     locationHierarchy.add(new InlineDimension(new FieldSchema("regionname",
         "string", "region"), regions));
 
-    cubeDimensions.add(new CubeDimension("location", locationHierarchy));
-    cubeDimensions.add(new CubeDimension("dim1", Arrays.asList(
-        new BaseDimension(new FieldSchema("dim1", "string", "basedim")))));
-    cubeDimensions.add(new CubeDimension("dim2", Arrays.asList(
-        (BaseDimension)(new ReferencedDimension(
+    cubeDimensions.add(new HierarchicalDimension("location", locationHierarchy));
+    cubeDimensions.add(new BaseDimension(new FieldSchema("dim1", "string",
+        "basedim")));
+    cubeDimensions.add(new ReferencedDimension(
             new FieldSchema("dim2", "string", "ref dim"),
-            new TableReference("testdim2", "id"))))));
-    cubeDimensions.add(new CubeDimension("dim3", Arrays.asList(
-        (BaseDimension)(new InlineDimension(
-            new FieldSchema("region", "string", "region dim"), regions)))));
+            new TableReference("testdim2", "id")));
+    cubeDimensions.add(new InlineDimension(
+            new FieldSchema("region", "string", "region dim"), regions));
     cube = new Cube(cubeName, cubeMeasures, cubeDimensions);
   }
 



Mime
View raw message