[
https://issues.apache.org/jira/browse/SPARK-16354?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Wenchen Fan resolved SPARK-16354.
---------------------------------
Resolution: Fixed
Target Version/s: 2.0.1, 2.1.0
> Illegal Inputs In LIMIT or TABLESAMPLE
> --------------------------------------
>
> Key: SPARK-16354
> URL: https://issues.apache.org/jira/browse/SPARK-16354
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 2.0.0
> Reporter: Xiao Li
> Assignee: Xiao Li
>
> {noformat}
> SELECT * FROM testData TABLESAMPLE (-1 rows)
> SELECT * FROM testData LIMIT -1
> {noformat}
> Negative values should not be allowed in {{TABLESAMPLE n ROWS}} and {{LIMIT
> n}}
> In addition, Spark SQL follows the restriction of LIMIT clause in Hive. The
> argument to the LIMIT clause must evaluate to a constant value. It can be a
> numeric literal, or another kind of numeric expression involving operators,
> casts, and function return values. You cannot refer to a column or use a
> subquery. Currently, we do not detect whether the expression in LIMIT clause
> is foldable or not. If non-foldable, we might issue a strange error message.
> For example,
> {noformat}
> SELECT * FROM testData LIMIT rand() > 0.2
> {noformat}
> Then, a misleading error message is issued, like
> {noformat}
> assertion failed: No plan for GlobalLimit (_nondeterministic#203 > 0.2)
> +- Project [key#11, value#12, rand(-1441968339187861415) AS
> _nondeterministic#203]
> +- LocalLimit (_nondeterministic#202 > 0.2)
> +- Project [key#11, value#12, rand(-1308350387169017676) AS
> _nondeterministic#202]
> +- LogicalRDD [key#11, value#12]
> java.lang.AssertionError: assertion failed: No plan for GlobalLimit
> (_nondeterministic#203 > 0.2)
> +- Project [key#11, value#12, rand(-1441968339187861415) AS
> _nondeterministic#203]
> +- LocalLimit (_nondeterministic#202 > 0.2)
> +- Project [key#11, value#12, rand(-1308350387169017676) AS
> _nondeterministic#202]
> +- LogicalRDD [key#11, value#12]
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]