Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: some SQL queries were malformed #1222

Merged
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 @@ -230,7 +230,7 @@ private static final String replaceQueryForFifo(String query) {
"AND " +
"job.pk_facility = ? " +
"AND " +
"(job.str_os = ? OR job.str_os IS NULL)" +
"(job.str_os = ? OR job.str_os IS NULL) " +
"AND " +
"job.pk_job IN ( " +
"SELECT " +
Expand All @@ -256,7 +256,7 @@ private static final String replaceQueryForFifo(String query) {
"AND " +
"j.pk_facility = ? " +
"AND " +
"(j.str_os = ? OR j.str_os IS NULL)" +
"(j.str_os = ? OR j.str_os IS NULL) " +
"AND " +
"(CASE WHEN lst.int_waiting_count > 0 THEN lst.pk_layer ELSE NULL END) = l.pk_layer " +
"AND " +
Expand Down Expand Up @@ -333,7 +333,7 @@ private static final String replaceQueryForFifo(String query) {
"AND " +
"job.pk_facility = ? " +
"AND " +
"(job.str_os = ? OR job.str_os IS NULL)" +
"(job.str_os = ? OR job.str_os IS NULL) " +
"AND " +
"job.pk_job IN ( " +
"SELECT /* index (h i_str_host_tag) */ " +
Expand All @@ -354,7 +354,7 @@ private static final String replaceQueryForFifo(String query) {
"AND " +
"j.pk_facility = ? " +
"AND " +
"(j.str_os = ? OR j.str_os IS NULL)" +
"(j.str_os = ? OR j.str_os IS NULL) " +
"AND " +
"(CASE WHEN lst.int_waiting_count > 0 THEN lst.pk_layer ELSE NULL END) = l.pk_layer " +
"AND " +
Expand Down Expand Up @@ -426,7 +426,7 @@ private static final String replaceQueryForFifo(String query) {
"AND " +
"(folder_resource.int_max_gpus = -1 OR folder_resource.int_gpus < folder_resource.int_max_gpus) " +
"AND " +
"job_resource.int_priority > ?" +
"job_resource.int_priority > ? " +
"AND " +
"job_resource.int_cores < job_resource.int_max_cores " +
"AND " +
Expand All @@ -438,7 +438,7 @@ private static final String replaceQueryForFifo(String query) {
"AND " +
"job.pk_facility = ? " +
"AND " +
"(job.str_os = ? OR job.str_os IS NULL)" +
"(job.str_os = ? OR job.str_os IS NULL) " +
"AND " +
"job.pk_job IN ( " +
"SELECT /* index (h i_str_host_tag) */ " +
Expand All @@ -457,7 +457,7 @@ private static final String replaceQueryForFifo(String query) {
"AND " +
"j.pk_facility = ? " +
"AND " +
"(j.str_os = ? OR j.str_os IS NULL)" +
"(j.str_os = ? OR j.str_os IS NULL) " +
"AND " +
"(CASE WHEN lst.int_waiting_count > 0 THEN lst.pk_layer ELSE NULL END) = l.pk_layer " +
"AND " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class FilterDaoJdbc extends JdbcDaoSupport implements FilterDao {

private static final String GET_ACTIVE_FILTERS =
"SELECT " +
"filter.*" +
"filter.* " +
"FROM " +
"filter " +
"WHERE " +
Expand All @@ -66,7 +66,7 @@ public class FilterDaoJdbc extends JdbcDaoSupport implements FilterDao {

private static final String GET_FILTERS =
"SELECT " +
"filter.*" +
"filter.* " +
"FROM " +
"filter " +
"WHERE " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ public void updateMaxRSS(JobInterface job, long value) {
"str_visible_name = NULL, " +
"ts_stopped = current_timestamp "+
"WHERE " +
"str_state = 'PENDING'" +
"str_state = 'PENDING' " +
"AND " +
"pk_job = ?";

Expand Down Expand Up @@ -945,7 +945,7 @@ public void updateParent(JobInterface job, GroupDetail dest, Inherit[] inherits)
"AND " +
"job.b_auto_book = true " +
"AND " +
"job_stat.int_waiting_count != 0" +
"job_stat.int_waiting_count != 0 " +
"AND " +
"job_resource.int_cores < job_resource.int_max_cores " +
"AND " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public void insertShow(ShowEntity show) {
"SELECT " +
"COUNT(show.pk_show) " +
"FROM " +
"show LEFT JOIN show_alias ON (show.pk_show = show_alias.pk_show )" +
"show LEFT JOIN show_alias ON (show.pk_show = show_alias.pk_show) " +
"WHERE " +
"(show.str_name = ? OR show_alias.str_name = ?) ";
public boolean showExists(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ public void isOptimizable() {
layer.getLayerId());

jdbcTemplate.update(
"UPDATE layer_usage SET int_core_time_success = 3600 * 6" +
"UPDATE layer_usage SET int_core_time_success = 3600 * 6 " +
"WHERE pk_layer=?", layer.getLayerId());

assertFalse(layerDao.isOptimizable(layer, 5, 3600));
Expand All @@ -532,7 +532,7 @@ public void isOptimizable() {
* Assert True
*/
jdbcTemplate.update(
"UPDATE layer_usage SET int_core_time_success = 3500 * 5" +
"UPDATE layer_usage SET int_core_time_success = 3500 * 5 " +
"WHERE pk_layer=?", layer.getLayerId());

assertTrue(layerDao.isOptimizable(layer, 5, 3600));
Expand Down