1
0
Fork 0

Adding upstream version 21.0.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 21:20:19 +01:00
parent 07f4660f31
commit 91f2cef5f0
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
115 changed files with 66603 additions and 60920 deletions

View file

@ -94,11 +94,10 @@ class TestExecutor(unittest.TestCase):
with self.subTest(f"tpch-h {i + 1}"):
sql, _ = self.sqls[i]
a = self.cached_execute(sql)
b = pd.DataFrame(table.rows, columns=table.columns)
# The executor represents NULL values as None, whereas DuckDB represents them as NaN,
# and so the following is done to silence Pandas' "Mismatched null-like values" warnings
b = b.fillna(value=np.nan)
b = pd.DataFrame(
((np.nan if c is None else c for c in r) for r in table.rows),
columns=table.columns,
)
assert_frame_equal(a, b, check_dtype=False, check_index_type=False)
@ -778,14 +777,24 @@ class TestExecutor(unittest.TestCase):
self.assertEqual(result.rows, expected)
def test_dict_values(self):
tables = {
"foo": [{"raw": {"name": "Hello, World"}}],
}
result = execute("SELECT raw:name AS name FROM foo", read="snowflake", tables=tables)
tables = {"foo": [{"raw": {"name": "Hello, World", "a": [{"b": 1}]}}]}
result = execute("SELECT raw:name AS name FROM foo", read="snowflake", tables=tables)
self.assertEqual(result.columns, ("NAME",))
self.assertEqual(result.rows, [("Hello, World",)])
result = execute("SELECT raw:a[0].b AS b FROM foo", read="snowflake", tables=tables)
self.assertEqual(result.columns, ("B",))
self.assertEqual(result.rows, [(1,)])
result = execute("SELECT raw:a[1].b AS b FROM foo", read="snowflake", tables=tables)
self.assertEqual(result.columns, ("B",))
self.assertEqual(result.rows, [(None,)])
result = execute("SELECT raw:a[0].c AS c FROM foo", read="snowflake", tables=tables)
self.assertEqual(result.columns, ("C",))
self.assertEqual(result.rows, [(None,)])
tables = {
'"ITEM"': [
{"id": 1, "attributes": {"flavor": "cherry", "taste": "sweet"}},