[jira] [Commented] (DRILL-6937) sys.functions table needs a fix in the names column

2019-01-21 Thread Kunal Khatua (JIRA)


[ 
https://issues.apache.org/jira/browse/DRILL-6937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16748442#comment-16748442
 ] 

Kunal Khatua commented on DRILL-6937:
-

I think, everything is implemented as a function. So in this case, the function 
is 
{{bit Z = greater_than(bigint X, bigint Y)}}
However, the SQL language parser is (probably) providing us syntactic sugar by 
making it easier to right
{{Z = X > Y}}

Both options are available to the user, we just tend to use what is more 
intuitive.
{code}
0: jdbc:drill:drillbit=kk127> select 2 > 1 from (values(1));
+-+
| EXPR$0  |
+-+
| true|
+-+
1 row selected (0.862 seconds)
0: jdbc:drill:drillbit=kk127> select greater_than(2,1) from (values(1));
+-+
| EXPR$0  |
+-+
| true|
+-+
1 row selected (0.453 seconds)
{code}

> sys.functions table needs a fix in the names column
> ---
>
> Key: DRILL-6937
> URL: https://issues.apache.org/jira/browse/DRILL-6937
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Execution - Flow
>Affects Versions: 1.15.0
>Reporter: Khurram Faraaz
>Assignee: Kunal Khatua
>Priority: Minor
> Fix For: 1.16.0
>
>
> The function names in the name column of sys.functions in some cases, are the 
> operators, this is not the expected behavior, the name column should have 
> actual names and not the operators.
> I am on Drill 1.15.0 commit : 8743e8f1e8d5bca4d67c94d07a8560ad356ff2b6
> {noformat}
> Apache Drill 1.15.0
> "Data is the new oil. Ready to Drill some?"
> 0: jdbc:drill:schema=dfs.tmp> select count(*) from sys.functions;
> +-+
> | EXPR$0 |
> +-+
> | 2846 |
> +-+
> 1 row selected (0.327 seconds)
> 0: jdbc:drill:schema=dfs.tmp>
> {noformat}
> {noformat}
> 0: jdbc:drill:schema=dfs.tmp> select distinct name from sys.functions limit 
> 12;
> ++
> | name |
> ++
> | != |
> | $sum0 |
> | && |
> | - |
> | /int |
> | < |
> | <= |
> | <> |
> | = |
> | == |
> | > |
> | >= |
> ++
> 12 rows selected (0.175 seconds)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DRILL-6937) sys.functions table needs a fix in the names column

2019-01-21 Thread Khurram Faraaz (JIRA)


[ 
https://issues.apache.org/jira/browse/DRILL-6937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16748292#comment-16748292
 ] 

Khurram Faraaz commented on DRILL-6937:
---

One question is, why do we have two different entries in the sys.functions 
table, one with name being ">" and other with name being "greater_than", all 
other columns for the two functions seem to have identical values, except for 
the name.

{noformat}
| > | BIGINT-REQUIRED,BIGINT-REQUIRED | BIT | built-in | false |

| greater_than | BIGINT-REQUIRED,BIGINT-REQUIRED | BIT | built-in | false | 
{noformat}

> sys.functions table needs a fix in the names column
> ---
>
> Key: DRILL-6937
> URL: https://issues.apache.org/jira/browse/DRILL-6937
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Execution - Flow
>Affects Versions: 1.15.0
>Reporter: Khurram Faraaz
>Assignee: Kunal Khatua
>Priority: Minor
> Fix For: 1.16.0
>
>
> The function names in the name column of sys.functions in some cases, are the 
> operators, this is not the expected behavior, the name column should have 
> actual names and not the operators.
> I am on Drill 1.15.0 commit : 8743e8f1e8d5bca4d67c94d07a8560ad356ff2b6
> {noformat}
> Apache Drill 1.15.0
> "Data is the new oil. Ready to Drill some?"
> 0: jdbc:drill:schema=dfs.tmp> select count(*) from sys.functions;
> +-+
> | EXPR$0 |
> +-+
> | 2846 |
> +-+
> 1 row selected (0.327 seconds)
> 0: jdbc:drill:schema=dfs.tmp>
> {noformat}
> {noformat}
> 0: jdbc:drill:schema=dfs.tmp> select distinct name from sys.functions limit 
> 12;
> ++
> | name |
> ++
> | != |
> | $sum0 |
> | && |
> | - |
> | /int |
> | < |
> | <= |
> | <> |
> | = |
> | == |
> | > |
> | >= |
> ++
> 12 rows selected (0.175 seconds)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DRILL-6937) sys.functions table needs a fix in the names column

2019-01-21 Thread Kunal Khatua (JIRA)


[ 
https://issues.apache.org/jira/browse/DRILL-6937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16748280#comment-16748280
 ] 

Kunal Khatua commented on DRILL-6937:
-

[~khfaraaz] the {{/int}} function name is correct. See 
https://github.com/apache/drill/blame/master/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/IntervalNumericArithmetic.java#L133

That said, I'm not sure if this is really a bug, since there have been other 
functions, like {{$sum0}} around as well:
https://github.com/apache/drill/blame/master/exec/java-exec/src/main/codegen/templates/SumZeroAggr.java#L48

Not all functions in the {{sys.functions}} table are necessarily utilized by 
users in their alphabetical representation, and are exposed to mathematical 
symbols as operators.

For example, the _less than_  or _greater than_ operator can be seen here in 
multiple forms.
{code}
0: jdbc:drill:drillbit=kk127> select * from sys.functions where returnType = 
'BIT' and signature = 'BIGINT-REQUIRED,BIGINT-REQUIRED'  limit 15;
+---+--+-+---+---+
|   name|signature | returnType  |  
source   | internal  |
+---+--+-+---+---+
| !=| BIGINT-REQUIRED,BIGINT-REQUIRED  | BIT | 
built-in  | false |
| < | BIGINT-REQUIRED,BIGINT-REQUIRED  | BIT | 
built-in  | false |
| <=| BIGINT-REQUIRED,BIGINT-REQUIRED  | BIT | 
built-in  | false |
| <>| BIGINT-REQUIRED,BIGINT-REQUIRED  | BIT | 
built-in  | false |
| = | BIGINT-REQUIRED,BIGINT-REQUIRED  | BIT | 
built-in  | false |
| ==| BIGINT-REQUIRED,BIGINT-REQUIRED  | BIT | 
built-in  | false |
| > | BIGINT-REQUIRED,BIGINT-REQUIRED  | BIT | 
built-in  | false |
| >=| BIGINT-REQUIRED,BIGINT-REQUIRED  | BIT | 
built-in  | false |
| equal | BIGINT-REQUIRED,BIGINT-REQUIRED  | BIT | 
built-in  | false |
| greater_than  | BIGINT-REQUIRED,BIGINT-REQUIRED  | BIT | 
built-in  | false |
| greater_than_or_equal_to  | BIGINT-REQUIRED,BIGINT-REQUIRED  | BIT | 
built-in  | false |
| less_than | BIGINT-REQUIRED,BIGINT-REQUIRED  | BIT | 
built-in  | false |
| less_than_or_equal_to | BIGINT-REQUIRED,BIGINT-REQUIRED  | BIT | 
built-in  | false |
| not_equal | BIGINT-REQUIRED,BIGINT-REQUIRED  | BIT | 
built-in  | false |
+---+--+-+---+---+
14 rows selected (0.282 seconds)
{code}

So, I'm not sure this would qualify as a bug. 
[~arina] do you agree?

> sys.functions table needs a fix in the names column
> ---
>
> Key: DRILL-6937
> URL: https://issues.apache.org/jira/browse/DRILL-6937
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Execution - Flow
>Affects Versions: 1.15.0
>Reporter: Khurram Faraaz
>Assignee: Kunal Khatua
>Priority: Minor
> Fix For: 1.16.0
>
>
> The function names in the name column of sys.functions in some cases, are the 
> operators, this is not the expected behavior, the name column should have 
> actual names and not the operators.
> I am on Drill 1.15.0 commit : 8743e8f1e8d5bca4d67c94d07a8560ad356ff2b6
> {noformat}
> Apache Drill 1.15.0
> "Data is the new oil. Ready to Drill some?"
> 0: jdbc:drill:schema=dfs.tmp> select count(*) from sys.functions;
> +-+
> | EXPR$0 |
> +-+
> | 2846 |
> +-+
> 1 row selected (0.327 seconds)
> 0: jdbc:drill:schema=dfs.tmp>
> {noformat}
> {noformat}
> 0: jdbc:drill:schema=dfs.tmp> select distinct name from sys.functions limit 
> 12;
> ++
> | name |
> ++
> | != |
> | $sum0 |
> | && |
> | - |
> | /int |
> | < |
> | <= |
> | <> |
> | = |
> | == |
> | > |
> | >= |
> ++
> 12 rows selected (0.175 seconds)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DRILL-6937) sys.functions table needs a fix in the names column

2018-12-28 Thread Kunal Khatua (JIRA)


[ 
https://issues.apache.org/jira/browse/DRILL-6937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16730499#comment-16730499
 ] 

Kunal Khatua commented on DRILL-6937:
-

[~khfaraaz] Drill operators are also implicitly functions, which is why they 
appear in the listing. That is how Drill is able to enforce data type 
compatibility, because those operators get translated to functions with valid 
arguments.

That said, some functions are internal in nature, e.g.
{code}
0: jdbc:drill:drillbit=10.10.100.127> select distinct name from sys.functions 
where internal limit 3;
+---+
| name |
+---+
| castEmptyStringNullableVar16CharToNULLABLEBIGINT |
| castEmptyStringNullableVar16CharToNULLABLEDATE |
| castEmptyStringNullableVar16CharToNULLABLEFLOAT4 |
+---+
3 rows selected (0.408 seconds)
{code}
 
However, the {{$sum0}} and {{/int}} are operators I've not seen before and 
might be part of some new UDFs. I'll take a look at it and update the JIRA with 
the appropriate resolution.
 

> sys.functions table needs a fix in the names column
> ---
>
> Key: DRILL-6937
> URL: https://issues.apache.org/jira/browse/DRILL-6937
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Execution - Flow
>Affects Versions: 1.15.0
>Reporter: Khurram Faraaz
>Assignee: Kunal Khatua
>Priority: Major
> Fix For: 1.16.0
>
>
> The function names in the name column of sys.functions in some cases, are the 
> operators, this is not the expected behavior, the name column should have 
> actual names and not the operators.
> I am on Drill 1.15.0 commit : 8743e8f1e8d5bca4d67c94d07a8560ad356ff2b6
> {noformat}
> Apache Drill 1.15.0
> "Data is the new oil. Ready to Drill some?"
> 0: jdbc:drill:schema=dfs.tmp> select count(*) from sys.functions;
> +-+
> | EXPR$0 |
> +-+
> | 2846 |
> +-+
> 1 row selected (0.327 seconds)
> 0: jdbc:drill:schema=dfs.tmp>
> {noformat}
> {noformat}
> 0: jdbc:drill:schema=dfs.tmp> select distinct name from sys.functions limit 
> 12;
> ++
> | name |
> ++
> | != |
> | $sum0 |
> | && |
> | - |
> | /int |
> | < |
> | <= |
> | <> |
> | = |
> | == |
> | > |
> | >= |
> ++
> 12 rows selected (0.175 seconds)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)