Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.druid.msq.guice.MultiStageQuery;
import org.apache.druid.msq.sql.MSQTaskSqlEngine;
import org.apache.druid.query.QueryException;
import org.apache.druid.query.http.SqlTaskStatus;
import org.apache.druid.server.QueryResponse;
import org.apache.druid.server.initialization.ServerConfig;
import org.apache.druid.server.security.Access;
Expand All @@ -47,7 +48,6 @@
import org.apache.druid.sql.http.ResultFormat;
import org.apache.druid.sql.http.SqlQuery;
import org.apache.druid.sql.http.SqlResource;
import org.apache.druid.sql.http.SqlTaskStatus;

import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.java.util.common.logger.Logger;
import org.apache.druid.query.QueryContexts;
import org.apache.druid.query.http.SqlTaskStatus;
import org.apache.druid.sql.http.SqlQuery;
import org.apache.druid.sql.http.SqlTaskStatus;
import org.apache.druid.testing.utils.DataLoaderHelper;
import org.apache.druid.testing.utils.MsqTestQueryHelper;
import org.apache.druid.testsEx.cluster.CatalogClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import org.apache.druid.catalog.model.table.DatasourceDefn;
import org.apache.druid.catalog.model.table.TableBuilder;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.query.http.SqlTaskStatus;
import org.apache.druid.sql.http.SqlQuery;
import org.apache.druid.sql.http.SqlTaskStatus;
import org.apache.druid.testing.utils.MsqTestQueryHelper;
import org.apache.druid.testsEx.categories.Catalog;
import org.apache.druid.testsEx.cluster.CatalogClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.msq.exec.ClusterStatisticsMergeMode;
import org.apache.druid.msq.util.MultiStageQueryContext;
import org.apache.druid.query.http.SqlTaskStatus;
import org.apache.druid.sql.http.SqlQuery;
import org.apache.druid.sql.http.SqlTaskStatus;
import org.apache.druid.testing.clients.CoordinatorResourceTestClient;
import org.apache.druid.testing.utils.DataLoaderHelper;
import org.apache.druid.testing.utils.MsqTestQueryHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.java.util.common.logger.Logger;
import org.apache.druid.msq.util.MultiStageQueryContext;
import org.apache.druid.sql.http.SqlTaskStatus;
import org.apache.druid.query.http.SqlTaskStatus;
import org.apache.druid.testing.clients.CoordinatorResourceTestClient;
import org.apache.druid.testing.utils.DataLoaderHelper;
import org.apache.druid.testing.utils.ITRetryUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.apache.druid.msq.indexing.report.MSQResultsReport;
import org.apache.druid.msq.indexing.report.MSQTaskReport;
import org.apache.druid.msq.indexing.report.MSQTaskReportPayload;
import org.apache.druid.sql.http.SqlTaskStatus;
import org.apache.druid.query.http.SqlTaskStatus;
import org.apache.druid.storage.local.LocalFileExportStorageProvider;
import org.apache.druid.testing.clients.CoordinatorResourceTestClient;
import org.apache.druid.testing.utils.DataLoaderHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
import org.apache.druid.msq.indexing.report.MSQResultsReport;
import org.apache.druid.msq.indexing.report.MSQTaskReport;
import org.apache.druid.msq.indexing.report.MSQTaskReportPayload;
import org.apache.druid.query.http.SqlTaskStatus;
import org.apache.druid.sql.http.SqlQuery;
import org.apache.druid.sql.http.SqlTaskStatus;
import org.apache.druid.testing.IntegrationTestingConfig;
import org.apache.druid.testing.clients.OverlordResourceTestClient;
import org.apache.druid.testing.clients.SqlResourceTestClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

package org.apache.druid.sql.calcite.planner;
package org.apache.druid.query.explain;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

package org.apache.druid.sql.http;
package org.apache.druid.query.explain;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand All @@ -26,7 +26,6 @@
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.apache.druid.sql.calcite.planner.ExplainAttributes;

import java.io.IOException;
import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.druid.query.http;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Objects;

/**
* Client representation of {@link org.apache.druid.sql.http.SqlParameter}. This is effectively a lightweight POJO class
* for use by clients that excludes Calcite dependencies and server-side logic from the Broker.
*/
public class ClientSqlParameter
{
@JsonProperty
private final String type;

@JsonProperty
private final Object value;

@JsonCreator
public ClientSqlParameter(
@JsonProperty("type") String type,
@JsonProperty("value") Object value
)
{
this.type = type;
this.value = value;
}

@Override
public boolean equals(Object o)
{
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ClientSqlParameter that = (ClientSqlParameter) o;
return Objects.equals(type, that.type) && Objects.equals(value, that.value);
}

@Override
public int hashCode()
{
return Objects.hash(type, value);
}

@Override
public String toString()
{
return "ClientSqlParameter{" +
"type='" + type + '\'' +
", value=" + value +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.druid.query.http;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
* Client representation of {@link org.apache.druid.sql.http.SqlQuery}. This is effectively a lightweight POJO class for
* use by clients such as {@link org.apache.druid.client.broker.BrokerClient} that doesn't bring in any of the
* Calcite dependencies and server-side logic from the Broker.
*/
public class ClientSqlQuery
{
@JsonProperty
private final String query;

@JsonProperty
private final String resultFormat;

@JsonProperty
private final boolean header;

@JsonProperty
private final boolean typesHeader;

@JsonProperty
private final boolean sqlTypesHeader;

@JsonProperty
private final Map<String, Object> context;

@JsonProperty
private final List<ClientSqlParameter> parameters;

@JsonCreator
public ClientSqlQuery(
@JsonProperty("query") final String query,
@JsonProperty("resultFormat") final String resultFormat,
@JsonProperty("header") final boolean header,
@JsonProperty("typesHeader") final boolean typesHeader,
@JsonProperty("sqlTypesHeader") final boolean sqlTypesHeader,
@JsonProperty("context") final Map<String, Object> context,
@JsonProperty("parameters") final List<ClientSqlParameter> parameters
)
{
this.query = query;
this.resultFormat = resultFormat;
this.header = header;
this.typesHeader = typesHeader;
this.sqlTypesHeader = sqlTypesHeader;
this.context = context;
this.parameters = parameters;
}

public String getQuery()
{
return query;
}

public String getResultFormat()
{
return resultFormat;
}

public boolean isHeader()
{
return header;
}

public boolean isTypesHeader()
{
return typesHeader;
}

public boolean isSqlTypesHeader()
{
return sqlTypesHeader;
}

public Map<String, Object> getContext()
{
return context;
}

public List<ClientSqlParameter> getParameters()
{
return parameters;
}


@Override
public boolean equals(final Object o)
{
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ClientSqlQuery sqlQuery = (ClientSqlQuery) o;
return header == sqlQuery.header &&
typesHeader == sqlQuery.typesHeader &&
sqlTypesHeader == sqlQuery.sqlTypesHeader &&
Objects.equals(query, sqlQuery.query) &&
Objects.equals(resultFormat, sqlQuery.resultFormat) &&
Objects.equals(context, sqlQuery.context) &&
Objects.equals(parameters, sqlQuery.parameters);
}

@Override
public int hashCode()
{
return Objects.hash(query, resultFormat, header, typesHeader, sqlTypesHeader, context, parameters);
}

@Override
public String toString()
{
return "ClientSqlQuery{" +
"query='" + query + '\'' +
", resultFormat=" + resultFormat +
", header=" + header +
", typesHeader=" + typesHeader +
", sqlTypesHeader=" + sqlTypesHeader +
", context=" + context +
", parameters=" + parameters +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

package org.apache.druid.sql.http;
package org.apache.druid.query.http;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

package org.apache.druid.sql.calcite.planner;
package org.apache.druid.query.explain;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.druid.error.DruidException;
Expand All @@ -38,7 +38,7 @@ public class ExplainAttributesTest
public void testGetters()
{
final ExplainAttributes selectAttributes = new ExplainAttributes("SELECT", null, null, null, null);
Assert.assertEquals("SELECT", selectAttributes.getStatementType());
assertEquals("SELECT", selectAttributes.getStatementType());
Assert.assertNull(selectAttributes.getTargetDataSource());
Assert.assertNull(selectAttributes.getPartitionedBy());
Assert.assertNull(selectAttributes.getClusteredBy());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

package org.apache.druid.sql.http;
package org.apache.druid.query.explain;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
Expand All @@ -27,7 +27,6 @@
import org.apache.druid.error.DruidException;
import org.apache.druid.jackson.DefaultObjectMapper;
import org.apache.druid.java.util.common.granularity.Granularities;
import org.apache.druid.sql.calcite.planner.ExplainAttributes;
import org.junit.Test;

import java.util.List;
Expand Down
Loading