[ 
https://issues.apache.org/jira/browse/CALCITE-4732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17429258#comment-17429258
 ] 

duan xiong commented on CALCITE-4732:
-------------------------------------

[~yangguilong] I can get what you mean. But I think It is not a bug. 

Because In Elasticsearch according 
[es-date-field-type|https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html]
 the date has three formats: 
 * strings containing formatted dates, e.g. {{"2015-01-01"}} or {{"2015/01/01 
12:10:30"}}.
 * a number representing _milliseconds-since-the-epoch_.
 * a number representing _seconds-since-the-epoch_

So In the test:
{code:java}
'2018-01-01' == 1514764800000{code}
And In this PR if we add a new doc like doc4:
{code:java}
String doc1 = "{cat1:'a', cat2:'g', val1:1, cat4:'2018-01-01', cat5:1}";
String doc2 = "{cat2:'g', cat3:'y', val2:5, cat4:'2019-12-12'}";
String doc3 = "{cat1:'b', cat2:'h', cat3:'z', cat5:2, val1:7, val2:42}";
String doc4 = "{cat1:'b', cat2:'h', cat3:'z', cat4:'1576108800000', cat5:2, 
val1:7, val2:42}";{code}
will return:
{code:java}
cat4=2018-01-01T00:00:00.000Z; EXPR$1=1.0
cat4=2019-12-12T00:00:00.000Z; EXPR$1=7.0
cat4=null; EXPR$1=7.0{code}
So if you want to the result have the same value (String->String)as the input 
it doesn't work.

But If you just want to have a data format type to return this PR can work.

> date type field group problem
> -----------------------------
>
>                 Key: CALCITE-4732
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4732
>             Project: Calcite
>          Issue Type: Bug
>          Components: elasticsearch-adapter
>            Reporter: james yang
>            Priority: Major
>
> when I execute a sql group by a date type field ,I get the int value of the 
> date not the string value



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to