You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Ken Williams (JIRA)" <ji...@apache.org> on 2013/10/18 16:14:43 UTC

[jira] [Commented] (HIVE-178) SELECT without FROM should assume a one-row table with no columns.

    [ https://issues.apache.org/jira/browse/HIVE-178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13799125#comment-13799125 ] 

Ken Williams commented on HIVE-178:
-----------------------------------

Following up on [~electrum]'s {{dual}} approach - since the {{VALUES(...)}} syntax isn't yet supported in Hive, one can do something like this:

{code}
CREATE TABLE dual (dummy STRING);
INSERT INTO TABLE dual SELECT count(*) FROM dual;
{code}

Then {{SELECT ... FROM dual;}} queries work as expected.

> SELECT without FROM should assume a one-row table with no columns.
> ------------------------------------------------------------------
>
>                 Key: HIVE-178
>                 URL: https://issues.apache.org/jira/browse/HIVE-178
>             Project: Hive
>          Issue Type: Wish
>          Components: Query Processor, Testing Infrastructure
>            Reporter: Adam Kramer
>            Priority: Minor
>              Labels: SQL
>
> SELECT 1+1;
> should just return '2', but instead hive fails because no table is listed.
> SELECT 1+1 FROM (empty table);
> should also just return '2', but instead hive "succeeds" because there is "no possible output," so it produces no output.
> So, currently we have to run 
> SELECT 1+1 FROM (silly one-row dummy table);
> ...which runs a whole mapreduce step to ignore a column of data that is useless anyway. This is much easier due to local mode, but still, it would be nice to be able to SELECT without specifying a table and to get one row of output in moments instead of waiting for even a local-mode job to launch, complete, and return.
> This is especially useful for testing UDFs.
> Relatedly, an optimization by which Hive can tell that data from a table isn't even USED would be useful, because it means that the data needn't be queried...the only relevant info from the table would be the number of rows it has, which is available for free from the metastore.



--
This message was sent by Atlassian JIRA
(v6.1#6144)