Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2055#discussion_r174208671
  
    --- Diff: 
integration/spark-common-test/src/test/scala/org/apache/carbondata/mapred/TestMapReduceCarbonFileInputFormat.java
 ---
    @@ -0,0 +1,193 @@
    +/*
    + * 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.mapred;
    +
    +
    +import java.io.BufferedReader;
    +import java.io.BufferedWriter;
    +import java.io.File;
    +import java.io.FileFilter;
    +import java.io.FileReader;
    +import java.io.FileWriter;
    +import java.io.IOException;
    +import java.util.List;
    +import java.util.UUID;
    +
    +import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
    +import org.apache.carbondata.core.scan.expression.Expression;
    +import org.apache.carbondata.core.util.CarbonUtil;
    +import org.apache.carbondata.core.util.path.CarbonTablePath;
    +import org.apache.carbondata.hadoop.CarbonProjection;
    +import org.apache.carbondata.hadoop.api.CarbonFileInputFormat;
    +import org.apache.carbondata.hadoop.api.CarbonTableInputFormat;
    +
    +import org.apache.commons.logging.Log;
    +import org.apache.commons.logging.LogFactory;
    +import org.apache.hadoop.conf.Configuration;
    +import org.apache.hadoop.conf.Configured;
    +import org.apache.hadoop.fs.Path;
    +import org.apache.hadoop.io.IntWritable;
    +import org.apache.hadoop.io.Text;
    +import org.apache.hadoop.mapred.FileInputFormat;
    +import org.apache.hadoop.mapred.JobClient;
    +import org.apache.hadoop.mapred.JobConf;
    +import org.apache.hadoop.mapreduce.Job;
    +import org.apache.hadoop.mapreduce.Mapper;
    +import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
    +import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
    +import org.apache.hadoop.util.Tool;
    +import org.apache.hadoop.util.ToolRunner;
    +import org.junit.Assert;
    +import org.junit.Test;
    +
    +public class TestMapReduceCarbonFileInputFormat {
    +
    +  private static final Log LOG = 
LogFactory.getLog(TestMapReduceCarbonFileInputFormat.class);
    +
    +  private int countTheLines(String outPath) throws Exception {
    +    File file = new File(outPath);
    +    if (file.exists()) {
    +      BufferedReader reader = new BufferedReader(new FileReader(file));
    +      int i = 0;
    +      while (reader.readLine() != null) {
    +        i++;
    +      }
    +      reader.close();
    +      return i;
    +    }
    +    return 0;
    +  }
    +
    +  private int countTheColumns(String outPath) throws Exception {
    +    File file = new File(outPath);
    +    if (file.exists()) {
    +      BufferedReader reader = new BufferedReader(new FileReader(file));
    +      String[] split = reader.readLine().split(",");
    +      reader.close();
    +      return split.length;
    +    }
    +    return 0;
    +  }
    +
    +
    --- End diff --
    
    remove empty lines


---

Reply via email to