Merge branch 'feature/fix-jackson-transient-serialization-bug' of github.com:Azure/azure-kusto-java into feature/fix-jackson-transient-serialization-bug

This commit is contained in:
Tanmaya Panda 2023-07-17 10:00:00 +05:30
Родитель d6864bba2a 3a433a27f4
Коммит d696eb66a5
3 изменённых файлов: 56 добавлений и 4 удалений

Просмотреть файл

@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## Unreleased
### Added
* `executeQuery`, `executeMgmt` to call with a specific type.
## [5.0.0]
### Fixed
* Move back to Java 8
* Update BOM version and msal

Просмотреть файл

@ -15,6 +15,18 @@ public interface Client extends Closeable {
KustoOperationResult execute(String database, String command, ClientRequestProperties properties) throws DataServiceException, DataClientException;
KustoOperationResult executeQuery(String command) throws DataServiceException, DataClientException;
KustoOperationResult executeQuery(String database, String command) throws DataServiceException, DataClientException;
KustoOperationResult executeQuery(String database, String command, ClientRequestProperties properties) throws DataServiceException, DataClientException;
KustoOperationResult executeMgmt(String command) throws DataServiceException, DataClientException;
KustoOperationResult executeMgmt(String database, String command) throws DataServiceException, DataClientException;
KustoOperationResult executeMgmt(String database, String command, ClientRequestProperties properties) throws DataServiceException, DataClientException;
String executeToJsonResult(String database) throws DataServiceException, DataClientException;
String executeToJsonResult(String database, String command) throws DataServiceException, DataClientException;

Просмотреть файл

@ -52,12 +52,12 @@ class ClientImpl implements Client, StreamingClient {
public static final String JAVA_INGEST_ACTIVITY_TYPE_PREFIX = "DN.JavaClient.Execute";
private final TokenProviderBase aadAuthenticationHelper;
private final String clusterUrl;
private ClientDetails clientDetails;
private final ClientDetails clientDetails;
private final CloseableHttpClient httpClient;
private final boolean leaveHttpClientOpen;
private boolean endpointValidated = false;
private ObjectMapper objectMapper = Utils.getObjectMapper();
private final ObjectMapper objectMapper = Utils.getObjectMapper();
public ClientImpl(ConnectionStringBuilder csb) throws URISyntaxException {
this(csb, HttpClientProperties.builder().build());
@ -110,7 +110,11 @@ class ClientImpl implements Client, StreamingClient {
@Override
public KustoOperationResult execute(String database, String command, ClientRequestProperties properties) throws DataServiceException, DataClientException {
CommandType commandType = determineCommandType(command);
return execute(database, command, properties, determineCommandType(command));
}
private KustoOperationResult execute(String database, String command, ClientRequestProperties properties, CommandType commandType)
throws DataServiceException, DataClientException {
return MonitoredActivity.invoke(
(SupplierTwoExceptions<KustoOperationResult, DataServiceException, DataClientException>) () -> executeImpl(database, command, properties,
commandType),
@ -118,6 +122,38 @@ class ClientImpl implements Client, StreamingClient {
updateAndGetExecuteTracingAttributes(database, properties));
}
@Override
public KustoOperationResult executeQuery(String command) throws DataServiceException, DataClientException {
return executeQuery(DEFAULT_DATABASE_NAME, command);
}
@Override
public KustoOperationResult executeQuery(String database, String command) throws DataServiceException, DataClientException {
return executeQuery(database, command, null);
}
@Override
public KustoOperationResult executeQuery(String database, String command, ClientRequestProperties properties)
throws DataServiceException, DataClientException {
return execute(database, command, properties, CommandType.QUERY);
}
@Override
public KustoOperationResult executeMgmt(String command) throws DataServiceException, DataClientException {
return executeMgmt(DEFAULT_DATABASE_NAME, command);
}
@Override
public KustoOperationResult executeMgmt(String database, String command) throws DataServiceException, DataClientException {
return executeMgmt(database, command, null);
}
@Override
public KustoOperationResult executeMgmt(String database, String command, ClientRequestProperties properties)
throws DataServiceException, DataClientException {
return execute(database, command, properties, CommandType.ADMIN_COMMAND);
}
private Map<String, String> updateAndGetExecuteTracingAttributes(String database, TraceableAttributes traceableAttributes) {
Map<String, String> attributes = new HashMap<>();
attributes.put("cluster", clusterUrl);