Hi team :wave: I'm writing a custom Trino connect...
# troubleshooting
s
Hi team 👋 I'm writing a custom Trino connector to read from our Pinot cluster and I'm running into an issue when trying to use
LASTWITHTIME
. The first time I run the query (
SELECT * FROM catalog.schema."SELECT LASTWITHTIME(dataColumnName, timeColumnName, 'STRING') FROM tableName WHERE column = 'someColumnValue' LIMIT 10";
) I get the following error:
Copy code
java.lang.ExceptionInInitializerError
	at org.apache.pinot.common.function.TransformFunctionType.getTransformFunctionType(TransformFunctionType.java:106)
Any consecutive runs of the query produce the following error:
Copy code
java.lang.NoClassDefFoundError: Could not initialize class org.apache.pinot.common.function.FunctionRegistry
	at org.apache.pinot.common.function.TransformFunctionType.getTransformFunctionType(TransformFunctionType.java:106)
Other queries, including dynamic queries work okay. I am using Pinot version 0.9.3. Has anyone come across this before? Any help would be appreciated, many thanks in advance!
m
Is that a nested query? Pinot doesn’t support nested queries at the moment.
Oh sorry didn’t realize you are using Trino connector
s
It's a dynamic query where we're pushing down the whole query to Pinot. For example this works:
Copy code
SELECT * FROM catalog.schema."SELECT columnName FROM table LIMIT 1";
r
the class isn't loading, which is interesting
this will mean one of two things: • non-atomic classloader attempts to load same class twice (I highly doubt this can affect pinot) • static initializer throws during intialization
s
Hi @Richard Startin thanks for replying! I don't see any errors in the logs during initialization or running other queries, it seems to only throw when I run that particular query
m
Seems like the inner query runs on Pinot successfully, so the transform function is indeed part of 0.9.x
@Elon any idea on the connector?
@Sevvy Yusuf can you paste the output of explain
s
Yup -
explain analyze
throws this error too:
Copy code
Query 20220307_173536_00009_bawgb failed: java.lang.NoClassDefFoundError: Could not initialize class org.apache.pinot.common.function.FunctionRegistry
Looking at the stack trace the error arises when the connector tries to build a dynamic table from the PQL. This is where it throws:
Copy code
org.apache.pinot.common.function.TransformFunctionType.getTransformFunctionType(TransformFunctionType.java:106
r
NoClassDefFoundError
means that the class could not be loaded but not because the classfile is missing
it normally means initialization failed if the classloader isn't buggy
s
Thank you everyone for all your help in this matter. Following the advice here I looked into my connector code and realised the maven-shade-plugin was filtering out classes I needed for the initialization of the FunctionRegistry. I have now resolved the issue however I am still not able to run the query successfully - it's now failing with the following error:
Copy code
Unexpected aggregate expression: 'lastwithtime(id,timestamp,'string')'
I have opened this issue as it doesn't look like the FunctionRegistry contains LASTWITHTIME when it's initialized from my logs. Thank you all again!
m
@Elon could we add this function support in the connector?
e
Yes, sure!
Can I add it to the function registry?
@Sevvy Yusuf @Mayank - there is a possibility that this works with an open pr that updates how functions are evaluated. I commented in the issue.
s
Thanks @Elon! I responded to your comment on the issue
🙏 1
e
nice:) What data type should the
id
field be? Assuming
timestamp
is a long, right?
l
Also bear in mind lastwithtime seems to have two function signatures, one where it requires 2 args, and one where it requires 3. I’m not entirely sure why the one with 3 is necessary
💡 1
s
the
id
field is a String and yep the
timestamp
is a Long
🙏 1
e
thanks!
f
Interested by that. Tried the same query and failed Trino trino-372 and pinot-0.9.3
This should fix the issue ^^
🙌 1
l
This is great, but we did fork the connector and upgrade it ourselves. We’ll compare the two and see if we missed anything, thank you for the help
👍 1
s
Hi @Elon thank you so much for getting this change in! We've just brought these into our connector and still seeing
Copy code
Query 20220323_155125_00000_kskyw failed: Unexpected aggregate expression: 'lastwithtime(id,timestamp,'string')'
Looks like the
lastwithtime
function isn't part of the
TransformFunctionType
enum class (link). Could this be causing the issue?
e
That sounds likely, I will check. Thanks for catching this!
Can you paste the query when you have a chance?
iirc this could be bcz you need to use the 0.9.3 pr: https://github.com/trinodb/trino/pull/11475 - can you try it with that branch?
s
Thanks @Elon! This is the query we're using:
Copy code
SELECT * FROM catalog.default."SELECT LASTWITHTIME(id, timestamp, 'STRING') FROM table WHERE field = 'something' LIMIT 10";
The connector we're using is basically a fork from Trino 371, we upgraded Pinot version to 0.9.3 and I've just brought in all the changes in your PR above and it's still coming back with that error
e
Ok, I will investigate and add this as a unit test then:) I'll update you shortly
s
Thank you!
Hey @Elon - any updates on this?
e
The pr should be landing very soon - we updated it to support 0.10.0.
l
That's awesome @Elon. Any ETA on when that would be available?