alibaba / alibaba/DataX

elasticsearchwriter 下的 ESWriter.java 代码问题

Open
#138 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
17.4k
Forks
5.7k
PR merge metrics
No merged PRs in 30d

Description

ESWriter.java 第300行
getDateStr 方法 的 if (column.getType() != Column.Type.DATE && esColumn.getFormat() != null)

应该要改成 if (column.getType() == Column.Type.DATE && esColumn.getFormat() != null)

不然此处非date的type进行format有何意义,并且如果有的date带了format参数,也没用进行format了

` private String getDateStr(ESColumn esColumn, Column column) {
DateTime date = null;
DateTimeZone dtz = DateTimeZone.getDefault();
if (esColumn.getTimezone() != null) {
// 所有时区参考 http://www.joda.org/joda-time/timezones.html
dtz = DateTimeZone.forID(esColumn.getTimezone());
}
if (column.getType() != Column.Type.DATE && esColumn.getFormat() != null) {
DateTimeFormatter formatter = DateTimeFormat.forPattern(esColumn.getFormat());
date = formatter.withZone(dtz).parseDateTime(column.asString());
return date.toString();
} else if (column.getType() == Column.Type.DATE) {
date = new DateTime(column.asLong(), dtz);
return date.toString();
} else {
return column.asString();
}
}`

Contributor guide

No contributing guide indexed for this repository

Research direction

Open ESWriter.java and inspect getDateStr around line 300, especially the conditional using column.getType() and esColumn.getFormat(). Confirm the condition matches the requested DATE handling, then verify that formatted DATE values use the formatter while non-DATE values do not.】【。} അല? Wait invalid extra? Need pure JSON. The generated includes weird. redo. jü.ેણ软件合法吗. I need final exact. Ensure no accidental.

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch, java
Domain
data-engineering, search
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.