Re: Invoking UDF that doesn't have parameters without paranthesis

2016-12-26 Thread Nagarajan Chinnasamy
Code for session_id function can be viewed at:
https://github.com/apache/drill/pull/685/files#diff-017c33174625f4e64c2aba21b59aadb6

Appreciate if you can check this and tell me how I can make it work without
using parenthesis while calling.

Best Regards,
Nagu.

On Fri, Dec 23, 2016 at 12:39 PM, Nagarajan Chinnasamy <
nagarajanchinnas...@gmail.com> wrote:

> Looks like session_id is not being treated as a *built-in* function.
> However its in the same jar as other context-based-functions. It does
> figure in the registry. Is there anything special needs to be done to get
> session_id to be treated as a built-in function -- in Drill
>
> Best Regards,
> Nagu.
>
> On Fri, Dec 23, 2016 at 2:02 AM, Nagarajan Chinnasamy <
> nagarajanchinnas...@gmail.com> wrote:
>
>> I have coded session_id same as other functions that work without
>> parenthesis. That means, in Drill, there has to be a way to make a function
>> to work without parenthesis (through Calcite). I researched enough and I
>> could not find the place where I can configure to make it work so Drill
>> Gurus have to help me here...
>>
>> Best Regards,
>> Nagu.
>>
>> On Wed, Dec 21, 2016 at 1:20 AM, Jinfeng Ni  wrote:
>>
>>> For function without parentheses, Calcite validator checks a
>>> SqlIdentifier against validator's operatorTable. If such identifier
>>> appears in the operatorTable, the SqlIdentifier is converted to a
>>> SqlCall. For your use case, you probably need add such function into
>>> operatorTable. You may follow Julian's suggestion of looking at
>>> CURRENT_DATE function.
>>>
>>> 1. https://github.com/apache/calcite/blob/master/core/src/main/
>>> java/org/apache/calcite/sql/SqlIdentifier.java#L302-L308
>>>
>>> On Tue, Dec 20, 2016 at 11:19 AM, Julian Hyde  wrote:
>>> > I don’t think you need to change the parser, just the validator (the
>>> changes to SqlOperator.getSyntax I described already). The parser will
>>> parse an identifier, and the validator will recognize that it is a call to
>>> a function with no arguments.
>>> >
>>> > Unless Drill has diverged further from Calcite than I imagine it has.
>>> >
>>> > Julian
>>> >
>>> >
>>> >> On Dec 20, 2016, at 10:51 AM, Sudheesh Katkam 
>>> wrote:
>>> >>
>>> >> I do not know the exact answer.
>>> >>
>>> >> Quite likely the Calcite parser needs to be changed, this blob:
>>> >>
>>> >> https://github.com/apache/calcite/blob/master/core/src/main/
>>> codegen/templates/Parser.jj#L4765 >> cite/blob/master/core/src/main/codegen/templates/Parser.jj#L4765>
>>> >>
>>> >> Drill extends the Calcite parser, not sure if the change can be made
>>> here:
>>> >>
>>> >> https://github.com/apache/drill/blob/master/exec/java-exec/s
>>> rc/main/codegen/includes/parserImpls.ftl >> ll/blob/master/exec/java-exec/src/main/codegen/includes/parserImpls.ftl>
>>> >>
>>> >> Thank you,
>>> >> Sudheesh
>>> >>
>>> >>> On Dec 19, 2016, at 3:00 PM, Nagarajan Chinnasamy <
>>> nagarajanchinnas...@gmail.com> wrote:
>>> >>>
>>> >>> Hi Julian Hyde,
>>> >>>
>>> >>> Thanks for your response. I am looking for the Drill way of doing it.
>>> >>>
>>> >>> In fact I have coded session_id function exactly as one of other
>>> >>> ContextFunctions of Drill. I seem to be missing something :(
>>> >>>
>>> >>>
>>> >>>
>>> >>>
>>> >>> Best Regards,
>>> >>> Nagu.
>>> >>>
>>> >>> On Mon, Dec 19, 2016 at 1:30 PM, Nagarajan Chinnasamy <
>>> >>> nagarajanchinnas...@gmail.com> wrote:
>>> >>>
>>>  Hi,
>>> 
>>>  Am developing a UDF called SESSION_ID as detailed in issue:
>>> 
>>>    https://issues.apache.org/jira/browse/DRILL-5043
>>> 
>>>  It does not take any input parameters. Now, I can only invoke it
>>> using
>>>  parenthesis as in:
>>> 
>>>    SELECT SESSION_ID() FROM (Values(1));
>>> 
>>>  I would like to know what do I need to do if I need to invoke it
>>> without
>>>  paranthesis like:
>>> 
>>>    SELECT SESSION_ID FROM (Values(1));
>>> 
>>>  Appreciate your input.
>>> 
>>>  Best Regards,
>>>  Nagu.
>>> 
>>> >>
>>> >
>>>
>>
>>
>


[HANGOUT] Suggestions for topics for 27/12

2016-12-26 Thread Arina Yelchiyeva
Hi all,

The bi-weekly hangout is tomorrow (27/12/16, 10 AM PST). If you have
any suggestions
for topics for tomorrow,  please add to this thread. We will also ask for
topics at the beginning of the hangout.

Hangout link:
*https://plus.google.com/hangouts/_/event/ci4rdiju8bv04a64efj5fedd0lc
*

Kind regards
Arina


[jira] [Created] (DRILL-5164) equi-join query results in CompileException

2016-12-26 Thread Khurram Faraaz (JIRA)
Khurram Faraaz created DRILL-5164:
-

 Summary: equi-join query results in CompileException
 Key: DRILL-5164
 URL: https://issues.apache.org/jira/browse/DRILL-5164
 Project: Apache Drill
  Issue Type: Bug
  Components: Execution - Codegen
Affects Versions: 1.9.0
Reporter: Khurram Faraaz
Priority: Critical


Drill 1.9.0 
git commit ID : 4c1b420b
4 node CentOS cluster
JSON file has 4095 keys (columns)

{noformat}
0: jdbc:drill:schema=dfs.tmp> select * from `manyColsInJson.json` t1, 
`manyColsInJson.json` t2 where t1.key2000 = t2.key2000;
Error: SYSTEM ERROR: CompileException: File 
'org.apache.drill.exec.compile.DrillJavaFileObject[HashJoinProbeGen294.java]', 
Line 16397, Column 17: HashJoinProbeGen294.java:16397: error: code too large
public void doSetup(FragmentContext context, VectorContainer buildBatch, 
RecordBatch probeBatch, RecordBatch outgoing)
^ (compiler.err.limit.code)

Fragment 0:0

[Error Id: 7d0efa7e-e183-4c40-939a-4908699f94bf on centos-01.qa.lab:31010] 
(state=,code=0)
{noformat}

Stack trace from drillbit.log

{noformat}
2016-12-26 09:52:11,321 [279f17fd-c8f0-5d18-1124-76099f0a5cc8:frag:0:0] ERROR 
o.a.d.e.w.fragment.FragmentExecutor - SYSTEM ERROR: CompileException: File 
'org.apache.drill.exec.compile.DrillJavaFileObject[HashJoinProbeGen294.java]', 
Line 16397, Column 17: HashJoinProbeGen294.java:16397: error: code too large
public void doSetup(FragmentContext context, VectorContainer buildBatch, 
RecordBatch probeBatch, RecordBatch outgoing)
^ (compiler.err.limit.code)

Fragment 0:0

[Error Id: 7d0efa7e-e183-4c40-939a-4908699f94bf on centos-01.qa.lab:31010]
org.apache.drill.common.exceptions.UserException: SYSTEM ERROR: 
CompileException: File 
'org.apache.drill.exec.compile.DrillJavaFileObject[HashJoinProbeGen294.java]', 
Line 16397, Column 17: HashJoinProbeGen294.java:16397: error: code too large
public void doSetup(FragmentContext context, VectorContainer buildBatch, 
RecordBatch probeBatch, RecordBatch outgoing)
^ (compiler.err.limit.code)

Fragment 0:0

[Error Id: 7d0efa7e-e183-4c40-939a-4908699f94bf on centos-01.qa.lab:31010]
at 
org.apache.drill.common.exceptions.UserException$Builder.build(UserException.java:543)
 ~[drill-common-1.9.0.jar:1.9.0]
at 
org.apache.drill.exec.work.fragment.FragmentExecutor.sendFinalState(FragmentExecutor.java:293)
 [drill-java-exec-1.9.0.jar:1.9.0]
at 
org.apache.drill.exec.work.fragment.FragmentExecutor.cleanup(FragmentExecutor.java:160)
 [drill-java-exec-1.9.0.jar:1.9.0]
at 
org.apache.drill.exec.work.fragment.FragmentExecutor.run(FragmentExecutor.java:262)
 [drill-java-exec-1.9.0.jar:1.9.0]
at 
org.apache.drill.common.SelfCleaningRunnable.run(SelfCleaningRunnable.java:38) 
[drill-common-1.9.0.jar:1.9.0]
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
[na:1.8.0_91]
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
[na:1.8.0_91]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_91]
Caused by: org.apache.drill.common.exceptions.DrillRuntimeException: 
org.apache.drill.exec.exception.SchemaChangeException: 
org.apache.drill.exec.exception.ClassTransformationException: 
java.util.concurrent.ExecutionException: 
org.apache.drill.exec.exception.ClassTransformationException: Failure 
generating transformation classes for value:

package org.apache.drill.exec.test.generated;

...
public class HashJoinProbeGen294 {

NullableVarCharVector[] vv0;
NullableVarCharVector vv3;
NullableVarCharVector[] vv6;
...
vv49137 .copyFromSafe((probeIndex), (outIndex), vv49134);
vv49143 .copyFromSafe((probeIndex), (outIndex), vv49140);
vv49149 .copyFromSafe((probeIndex), (outIndex), vv49146);
}
}

public void __DRILL_INIT__()
throws SchemaChangeException
{
}

}

at 
org.apache.drill.exec.compile.ClassTransformer.getImplementationClass(ClassTransformer.java:302)
 ~[drill-java-exec-1.9.0.jar:1.9.0]
at 
org.apache.drill.exec.compile.CodeCompiler$Loader.load(CodeCompiler.java:78) 
~[drill-java-exec-1.9.0.jar:1.9.0]
at 
org.apache.drill.exec.compile.CodeCompiler$Loader.load(CodeCompiler.java:74) 
~[drill-java-exec-1.9.0.jar:1.9.0]
at 
com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
 ~[guava-18.0.jar:na]
at 
com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319) 
~[guava-18.0.jar:na]
... 34 common frames omitted
Caused by: org.codehaus.commons.compiler.CompileException: File 
'org.apache.drill.exec.compile.DrillJavaFileObject[HashJoinProbeGen294.java]', 
Line 16397, Column 17: HashJoinProbeGen294.java:16397: error: code too large
public void