Skip to content

Commit

Permalink
Follow the java naming conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmyMiao87 committed Jun 6, 2019
1 parent 6b77052 commit c6d9e32
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
8 changes: 5 additions & 3 deletions be/src/exec/broker_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ Status BrokerScanner::init_expr_ctxes() {
if (has_transform_slot_ids) {
auto it = _params.transform_slot_ids.find(slot_desc->id());
if (it == std::end(_params.transform_slot_ids)) {
_has_expr_columns.emplace_back(true);
_has_expr_columns.emplace_back(false);
}
else {
_has_expr_columns.emplace_back(false);
_has_expr_columns.emplace_back(true);
}
}
}
Expand Down Expand Up @@ -605,7 +605,7 @@ bool BrokerScanner::fill_dest_tuple(const Slice& line, Tuple* dest_tuple, MemPoo
void* value = ctx->get_value(_src_tuple_row);
if (value == nullptr) {
if (_strict_mode && !_src_tuple->is_null(slot_desc->null_indicator_offset())
&& !_has_expr_columns[ctx_idx++]) {
&& !_has_expr_columns[ctx_idx]) {
std::stringstream error_msg;
error_msg << "column(" << slot_desc->col_name() << ") value is incorrect "
<< "while strict mode is " << std::boolalpha << _strict_mode;
Expand All @@ -624,11 +624,13 @@ bool BrokerScanner::fill_dest_tuple(const Slice& line, Tuple* dest_tuple, MemPoo
return false;
}
dest_tuple->set_null(slot_desc->null_indicator_offset());
ctx_idx++;
continue;
}
dest_tuple->set_not_null(slot_desc->null_indicator_offset());
void* slot = dest_tuple->get_slot(slot_desc->tuple_offset());
RawValue::write(value, slot, slot_desc->type(), mem_pool);
ctx_idx++;
continue;
}
return true;
Expand Down
9 changes: 7 additions & 2 deletions fe/src/main/java/org/apache/doris/load/loadv2/LoadJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.doris.common.DdlException;
import org.apache.doris.common.ErrorCode;
import org.apache.doris.common.ErrorReport;
import org.apache.doris.common.FeMetaVersion;
import org.apache.doris.common.LabelAlreadyUsedException;
import org.apache.doris.common.MetaNotFoundException;
import org.apache.doris.common.UserException;
Expand Down Expand Up @@ -691,7 +692,9 @@ public void write(DataOutput out) throws IOException {
}
out.writeInt(progress);
loadingStatus.write(out);
// TODO: record strict mode in next meta version
// if (Catalog.getCurrentCatalogJournalVersion() >= FeMetaVersion.VERSION_52) {
// out.writeBoolean(strictMode);
// }
}

@Override
Expand All @@ -718,6 +721,8 @@ public void readFields(DataInput in) throws IOException {
}
progress = in.readInt();
loadingStatus.readFields(in);
// TODO: read strict mode in next meta version
// if (Catalog.getCurrentCatalogJournalVersion() >= FeMetaVersion.VERSION_52) {
// strictMode = in.readBoolean();
// }
}
}
7 changes: 4 additions & 3 deletions fe/src/main/java/org/apache/doris/planner/BrokerScanNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ private void initParams(ParamCreateContext context) throws AnalysisException, Us
private void finalizeParams(ParamCreateContext context) throws UserException, AnalysisException {
Map<String, SlotDescriptor> slotDescByName = context.slotDescByName;
Map<String, Expr> exprMap = context.exprMap;
Set<Integer> transform_slot_ids = Sets.newHashSet();
Set<Integer> transformSlotIds = Sets.newHashSet();
// Analyze expr map
if (exprMap != null) {
for (Map.Entry<String, Expr> entry : exprMap.entrySet()) {
Expand Down Expand Up @@ -416,7 +416,6 @@ private void finalizeParams(ParamCreateContext context) throws UserException, An
expr = exprMap.get(destSlotDesc.getColumn().getName());
}
if (expr == null) {
transform_slot_ids.add(destSlotDesc.getId().asInt());
SlotDescriptor srcSlotDesc = slotDescByName.get(destSlotDesc.getColumn().getName());
if (srcSlotDesc != null) {
// If dest is allow null, we set source to nullable
Expand All @@ -437,6 +436,8 @@ private void finalizeParams(ParamCreateContext context) throws UserException, An
}
}
}
} else {
transformSlotIds.add(destSlotDesc.getId().asInt());
}

if (isNegative && destSlotDesc.getColumn().getAggregationType() == AggregateType.SUM) {
Expand All @@ -446,7 +447,7 @@ private void finalizeParams(ParamCreateContext context) throws UserException, An
expr = castToSlot(destSlotDesc, expr);
context.params.putToExpr_of_dest_slot(destSlotDesc.getId().asInt(), expr.treeToThrift());
}
context.params.setTransform_slot_ids(transform_slot_ids);
context.params.setTransform_slot_ids(transformSlotIds);
context.params.setDest_tuple_id(desc.getId().asInt());
context.params.setStrict_mode(strictMode);
// Need re compute memory layout after set some slot descriptor to nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public void finalize(Analyzer analyzer) throws UserException, UserException {

private void finalizeParams() throws UserException {
boolean negative = streamLoadTask.getNegative();
Set<Integer> transform_slot_ids = Sets.newHashSet();
Set<Integer> transformSlotIds = Sets.newHashSet();
for (SlotDescriptor dstSlotDesc : desc.getSlots()) {
if (!dstSlotDesc.isMaterialized()) {
continue;
Expand All @@ -252,7 +252,6 @@ private void finalizeParams() throws UserException {
expr = exprsByName.get(dstSlotDesc.getColumn().getName());
}
if (expr == null) {
transform_slot_ids.add(dstSlotDesc.getId().asInt());
SlotDescriptor srcSlotDesc = slotDescByName.get(dstSlotDesc.getColumn().getName());
if (srcSlotDesc != null) {
// If dest is allow null, we set source to nullable
Expand All @@ -272,6 +271,8 @@ private void finalizeParams() throws UserException {
}
}
}
} else {
transformSlotIds.add(dstSlotDesc.getId().asInt());
}
// check hll_hash
if (dstSlotDesc.getType().getPrimitiveType() == PrimitiveType.HLL) {
Expand All @@ -293,7 +294,7 @@ private void finalizeParams() throws UserException {
expr = castToSlot(dstSlotDesc, expr);
brokerScanRange.params.putToExpr_of_dest_slot(dstSlotDesc.getId().asInt(), expr.treeToThrift());
}
brokerScanRange.params.setTransform_slot_ids(transform_slot_ids);
brokerScanRange.params.setTransform_slot_ids(transformSlotIds);
brokerScanRange.params.setDest_tuple_id(desc.getId().asInt());
// LOG.info("brokerScanRange is {}", brokerScanRange);

Expand Down
2 changes: 1 addition & 1 deletion gensrc/thrift/PlanNodes.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ struct TBrokerScanRangeParams {
8: optional list<i64> partition_ids

// transform slot isd is a TSlotId list
// the member of list will be transform to slot type without expr
// the member of list will be transform to slot type by expr
9: optional set<Types.TSlotId> transform_slot_ids
// strictMode is a boolean
// if strict mode is true, the incorrect data (the result of cast is null) will not be loaded
Expand Down

0 comments on commit c6d9e32

Please sign in to comment.