A brief twitter exchange triggered some thoughts about expectations and how those determine whether something is a good A, a passable B or a terrible C.
When you want to go somewhere and you do not know the way, you need directions. Somebody or something needs to show you the path to follow. That’s what turn by turn navigation on your mobile does. Following this path does not mean you got to know the area. You know one just one way to get from A to B know.
A map, on the other hand, provides an overview, context and alternatives but no immediate path.
Using a map means you have to actively engage with the information, see for yourself which roads cannot be taken (maybe you are in a huge truck and the small sideways with wood bridges are not going to work for you) and eventually plot your own path.
Both maps and paths, are related but are far from being the same.
A useful analogy
This analogy works not just for navigating transportation networks.
If your company wants to build an information system to do X then usually it will give the job to someone with a path to get there. It does not need to discuss all the alternative technologies or architectures. When X can be achieved reliably, in-time and on-budget, then that’s usually already a great outcome. Getting such a path (think project) is commodity shopping.
On the other hand, when you want to do new things or old things in a very different way than before, a path is not the answer to that. This is where you need to work with a map. You need different viewpoints and scenarios to walk through. This situation requires you to discover and create a path. You can buy help for this process but you cannot skip the work.
(You might notice, that product or service roadmaps are specifically not maps. They are usually paths with a decreasing level of certainty towards the end. They can provide a heads-up to what might be coming but they don’t show alternatives, contexts or overview.)
To avoid disappointment and frustration it is important to be clear about what you expect.
Are you asking questions in user forums to get a map? Do you want blog posts to give you a path from A to B? Do you want to discuss options and discover/create paths?
For the SAP Community Platform getting answers to such questions will be important to avoid further disappointments.
I took a swing at it and the following is my result (a slightly edited version of my original answer).
Alright, let’s do this! (even though I don’t have an idea why it would matter at all…)
So, I’m not a computer scientist, and only a third through “The Annotated Turing” (which seems to be a great book, btw). This means what follows is the layman’s approach on this.
First off, I had to understand, what is meant by “Turing complete” and how to show that a language has that characteristic.
For that, there are a couple of Wikipedia entries and SO discussions available and I leave that for everyone to read (e.g. here and here).
One of those discussions linked to a presentation that claimed to prove that PostgreSQL-SQL with recursive common table expressions (CTS) is Turing complete. In order to prove this, the author of the presentation (here) said, that it’s enough to prove that a language can emulate another language that has already been shown to be Turing complete.
The author’s choice was a cyclic tag system with a specific rule set (rule 110) which apparently has been shown to be Turing complete.
Then the author goes on and implements this cyclic tag system with a recursive common table expression and thereby proves the claim.
So, what does that mean for SAP HANA SQL?
SAP HANA SQL/SQLScript does not support recursive common table expressions (much to the distaste of everyone who tries to handle hierarchies and does not know about SAP HANA’s special hierarchy views and functions (look there) and it also does not support recursive procedure calls.
Bummer, one might think.
Fortunately, every recursion can be expressed as an iteration (compare here), so I thought, let’s try this cyclic tag system in SQLScript.
This is the result (HANA 1, rev.122.15, on my NUC system). The SQL code is also available in my GitHub repo.
declare prods VARCHAR(4) ARRAY;
declare currProd, initWord, currWord VARC<span data-mce-type="bookmark" style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" class="mce_SELRES_start"></span>HAR(300); -- 300 is arbitrary and would be exceeded for more runs
declare currProdNo integer = 0;
declare runs, maxruns bigint = 0;
initWord :='11001'; -- the starting/initial 'word'
maxruns := 100; -- a limit to the number of iterations
-- rule 110 is suspected to run indefinitively
prods = ARRAY ('010', '000', '1111'); -- the three 'producer rules' stored in a string array
currWord := :initWord;
runs := 0;
-- dummy table var to monitor output
tmp = select :runs as RUNS, :currProd as CURRPROD, :currWord as CURRWORD
while (:runs < :maxruns) DO
runs := :runs+1;
currProdNo := mod(:runs,3)+1; -- pick rule no. 1,2 or 3 but never 0
-- as SQLScript arrays are 1 based
currProd := :prods[:currProdNo];
if (left (:currWord, 1)='1') then -- add current producer to the 'word'
currWord := :currWord || :currProd;
currWord := substring (:currWord, 2); -- remove leftmost character
-- save current state into temp table var
tmp = select RUNS, CURRPROD, CURRWORD from :tmp
select :runs as RUNS, :currProd as CURRPROD, :currWord as CURRWORD
select * from :tmp; -- output the table var
That looks suspiciously like the output from the Wikipedia link (above) and does not seem to stop (except for the super-clever maxruns variable ).
With that, I’d say, it’s possible to create a cyclic tag system rule 110 with SQLScript.
The tag system is Turing complete, therefore SQLScript must be Turing complete.
Still, I have no idea why this would matter at all and that’s really all I can say/write about this.