You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Aman Sinha (JIRA)" <ji...@apache.org> on 2015/01/07 18:57:34 UTC
[jira] [Commented] (DRILL-1937) Disable internal function
SINGLE_VALUE()
[ https://issues.apache.org/jira/browse/DRILL-1937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14267944#comment-14267944 ]
Aman Sinha commented on DRILL-1937:
-----------------------------------
Some background on this: Calcite introduces the SINGLE_VALUE() function to enforce scalar checks for subqueries ... for example:
Note the use of SINGLE_VALUE inside AggregateRel in the Calcite logical plan:
{code}
0: jdbc:drill:zk=local> select n_name from cp.`tpch/nation.parquet` where n_nationkey = (select r_regionkey from cp.`tpch/region.parquet` where r_regionkey = 1);
Query failed: Query failed: Unexpected exception during fragment initialization: Node [rel#44:Subset#7.LOGICAL.ANY([]).[]] could not be implemented; planner state:
Root: rel#44:Subset#7.LOGICAL.ANY([]).[]
Original rel:
AbstractConverter(subset=[rel#44:Subset#7.LOGICAL.ANY([]).[]], convention=[LOGICAL], DrillDistributionTraitDef=[ANY([])], sort=[[]]): rowcount = 1.7976931348623157E308, cumulative cost = {inf}, id = 45
ProjectRel(subset=[rel#43:Subset#7.NONE.ANY([]).[]], n_name=[$2]): rowcount = 1.7976931348623157E308, cumulative cost = {1.7976931348623157E308 rows, 1.7976931348623157E308 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 42
FilterRel(subset=[rel#41:Subset#6.NONE.ANY([]).[]], condition=[=($1, $3)]): rowcount = 2.6965397022934733E307, cumulative cost = {2.6965397022934733E307 rows, 1.7976931348623157E308 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 40
JoinRel(subset=[rel#39:Subset#5.NONE.ANY([]).[]], condition=[true], joinType=[left]): rowcount = 1.7976931348623157E308, cumulative cost = {1.7976931348623157E308 rows, 0.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 38
EnumerableTableAccessRel(subset=[rel#30:Subset#0.ENUMERABLE.ANY([]).[]], table=[[cp, tpch/nation.parquet]]): rowcount = 100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 8
AggregateRel(subset=[rel#37:Subset#4.NONE.ANY([]).[]], group=[{}], agg#0=[SINGLE_VALUE($0)]): rowcount = 1.7976931348623158E307, cumulative cost = {1.7976931348623158E307 rows, 0.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 36
ProjectRel(subset=[rel#35:Subset#3.NONE.ANY([]).[]], r_regionkey=[$1]): rowcount = 1.7976931348623157E308, cumulative cost = {1.7976931348623157E308 rows, 1.7976931348623157E308 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 34
FilterRel(subset=[rel#33:Subset#2.NONE.ANY([]).[]], condition=[=($1, 1)]): rowcount = 15.0, cumulative cost = {15.0 rows, 100.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 32
EnumerableTableAccessRel(subset=[rel#31:Subset#1.ENUMERABLE.ANY([]).[]], table=[[cp, tpch/region.parquet]]): rowcount = 100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 9
{code}
Drill should either implement the SINGLE_VALUE function or at least in the near term we should throw a general error..something like 'Comparison with non-scalar subquery is not supported'
> Disable internal function SINGLE_VALUE()
> -----------------------------------------
>
> Key: DRILL-1937
> URL: https://issues.apache.org/jira/browse/DRILL-1937
> Project: Apache Drill
> Issue Type: Bug
> Components: SQL Parser
> Affects Versions: 0.8.0
> Reporter: Victoria Markman
> Assignee: Aman Sinha
>
> {code}
> #Fri Jan 02 21:20:47 EST 2015
> git.commit.id.abbrev=b491cdb
> {code}
> It is dangerous to have an internal function be exposed to users.
> What if one day user decided to write a UDF with the same signature ?
> {code}
> 0: jdbc:drill:schema=dfs> select SINGLE_VALUE(1) from `t.json`;
> +--+
> | |
> +--+
> +--+
> No rows selected (0.111 seconds)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)