From 6db2412be79e4ade8bfe9e28010a38fedd1e0404 Mon Sep 17 00:00:00 2001 From: Luca <32342099+McLavish@users.noreply.github.com> Date: Mon, 10 Aug 2026 10:56:13 +0200 Subject: [PATCH 1/3] perf fix: removed count() when results exceeded sizecap. this triggered a query double execution --- src/jsoniqmagic/magic.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/jsoniqmagic/magic.py b/src/jsoniqmagic/magic.py index c607f4c..9d9a9cc 100644 --- a/src/jsoniqmagic/magic.py +++ b/src/jsoniqmagic/magic.py @@ -157,8 +157,7 @@ def run(self, line, cell=None, timed=False): print("Usual reasons: firewall, misconfigured proxy.") return if len(capplusone) > rumble.getRumbleConf().getResultSizeCap(): - count = response.count() - print("The query output %s items, which is too many to display. Displaying the first %s items:" % (count, rumble.getRumbleConf().getResultSizeCap())) + print("The query output too many items to display. Displaying the first %s items:" % (rumble.getRumbleConf().getResultSizeCap())) for e in capplusone[:rumble.getRumbleConf().getResultSizeCap()]: print(json.dumps(json.loads(e.serializeAsJSON()), indent=2)) From a13108f5d43dd485a8f579a0aaa3eebdf465018f Mon Sep 17 00:00:00 2001 From: McLavish Date: Wed, 11 Nov 2026 17:10:57 +0100 Subject: [PATCH 2/3] Update function call to use latest api. --- src/jsoniqmagic/magic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jsoniqmagic/magic.py b/src/jsoniqmagic/magic.py index 1afe827..777c444 100644 --- a/src/jsoniqmagic/magic.py +++ b/src/jsoniqmagic/magic.py @@ -73,7 +73,7 @@ def _execute(self, rumble, language, data, args, start): if (args.json or (not args.pandas_data_frame and not args.pyspark_data_frame)): capplusone = response.take(rumble.getRumbleConf().getInt("runtime.resultsSizeCap") + 1) if len(capplusone) > rumble.getRumbleConf().getInt("runtime.resultsSizeCap"): - print("The query output too many items to display. Displaying the first %s items:" % (rumble.getRumbleConf().getResultSizeCap())) + print("The query output too many items to display. Displaying the first %s items:" % (rumble.getRumbleConf().getInt("runtime.resultsSizeCap"))) for e in capplusone[:rumble.getRumbleConf().getInt("runtime.resultsSizeCap")]: print(json.dumps(json.loads(e.serializeAsJSON()), indent=2)) From 9538458dd639c320c18721315f4591e7c3c88006 Mon Sep 17 00:00:00 2001 From: McLavish Date: Wed, 11 Nov 2026 17:20:35 +0100 Subject: [PATCH 3/3] Remove test for count. --- tests/test_notebook_errors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_notebook_errors.py b/tests/test_notebook_errors.py index 049fb77..e28402b 100644 --- a/tests/test_notebook_errors.py +++ b/tests/test_notebook_errors.py @@ -76,7 +76,7 @@ def test_non_java_errors_are_unchanged(): @pytest.mark.parametrize("stage,option", [ ("query", "-j"), ("serialize", "-s"), ("df", "-df"), ("show", "-df"), ("pdf", "-pdf"), ("availableOutputs", "-u"), - ("applyPUL", "-u"), ("take", "-j"), ("count", "-j"), + ("applyPUL", "-u"), ("take", "-j"), ("serializeAsJSON", "-j"), ]) def test_magic_uses_shared_error_policy(language, debug, stage, option):