You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Adam Kramer (JIRA)" <ji...@apache.org> on 2008/12/16 00:31:44 UTC

[jira] Created: (HIVE-178) SELECT without FROM; dropping unnecessary table references

SELECT without FROM; dropping unnecessary table references
----------------------------------------------------------

                 Key: HIVE-178
                 URL: https://issues.apache.org/jira/browse/HIVE-178
             Project: Hadoop Hive
          Issue Type: Improvement
          Components: Query Processor
            Reporter: Adam Kramer


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 (actual table with data);

...which runs a whole mapreduce step to ignore all of the data before spitting out '2'.

It would be nice to be able to SELECT without specifying a table, and perhaps relatedly, to be able to edit the above query (which worked) to not need to actually process (actual table with data) given that no data is being pulled from it (as we see from the SELECT statement, that table's name or alias does not appear).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HIVE-178) SELECT without FROM; dropping unnecessary table references

Posted by "David Phillips (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Phillips updated HIVE-178:
--------------------------------

      Priority: Minor  (was: Major)
    Issue Type: Wish  (was: Bug)

Changing from bug to wish as the current behavior is correct.  The current workaround is to select from a table with a single row, or select from a small table with LIMIT 1.

For simple cases like the example, skipping the Hadoop job entirely would be nice.

> SELECT without FROM; dropping unnecessary table references
> ----------------------------------------------------------
>
>                 Key: HIVE-178
>                 URL: https://issues.apache.org/jira/browse/HIVE-178
>             Project: Hadoop Hive
>          Issue Type: Wish
>          Components: Query Processor
>            Reporter: Adam Kramer
>            Priority: Minor
>
> 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. This is the reason I filed under "bug" instead of "improvement:" If it does not return '2' hive should fail.
> So, currently we have to run 
> SELECT 1+1 FROM (actual table with data);
> ...which runs a whole mapreduce step to ignore all of the data in the table before spitting out '2'. This will be exceptionally frustrating if hadoop makes us wait for mapper(s).
> It would be nice to be able to SELECT without specifying a table, and perhaps relatedly, to be able to edit the above query (which worked) to not need to actually process (actual table with data) given that no data is being pulled from it (as we see from the SELECT statement, that table's name or alias does not appear).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HIVE-178) SELECT without FROM; dropping unnecessary table references

Posted by "Adam Kramer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Kramer updated HIVE-178:
-----------------------------

    Description: 
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. This is the reason I filed under "bug" instead of "improvement:" If it does not return '2' hive should fail.

So, currently we have to run 

SELECT 1+1 FROM (actual table with data);

...which runs a whole mapreduce step to ignore all of the data in the table before spitting out '2'. This will be exceptionally frustrating if hadoop makes us wait for mapper(s).

It would be nice to be able to SELECT without specifying a table, and perhaps relatedly, to be able to edit the above query (which worked) to not need to actually process (actual table with data) given that no data is being pulled from it (as we see from the SELECT statement, that table's name or alias does not appear).


  was:
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 (actual table with data);

...which runs a whole mapreduce step to ignore all of the data before spitting out '2'.

It would be nice to be able to SELECT without specifying a table, and perhaps relatedly, to be able to edit the above query (which worked) to not need to actually process (actual table with data) given that no data is being pulled from it (as we see from the SELECT statement, that table's name or alias does not appear).

     Issue Type: Bug  (was: Improvement)

> SELECT without FROM; dropping unnecessary table references
> ----------------------------------------------------------
>
>                 Key: HIVE-178
>                 URL: https://issues.apache.org/jira/browse/HIVE-178
>             Project: Hadoop Hive
>          Issue Type: Bug
>          Components: Query Processor
>            Reporter: Adam Kramer
>
> 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. This is the reason I filed under "bug" instead of "improvement:" If it does not return '2' hive should fail.
> So, currently we have to run 
> SELECT 1+1 FROM (actual table with data);
> ...which runs a whole mapreduce step to ignore all of the data in the table before spitting out '2'. This will be exceptionally frustrating if hadoop makes us wait for mapper(s).
> It would be nice to be able to SELECT without specifying a table, and perhaps relatedly, to be able to edit the above query (which worked) to not need to actually process (actual table with data) given that no data is being pulled from it (as we see from the SELECT statement, that table's name or alias does not appear).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVE-178) SELECT without FROM; dropping unnecessary table references

Posted by "David Phillips (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660813#action_12660813 ] 

David Phillips commented on HIVE-178:
-------------------------------------

bq. (select from empty table) should also just return '2' ... so it produces no output.

Selecting from an empty table should not produce results (unless it is an aggregate without grouping).  An empty table is an empty set, thus it would produce an empty set (no output rows):

{noformat}
mysql> create table empty (x int);
Query OK, 0 rows affected (0.00 sec)

mysql> select 1+1 from empty;
Empty set (0.00 sec)
{noformat}



> SELECT without FROM; dropping unnecessary table references
> ----------------------------------------------------------
>
>                 Key: HIVE-178
>                 URL: https://issues.apache.org/jira/browse/HIVE-178
>             Project: Hadoop Hive
>          Issue Type: Bug
>          Components: Query Processor
>            Reporter: Adam Kramer
>
> 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. This is the reason I filed under "bug" instead of "improvement:" If it does not return '2' hive should fail.
> So, currently we have to run 
> SELECT 1+1 FROM (actual table with data);
> ...which runs a whole mapreduce step to ignore all of the data in the table before spitting out '2'. This will be exceptionally frustrating if hadoop makes us wait for mapper(s).
> It would be nice to be able to SELECT without specifying a table, and perhaps relatedly, to be able to edit the above query (which worked) to not need to actually process (actual table with data) given that no data is being pulled from it (as we see from the SELECT statement, that table's name or alias does not appear).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVE-178) SELECT without FROM; dropping unnecessary table references

Posted by "David Phillips (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660818#action_12660818 ] 

David Phillips commented on HIVE-178:
-------------------------------------

It would be nice to treat a SELECT without a table the same as selecting from a table with a single row.  MySQL and PostgreSQL work this way.

Another alternative is the Oracle approach: provide a special dummy table named DUAL defined as follows:

{noformat}
CREATE TABLE dual (dummy STRING);
INSERT INTO dual VALUES('X');
{noformat}

It might be easiest to implement the MySQL/PostgreSQL way using the dummy table method, even if we don't require explicitly selecting from it, especially when you consider things like this:

{{SELECT * FROM (SELECT 1+1 x) z;}}


> SELECT without FROM; dropping unnecessary table references
> ----------------------------------------------------------
>
>                 Key: HIVE-178
>                 URL: https://issues.apache.org/jira/browse/HIVE-178
>             Project: Hadoop Hive
>          Issue Type: Bug
>          Components: Query Processor
>            Reporter: Adam Kramer
>
> 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. This is the reason I filed under "bug" instead of "improvement:" If it does not return '2' hive should fail.
> So, currently we have to run 
> SELECT 1+1 FROM (actual table with data);
> ...which runs a whole mapreduce step to ignore all of the data in the table before spitting out '2'. This will be exceptionally frustrating if hadoop makes us wait for mapper(s).
> It would be nice to be able to SELECT without specifying a table, and perhaps relatedly, to be able to edit the above query (which worked) to not need to actually process (actual table with data) given that no data is being pulled from it (as we see from the SELECT statement, that table's name or alias does not appear).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.