apache / pinot

Apache Pinot - A realtime distributed OLAP datastore
https://pinot.apache.org/
Apache License 2.0
5.27k stars 1.23k forks source link

The EXPR_MIN / EXPR_MAX function does not work properly. #12224

Open minwoo-jung opened 6 months ago

minwoo-jung commented 6 months ago

Hi, I am an open source APM pinpoint developer. We are applying pinot to pinpoint and using it well to analyze our monitoring data. We will continue to actively use it a lot in the future. I am writing this because I have a problem while using the new features in 1.0.0.

Problem

I upgraded pinot to 1.0.0 to use the EXPR_MIN and EXPR_MAX functions.

I executed a very simple query in the console view of the controller and got the following error message.

SELECT
    EXPR_MAX(hostName, fieldValue, hostName)
FROM systemMetricDouble
Error Code: 200

QueryExecutionError:
Query execution error on: PINOT_SERVER_COMPONENT_NAME_8098 org.apache.pinot.spi.exception.BadQueryRequestException: Invalid aggregation function: exprmax(hostName,fieldValue,hostName); Reason: Aggregation function: exprmax(hostName,fieldValue,hostName) is only supported in selection without alias.

Here is the code location where the problem occurred

Analysis

Conclusion&Question

somandal commented 6 months ago

can you set: "pinot.broker.result.rewriter.class.names" to the value "org.apache.pinot.core.query.utils.rewriter.ParentAggregationResultRewriter" and try again?

minwoo-jung commented 6 months ago

@somandal I haven't tried it yet. I wanted to make sure I was guided correctly before I tried it and added the settings. Since it's a live service, I want to set it up properly the first time.

I'm not sure if I only need to add pinot.broker.result.rewriter.class.names, so I'd like to confirm.

somandal commented 6 months ago

yes only the broker one is enough

minwoo-jung commented 6 months ago

@somandal Thank you for your quick reply. :) I will try adding the settings.

I have an additional question.

minwoo-jung commented 6 months ago

@somandal I added the following settings to pinot-broker.conf as you suggested.

pinot.broker.result.rewriter.class.names=org.apache.pinot.core.query.utils.rewriter.ParentAggregationResultRewriter

Question 1 However, I got the same error I would like to ask you to confirm that the class I need to add is ParentAggregationResultRewriter .

Question 2 Also, I analyzed the code and it looks like the following settings should be added, right?

pinot.broker.query.rewriter.class.names=org.apache.pinot.sql.parsers.rewriter.ExprMinMaxRewriter
somandal commented 6 months ago

I double checked the class and the result.rewriter class is correct Yes you will need to ensure you also update the query.rewriter to include the org.apache.pinot.sql.parsers.rewriter.ExprMinMaxRewriter class. ExprMinMaxTest has set both and you can reference that to validate the class names. I did verify in the code that only the pinot.broker configs need to be set up for these.

I thought I needed to add 'org.apache.pinot.sql.parsers.rewriter.ExprMinMaxRewriter', but you guided me to set up 'org.apache.pinot.core.query.utils.rewriter.ParentAggregationResultRewriter'. I would like to double-check that this is correct.

Yes you actually need to set up both, I earlier thought that the ExprMinMaxRewriter is included by default but it isn't

Is it an intended guide that requires users to add their own settings(pinot.broker.result.rewriter.class.names) to use EXPR_MIN / EXPR_MAX?

My understanding is that there is some overhead and we don't have exact numbers on how much overhead these rewriters add so we only enabled it for tables where this feature is needed. These rewriters will be called for all queries.

minwoo-jung commented 6 months ago

@somandal First of all, thank you for taking the time out of your busy schedule to double check and provide a detailed answer. I followed your guide and started an instance and ran some tests.

The expr_min and expr_max functions seem to work for the queries I want. However, I noticed a couple of issues.

problem 1

Symptoms of the Issue

A LIMIT is not working properly.

I ran the simple query below and noticed that it returns a lot of data even though the limit is 10.

SELECT
    EXPR_MAX(hostName, fieldValue, hostName)
FROM systemMetricDouble
limit 10

image

B I also had intermittent query failures. The logs from the failures are shown below.

image

controller log [2024-01-10 15:24:01.938] ERROR [PinotQueryResource] [grizzly-http-server-1] Caught exception while sending query request java.io.IOException: Failed : HTTP error code : 500. Root Cause: Unknown at org.apache.pinot.controller.api.resources.PinotQueryResource.sendPostRaw(PinotQueryResource.java:418) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.apache.pinot.controller.api.resources.PinotQueryResource.sendRequestRaw(PinotQueryResource.java:456) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.apache.pinot.controller.api.resources.PinotQueryResource.sendRequestToBroker(PinotQueryResource.java:350) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.apache.pinot.controller.api.resources.PinotQueryResource.getQueryResponse(PinotQueryResource.java:270) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.apache.pinot.controller.api.resources.PinotQueryResource.executeSqlQuery(PinotQueryResource.java:181) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.apache.pinot.controller.api.resources.PinotQueryResource.handlePostSql(PinotQueryResource.java:120) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at jdk.internal.reflect.GeneratedMethodAccessor338.invoke(Unknown Source) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:134) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:177) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:219) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:81) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:478) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:400) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:256) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.internal.Errors.process(Errors.java:292) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.internal.Errors.process(Errors.java:274) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.internal.Errors.process(Errors.java:244) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:235) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:684) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:356) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:200) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at java.lang.Thread.run(Thread.java:829) [?:?] [2024-01-10 15:24:01.939] ERROR [PinotQueryResource] [grizzly-http-server-1] Caught exception in sendQueryRaw java.io.IOException: Failed : HTTP error code : 500. Root Cause: Unknown at org.apache.pinot.controller.api.resources.PinotQueryResource.sendPostRaw(PinotQueryResource.java:418) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.apache.pinot.controller.api.resources.PinotQueryResource.sendRequestRaw(PinotQueryResource.java:456) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.apache.pinot.controller.api.resources.PinotQueryResource.sendRequestToBroker(PinotQueryResource.java:350) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.apache.pinot.controller.api.resources.PinotQueryResource.getQueryResponse(PinotQueryResource.java:270) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.apache.pinot.controller.api.resources.PinotQueryResource.executeSqlQuery(PinotQueryResource.java:181) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.apache.pinot.controller.api.resources.PinotQueryResource.handlePostSql(PinotQueryResource.java:120) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at jdk.internal.reflect.GeneratedMethodAccessor338.invoke(Unknown Source) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:134) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:177) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:219) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:81) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:478) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:400) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:256) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.internal.Errors.process(Errors.java:292) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.internal.Errors.process(Errors.java:274) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.internal.Errors.process(Errors.java:244) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:235) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:684) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:356) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:200) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at java.lang.Thread.run(Thread.java:829) [?:?] [2024-01-10 15:24:01.939] ERROR [PinotQueryResource] [grizzly-http-server-1] Caught exception while processing post request java.io.IOException: Failed : HTTP error code : 500. Root Cause: Unknown at org.apache.pinot.controller.api.resources.PinotQueryResource.sendPostRaw(PinotQueryResource.java:418) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.apache.pinot.controller.api.resources.PinotQueryResource.sendRequestRaw(PinotQueryResource.java:456) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.apache.pinot.controller.api.resources.PinotQueryResource.sendRequestToBroker(PinotQueryResource.java:350) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.apache.pinot.controller.api.resources.PinotQueryResource.getQueryResponse(PinotQueryResource.java:270) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.apache.pinot.controller.api.resources.PinotQueryResource.executeSqlQuery(PinotQueryResource.java:181) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.apache.pinot.controller.api.resources.PinotQueryResource.handlePostSql(PinotQueryResource.java:120) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at jdk.internal.reflect.GeneratedMethodAccessor338.invoke(Unknown Source) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52) ~[pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:134) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:177) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:219) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:81) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:478) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:400) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:256) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.internal.Errors.process(Errors.java:292) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.internal.Errors.process(Errors.java:274) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.internal.Errors.process(Errors.java:244) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:235) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:684) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:356) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:200) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549) [pinot-all-1.0.0-jar-with-dependencies.jar:1.0.0-b6bdf6c9686b286a149d2d1aea4a385ee98f3e79] at java.lang.Thread.run(Thread.java:829) [?:?]
broker log [2024-01-10 15:24:01.937] ERROR [PinotClientRequest] [jersey-server-managed-async-executor-2] Caught exception while processing POST request java.lang.NullPointerException: null
server log server 0 [2024-01-10 16:19:53.407] INFO [Metadata] [uriStat__5__4__20231016T0259Z] [Consumer clientId=uriStat_REALTIME-url-stat-5, groupId=null] Cluster ID: nKzujV0nQYSCxgoKn3xB9A [2024-01-10 16:19:53.939] INFO [QueryScheduler] [pqr-2] Processed requestId=385128946000000410,table=systemMetricDouble_OFFLINE,segments(queried/processed/matched/consumingQueried/consumingProcessed/consumingMatched/invalid/limit/value)=16/15/15/-1/0/0/0/0/1,schedulerWaitMs=0,reqDeserMs=0,totalExecMs=116,resSerMs=1,totalTimeMs=117,minConsumingFreshnessMs=-1,broker=Broker_alpha-pinot-broker-0.alpha-pinot-broker-headless.n3r-project-pinot-alpha.svc.cluster.local_8099,numDocsScanned=10085435,scanInFilter=10085435,scanPostFilter=20170870,sched=FCFS,threadCpuTimeNs(total/thread/sysActivity/resSer)=0/0/0/0 [2024-01-10 16:19:53.939] INFO [InstanceRequestHandler] [nioEventLoopGroup-3-7] Slow query: request handler processing time: 117, send response latency: 0, total time to handle request: 117 [2024-01-10 16:19:54.009] INFO [QueryScheduler] [pqr-6] Processed requestId=385128946000000410,table=systemMetricDouble_REALTIME,segments(queried/processed/matched/consumingQueried/consumingProcessed/consumingMatched/invalid/limit/value)=167/164/164/24/0/0/0/0/0,schedulerWaitMs=0,reqDeserMs=0,totalExecMs=184,resSerMs=3,totalTimeMs=187,minConsumingFreshnessMs=1704871184145,broker=Broker_alpha-pinot-broker-0.alpha-pinot-broker-headless.n3r-project-pinot-alpha.svc.cluster.local_8099,numDocsScanned=10289406,scanInFilter=10289406,scanPostFilter=20578812,sched=FCFS,threadCpuTimeNs(total/thread/sysActivity/resSer)=0/0/0/0 [2024-01-10 16:19:54.009] INFO [InstanceRequestHandler] [nioEventLoopGroup-3-3] Slow query: request handler processing time: 187, send response latency: 0, total time to handle request: 187 server 1 [2024-01-10 16:19:53.937] INFO [QueryScheduler] [pqr-2] Processed requestId=385128946000000410,table=systemMetricDouble_OFFLINE,segments(queried/processed/matched/consumingQueried/consumingProcessed/consumingMatched/invalid/limit/value)=16/13/13/-1/0/0/0/0/3,schedulerWaitMs=0,reqDeserMs=0,totalExecMs=112,resSerMs=3,totalTimeMs=115,minConsumingFreshnessMs=-1,broker=Broker_alpha-pinot-broker-0.alpha-pinot-broker-headless.n3r-project-pinot-alpha.svc.cluster.local_8099,numDocsScanned=8712881,scanInFilter=8712881,scanPostFilter=17425762,sched=FCFS,threadCpuTimeNs(total/thread/sysActivity/resSer)=0/0/0/0 [2024-01-10 16:19:53.938] INFO [InstanceRequestHandler] [nioEventLoopGroup-3-7] Slow query: request handler processing time: 115, send response latency: 1, total time to handle request: 116 [2024-01-10 16:19:53.962] INFO [LLRealtimeSegmentDataManager_systemMetricDouble__32__49__20240109T1000Z] [systemMetricDouble__32__49__20240109T1000Z] Consumed 36 events from (rate:0.59995/s), currentOffset=1012103969, numRowsConsumedSoFar=46073, numRowsIndexedSoFar=46073 [2024-01-10 16:19:53.962] INFO [LLRealtimeSegmentDataManager_systemMetricDouble__15__48__20240109T2231Z] [systemMetricDouble__15__48__20240109T2231Z] Consumed 12 events from (rate:0.19999/s), currentOffset=159385186, numRowsConsumedSoFar=6339, numRowsIndexedSoFar=6339 [2024-01-10 16:19:53.996] INFO [QueryScheduler] [pqr-3] Processed requestId=385128946000000410,table=systemMetricDouble_REALTIME,segments(queried/processed/matched/consumingQueried/consumingProcessed/consumingMatched/invalid/limit/value)=166/165/165/24/0/0/0/0/0,schedulerWaitMs=0,reqDeserMs=0,totalExecMs=174,resSerMs=0,totalTimeMs=174,minConsumingFreshnessMs=1704871184146,broker=Broker_alpha-pinot-broker-0.alpha-pinot-broker-headless.n3r-project-pinot-alpha.svc.cluster.local_8099,numDocsScanned=10792825,scanInFilter=10792825,scanPostFilter=21585650,sched=FCFS,threadCpuTimeNs(total/thread/sysActivity/resSer)=0/0/0/0 server 2 [2024-01-10 16:19:54.138] INFO [QueryScheduler] [pqr-5] Processed requestId=385128946000000410,table=systemMetricDouble_OFFLINE,segments(queried/processed/matched/consumingQueried/consumingProcessed/consumingMatched/invalid/limit/value)=17/15/15/-1/0/0/0/0/2,schedulerWaitMs=0,reqDeserMs=0,totalExecMs=313,resSerMs=3,totalTimeMs=316,minConsumingFreshnessMs=-1,broker=Broker_alpha-pinot-broker-0.alpha-pinot-broker-headless.n3r-project-pinot-alpha.svc.cluster.local_8099,numDocsScanned=9508324,scanInFilter=9508324,scanPostFilter=19016648,sched=FCFS,threadCpuTimeNs(total/thread/sysActivity/resSer)=0/0/0/0 [2024-01-10 16:19:54.138] INFO [InstanceRequestHandler] [nioEventLoopGroup-3-8] Slow query: request handler processing time: 316, send response latency: 0, total time to handle request: 316 [2024-01-10 16:19:54.146] INFO [LLRealtimeSegmentDataManager_systemMetricDouble__25__51__20240110T0604Z] [systemMetricDouble__25__51__20240110T0604Z] Consumed 72 events from (rate:1.19996/s), currentOffset=159369061, numRowsConsumedSoFar=5441, numRowsIndexedSoFar=5441 [2024-01-10 16:19:54.147] INFO [LLRealtimeSegmentDataManager_systemMetricDouble__38__51__20240110T0604Z] [systemMetricDouble__38__51__20240110T0604Z] Consumed 68 events from (rate:1.1332955/s), currentOffset=130356752, numRowsConsumedSoFar=5441, numRowsIndexedSoFar=5441 [2024-01-10 16:19:54.147] INFO [LLRealtimeSegmentDataManager_systemMetricDouble__55__52__20240110T0500Z] [systemMetricDouble__55__52__20240110T0500Z] Consumed 48 events from (rate:0.79998666/s), currentOffset=109973534, numRowsConsumedSoFar=6698, numRowsIndexedSoFar=6698 [2024-01-10 16:19:54.147] INFO [LLRealtimeSegmentDataManager_systemMetricDouble__53__52__20240109T1545Z] [systemMetricDouble__53__52__20240109T1545Z] Consumed 54 events from (rate:0.899955/s), currentOffset=154929857, numRowsConsumedSoFar=50441, numRowsIndexedSoFar=50441 [2024-01-10 16:19:54.148] INFO [LLRealtimeSegmentDataManager_systemMetricDouble__21__51__20240109T1213Z] [systemMetricDouble__21__51__20240109T1213Z] Consumed 51 events from (rate:0.8473309/s), currentOffset=38389488, numRowsConsumedSoFar=55030, numRowsIndexedSoFar=55030 [2024-01-10 16:19:54.164] INFO [QueryScheduler] [pqr-2] Processed requestId=385128946000000410,table=systemMetricDouble_REALTIME,segments(queried/processed/matched/consumingQueried/consumingProcessed/consumingMatched/invalid/limit/value)=167/167/167/16/0/0/0/0/0,schedulerWaitMs=0,reqDeserMs=0,totalExecMs=341,resSerMs=1,totalTimeMs=342,minConsumingFreshnessMs=1704871184147,broker=Broker_alpha-pinot-broker-0.alpha-pinot-broker-headless.n3r-project-pinot-alpha.svc.cluster.local_8099,numDocsScanned=10981394,scanInFilter=10981394,scanPostFilter=21962788,sched=FCFS,threadCpuTimeNs(total/thread/sysActivity/resSer)=0/0/0/0

ETC

select * from systemMetricDouble limit 10

problem 2

Symptoms of the Issue

AS does not work. When I run the following query, the columns that I specified as AS are not aliased. There is no problem with the resulting data.

SELECT
    MAX(fieldValue) AS maxValue,
    EXPR_MAX(hostName, fieldValue, hostName),
    MIN(fieldValue) AS minValue,
    EXPR_MIN(hostName, fieldValue, hostName),
    DATETIMECONVERT(eventTime, '1:MILLISECONDS:EPOCH', '1:MILLISECONDS:EPOCH', '12100000:MILLISECONDS') AS eventTime
FROM systemMetricDouble
WHERE tenantId = 'pinpoint'
AND hostGroupName = 'AlphaPinpointWeb'
AND metricName = 'mem'
AND fieldName = 'used'
AND eventTime BETWEEN 1704101884000 AND 1704706684000
GROUP BY eventTime
ORDER BY eventTime asc
LIMIT 201

Controller UI image image

problem 3

Symptoms of the Issue

Cannot use aliases specified by AS in group by and order by. I also checked that the options related to expr_min and expr_max worked fine before I added them.

sql

SELECT
    AVG(fieldValue) AS avgValue,
    DATETIME_CONVERT(eventTime, '1:MILLISECONDS:TIMESTAMP', '1:MILLISECONDS:EPOCH', '12100000:MILLISECONDS') as avgTime
FROM systemMetricDouble
WHERE tenantId = 'pinpoint'
AND hostGroupName = 'AlphaPinpointWeb'
AND metricName = 'mem'
AND hostName = 'dev-pinpoint-olap02-ncl'
AND fieldName = 'used'
AND eventTime BETWEEN 1704101884000 AND 1704706684000
GROUP BY avgTime 
ORDER BY avgTime asc
LIMIT 201

error log

Error Code: 150

SQLParsingError:
org.apache.pinot.sql.parsers.SqlCompilationException: 'as(datetimeconvert(eventTime, null, null, null), avgTime)' should appear in GROUP BY clause.
    at org.apache.pinot.sql.parsers.CalciteSqlParser.validateGroupByClause(CalciteSqlParser.java:220)
    at org.apache.pinot.sql.parsers.CalciteSqlParser.validate(CalciteSqlParser.java:203)
    at org.apache.pinot.sql.parsers.CalciteSqlParser.queryRewrite(CalciteSqlParser.java:552)
    at org.apache.pinot.sql.parsers.CalciteSqlParser.compileSqlNodeToPinotQuery(CalciteSqlParser.java:486)

Workaround

Duplicate use of DATETIME_CONVERT function without using alias for group by and order by.

sql

SELECT
    AVG(fieldValue) AS avgValue,
    DATETIME_CONVERT(eventTime, '1:MILLISECONDS:TIMESTAMP', '1:MILLISECONDS:EPOCH', '12100000:MILLISECONDS') as avgTime
FROM systemMetricDouble
WHERE tenantId = 'pinpoint'
AND hostGroupName = 'AlphaPinpointWeb'
AND metricName = 'mem'
AND hostName = 'dev-pinpoint-olap02-ncl'
AND fieldName = 'used'
AND eventTime BETWEEN 1704101884000 AND 1704706684000
GROUP BY DATETIME_CONVERT(eventTime, '1:MILLISECONDS:TIMESTAMP', '1:MILLISECONDS:EPOCH', '12100000:MILLISECONDS') 
ORDER BY DATETIME_CONVERT(eventTime, '1:MILLISECONDS:TIMESTAMP', '1:MILLISECONDS:EPOCH', '12100000:MILLISECONDS') asc
LIMIT 201

ETC

The table schema and definitions can be found in the links below.

somandal commented 6 months ago

Please see this page for a list of limitations: https://docs.pinot.apache.org/configuration-reference/functions/arg_min-arg_max

Some of this still needs to be tested out more. I'm guessing the alias problem results in not being able to use expr_min/max with any AS expression but will need to confirm

minwoo-jung commented 6 months ago

@somandal Thank you for your response. are you one of the maintainers(core developer) for Pinot? If you are, may I ask you to bug fix the above issue?

Without going into details, queries that were working fine are failing when the "Use Multi-Stage Engine" option is enabled. I would like to know if the expr_min and expr_max functions are officially available.^^