Skip to content

Commit

Permalink
Update LDENPointNoiseMapFactory.java
Browse files Browse the repository at this point in the history
Description:
This change updates the precision of numeric columns from (5,2) to (9,2) in the forgeCreateTable method.

Reason for Change:
The previous precision (5,2) caused the error:
"Value too long for column 'HZ8000 NUMERIC(5, 2)'"
This issue typically occurs when the propagation distance exceeds 3000 meters, resulting in values that exceed the allowed range.

Proposed Fix:
Update the numeric(5,2) columns to numeric(9,2) for fields LAEQ, LEQ, and frequency-related columns (HZ*).
This ensures compatibility with larger numerical values generated in scenarios with significant propagation distances.

Impact:
Resolves the numerical precision issue for long propagation distances.
Prevents runtime errors when inserting large numerical values into frequency (HZ*) and acoustic level (LAEQ, LEQ) columns.
  • Loading branch information
IsotoCedex authored Jan 7, 2025
1 parent ba984f5 commit acf9ae7
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,16 @@ void processStack(String tableName, ConcurrentLinkedDeque<ComputeRaysOutAttenuat
}
}


/**
*
* The previous precision (5,2) caused the error:
* "Value too long for column 'HZ8000 NUMERIC(5, 2)'"
* This issue typically occurs when the propagation distance exceeds 3000 meters, resulting in values that exceed the allowed range.
* Proposed Fix:
* Update the numeric(5,2) columns to numeric(9,2) for fields LAEQ, LEQ, and frequency-related columns (HZ*).
* This ensures compatibility with larger numerical values generated in scenarios with significant propagation distances.
*/
private String forgeCreateTable(String tableName) {
StringBuilder sb = new StringBuilder("create table ");
sb.append(tableName);
Expand All @@ -402,15 +412,15 @@ private String forgeCreateTable(String tableName) {
sb.append(" (IDRECEIVER bigint NOT NULL");
}
if (ldenConfig.computeLAEQOnly){
sb.append(", LAEQ numeric(5, 2)");
sb.append(", LAEQ numeric(9, 2)");
sb.append(");");
} else {
for (int idfreq = 0; idfreq < ldenConfig.propagationProcessPathDataDay.freq_lvl.size(); idfreq++) {
sb.append(", HZ");
sb.append(ldenConfig.propagationProcessPathDataDay.freq_lvl.get(idfreq));
sb.append(" numeric(5, 2)");
sb.append(" numeric(9, 2)");
}
sb.append(", LAEQ numeric(5, 2), LEQ numeric(5, 2)");
sb.append(", LAEQ numeric(9, 2), LEQ numeric(9, 2)");
sb.append(");");
}
return sb.toString();
Expand Down

0 comments on commit acf9ae7

Please sign in to comment.