apache / pinot

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

Exception while using NOT on regexp_like function #5797

Open pradeepgv42 opened 4 years ago

pradeepgv42 commented 4 years ago

select * from table where timestamp > X and not regexp_like(column, '')

throws following exception

pinot error: {'errorCode': 150, 'message': 'PQLParsingError:\n' 'java.lang.IllegalArgumentException: No enum constant ' 'org.apache.pinot.pql.parsers.pql2.ast.FilterKind.NOT\n' '\tat java.lang.Enum.valueOf(Enum.java:238)\n' '\tat ' 'org.apache.pinot.pql.parsers.pql2.ast.FilterKind.valueOf(FilterKind.java:21)\n' '\tat ' 'org.apache.pinot.parsers.utils.ParserUtils.getFilterKind(ParserUtils.java:83)\n' '\tat ' 'org.apache.pinot.pql.parsers.PinotQuery2BrokerRequestConverter.traverseFilterExpression(PinotQuery2BrokerRequestConverter.java:250)\n' '\tat ' 'org.apache.pinot.pql.parsers.PinotQuery2BrokerRequestConverter.traverseFilterExpression(PinotQuery2BrokerRequestConverter.java:259)\n' '\tat ' 'org.apache.pinot.pql.parsers.PinotQuery2BrokerRequestConverter.convertFilter(PinotQuery2BrokerRequestConverter.java:178)\n' '\tat ' 'org.apache.pinot.pql.parsers.PinotQuery2BrokerRequestConverter.convert(PinotQuery2BrokerRequestConverter.java:58)\n' '\tat ' 'org.apache.pinot.sql.parsers.CalciteSqlCompiler.compileToBrokerRequest(CalciteSqlCompiler.java:34)\n' '\tat ' 'org.apache.pinot.broker.requesthandler.BaseBrokerRequestHandler.handleRequest(BaseBrokerRequestHandler.java:186)\n' '\tat ' 'org.apache.pinot.broker.api.resources.PinotClientRequest.processSqlQueryPost(PinotClientRequest.java:155)\n' '\tat sun.reflect.GeneratedMethodAccessor11.invoke(Unknown ' 'Source)\n' '\tat ' 'sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n' '\tat java.lang.reflect.Method.invoke(Method.java:498)\n' '\tat ' 'org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)'}

Wondering if it's just a missing enum or this node type was intentionally skipped?

xiangfu0 commented 3 years ago

Since the negate of a regex is not a trivial conversion, based on current FilterKind enums, I think we need to add:

  NOT_REGEXP_LIKE
  NOT_TEXT_MATCH
  NOT_JSON_MATCH