Github user chenghao-intel commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9097#discussion_r42200104
  
    --- Diff: 
sql/hive/src/main/java/org/apache/spark/sql/hive/mapred/CombineSplit.java ---
    @@ -0,0 +1,95 @@
    +/*
    + * 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.spark.sql.hive.mapred;
    +
    +import java.io.DataInput;
    +import java.io.DataOutput;
    +import java.io.IOException;
    +
    +import org.apache.hadoop.io.Writable;
    +import org.apache.hadoop.io.WritableFactories;
    +import org.apache.hadoop.mapred.InputSplit;
    +
    +public class CombineSplit implements InputSplit {
    +  private InputSplit[] splits;
    +  private long totalLen;
    +  private String[] locations;
    +
    +  public CombineSplit() {
    +  }
    +
    +  public CombineSplit(InputSplit[] ss, long totalLen, String[] locations) {
    +    splits = ss;
    +    this.totalLen = totalLen;
    +    this.locations = locations;
    +  }
    +
    +  public InputSplit getSplit(int idx) {
    +    return splits[idx];
    +  }
    +
    +  public int getSplitNum() {
    +    return splits.length;
    +  }
    +
    +  @Override
    +  public long getLength() {
    +    return totalLen;
    +  }
    +
    +  @Override
    +  public String[] getLocations() throws IOException {
    +    return locations;
    +  }
    +
    +  @Override
    +  public void write(DataOutput out) throws IOException {
    +    out.writeLong(totalLen);
    +    out.writeInt(locations.length);
    +    for (String location : locations) {
    +      out.writeUTF(location);
    +    }
    +    out.writeInt(splits.length);
    +    out.writeUTF(splits[0].getClass().getCanonicalName());
    --- End diff --
    
    Can you add a comment says, we only process combination within a single 
table partition, so all of the class name of the splits should be exactly the 
identical.
    
    Nit: Writing the split class name in the very beginning? Instead of after 
all of the location info.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to