Commit a5ff922
committed
[SPARK-28308][CORE] CalendarInterval sub-second part should be padded before parsing
## What changes were proposed in this pull request?
The sub-second part of the interval should be padded before parsing. Currently, Spark gives a correct value only when there is 9 digits below `.`.
```
spark-sql> select interval '0 0:0:0.123456789' day to second;
interval 123 milliseconds 456 microseconds
spark-sql> select interval '0 0:0:0.12345678' day to second;
interval 12 milliseconds 345 microseconds
spark-sql> select interval '0 0:0:0.1234' day to second;
interval 1 microseconds
```
## How was this patch tested?
Pass the Jenkins with the fixed test cases.
Closes #25079 from dongjoon-hyun/SPARK-28308.
Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>1 parent 28ea445 commit a5ff922
File tree
3 files changed
+9
-5
lines changed- common/unsafe/src
- main/java/org/apache/spark/unsafe/types
- test/java/org/apache/spark/unsafe/types
- sql/hive/src/test/scala/org/apache/spark/sql/hive/execution
3 files changed
+9
-5
lines changedLines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
| 181 | + | |
| 182 | + | |
182 | 183 | | |
183 | 184 | | |
184 | 185 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
| 166 | + | |
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
| |||
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1179 | 1179 | | |
1180 | 1180 | | |
1181 | 1181 | | |
| 1182 | + | |
| 1183 | + | |
1182 | 1184 | | |
1183 | 1185 | | |
1184 | 1186 | | |
1185 | 1187 | | |
1186 | | - | |
| 1188 | + | |
1187 | 1189 | | |
1188 | | - | |
1189 | | - | |
| 1190 | + | |
| 1191 | + | |
1190 | 1192 | | |
1191 | 1193 | | |
1192 | 1194 | | |
| |||
0 commit comments