Skip to content

Commit

Permalink
[Improvement][Audit] add sql type for query audit (apache#37790)
Browse files Browse the repository at this point in the history
Co-authored-by: garenshi <[email protected]>
  • Loading branch information
qzsee and garenshi authored Jul 26, 2024
1 parent 4bfbab5 commit 22dc6c9
Show file tree
Hide file tree
Showing 156 changed files with 922 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ public void analyze(Analyzer analyzer) throws UserException {
public String toSql() {
return "ALTER CATALOG " + catalogName + " MODIFY COMMENT " + comment;
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,9 @@ public void analyze(Analyzer analyzer) throws UserException {
public String toSql() {
return "ALTER CATALOG " + catalogName + " RENAME " + newCatalogName;
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,9 @@ public String toSql() {
public boolean needAuditEncryption() {
return true;
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,9 @@ public String toSql() {
sb.append("PROPERTIES(").append(new PrintableMap<>(properties, " = ", true, false)).append(")");
return sb.toString();
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -219,4 +219,9 @@ public String toSql() {
public String getValue(StatsType statsType) {
return statsTypeToValue.get(statsType);
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,9 @@ public String toSql() {
return "ALTER DATABASE " + dbName + " SET PROPERTIES ("
+ new PrintableMap<String, String>(properties, "=", true, false, ",") + ")";
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,9 @@ public String toSql() {
+ quotaType.name()
+ " QUOTA " + quotaValue;
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,9 @@ public String toSql() {
return "ALTER DATABASE " + dbName + " RENAME " + newDbName;
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,9 @@ public void analyze(Analyzer analyzer) throws UserException {
throw new AnalysisException("Can't alter inner job status");
}
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,9 @@ public String toSql() {
return sb.toString();
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,9 @@ public String toSql() {
sb.append("PROPERTIES(").append(new PrintableMap<>(properties, " = ", true, false)).append(")");
return sb.toString();
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,9 @@ public String toSql() {
public boolean needAuditEncryption() {
return true;
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,9 @@ public String toSql() {
sb.append(" COMMENT \"").append(comment).append("\"");
return sb.toString();
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,10 @@ private void checkDataSourceProperties() throws UserException {
dataSourceProperties.setTimezone(job.getTimezone());
dataSourceProperties.analyze();
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,9 @@ public String toSql() {
.append(")");
return sb.toString();
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,9 @@ public String toSql() {
public String toString() {
return toSql();
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,9 @@ public String toSql() {
public String toString() {
return toSql();
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,9 @@ public String toSql() {

return sb.toString();
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,9 @@ public String toSql() {
public String toString() {
return toSql();
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,9 @@ public String toSql() {
sb.append("PROPERTIES(").append(new PrintableMap<>(properties, " = ", true, false)).append(")");
return sb.toString();
}

@Override
public StmtType stmtType() {
return StmtType.ALTER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,9 @@ public boolean forceFull() {
public boolean usingSqlForExternalTable() {
return analyzeProperties.usingSqlForExternalTable();
}

@Override
public StmtType stmtType() {
return StmtType.ANALYZE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,10 @@ public String toSql() {
sb.append("\n)");
return sb.toString();
}

@Override
public StmtType stmtType() {
return StmtType.BACKUP;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,9 @@ public String toSql() {

return sb.toString();
}

@Override
public StmtType stmtType() {
return StmtType.CANCEL;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,9 @@ public String toString() {
return toSql();
}

@Override
public StmtType stmtType() {
return StmtType.CANCEL;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,9 @@ public String toSql() {
public String toString() {
return toSql();
}

@Override
public StmtType stmtType() {
return StmtType.CANCEL;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,9 @@ public String toString() {
return toSql();
}

@Override
public StmtType stmtType() {
return StmtType.CANCEL;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,9 @@ public void analyze(Analyzer analyzer) throws UserException {
}
this.taskId = ((IntLiteral) compoundPredicate.getChildren().get(1).getChild(1)).getLongValue();
}

@Override
public StmtType stmtType() {
return StmtType.CANCEL;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,9 @@ public String toString() {
return toSql();
}

@Override
public StmtType stmtType() {
return StmtType.CANCEL;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,9 @@ public String toSql() {
public RedirectStatus getRedirectStatus() {
return RedirectStatus.FORWARD_WITH_SYNC;
}

@Override
public StmtType stmtType() {
return StmtType.CLEAN;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@ public String toSql() {
public RedirectStatus getRedirectStatus() {
return RedirectStatus.FORWARD_WITH_SYNC;
}

@Override
public StmtType stmtType() {
return StmtType.CLEAN;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,9 @@ public String toSql() {
public enum Scope {
ALL, DB, TABLE
}

@Override
public StmtType stmtType() {
return StmtType.CLEAN;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,9 @@ public String toSql() {
public boolean needAuditEncryption() {
return true;
}

@Override
public StmtType stmtType() {
return StmtType.CREATE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,9 @@ public Map<String, String> getProperties() {
public DataSyncJobType getDataSyncJobType() {
return dataSyncJobType;
}

@Override
public StmtType stmtType() {
return StmtType.CREATE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,9 @@ public String toSql() {
}
return stringBuilder.toString();
}

@Override
public StmtType stmtType() {
return StmtType.CREATE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,9 @@ public String toSql() {
.append(encryptKeyName.getKeyName()).append(" AS \"").append(keyString).append("\"");
return stringBuilder.toString();
}

@Override
public StmtType stmtType() {
return StmtType.CREATE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,9 @@ public String toSql() {
public RedirectStatus getRedirectStatus() {
return RedirectStatus.FORWARD_WITH_SYNC;
}

@Override
public StmtType stmtType() {
return StmtType.CREATE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -902,4 +902,9 @@ public String toSql() {
public RedirectStatus getRedirectStatus() {
return RedirectStatus.FORWARD_WITH_SYNC;
}

@Override
public StmtType stmtType() {
return StmtType.CREATE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -723,4 +723,9 @@ public static boolean isMVColumnNormal(String name) {
public String toSql() {
return null;
}

@Override
public StmtType stmtType() {
return StmtType.CREATE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,9 @@ public String toSql() {
}
return sb.toString();
}

@Override
public StmtType stmtType() {
return StmtType.CREATE;
}
}
Loading

0 comments on commit 22dc6c9

Please sign in to comment.