提交 bb4105ed 编写于 作者: F fjy

fix broken standalone hadoop ingestion

上级 2e0353e5
......@@ -37,7 +37,6 @@ import com.google.inject.Module;
import com.metamx.common.ISE;
import com.metamx.common.guava.FunctionalIterable;
import com.metamx.common.logger.Logger;
import com.metamx.common.parsers.TimestampParser;
import io.druid.common.utils.JodaUtils;
import io.druid.data.input.InputRow;
import io.druid.data.input.impl.StringInputRowParser;
......@@ -111,7 +110,17 @@ public class HadoopDruidIndexerConfig
public static HadoopDruidIndexerConfig fromMap(Map<String, Object> argSpec)
{
return HadoopDruidIndexerConfig.jsonMapper.convertValue(argSpec, HadoopDruidIndexerConfig.class);
//backwards compatibility
if (argSpec.containsKey("schema")) {
return HadoopDruidIndexerConfig.jsonMapper.convertValue(argSpec, HadoopDruidIndexerConfig.class);
} else {
return new HadoopDruidIndexerConfig(
HadoopDruidIndexerConfig.jsonMapper.convertValue(
argSpec,
HadoopIngestionSpec.class
)
);
}
}
@SuppressWarnings("unchecked")
......
......@@ -138,7 +138,7 @@ public class HadoopIngestionSpec extends IngestionSpec<HadoopIOConfig, HadoopTun
this.dataSchema = new DataSchema(
dataSource,
new StringInputRowParser(
dataSpec == null ? null : dataSpec.toParseSpec(timestampSpec, dimensionExclusions),
dataSpec == null ? null : dataSpec.toParseSpec(theTimestampSpec, dimensionExclusions),
null, null, null, null
),
rollupSpec == null
......
......@@ -67,11 +67,10 @@ public class CliInternalHadoopIndexer implements Runnable
try {
HadoopIngestionSpec spec;
if (argumentSpec.startsWith("{")) {
spec = HadoopDruidIndexerConfig.jsonMapper.readValue(argumentSpec, HadoopIngestionSpec.class);
return HadoopDruidIndexerConfig.fromString(argumentSpec);
} else {
spec = HadoopDruidIndexerConfig.jsonMapper.readValue(new File(argumentSpec), HadoopIngestionSpec.class);
return HadoopDruidIndexerConfig.fromFile(new File(argumentSpec));
}
return HadoopDruidIndexerConfig.fromSchema(spec);
}
catch (Exception e) {
throw Throwables.propagate(e);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册