question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[bug] CAST after expression causes weird exception

See original GitHub issue

Bug report

select 
  playerID, 
  cast(hits as long) AS totalHits
from baseballStats 
order by totalHits DESC

or

select 
  playerID, 
  count(cast(hits as long)) AS totalHits
from baseballStats 
group by playerID
order by totalHits DESC

works fine.

but:

select 
  playerID, 
  cast(count(hits) as long) AS totalHits
from baseballStats 
group by playerID
order by totalHits DESC

gives

[
  {
    "message": "QueryExecutionError:
ProcessingException(errorCode:450, message:InternalError:
java.lang.NullPointerException
    at org.apache.pinot.core.operator.combine.GroupByOrderByCombineOperator.mergeResults(GroupByOrderByCombineOperator.java:236).
    at 
org.apache.pinot.core.operator.combine.BaseCombineOperator.getNextBlock(BaseCombineOperator.java:119)
    at org.apache.pinot.core.operator.combine.BaseCombineOperator.getNextBlock(BaseCombineOperator.java:50)",
    "errorCode": 200
  }
]

what’s more

select 
  playerID, 
  cast(count(hits) as long) AS totalHits
from baseballStats 
group by playerID

without order by gives a non-descriptive exception

ProcessingException(errorCode:450, message:InternalError:
java.io.IOException: Failed : HTTP error code : 500
	at org.apache.pinot.controller.api.resources.PinotQueryResource.sendPostRaw(PinotQueryResource.java:305)
	at org.apache.pinot.controller.api.resources.PinotQueryResource.sendRequestRaw(PinotQueryResource.java:343)
	at org.apache.pinot.controller.api.resources.PinotQueryResource.getQueryResponse(PinotQueryResource.java:225)
	at org.apache.pinot.controller.api.resources.PinotQueryResource.handlePostSql(PinotQueryResource.java:137))

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
Jackie-Jiangcommented, Apr 16, 2022

Scalar function is used in the following places:

  • Ingestion transform
  • Compile time evaluation of literal only function
  • Post aggregation transform
  • If transform function is not implemented for the same name, scalar function can be used as transform function (poor performance)

For post aggregation transform and transform, if the result class for the scalar function is dynamic, we will treat it as STRING. In order to solve this problem, we need to add the support to derive the result type from the arguments’ type.

1reaction
walterddrcommented, Apr 14, 2022

I doubt the cause is the absence of a scalar function then. The motivation of that PR is to ensure casts in filters don’t prevent index use.

for the purpose of index use i think the PR works well. it doesn’t solve what’s describe in this issue though

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug descriptions — spotbugs 4.7.3 documentation
Asserting type checks in tests is not recommended as a class cast exception message could better indicate the cause of an instance of...
Read more >
java - LambdaConversionException with generics: JVM bug?
The exception is thrown trying to resolve entity::filename . filename() is declared in HasImagesEntity . As far as I can tell, I get...
Read more >
Bug listing with status RESOLVED with resolution FIXED as at ...
configure" status:RESOLVED resolution:FIXED severity:normal · Bug:188 - "environment variable GZIP cause pilot-link-0.9.6.ebuild (kde) to fail ?
Read more >
Solving 5 Mysterious Spark Errors | by yhoztak - Medium
Problem 1: Resolved attribute(s) your_field#xx missing from ….. The actual error looks like this and noted in Spark Jira Exception in thread "main"...
Read more >
Errors and Exceptions | Learn You Some Erlang for Great Good!
Badmatch errors happen whenever pattern matching fails. This most likely means you're trying to do impossible pattern matches (such as above), trying to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found