Java Code Examples for org.apache.hadoop.hive.ql.exec.vector.DecimalColumnVector#set()

The following examples show how to use org.apache.hadoop.hive.ql.exec.vector.DecimalColumnVector#set() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OrcWriter.java    From osm2orc with ISC License 6 votes vote down vote up
@Override
public void process(WayContainer container) {
    DecimalColumnVector lat = (DecimalColumnVector) batch.cols[3];
    DecimalColumnVector lon = (DecimalColumnVector) batch.cols[4];
    ListColumnVector nds = (ListColumnVector) batch.cols[5];

    checkLimit();
    addCommonProperties(container);

    lat.isNull[row] = true;
    lon.isNull[row] = true;
    lat.set(row, (HiveDecimal) null);
    lon.set(row, (HiveDecimal) null);

    Way way = container.getEntity();

    nds.lengths[row] = way.getWayNodes().size();
    nds.childCount += nds.lengths[row];
    nds.child.ensureSize(nds.childCount, nds.offsets[row] != 0);

    for (int j = 0; j < way.getWayNodes().size(); j++) {
        StructColumnVector ndsStruct = (StructColumnVector) nds.child;

        ((LongColumnVector) ndsStruct.fields[0]).vector[(int) nds.offsets[row] + j] = way.getWayNodes().get(j).getNodeId();
    }
}
 
Example 2
Source File: OrcWriter.java    From osm2orc with ISC License 5 votes vote down vote up
@Override
public void process(NodeContainer container) {
    DecimalColumnVector lat = (DecimalColumnVector) batch.cols[3];
    DecimalColumnVector lon = (DecimalColumnVector) batch.cols[4];

    checkLimit();
    addCommonProperties(container);

    Node node = container.getEntity();
    lat.set(row, HiveDecimal.create(BigDecimal.valueOf(node.getLatitude())));
    lon.set(row, HiveDecimal.create(BigDecimal.valueOf(node.getLongitude())));
}
 
Example 3
Source File: OrcWriter.java    From osm2orc with ISC License 5 votes vote down vote up
@Override
public void process(RelationContainer container) {
    DecimalColumnVector lat = (DecimalColumnVector) batch.cols[3];
    DecimalColumnVector lon = (DecimalColumnVector) batch.cols[4];
    ListColumnVector members = (ListColumnVector) batch.cols[6];

    checkLimit();
    addCommonProperties(container);

    lat.isNull[row] = true;
    lon.isNull[row] = true;
    lat.set(row, (HiveDecimal) null);
    lon.set(row, (HiveDecimal) null);

    Relation relation = container.getEntity();

    members.lengths[row] = relation.getMembers().size();
    members.childCount += members.lengths[row];
    members.child.ensureSize(members.childCount, members.offsets[row] != 0);

    for (int j = 0; j < relation.getMembers().size(); j++) {
        StructColumnVector membersStruct = (StructColumnVector) members.child;

        ((BytesColumnVector) membersStruct.fields[0]).setVal((int) members.offsets[row] + j, relation.getMembers().get(j).getMemberType().toString().toLowerCase().getBytes());
        ((LongColumnVector) membersStruct.fields[1]).vector[(int) members.offsets[row] + j] = relation.getMembers().get(j).getMemberId();
        ((BytesColumnVector) membersStruct.fields[2]).setVal((int) members.offsets[row] + j, relation.getMembers().get(j).getMemberRole().getBytes());
    }
}
 
Example 4
Source File: AbstractOrcColumnVector.java    From flink with Apache License 2.0 5 votes vote down vote up
private static DecimalColumnVector createDecimalVector(int batchSize, int precision, int scale, Object value) {
	DecimalColumnVector dv = new DecimalColumnVector(batchSize, precision, scale);
	if (value == null) {
		dv.noNulls = false;
		dv.isNull[0] = true;
		dv.isRepeating = true;
	} else {
		dv.set(0, value instanceof HiveDecimal ?
				(HiveDecimal) value :
				HiveDecimal.create((BigDecimal) value));
		dv.isRepeating = true;
		dv.isNull[0] = false;
	}
	return dv;
}