Parameterized SQL query to Athena via AWS SDK

I use a trial version of localstack-pro. I try to run a parameterized SQL query from java code via aws sdk. I run this code:

String query = " select * from hdl.tns where source = ?";

StartQueryExecutionRequest startQueryExecutionRequest =

StartQueryExecutionResponse startQueryExecutionResponse = client.startQueryExecution(startQueryExecutionRequest);

And in localstack console, I see this error:

mocked-aws  | 2023-06-07T13:58:09.096 ERROR --- [  Thread-431] : Athena error for query " select * from hdl.tns where source = ?"
mocked-aws  | Traceback (most recent call last):
mocked-aws  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack_ext/services/athena/", line 32, in Q
mocked-aws  |     run_safe(lambda:resources.create_s3_bucket(F,s3_client=G));L=B[D];J=query_utils.execute_query(L,database=T,context=O);A.exec_results[B[C]]=J;LOG.debug('Athena result for query "%s":\n%s',B[D],J);U=convert_to_csv(J);M=f"{K}/results.csv";V=f"s3://{F}/{M}";H['ResultConfiguration']=ResultConfiguration(OutputLocation=V);G.put_object(Body=to_bytes(U),Bucket=F,Key=M)
mocked-aws  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack_ext/services/athena/", line 32, in execute_query
mocked-aws  |     E=C.prepared_statements if C else _B;return execute_presto_query(A,database=B,prepared_statements=E)
mocked-aws  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack_ext/utils/bigdata/", line 205, in execute_presto_query
mocked-aws  |     def execute_presto_query(query,database=_B,prepared_statements=_B):A=execute_presto_queries([query],database=database,prepared_statements=prepared_statements);return A[0]
mocked-aws  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack_ext/utils/bigdata/", line 227, in execute_presto_queries
mocked-aws  |     for I in queries:J=H(I);B.append(J)
mocked-aws  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack_ext/utils/bigdata/", line 224, in H
mocked-aws  |     raise Exception(f"Unable to get result from Presto server after {PRESTO_STARTUP_QUERY_RETRIES} retries: {A}")
mocked-aws  | Exception: Unable to get result from Presto server after 15 retries: PrestoUserError(type=USER_ERROR, name=INVALID_PARAMETER_USAGE, message="line 1:2: Incorrect number of parameters: expected 1 but found 0", query_id=20230607_135742_00012_d2ep6)

It looks like the server side does not see provided parameter, or maybe I provide it in the wrong way, or maybe I mentioned it in the query in the wrong way. I did it according to the official AWS documentation How can I resolve the issue?

Hi — Could you please reach out to us on LocalStack Pro Support app over Slack (Help & Support | Docs)? We’ll be happy to look into it! We need some information from diagnostic endpoint available in LocalStack and it would be good to take the conversation private. Thanks!