NLPchina / elasticsearch-sql

Use SQL to query Elasticsearch
Apache License 2.0
7k stars 1.54k forks source link

Select from one index which start with number + 'e' then number_format_exception be throwd #282

Open FreedomBX opened 8 years ago

FreedomBX commented 8 years ago

I select * from one index which start with number + 'e' , like uuid(5ed516e548a8458c825ec3655127cd46), then { "error" : { "root_cause" : [ { "type" : "number_format_exception", "reason" : null } ], "type" : "number_format_exception", "reason" : null }, "status" : 400 } return

why?

FreedomBX commented 8 years ago

test again,not start with number,but start with [0-9]e(scientific notation),the error will be occured.

eliranmoyal commented 8 years ago

show the select please

FreedomBX commented 8 years ago

select * from 5ed516e548a8458c825ec3655127cd46,any index which start with number + 'e' + any string

wntp commented 8 years ago

当你的表名以数字开头的时候,在Sql识别的时候会出现异常。

FreedomBX commented 8 years ago

但是elasticsearch的index是可以以数字开头的,而且这个不是数字开头的问题,正常数字开头是可以的,只是在写成科学计数法的时候会认为这是个数字,导致错误

allwefantasy commented 8 years ago

The error happened cause com.alibaba.druid.sql.parser.Lexer thought 'number' + 'e' was decimalValue. Can you just make a alias name for the index which you query?

allwefantasy commented 8 years ago

Update: note that this is a bug in druid library which is open source project for jdbc datasource. Maybe we can check the latest version to make sure whether the issue has been fixed.

eliranmoyal commented 8 years ago

There is a workaround for your issue

SELECT * FROM ['5ed516e548a8458c825ec3655127cd46']