Apache DataFusion SQL Query Engine
Fix off by 1 in decimal cast to lower precision (#14731)
Piotr Findeisen04dc656de80b
diff --git a/Cargo.lock b/Cargo.lockindex bc8b2943b2..4e110789bf 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -246,9 +246,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"[[package]]name = "arrow"-version = "54.1.0"+version = "54.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6422e12ac345a0678d7a17e316238e3a40547ae7f92052b77bd86d5e0239f3fc"+checksum = "755b6da235ac356a869393c23668c663720b8749dd6f15e52b6c214b4b964cc7"dependencies = ["arrow-arith","arrow-array",@@ -270,9 +270,9 @@ dependencies = [[[package]]name = "arrow-arith"-version = "54.1.0"+version = "54.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "23cf34bb1f48c41d3475927bcc7be498665b8e80b379b88f62a840337f8b8248"+checksum = "64656a1e0b13ca766f8440752e9a93e11014eec7b67909986f83ed0ab1fe37b8"dependencies = ["arrow-array","arrow-buffer",@@ -312,9 +312,9 @@ dependencies = [[[package]]name = "arrow-cast"-version = "54.1.0"+version = "54.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "626e65bd42636a84a238bed49d09c8777e3d825bf81f5087a70111c2831d9870"+checksum = "1ac7eba5a987f8b4a7d9629206ba48e19a1991762795bbe5d08497b7736017ee"dependencies = ["arrow-array","arrow-buffer",@@ -333,9 +333,9 @@ dependencies = [[[package]]name = "arrow-csv"-version = "54.1.0"+version = "54.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "71c8f959f7a1389b1dbd883cdcd37c3ed12475329c111912f7f69dad8195d8c6"+checksum = "90f12542b8164398fc9ec595ff783c4cf6044daa89622c5a7201be920e4c0d4c"dependencies = ["arrow-array","arrow-cast",@@ -402,9 +402,9 @@ dependencies = [[[package]]name = "arrow-json"-version = "54.1.0"+version = "54.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "35de94f165ed8830aede72c35f238763794f0d49c69d30c44d49c9834267ff8c"+checksum = "9551d9400532f23a370cabbea1dc5a53c49230397d41f96c4c8eedf306199305"dependencies = ["arrow-array","arrow-buffer",@@ -422,9 +422,9 @@ dependencies = [[[package]]name = "arrow-ord"-version = "54.1.0"+version = "54.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8aa06e5f267dc53efbacb933485c79b6fc1685d3ffbe870a16ce4e696fb429da"+checksum = "6c07223476f8219d1ace8cd8d85fa18c4ebd8d945013f25ef5c72e85085ca4ee"dependencies = ["arrow-array","arrow-buffer",@@ -435,9 +435,9 @@ dependencies = [[[package]]name = "arrow-row"-version = "54.1.0"+version = "54.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "66f1144bb456a2f9d82677bd3abcea019217e572fc8f07de5a7bac4b2c56eb2c"+checksum = "91b194b38bfd89feabc23e798238989c6648b2506ad639be42ec8eb1658d82c4"dependencies = ["arrow-array","arrow-buffer",@@ -457,9 +457,9 @@ dependencies = [[[package]]name = "arrow-select"-version = "54.1.0"+version = "54.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f690752fdbd2dee278b5f1636fefad8f2f7134c85e20fd59c4199e15a39a6807"+checksum = "ac265273864a820c4a179fc67182ccc41ea9151b97024e1be956f0f2369c2539"dependencies = ["ahash 0.8.11","arrow-array",@@ -471,9 +471,9 @@ dependencies = [[[package]]name = "arrow-string"-version = "54.1.0"+version = "54.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d0fff9cd745a7039b66c47ecaf5954460f9fa12eed628f65170117ea93e64ee0"+checksum = "d44c8eed43be4ead49128370f7131f054839d3d6003e52aebf64322470b8fbd0"dependencies = ["arrow-array","arrow-buffer",@@ -2573,7 +2573,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"dependencies = ["libc",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -3470,7 +3470,7 @@ checksum = "e19b23d53f35ce9f56aebc7d1bb4e6ac1e9c0db7ac85c8d1760c04379edced37"dependencies = ["hermit-abi","libc",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -4639,7 +4639,7 @@ dependencies = ["once_cell","socket2","tracing",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -5061,7 +5061,7 @@ dependencies = ["errno","libc","linux-raw-sys",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -5624,7 +5624,7 @@ dependencies = ["cfg-if","libc","psm",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -5859,7 +5859,7 @@ dependencies = ["getrandom 0.3.1","once_cell","rustix",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -6734,7 +6734,7 @@ version = "0.1.9"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"dependencies = [- "windows-sys 0.48.0",+ "windows-sys 0.59.0",][[package]]diff --git a/Cargo.toml b/Cargo.tomlindex 4fcc131442..3aacf47508 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -78,7 +78,7 @@ version = "45.0.0"ahash = { version = "0.8", default-features = false, features = ["runtime-rng",] }-arrow = { version = "54.1.0", features = [+arrow = { version = "54.2.0", features = ["prettyprint","chrono-tz",] }diff --git a/datafusion/sqllogictest/test_files/decimal.slt b/datafusion/sqllogictest/test_files/decimal.sltindex f082a79c55..089910785a 100644--- a/datafusion/sqllogictest/test_files/decimal.slt+++ b/datafusion/sqllogictest/test_files/decimal.slt@@ -740,3 +740,10 @@ query RSELECT CAST('0' AS decimal(38,0));----0++query RR+SELECT+ cast(cast('0' as decimal(3,0)) as decimal(2,0)),+ cast(cast('5.20' as decimal(4,2)) as decimal(3,2))+----+0 5.2