spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Apache Spark (JIRA)" <>
Subject [jira] [Commented] (SPARK-26205) Optimize In expression for bytes, shorts, ints
Date Wed, 28 Nov 2018 19:10:00 GMT


Apache Spark commented on SPARK-26205:

User 'aokolnychyi' has created a pull request for this issue:

> Optimize In expression for bytes, shorts, ints
> ----------------------------------------------
>                 Key: SPARK-26205
>                 URL:
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: Anton Okolnychyi
>            Priority: Major
> Currently, {{In}} expressions are compiled into a sequence of if-else statements, which
results in O\(n\) time complexity. {{InSet}} is an optimized version of {{In}}, which is supposed
to improve the performance if the number of elements is big enough. However, {{InSet}} actually
degrades the performance in many cases due to various reasons (benchmarks will be available
in SPARK-26203 and solutions are discussed in SPARK-26204).
> The main idea of this JIRA is to make use of {{tableswitch}} and {{lookupswitch}} bytecode instructions.
In short, we can improve our time complexity from O\(n\) to O\(1\) or at least O\(log n\)
by using Java {{switch}} statements. We will have O\(1\) time complexity if our case values
are compact and {{tableswitch}} can be used. Otherwise, {{lookupswitch}} will give us O\(log
> An important benefit of the proposed approach is that we do not have to pay an extra
cost for autoboxing as in case of {{InSet}}. As a consequence, we can substantially outperform
{{InSet}} even on 250+ elements.
> See [here|] and
for more information.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message