Search in sources :

Example 1 with StreamSinkFieldEntity

use of org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity in project incubator-inlong by apache.

the class HiveStreamSinkOperation method getById.

@Override
public SinkResponse getById(@NotNull String sinkType, @NotNull Integer id) {
    StreamSinkEntity entity = sinkMapper.selectByPrimaryKey(id);
    Preconditions.checkNotNull(entity, ErrorCodeEnum.SINK_INFO_NOT_FOUND.getMessage());
    String existType = entity.getSinkType();
    Preconditions.checkTrue(Constant.SINK_HIVE.equals(existType), String.format(Constant.SINK_TYPE_NOT_SAME, Constant.SINK_HIVE, existType));
    SinkResponse response = this.getFromEntity(entity, HiveSinkResponse::new);
    List<StreamSinkFieldEntity> entities = sinkFieldMapper.selectBySinkId(id);
    List<SinkFieldResponse> infos = CommonBeanUtils.copyListProperties(entities, SinkFieldResponse::new);
    response.setFieldList(infos);
    return response;
}
Also used : SinkResponse(org.apache.inlong.manager.common.pojo.sink.SinkResponse) HiveSinkResponse(org.apache.inlong.manager.common.pojo.sink.hive.HiveSinkResponse) HiveSinkResponse(org.apache.inlong.manager.common.pojo.sink.hive.HiveSinkResponse) StreamSinkEntity(org.apache.inlong.manager.dao.entity.StreamSinkEntity) SinkFieldResponse(org.apache.inlong.manager.common.pojo.sink.SinkFieldResponse) StreamSinkFieldEntity(org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity)

Example 2 with StreamSinkFieldEntity

use of org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity in project incubator-inlong by apache.

the class HiveStreamSinkOperation method saveFieldOpt.

@Override
public void saveFieldOpt(SinkRequest request) {
    List<SinkFieldRequest> fieldList = request.getFieldList();
    LOGGER.info("begin to save field={}", fieldList);
    if (CollectionUtils.isEmpty(fieldList)) {
        return;
    }
    int size = fieldList.size();
    List<StreamSinkFieldEntity> entityList = new ArrayList<>(size);
    String groupId = request.getInlongGroupId();
    String streamId = request.getInlongStreamId();
    String sinkType = request.getSinkType();
    Integer sinkId = request.getId();
    for (SinkFieldRequest fieldInfo : fieldList) {
        StreamSinkFieldEntity fieldEntity = CommonBeanUtils.copyProperties(fieldInfo, StreamSinkFieldEntity::new);
        if (StringUtils.isEmpty(fieldEntity.getFieldComment())) {
            fieldEntity.setFieldComment(fieldEntity.getFieldName());
        }
        fieldEntity.setInlongGroupId(groupId);
        fieldEntity.setInlongStreamId(streamId);
        fieldEntity.setSinkType(sinkType);
        fieldEntity.setSinkId(sinkId);
        fieldEntity.setIsDeleted(EntityStatus.UN_DELETED.getCode());
        entityList.add(fieldEntity);
    }
    sinkFieldMapper.insertAll(entityList);
    LOGGER.info("success to save hive field");
}
Also used : SinkFieldRequest(org.apache.inlong.manager.common.pojo.sink.SinkFieldRequest) ArrayList(java.util.ArrayList) StreamSinkFieldEntity(org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity)

Example 3 with StreamSinkFieldEntity

use of org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity in project incubator-inlong by apache.

the class IcebergStreamSinkOperation method getById.

@Override
public SinkResponse getById(String sinkType, Integer id) {
    StreamSinkEntity entity = sinkMapper.selectByPrimaryKey(id);
    Preconditions.checkNotNull(entity, ErrorCodeEnum.SINK_INFO_NOT_FOUND.getMessage());
    String existType = entity.getSinkType();
    Preconditions.checkTrue(Constant.SINK_ICEBERG.equals(existType), String.format(Constant.SINK_TYPE_NOT_SAME, Constant.SINK_ICEBERG, existType));
    SinkResponse response = this.getFromEntity(entity, IcebergSinkResponse::new);
    List<StreamSinkFieldEntity> entities = sinkFieldMapper.selectBySinkId(id);
    List<SinkFieldResponse> infos = CommonBeanUtils.copyListProperties(entities, SinkFieldResponse::new);
    response.setFieldList(infos);
    return response;
}
Also used : IcebergSinkResponse(org.apache.inlong.manager.common.pojo.sink.iceberg.IcebergSinkResponse) SinkResponse(org.apache.inlong.manager.common.pojo.sink.SinkResponse) StreamSinkEntity(org.apache.inlong.manager.dao.entity.StreamSinkEntity) SinkFieldResponse(org.apache.inlong.manager.common.pojo.sink.SinkFieldResponse) StreamSinkFieldEntity(org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity) IcebergSinkResponse(org.apache.inlong.manager.common.pojo.sink.iceberg.IcebergSinkResponse)

Example 4 with StreamSinkFieldEntity

use of org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity in project incubator-inlong by apache.

the class KafkaStreamSinkOperation method saveFieldOpt.

@Override
public void saveFieldOpt(SinkRequest request) {
    List<SinkFieldRequest> fieldList = request.getFieldList();
    LOGGER.info("begin to save field={}", fieldList);
    if (CollectionUtils.isEmpty(fieldList)) {
        return;
    }
    int size = fieldList.size();
    List<StreamSinkFieldEntity> entityList = new ArrayList<>(size);
    String groupId = request.getInlongGroupId();
    String streamId = request.getInlongStreamId();
    String sinkType = request.getSinkType();
    Integer sinkId = request.getId();
    for (SinkFieldRequest fieldInfo : fieldList) {
        StreamSinkFieldEntity fieldEntity = CommonBeanUtils.copyProperties(fieldInfo, StreamSinkFieldEntity::new);
        if (StringUtils.isEmpty(fieldEntity.getFieldComment())) {
            fieldEntity.setFieldComment(fieldEntity.getFieldName());
        }
        fieldEntity.setInlongGroupId(groupId);
        fieldEntity.setInlongStreamId(streamId);
        fieldEntity.setSinkType(sinkType);
        fieldEntity.setSinkId(sinkId);
        fieldEntity.setIsDeleted(EntityStatus.UN_DELETED.getCode());
        entityList.add(fieldEntity);
    }
    sinkFieldMapper.insertAll(entityList);
    LOGGER.info("success to save field");
}
Also used : SinkFieldRequest(org.apache.inlong.manager.common.pojo.sink.SinkFieldRequest) ArrayList(java.util.ArrayList) StreamSinkFieldEntity(org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity)

Example 5 with StreamSinkFieldEntity

use of org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity in project incubator-inlong by apache.

the class IcebergStreamSinkOperation method saveFieldOpt.

@Override
public void saveFieldOpt(SinkRequest request) {
    List<SinkFieldRequest> fieldList = request.getFieldList();
    LOGGER.info("begin to save field={}", fieldList);
    if (CollectionUtils.isEmpty(fieldList)) {
        return;
    }
    int size = fieldList.size();
    List<StreamSinkFieldEntity> entityList = new ArrayList<>(size);
    String groupId = request.getInlongGroupId();
    String streamId = request.getInlongStreamId();
    String sinkType = request.getSinkType();
    Integer sinkId = request.getId();
    for (SinkFieldRequest fieldInfo : fieldList) {
        StreamSinkFieldEntity fieldEntity = CommonBeanUtils.copyProperties(fieldInfo, StreamSinkFieldEntity::new);
        if (StringUtils.isEmpty(fieldEntity.getFieldComment())) {
            fieldEntity.setFieldComment(fieldEntity.getFieldName());
        }
        fieldEntity.setInlongGroupId(groupId);
        fieldEntity.setInlongStreamId(streamId);
        fieldEntity.setSinkType(sinkType);
        fieldEntity.setSinkId(sinkId);
        fieldEntity.setIsDeleted(EntityStatus.UN_DELETED.getCode());
        entityList.add(fieldEntity);
    }
    sinkFieldMapper.insertAll(entityList);
    LOGGER.info("success to save hive field");
}
Also used : SinkFieldRequest(org.apache.inlong.manager.common.pojo.sink.SinkFieldRequest) ArrayList(java.util.ArrayList) StreamSinkFieldEntity(org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity)

Aggregations

StreamSinkFieldEntity (org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity)9 ArrayList (java.util.ArrayList)5 SinkFieldRequest (org.apache.inlong.manager.common.pojo.sink.SinkFieldRequest)4 SinkFieldResponse (org.apache.inlong.manager.common.pojo.sink.SinkFieldResponse)4 SinkResponse (org.apache.inlong.manager.common.pojo.sink.SinkResponse)4 StreamSinkEntity (org.apache.inlong.manager.dao.entity.StreamSinkEntity)4 HiveColumnQueryBean (org.apache.inlong.manager.common.pojo.query.hive.HiveColumnQueryBean)1 HiveTableQueryBean (org.apache.inlong.manager.common.pojo.query.hive.HiveTableQueryBean)1 ClickHouseSinkResponse (org.apache.inlong.manager.common.pojo.sink.ck.ClickHouseSinkResponse)1 HiveSinkResponse (org.apache.inlong.manager.common.pojo.sink.hive.HiveSinkResponse)1 IcebergSinkResponse (org.apache.inlong.manager.common.pojo.sink.iceberg.IcebergSinkResponse)1 KafkaSinkResponse (org.apache.inlong.manager.common.pojo.sink.kafka.KafkaSinkResponse)1