Skip to content

Commit

Permalink
KYLIN-3644 Fix SparkFactDistinct step NumberFormatException
Browse files Browse the repository at this point in the history
  • Loading branch information
Wayne1c authored and shaofengshi committed Nov 1, 2018
1 parent 3fabbe6 commit 6544143
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private void initNullStrings() {
}
}

protected boolean isNull(String v) {
public boolean isNull(String v) {
return nullStrs.contains(v);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import org.apache.kylin.cube.cuboid.CuboidUtil;
import org.apache.kylin.cube.model.CubeDesc;
import org.apache.kylin.cube.model.CubeJoinedFlatTableEnrich;
import org.apache.kylin.cube.util.KeyValueBuilder;
import org.apache.kylin.dict.DictionaryGenerator;
import org.apache.kylin.dict.IDictionaryBuilder;
import org.apache.kylin.engine.EngineFactory;
Expand Down Expand Up @@ -250,6 +251,7 @@ static class FlatOutputFucntion implements PairFlatMapFunction<Iterator<String[]
private Map<Integer, DimensionRangeInfo> dimensionRangeInfoMap;
private transient ByteBuffer tmpbuf;
private LongAccumulator bytesWritten;
private KeyValueBuilder keyValueBuilder;

public FlatOutputFucntion(String cubeName, String segmentId, String metaurl, SerializableConfiguration conf,
int samplingPercent, LongAccumulator bytesWritten) {
Expand All @@ -272,6 +274,7 @@ private void init() {
CubeJoinedFlatTableEnrich intermediateTableDesc = new CubeJoinedFlatTableEnrich(
EngineFactory.getJoinedFlatTableDesc(cubeSegment), cubeDesc);

keyValueBuilder = new KeyValueBuilder(intermediateTableDesc);
reducerMapping = new FactDistinctColumnsReducerMapping(cubeInstance);
tmpbuf = ByteBuffer.allocate(4096);

Expand Down Expand Up @@ -317,7 +320,7 @@ public Iterator<Tuple2<SelfDefineSortableKey, Text>> call(Iterator<String[]> row

for (int i = 0; i < allCols.size(); i++) {
String fieldValue = row[columnIndex[i]];
if (fieldValue == null)
if (fieldValue == null || keyValueBuilder.isNull(fieldValue))
continue;

final DataType type = allCols.get(i).getType();
Expand Down

0 comments on commit 6544143

Please sign in to comment.