Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ std::vector<SchemaScanner::ColumnDesc> SchemaRoutineLoadJobScanner::_s_tbls_colu
{"USER_NAME", TYPE_STRING, sizeof(StringRef), true},
{"CURRENT_ABORT_TASK_NUM", TYPE_INT, sizeof(int32_t), true},
{"IS_ABNORMAL_PAUSE", TYPE_BOOLEAN, sizeof(int8_t), true},
{"COMPUTE_GROUP", TYPE_STRING, sizeof(StringRef), true},
};

SchemaRoutineLoadJobScanner::SchemaRoutineLoadJobScanner()
Expand Down Expand Up @@ -173,6 +174,9 @@ Status SchemaRoutineLoadJobScanner::_fill_block_impl(vectorized::Block* block) {
case 17: // USER_NAME
column_value = job_info.__isset.user_name ? job_info.user_name : "";
break;
case 20: // COMPUTE_GROUP
column_value = job_info.__isset.compute_group ? job_info.compute_group : "";
break;
}

str_refs[row_idx] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ public class SchemaTable extends Table {
.column("USER_NAME", ScalarType.createStringType())
.column("CURRENT_ABORT_TASK_NUM", ScalarType.createType(PrimitiveType.INT))
.column("IS_ABNORMAL_PAUSE", ScalarType.createType(PrimitiveType.BOOLEAN))
.column("COMPUTE_GROUP", ScalarType.createStringType())
.build())
)
.put("load_jobs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1638,6 +1638,10 @@ public void setCloudCluster(String cloudCluster) {
this.cloudCluster = cloudCluster;
}

public String getClusterInfo() {
return Strings.nullToEmpty(cloudCluster);
}

// check the correctness of commit info
protected abstract boolean checkCommitInfo(RLTaskTxnCommitAttachment rlTaskTxnCommitAttachment,
TransactionState txnState,
Expand Down Expand Up @@ -1691,6 +1695,7 @@ public List<String> getShowInfo() {
row.add(otherMsg);
row.add(userIdentity.getQualifiedUser());
row.add(comment);
row.add(getClusterInfo());
return row;
} finally {
readUnlock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public class ShowRoutineLoadCommand extends ShowCommand {
.add("OtherMsg")
.add("User")
.add("Comment")
.add("ComputeGroup")
.build();

private final LabelNameInfo labelNameInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4364,6 +4364,7 @@ public TFetchRoutineLoadJobResult fetchRoutineLoadJob(TFetchRoutineLoadJobReques
jobInfo.setUserName(job.getUserIdentity().getQualifiedUser());
jobInfo.setCurrentAbortTaskNum(job.getJobStatistic().currentAbortedTaskNum);
jobInfo.setIsAbnormalPause(job.isAbnormalPause());
jobInfo.setComputeGroup(job.getClusterInfo());
jobInfos.add(jobInfo);
}
if (LOG.isDebugEnabled()) {
Expand Down
1 change: 1 addition & 0 deletions gensrc/thrift/FrontendService.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -1550,6 +1550,7 @@ struct TRoutineLoadJob {
18: optional string user_name
19: optional i32 current_abort_task_num
20: optional bool is_abnormal_pause
21: optional string compute_group
}

struct TFetchRoutineLoadJobResult {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ suite("test_routine_load_job_info_system_table","p0") {
def res = sql "SELECT JOB_NAME FROM information_schema.routine_load_jobs WHERE CURRENT_ABORT_TASK_NUM > 0 OR IS_ABNORMAL_PAUSE = TRUE"
log.info("res: ${res}".toString())
assertTrue(res.toString().contains("${jobName}"))

def computeGroupRes = sql "SELECT JOB_NAME, COMPUTE_GROUP FROM information_schema.routine_load_jobs WHERE JOB_NAME = '${jobName}'"
log.info("compute group res: ${computeGroupRes}".toString())
assertTrue(computeGroupRes.size() > 0)
assertNotNull(computeGroupRes[0][1])
} finally {
sql "stop routine load for ${jobName}"
sql "DROP TABLE IF EXISTS ${tableName}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,26 @@ suite("test_show_routine_load","p0") {
} finally {
sql "stop routine load for testShow"
}

// test show routine load computegroup
try {
sql """
CREATE ROUTINE LOAD testShowComputeGroup ON ${tableName}
COLUMNS TERMINATED BY ","
FROM KAFKA
(
"kafka_broker_list" = "${externalEnvIp}:${kafka_port}",
"kafka_topic" = "${kafkaCsvTpoics[0]}",
"property.kafka_default_offsets" = "OFFSET_BEGINNING"
);
"""
def res = sql "show routine load for testShowComputeGroup"
// ComputeGroup is the last column (index 22)
def computeGroupStr = res[0][22]
log.info("routine load computegroup: ${computeGroupStr.toString()}".toString())
assertNotNull(computeGroupStr)
} finally {
sql "stop routine load for testShowComputeGroup"
}
}
}
Loading