[
https://issues.apache.org/jira/browse/DRILL-1870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14247263#comment-14247263
]
Abhishek Girish commented on DRILL-1870:
----------------------------------------
Cannot use Cast:
select convert_from(row_key, 'UTF8') row_key, convert_from(onecf['name'],
'UTF8') name, convert_from(threecf['contributions'], 'UTF8') contributions,
cast(convert_from(twocf['age'], 'UTF8') as integer)age from voter where
row_key<10;
Query failed: Query failed: Failure while trying to start remote fragment,
Encountered an illegal char on line 1, column 29: '' [
d611b007-3c90-4941-b6e5-978bb2dc3148 on abhi8.qa.lab:31010 ]
Error: exception while executing query: Failure while executing query.
(state=,code=0)
Explain Plan:
+------------+------------+
| text | json |
+------------+------------+
| 00-00 Screen
00-01 Project(row_key=[$0], name=[$1], contributions=[$2], age=[$3])
00-02 UnionExchange
01-01 Project(row_key=[CONVERT_FROM($0, 'UTF8')],
name=[CONVERT_FROM($1, 'UTF8')], contributions=[CONVERT_FROM($2, 'UTF8')],
age=[CAST(CONVERT_FROM($3, 'UTF8')):INTEGER NOT NULL])
01-02 SelectionVectorRemover
01-03 Filter(condition=[<($0, 10)])
01-04 Project(row_key=[$2], ITEM=[ITEM($1, 'name')],
ITEM2=[ITEM($3, 'contributions')], ITEM3=[ITEM($0, 'age')])
01-05 Scan(groupscan=[HBaseGroupScan
[HBaseScanSpec=HBaseScanSpec [tableName=voter, startRow=null, stopRow=null,
filter=null], columns=[`row_key`, `onecf`.`name`, `threecf`.`contributions`,
`twocf`.`age`]]])
| {
"head" : {
"version" : 1,
"generator" : {
"type" : "ExplainHandler",
"info" : ""
},
"type" : "APACHE_DRILL_PHYSICAL",
"options" : [ ],
"queue" : 0,
"resultMode" : "EXEC"
},
"graph" : [ {
"pop" : "hbase-scan",
"@id" : 65541,
"hbaseScanSpec" : {
"tableName" : "voter",
"startRow" : "",
"stopRow" : "",
"serializedFilter" : null
},
"storage" : {
"type" : "hbase",
"config" : {
"hbase.zookeeper.quorum" : "10.10.103.32",
"hbase.zookeeper.property.clientPort" : "5181"
},
"size.calculator.enabled" : false,
"enabled" : true
},
"columns" : [ "`row_key`", "`onecf`.`name`", "`threecf`.`contributions`",
"`twocf`.`age`" ],
"cost" : 1.048576E7
}, {
"pop" : "project",
"@id" : 65540,
"exprs" : [ {
"ref" : "`row_key`",
"expr" : "`row_key`"
}, {
"ref" : "`ITEM`",
"expr" : "`onecf`.`name`"
}, {
"ref" : "`ITEM2`",
"expr" : "`threecf`.`contributions`"
}, {
"ref" : "`ITEM3`",
"expr" : "`twocf`.`age`"
} ],
"child" : 65541,
"initialAllocation" : 1000000,
"maxAllocation" : 10000000000,
"cost" : 1.048576E7
}, {
"pop" : "filter",
"@id" : 65539,
"child" : 65540,
"expr" : "less_than(`row_key`, 10) ",
"initialAllocation" : 1000000,
"maxAllocation" : 10000000000,
"cost" : 5242880.0
}, {
"pop" : "selection-vector-remover",
"@id" : 65538,
"child" : 65539,
"initialAllocation" : 1000000,
"maxAllocation" : 10000000000,
"cost" : 5242880.0
}, {
"pop" : "project",
"@id" : 65537,
"exprs" : [ {
"ref" : "`row_key`",
"expr" : "convert_from(`row_key`, \"UTF8\")"
}, {
"ref" : "`name`",
"expr" : "convert_from(`ITEM`, \"UTF8\")"
}, {
"ref" : "`contributions`",
"expr" : "convert_from(`ITEM2`, \"UTF8\")"
}, {
"ref" : "`age`",
"expr" : "cast( (convert_from(`ITEM3`, \"UTF8\") ) as INT )"
} ],
"child" : 65538,
"initialAllocation" : 1000000,
"maxAllocation" : 10000000000,
"cost" : 5242880.0
}, {
"pop" : "union-exchange",
"@id" : 2,
"child" : 65537,
"initialAllocation" : 1000000,
"maxAllocation" : 10000000000,
"cost" : 5242880.0
}, {
"pop" : "project",
"@id" : 1,
"exprs" : [ {
"ref" : "`row_key`",
"expr" : "`row_key`"
}, {
"ref" : "`name`",
"expr" : "`name`"
}, {
"ref" : "`contributions`",
"expr" : "`contributions`"
}, {
"ref" : "`age`",
"expr" : "`age`"
} ],
"child" : 2,
"initialAllocation" : 1000000,
"maxAllocation" : 10000000000,
"cost" : 5242880.0
}, {
"pop" : "screen",
"@id" : 0,
"child" : 1,
"initialAllocation" : 1000000,
"maxAllocation" : 10000000000,
"cost" : 5242880.0
} ]
} |
+------------+------------+
1 row selected (0.102 seconds)
> SQL functions cannot be applied along side convert_from
> -------------------------------------------------------
>
> Key: DRILL-1870
> URL: https://issues.apache.org/jira/browse/DRILL-1870
> Project: Apache Drill
> Issue Type: Bug
> Reporter: Abhishek Girish
> Assignee: Jacques Nadeau
>
> 1. Concat:
> > select concat(onecf['name'], ' hello ') name from voter where row_key=1;
> +------------+
> | name |
> +------------+
> | nick miller hello |
> +------------+
> > select concat(convert_from(onecf['name'], 'utf8'), '') name from voter
> > where row_key=1;
> Query failed: Query failed: Failure while trying to start remote fragment,
> Encountered an illegal char on line 1, column 28: '' [
> e40f445c-d3bc-4d8f-9ed2-d425ef332c3d on abhi6.qa.lab:31010 ]
> Error: exception while executing query: Failure while executing query.
> (state=,code=0)
> 2. Char Length:
> > select char_length(convert_from(onecf['name'], 'UTF8')) name from voter
> > where row_key=1;
> Query failed: Query failed: Failure while trying to start remote fragment,
> Encountered an illegal char on line 1, column 33: '' [
> 9aecabb7-189e-4f1d-9c34-9dda76593740 on abhi8.qa.lab:31010 ]
> Error: exception while executing query: Failure while executing query.
> (state=,code=0)
> > select char_length(onecf['name']) name from voter where row_key=1;
> +------------+
> | name |
> +------------+
> | 11 |
> +------------+
> 1 row selected (0.186 seconds)
> 3. SubString:
> > select substr(onecf['name'], 5, 8) name from voter where row_key=1;
> +------------+
> | name |
> +------------+
> | miller |
> +------------+
> 1 row selected (0.181 seconds)
> > select substr(convert_from(onecf['name'], 'utf8'), 5, 8) name from voter
> > where row_key=1;
> Query failed: Query failed: Failure while trying to start remote fragment,
> Encountered an illegal char on line 1, column 28: '' [
> 402c55e2-99e4-4b7b-b6c0-d9e5f5f66321 on abhi6.qa.lab:31010 ]
> Error: exception while executing query: Failure while executing query.
> (state=,code=0)
> 4. InitCap:
> > select initcap(onecf['name']) name from voter where row_key=1;
> +------------+
> | name |
> +------------+
> | Nick Miller |
> +------------+
> 1 row selected (0.151 seconds)
> > select initcap(convert_from(onecf['name'], 'utf8')) name from voter where
> > row_key=1;
> Query failed: Query failed: Failure while trying to start remote fragment,
> Encountered an illegal char on line 1, column 29: '' [
> b7eef4e3-72c0-48ab-b91a-54db6e6623d7 on abhi8.qa.lab:31010 ]
> Error: exception while executing query: Failure while executing query.
> (state=,code=0)
> Similarly other functions do not work.
> Log message:
> 2014-12-15 13:10:50,891 [BitServer-3] ERROR
> o.a.d.exec.rpc.control.ControlServer - Error
> 5668a697-8c64-4e8b-895d-e4faa642749d: Failure while trying to start remote
> fragment
> org.apache.drill.exec.rpc.UserRpcException:
> com.fasterxml.jackson.databind.JsonMappingException: Encountered an illegal
> char on line 1, column 29: '' (through reference chain:
> java.util.ArrayList[0])
> at
> org.apache.drill.exec.work.batch.ControlHandlerImpl.startNewRemoteFragment(ControlHandlerImpl.java:139)
> ~[drill-java-exec-0.8.0-SNAPSHOT-rebuffed.jar:0.8.0-SNAPSHOT]
> ...
> ...
> Caused by: com.fasterxml.jackson.databind.JsonMappingException: Encountered
> an illegal char on line 1, column 29: '' (through reference chain:
> java.util.ArrayList[0])
> at
> com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:210)
> ~[jackson-databind-2.4.3.jar:2.4.3]
> ...
> ...
> Caused by: java.lang.RuntimeException: Encountered an illegal char on line 1,
> column 29: ''
> at
> org.apache.drill.common.expression.parser.ExprLexer.mFallThrough(ExprLexer.java:3144)
> ~[drill-common-0.8.0-SNAPSHOT-rebuffed.jar:0.8.0-SNAPSHOT]
> at
> org.apache.drill.common.expression.parser.ExprLexer.mTokens(ExprLexer.java:3693)
> ~[drill-common-0.8.0-SNAPSHOT-rebuffed.jar:0.8.0-SNAPSHOT]
> at org.antlr.runtime.Lexer.nextToken(Lexer.java:89)
> ~[antlr-runtime-3.4.jar:na]
> ...
> ...
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)