Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

* Remove commons lang lib #415

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

ag-ramachandran
Copy link
Contributor

  • Remove usage of Pair
  • Remove commons lang
    We had a strange issue in spark yesterday where commons lang with var-args in setConnector details was causing an issue. Thought of removing these libs

* Remove usage of Pair
Copy link

github-actions bot commented Jan 30, 2025

Test Results

149 tests   - 183   149 ✅  - 174   5s ⏱️ - 4m 2s
 14 suites  -  13     0 💤  -   9 
 14 files    -  13     0 ❌ ±  0 

Results for commit 944834d. ± Comparison against base commit 945e8e5.

This pull request removes 183 tests.
com.microsoft.azure.kusto.ingest.AzureStorageClientTest ‑ UploadStreamToBlob_NullInputStream_IllegalArgumentException
com.microsoft.azure.kusto.ingest.AzureStorageClientTest ‑ compressAndStream_NullBlob_IllegalArgumentException
com.microsoft.azure.kusto.ingest.AzureStorageClientTest ‑ compressAndStream_NullStream_IllegalArgumentException
com.microsoft.azure.kusto.ingest.AzureStorageClientTest ‑ compressAndUploadFileToBlob_NullBlob_IllegalArgumentException
com.microsoft.azure.kusto.ingest.AzureStorageClientTest ‑ compressAndUploadFileToBlob_NullFilePath_IllegalArgumentException
com.microsoft.azure.kusto.ingest.AzureStorageClientTest ‑ postMessageToQueue_NullContent_IllegalArgumentException
com.microsoft.azure.kusto.ingest.AzureStorageClientTest ‑ postMessageToQueue_NullEntity_IllegalArgumentException
com.microsoft.azure.kusto.ingest.AzureStorageClientTest ‑ postMessageToQueue_NullQueuePath_IllegalArgumentException
com.microsoft.azure.kusto.ingest.AzureStorageClientTest ‑ postMessageToQueue_NullTableUri_IllegalArgumentException
com.microsoft.azure.kusto.ingest.AzureStorageClientTest ‑ uploadFileToBlob_NullBlob_IllegalArgumentException
…

♻️ This comment has been updated with latest results.

Copy link
Contributor

@AsafMah AsafMah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update changelog.md

public static final Set<String> KUSTO_LITERAL_PREFIX = Stream.of("H", "h").collect(Collectors.toCollection(HashSet::new));
public static final Set<String> KUSTO_MULTILINE_QUOTE_DELIMITERS = Stream.of("```", "~~~").collect(Collectors.toCollection(HashSet::new));
public static final Set<String> KUSTO_ESCAPE_SEQUENCES = Stream.of("\\\"", "'", "@\\\"", "@'").collect(Collectors.toCollection(HashSet::new));
private static final Set<String> KUSTO_LITERAL_PREFIX = Stream.of("H", "h").collect(Collectors.toCollection(HashSet::new));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically these are breaking changes, but I think it's ok they're private. We just need to document in the changelog

@@ -23,6 +22,8 @@ public class ConnectionStringBuilder {
public static final String DEFAULT_DATABASE_NAME = "NetDefaultDb";

private static final String DEFAULT_DEVICE_AUTH_TENANT = "organizations";
private static final String CLUSTER_URL_CANNOT_BE_NULL_OR_EMPTY = "clusterUrl cannot be null or empty";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we'll have some sort of helper method to throw if null or empty?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, we already have it with Ensure - let's use that

@@ -125,53 +126,46 @@ private void assignValue(String rawKey, String value) {
}

public String toString(boolean showSecrets) {
ArrayList<Pair<KnownKeywords, String>> entries = new ArrayList<>();
Map<KnownKeywords, String> entries = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I didn't use map in the first place is because it doesn't keep the order. But I think you can use LinkedHashMap which will keep the order

@@ -629,15 +621,15 @@ public static ConnectionStringBuilder createWithTokenCredential(@NotNull String
* @param appName The app hosting the connector, or null to use the current process name.
* @param appVersion The version of the app hosting the connector, or null to use "[none]".
* @param sendUser True if the user should be sent to Kusto, otherwise "[none]" will be sent.
* @param overrideUser The user to send to Kusto, or null zvto use the current user.
* @param overrideUser The user to send to Kusto, or null to use the current user.
* @param additionalFields Additional fields to trace.
* Example: "Kusto.MyConnector:{1.0.0}|App.{connector}:{0.5.3}|Kusto.MyField:{MyValue}"
*/
public void setConnectorDetails(String name, String version, @Nullable String appName, @Nullable String appVersion, boolean sendUser,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs to be documented in the changelog

@@ -7,6 +7,8 @@
import java.util.Map;

public class Tracer {
private Tracer() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? to prevent construction?

@@ -147,7 +148,7 @@ public void testSetConnectorNameAndVersion() throws URISyntaxException, DataClie
@Test
public void testSetConnectorNoAppVersion() throws URISyntaxException, DataClientException {
ConnectionStringBuilder csb = ConnectionStringBuilder.createWithAadManagedIdentity("https://testcluster.kusto.windows.net");
csb.setConnectorDetails("myConnector", "myVersion", null, null, true, "myApp");
csb.setConnectorDetails("myConnector", "myVersion", null, null, true, "myApp", Collections.emptyMap());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should still work ok if it gets null

private String appendedClientVersionForTracing;

private static final ConcurrentHashMap<String, String> defaultValues = new ConcurrentHashMap<>();
public static final String DEFAULT_APPLICATION = "defaultApplication";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool idea to use ConcurrentHasmap's computeifabsent and then access these as keys.

But maybe instead of strings, it should be an enum?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants