[SOL-42] Parallel script execution inside a Lua script Created: 27.01.2014  Updated: 30.03.2020

Status: Published
Project: Solution Center
Component/s: EXASolution
Affects Version/s: EXASolution 4.2.5, EXASolution 5.0, EXASOL 6.0.0, Exasol 6.1.0, Exasol 6.2.x
Fix Version/s: None

Type: How To
Reporter: Captain EXASOL Assignee: Captain EXASOL
Labels: None

Issue Links:
Causing
Related
Solution:

Background

The only working solution is using the IMPORT command over JDBC to connect to your EXASolution database and wrap the LUA-scripts you want to execute in parallel in the STATEMENT-Clause.

Prerequisites

You are using an enterprise version of Exasol, not the single node community edition. 

How to run Import in parallel using JDBC and LUA

The following small example shows this approach:

create or replace lua script cat_return returns table as
--Lua script that returns resultset of select * from cat
--used to test parallel call

suc, res = pquery([[select * from cat]],{})

tab = {}

for i=1, #res do

	tmp2 = {}
	for j=1, #res[i] do
		table.insert(tmp2, res[i][j]) 
	end

	table.insert(tab, tmp2)

end

return tab, 'TABLE_NAME VARCHAR(200), TABLE_TYPE VARCHAR(200)'

/

create or replace lua script partest returns rowcount as
--Parallel execution of other lua scripts
--performed using import statement

suc, res = pquery([[

	IMPORT INTO (TABLE_NAME VARCHAR(200), TABLE_TYPE VARCHAR(200)) FROM JDBC 
	AT 'jdbc:exa:192.148.120.16..20:8563;schema=MYUSER'
	USER 'myuser' IDENTIFIED BY 'xxxxxxxxx'
	STATEMENT 'execute script myuser.cat_return'
	STATEMENT 'execute script myuser.cat_return'
	STATEMENT 'execute script myuser.cat_return';

]],{})

return {rows_affected = #res}

/

execute script partest;

Category 1: Scripting

 Comments   
Comment by Stefan Reich [ 11.02.2014 ]

Please note that due to internal processing, no guarantees about the received row ordering can be given.

Generated at Sun Jul 12 16:01:24 CEST 2020 using Jira 7.13.13#713013-sha1:4c0f5f5e3383570393fbbf3d2fd5de1eb4057c36.