can Column name be number(integer) in Lingual

21 views
Skip to first unread message

santlal gupta

unread,
Sep 28, 2016, 8:42:51 AM9/28/16
to Lingual User
Hi,

I am trying column name as number(integer). I have tried below commands to create schema and table, and query to test it in  lingual. 

Commands : 

lingual catalog --schema logP -add

lingual catalog --schema logP --stereotype logPV --add --columns 1,2,f1 -type int,string,string

lingual catalog --schema logP --table logP1 --stereotype logPV -add /home/hduser/test.txt --protocol hdfs --format csv

lingual shell --verbose --showstacktrace

select * from "logP"."logP1" ;

test.txt :

1,2,f1
1,aaa,vvv
2,ccc,vvv
3,ffff,333

Query : 
1. select * from "logP"."logP1" ;
   output : 
+----+-------+------+
| 1  |   2       |  f1  |
+----+-------+------+
| 1  | aaa    | vvv  |
| 2  | ccc     | vvv  |
| 3  | ffff       | 333  |
+----+-------+------+

2.  select * from "logP"."logP1" where "1" > 1 ;
output : 
+----+----+-----+
| 1  | 2  | f1  |
+----+----+-----+
+----+----+-----+

3. select * from "logP"."logP1" where "2" like 'a%' ;

Exception : 

2016-09-28 17:56:22,779 ERROR [pool-2-thread-1] planner.LocalStepRunner (LocalStepRunner.java:call(97)) - unable to prepare operation graph
cascading.operation.OperationException: could not compile script: {
  return !cascading.lingual.optiq.Functions.falseIfNull(2 != null && net.hydromatic.optiq.runtime.SqlFunctions.like(2, "a%"));
}
at cascading.operation.expression.ScriptOperation.getEvaluator(ScriptOperation.java:218)

Caused by: cascading.thirdparty.org.codehaus.commons.compiler.CompileException: Line 2, Column 117: No applicable constructor/method found for actual parameters "int, java.lang.String"; candidates are: "public static boolean net.hydromatic.optiq.runtime.SqlFunctions.like(java.lang.String, java.lang.String, java.lang.String)", "public static boolean net.hydromatic.optiq.runtime.SqlFunctions.like(java.lang.String, java.lang.String)"
        at cascading.thirdparty.org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:10062

2016-09-28 17:56:22,977 ERROR [main] enumerable.CascadingFlowRunnerEnumerable (CascadingFlowRunnerEnumerable.java:createEnumerator(227)) - flow failed
cascading.flow.FlowException: local step failed
        at cascading.flow.planner.FlowStepJob.blockOnJob(FlowStepJob.java:259

i am using lingual 1.2.1 and Hadoop 2.6.0-cdh5.4.2

can you conform me whether column name can be number.


Thanks
Santlal Gupta

Julian Hyde

unread,
Sep 28, 2016, 2:21:44 PM9/28/16
to lingua...@googlegroups.com
As far as I know, and from the perspective of the Optiq parser/validator, columns can be numbers (as long as you remember to quote them). Have you tried your test case with columns called “a”, “b” instead of “1”, “2”?
 
--
You received this message because you are subscribed to the Google Groups "Lingual User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lingual-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

santlal gupta

unread,
Sep 29, 2016, 3:11:45 AM9/29/16
to Lingual User
Hi Julian,

Yes, I have tried columns with qoutes.

I have tried query as  select * from "logP"."logP1" where "1" > 1,  where "1" represents column and 1 represents  value with which i want to compare. 

Thanks
Santlal Gupta

Julian Hyde

unread,
Sep 29, 2016, 1:56:58 PM9/29/16
to lingua...@googlegroups.com
Have you tried your test case with columns called “a”, “b” instead of “1”, “2”?

santlal gupta

unread,
Sep 30, 2016, 3:21:32 AM9/30/16
to Lingual User
Hi Julian,

Yes i have tried it. Below is an example of it.

command to create schema and table : 

lingual catalog --schema logQ2 -add

lingual catalog --schema logQ2 --stereotype logPV --add --columns a,1,b -type int,string,string

lingual catalog --schema logQ2 --table logP1 --stereotype logPV -add /home/hduser/test.txt 

lingual shell --verbose --showstacktrace

Testcases : 

1. select * from "logQ2"."logP1" ; 

output : 
+----+-------+------+
| a  |   1   |  b   |
+----+-------+------+
| 1  | aaa   | vvv  |
| 2  | ccc   | vvv  |
| 3  | ffff  | 333  |
+----+-------+------+

2. select * from "logQ2"."logP1" where "b" like 'v%';

output : 

+----+------+------+
| a  |  1   |  b   |
+----+------+------+
| 1  | aaa  | vvv  |
| 2  | ccc  | vvv  |
+----+------+------+

3. select * from "logQ2"."logP1" where "1" like 'a%';

Exception : 

2016-09-30 12:29:20,861 ERROR [pool-12-thread-1] planner.LocalStepRunner (LocalStepRunner.java:call(97)) - unable to prepare operation graph
cascading.operation.OperationException: could not compile script: { 
  return !cascading.lingual.optiq.Functions.falseIfNull(1 != null && net.hydromatic.optiq.runtime.SqlFunctions.like(1, "a%")); 
}
        at cascading.operation.expression.ScriptOperation.getEvaluator(ScriptOperation.java:218)
 
Caused by: cascading.thirdparty.org.codehaus.commons.compiler.CompileException: Line 2, Column 117: No applicable constructor/method found for actual parameters "int, java.lang.String"; candidates are: "public static boolean net.hydromatic.optiq.runtime.SqlFunctions.like(java.lang.String, java.lang.String, java.lang.String)", "public static boolean net.hydromatic.optiq.runtime.SqlFunctions.like(java.lang.String, java.lang.String)"
        at cascading.thirdparty.org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:10062)
2016-09-30 12:29:21,062 ERROR [main] enumerable.CascadingFlowRunnerEnumerable (CascadingFlowRunnerEnumerable.java:createEnumerator(227)) - flow failed
cascading.flow.FlowException: local step failed
        at cascading.flow.planner.FlowStepJob.blockOnJob(FlowStepJob.java:259)

 
Thanks
Santlal Gupta 

Julian Hyde

unread,
Sep 30, 2016, 6:52:04 AM9/30/16
to lingua...@googlegroups.com
OK, that's pretty convincing evidence that there's a bug if column
names are numeric. I suggest you work around by creating non-numeric
column names.
Reply all
Reply to author
Forward
0 new messages