mirror of https://github.com/apache/druid.git
Fix DataSource serialization
This commit is contained in:
parent
5601c51ae6
commit
0b0648266c
|
@ -27,7 +27,7 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME,
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME,
|
||||||
include = JsonTypeInfo.As.PROPERTY,
|
include = JsonTypeInfo.As.PROPERTY,
|
||||||
property = "type",
|
property = "type",
|
||||||
defaultImpl = TableDataSource.class)
|
defaultImpl = LegacyDataSource.class)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = TableDataSource.class, name = "table"),
|
@JsonSubTypes.Type(value = TableDataSource.class, name = "table"),
|
||||||
@JsonSubTypes.Type(value = QueryDataSource.class, name = "query")
|
@JsonSubTypes.Type(value = QueryDataSource.class, name = "query")
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Druid - a distributed column store.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* This file Copyright (C) 2014 N3TWORK, Inc. and contributed to the Druid project
|
||||||
|
* under the Druid Corporate Contributor License Agreement.
|
||||||
|
*/
|
||||||
|
package io.druid.query;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class LegacyDataSource extends TableDataSource
|
||||||
|
{
|
||||||
|
@JsonCreator
|
||||||
|
public LegacyDataSource(String name)
|
||||||
|
{
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,7 +31,7 @@ public class TableDataSource implements DataSource
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public TableDataSource(@JsonProperty("name") String name)
|
public TableDataSource(@JsonProperty("name") String name)
|
||||||
{
|
{
|
||||||
this.name = name.toLowerCase();
|
this.name = (name == null ? null : name.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
|
@ -45,7 +45,7 @@ public class TableDataSource implements DataSource
|
||||||
public boolean equals(Object o)
|
public boolean equals(Object o)
|
||||||
{
|
{
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if (!(o instanceof TableDataSource)) return false;
|
||||||
|
|
||||||
TableDataSource that = (TableDataSource) o;
|
TableDataSource that = (TableDataSource) o;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue