carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenliang613 <...@git.apache.org>
Subject [GitHub] carbondata pull request #1286: [CARBONDATA-1404] Added Unit test cases for H...
Date Sun, 10 Sep 2017 01:58:03 GMT
Github user chenliang613 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1286#discussion_r137939031
  
    --- Diff: integration/hive/src/test/java/org/apache/carbondata/hive/CarbonDictionaryDecodeReadSupportTest.java
---
    @@ -0,0 +1,325 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.carbondata.hive;
    +
    +import java.io.IOException;
    +import java.text.SimpleDateFormat;
    +import java.util.ArrayList;
    +import java.util.Date;
    +import java.util.List;
    +
    +import org.apache.carbondata.core.cache.dictionary.AbstractColumnDictionaryInfo;
    +import org.apache.carbondata.core.cache.dictionary.ColumnDictionaryInfo;
    +import org.apache.carbondata.core.cache.dictionary.Dictionary;
    +import org.apache.carbondata.core.cache.dictionary.DictionaryColumnUniqueIdentifier;
    +import org.apache.carbondata.core.cache.dictionary.ForwardDictionaryCache;
    +import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
    +import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
    +import org.apache.carbondata.core.metadata.datatype.DataType;
    +import org.apache.carbondata.core.metadata.encoder.Encoding;
    +import org.apache.carbondata.core.metadata.schema.table.column.CarbonColumn;
    +import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension;
    +import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema;
    +
    +import mockit.Mock;
    +import mockit.MockUp;
    +import org.apache.hadoop.io.ArrayWritable;
    +import org.apache.spark.sql.catalyst.expressions.GenericInternalRow;
    +import org.apache.spark.sql.catalyst.util.GenericArrayData;
    +import org.apache.spark.sql.types.ArrayType;
    +import org.junit.Assert;
    +import org.junit.BeforeClass;
    +import org.junit.Test;
    +
    +public class CarbonDictionaryDecodeReadSupportTest {
    +
    +  private static Date date = new Date();
    +  private static DataType dataTypes[] =
    +      new DataType[] { DataType.INT, DataType.STRING, DataType.NULL, DataType.DOUBLE,
DataType.LONG,
    +          DataType.SHORT, DataType.DATE, DataType.TIMESTAMP, DataType.DECIMAL, DataType.STRUCT,
    +          DataType.ARRAY, DataType.BYTE_ARRAY };
    +  private static Encoding encodings[] =
    +      new Encoding[] { Encoding.DICTIONARY, Encoding.DIRECT_DICTIONARY, Encoding.BIT_PACKED
};
    +  private static CarbonColumn carbonColumnsArray[] = new CarbonColumn[12];
    +  private static ColumnSchema columnSchemas[] = new ColumnSchema[12];
    +  private CarbonDictionaryDecodeReadSupport carbonDictionaryDecodeReadSupportObj =
    +      new CarbonDictionaryDecodeReadSupport();
    +  private static AbsoluteTableIdentifier absoluteTableIdentifier;
    +  private Dictionary dictionary = new ColumnDictionaryInfo(DataType.BOOLEAN);
    +  private String name[] = new String[] { "FirstName", "LastName" };
    +  private Object objects[];
    +  private static String dateFormat = new SimpleDateFormat("yyyy/MM/dd").format(date);
    +  private static String timeStamp = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(date);
    +
    +  @BeforeClass public static void setUp() {
    +
    +    for (int i = 0; i < carbonColumnsArray.length; i++) {
    +      List<Encoding> encodingList = new ArrayList<>();
    +      columnSchemas[i] = new ColumnSchema();
    +      columnSchemas[i].setDataType(dataTypes[i]);
    +
    +      DataType datatype = columnSchemas[i].getDataType();
    +      if (datatype == DataType.STRING) {
    +        encodingList.add(encodings[0]);
    +      } else if (datatype.isComplexType()) {
    +        encodingList.add(encodings[0]);
    +        columnSchemas[i].setNumberOfChild(2);
    +        columnSchemas[i].setDimensionColumn(true);
    +      } else {
    +        encodingList.add(encodings[((i % 2) + 1)]);
    +      }
    +      columnSchemas[i].setEncodingList(encodingList);
    +      carbonColumnsArray[i] = new CarbonDimension(columnSchemas[i], 10, 20, 30, 40);
    +    }
    +
    +    absoluteTableIdentifier = new AbsoluteTableIdentifier(
    +        "/incubator-carbondata/examples/spark2/target/store",
    --- End diff --
    
    why the path including incubator ??  "/incubator-carbondata/examples/spark2/target/store"


---

Mime
View raw message