Граф коммитов

274 Коммитов

Автор SHA1 Сообщение Дата
maltalex 1986a5789f
added classes for generating pojos from KustoResultSetTable instances (#159)
* added classes for generating pojos from KustoResultSetTable instances

This commit includes three new classes:
1. KustoType which is a generic class for representing different Kusto
column types and bind them to different Java types

2. KustoColumn which represents a Kusto column - it has a name,
nullability information, and a type (KustoType)

3. KustoResultMapper which can be set up to parse KustoResultSetTable
instances and return a list of pojos. The setup phase is done using a
builder that takes the pojo constructor, as well as zero or more
instances of KustoColumn along with setter functions to set pojo's
fields based on the column values.

This mechanism can potentially be extended to use reflection based on
the target pojo class instead of the manual KustoResultMapper setup

* Update data/src/main/java/com/microsoft/azure/kusto/data/KustoType.java

Changed documentation link to international version

Co-authored-by: ohad bitton <32278684+ohadbitt@users.noreply.github.com>

* Use String.format() for exception messages

* Introduced ObjectPopulator class, ordinal column mapping

- Unified KustoColumn and QueryResultColumnInfo into the new
ObjectPopulator class
- Added support for manually specified column ordinals
- extractList finds column indexes once per result set to save on column
lookups

* KustoResultMapper extractSingle - don't create empty objects

If the KustoResultSetTable is null, the proper response is to return a
null object, not an unpopulated one

* ObjectPopulator - always use column index, formatting

populateFrom used to get objects from the ResultSet by the column name
unless an ordinal was set. Now it always uses the ordinal (looking it up
if necessary).

* KustoType formatting - don't align field declarations

* KustoResultMapperTest

The test uses a mocked KustoResultMapper to test the pojo mapping
functionality of the KustoResultMapper

* Update KustoType.java

* Removed addNonNullableColumn/addNonNullableColumn, added javadoc

Instead of individual addNonNullableColumn/addNullableColumn methods,
exposed the more generic addColumn methods. Additionally, added javadoc
to document the addColumn parameters

* Renamed ObjectPopulator to KustoResultColumnPopulator

* KustoResultColumnPopulator::populateFrom use passed ordinal

populateFrom used to always lookup the column ordinal by name instead of
using the passed ordinal. Now it's always using the ordinal, moving the
responsibility of correctly determining that ordinal to the caller.

* renamed variable in KustoResultColumnPopulator::populateFrom

* KustoResultMapper::extractList renamed variable

* added "single" to names of tests of KustoResultMapper::extractSingle

* Javadoc fixes in KustoType and KustoResultMapper

Co-authored-by: ohad bitton <32278684+ohadbitt@users.noreply.github.com>
2021-02-05 02:15:04 +02:00
Yihezkel Schoenbrun f4da15d312
Rearchitect the AAD authentication code to be object oriented (#160)
* Rearchitect the AAD authentication code to be object oriented and follow best-practices (Java and otherwise)

* Rearchitect the AAD authentication code to be object oriented and follow best-practices (Java and otherwise)

* Code review comments:
- Rename to CallbackTokenProvider
- Remove 2 unnecessarily-passed authorityIds

* Add another layer of abstraction (MsalTokenProvider)

* Add another layer of abstraction (MsalTokenProvider)

* Add Override annotation per code review comment
2021-01-07 13:15:08 +02:00
Yihezkel Schoenbrun 2e05191f2a
Replace ADAL authentication library with MSAL (#155)
* Convert from ADAL to MSAL (include a few questions to be resolved during code review)

* Resolve some TODOs

* Some minor changes and some changes from code review

* Incorporate most review comments

* Add '/' to authority to resolve issue.

* Per Yochai's request, first try to access the token silently, and if that fails authenticate from scratch

* Make the method determineAadAuthorityUrl() less confusing

* Fix error

* Fix test
2020-12-20 19:42:18 +02:00
Ohad Bitton 8e6e6ffe95 v2.4.2 2020-12-13 13:39:06 +02:00
ohad bitton c5079020c9
Remove federated url path if set (#152)
* remove federated url path if set

* ignore case

* better

* test

* fix test

* raw format

* comments

* comments

Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2020-12-13 13:36:41 +02:00
ohad bitton 3e30e743e1
Better exception message in post request (#156)
* better exception message in post request

* v2.4.1

Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2020-11-19 14:04:26 +02:00
Ohad Bitton f48266e41d v2.4.0 2020-11-18 15:37:50 +02:00
Ohad Bitton 99b6a6d2ea Add error.message to the Message of execute 2020-11-18 15:36:27 +02:00
ohbitton fc3b8a0c63 Merge remote-tracking branch 'origin/master' 2020-10-26 17:16:32 +02:00
ohbitton d07ae36e95 revert creds 2020-10-26 17:15:05 +02:00
Yihezkel Schoenbrun a75db70f3a
Streaming client wrong endpoint detection (#149)
* Streaming client wrong endpoint detection

* Fix invalid character for the file's encoding

* Add parent class to both Queued and Streaming IngestClients for the local purpose of removing significant code duplication in the wrong-endpoint-detection feature.
This change represents a better architecture that will yield further benefits.

* Rename AbstractIngestClient to IngestClientBase
2020-10-13 21:02:22 +03:00
AsafMah 9dce220692
ManagedStreamingIngestClient (#151)
Adds ManagedStreamingIngestClient to support multiple streaming retries and queue fallback.



commits:
* First commit, create file and basic members

* basic copy-paste argument validation, close streams on close.
no logic yet

* Copy ctors for all the needed types

* Filled out other methods (Like in the c# manager, all of them redirect to stream, except blob which goes directly to the queued ingestor)

* Simplest support for actual streaming

* Fixed with new name for the queued client

* Removed unsued stuff for now, added doc comment.

* Some small fixes from testing -
 - Log exception
 - Add a direct c-tor
 - Catch all exception types, since they may be unpredictable

* Reset the stream after an exception

* Adding tests for the class

* cleanup imports

* Added annotations as an explicit dependency(like in data) to appease CI.

* Update ingest/src/main/java/com/microsoft/azure/kusto/ingest/ManagedStreamingIngestClient.java

grammar

Co-authored-by: boazsha <15858748+boazsha@users.noreply.github.com>

* Update ingest/src/main/java/com/microsoft/azure/kusto/ingest/ManagedStreamingIngestClient.java

grammar

Co-authored-by: boazsha <15858748+boazsha@users.noreply.github.com>

* Change retry count to 3

* Made the json file tests different from each other, plus they now check the stream.

The gz file was changed since the old one had CRLF line endings, while the uncompressed one had LF.

* Documentation - added a note to explain ingestFromBlob's behaviour, and some tiny grammar fixes.

* Removed default compile annotation

* Update ingest/src/main/java/com/microsoft/azure/kusto/ingest/ManagedStreamingIngestClient.java

Co-authored-by: Boaz Shalom <15858748+boazsha@users.noreply.github.com>

* Removed todo comments from tests, since we decided to keep them this way

* Pass the to the StreamSourceInfo ctor whenever applicable

* Make comments fit the style

* Added doc for ingestFromBlob function

* Added factory for managed streaming ingest client

* Fixed managedingest from files - since FileInputStream isn't resettable, we can't use managed with it, so I added a class for it and a test.

* Reset the mock properly

* Add license

* Parsing permanent exceptions from the api (marked as @permanent=true in the returning json) and stopping if it is one.

* Reset the client in all tests

* Made compressedJson test work despite the fact that the stream closes in the end

* Adding debug prints to the comparison test since I don't know how else to check tests that run on my machine but fail on the testing machine

* Try using alternative method of reading string to avoid newline issue

* Also fixed the other one to make the tests pass, but we'll still have to look into why the file changes on the test machine

* Add UncloseableStream class

* Fixed typo

* Solve the newlines problem by hardcoding the string result into the test file.

* Use UncloseableStream in utils (still needs tests)

* Update ingest/src/main/java/com/microsoft/azure/kusto/ingest/ManagedStreamingIngestClient.java

Co-authored-by: ohad bitton <32278684+ohadbitt@users.noreply.github.com>

* Use proper reset function in tests

* Unit test UncloseableStream

* Correct format for web error

Co-authored-by: boazsha <15858748+boazsha@users.noreply.github.com>
Co-authored-by: ohad bitton <32278684+ohadbitt@users.noreply.github.com>
2020-10-13 13:15:30 +03:00
ohad bitton a1417109a2
Expose authority id for all authenticaiton methods (#153)
* Expose authority ID in all authentication methods

* version 2.3.2

* version 2.3.2
2020-09-30 17:56:36 +03:00
Ohad Bitton 2fdff9e618 version 2.3.1 2020-09-08 13:12:05 +03:00
Ohad Bitton b21fc31938 support clientRequestId 2020-09-08 12:55:05 +03:00
ohad bitton 59aa42e2c5
Accept json response + fix maven build warnings (#150)
* accept application/json + use same jackson version as spark connector

* version 2.3.0

* restrain nimbus version (resolve nimbus class not found)

* Fix maven warnings

* Fix maven warnings

* Update data/pom.xml

Co-authored-by: vladikbr <31644896+vladikbr@users.noreply.github.com>

* clean

Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
Co-authored-by: vladikbr <31644896+vladikbr@users.noreply.github.com>
2020-09-07 10:00:03 +03:00
Yihezkel Schoenbrun b1d3900dde
Add detection of wrong endpoint with correct endpoint URI suggestion (#143)
* Add detection of wrong endpoint with correct endpoint URI suggestion

* Fix code review comments

* Remove extraneous comment from test

* Queued Ingestion's wrong endpoint detection is more generic to reduce code duplication if the same feature is added for Streaming Ingestion.

Co-authored-by: ohad bitton <32278684+ohadbitt@users.noreply.github.com>
2020-09-02 08:44:45 +03:00
Ohad Bitton 4a64402e70 v2.2.0 2020-08-27 16:13:56 +03:00
ohad bitton 0e1112a98e
Support authentication via callable (#148)
* support authentication via callable

* naming

Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2020-08-27 15:53:48 +03:00
ohad bitton 8353f73225
Update pom.xml 2020-08-17 12:56:52 +03:00
ohad bitton 5e5ae1402d
Server timeout fix (#147)
* server timeout in timespan

* server timeout in timespan

* client timeout

Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2020-08-10 20:13:19 +03:00
ohad bitton 16cc0e8102
Greater adal version (#144)
* reduced wait time on Err

* err

Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2020-08-02 16:02:48 +03:00
ohad bitton cbe98d307e
Better timings for refresh test 2020-07-14 19:13:32 +03:00
ohad bitton 0d2031de19
Update pom.xml 2020-06-23 20:05:29 +03:00
ohad bitton 1c8b260d48
table id can be guid (#142)
Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2020-06-23 20:04:18 +03:00
ohad bitton 0b25d2dc9b
Reduced refresh time interval on Err (#140)
* reduced wait time on Err

* reduced wait time on Err

* test reduced wait time on Err

* reduced wait time on Err

Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2020-06-23 20:02:52 +03:00
vladikbr 35d682a89b
Add copyright headers, per MS OSS guidelines. (#141) 2020-06-22 14:38:59 +03:00
ohad bitton 457d21bb79
Bump version 2.1.0 (#139)
* Update pom.xml

* Update README.md
2020-06-14 11:56:18 +03:00
ohad bitton 21899206b5
Exceptions can be null (#137)
* Update KustoResultSetTable.java

* Update AadAuthenticationHelper.java
2020-06-14 11:46:34 +03:00
Michael Spector ad9cebb6d6
Add missing ApacheAvro format (#138)
Co-authored-by: Michael Spector <spektom@gmail.com>
2020-06-14 09:34:09 +03:00
Yochai Gilad 70cd5edfec
Add a Pull Request template to the repository (#133) 2020-05-19 08:46:58 +03:00
ohad bitton e47d48b2d3
v2.0.2 (#132)
* Update pom.xml

* Update README.md
2020-05-05 15:13:39 +03:00
ohad bitton f339e21733
getter (#131)
Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2020-05-05 12:47:59 +03:00
amshalev 34cf443231
E2E Test (#130)
* e2e

* working version

* try to fix build

* fix paths issues

* exclude e2e test

* CR fix + renaming to TestDataItem
2020-04-19 12:42:22 +03:00
amshalev fbc012d2f9
Fix - ColumnMapping serialization (#129)
* Fix - ColumnMapping serialization

* fix pom

* pom fix seecond try
2020-04-16 12:49:23 +03:00
ohad bitton 6ad0321f0f
Update KustoResultSetTable.java (#128)
* Update KustoResultSetTable.java

* Update pom.xml
2020-04-12 14:44:15 +03:00
ohad bitton b903e188a2
Fix command result parsing (#127)
* org.json version

* fix

Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2020-04-12 14:31:49 +03:00
Daniel Dubovski 391c78baf8
Create CODE_OF_CONDUCT.md (#126) 2020-04-01 11:09:19 +03:00
ohad bitton f5c93326e2
org.json version (#125)
Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2020-03-24 14:29:15 +02:00
ohad bitton d95811b132
version v2.0.0 (#124) 2020-03-19 15:06:45 +02:00
ohad bitton ce5e194037
Inline ingestion mapping (#122)
* new mappings

* new mappings

* better

* better

* comment

* comment

* better

* fix tests

* revert

* revert

* comments

Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2020-03-18 17:55:54 +02:00
ohad bitton ea621969ea
Kustoresultset (#111)
* resultSet

* resultset

* resultSet

* TRY

* TRY

* good result set

* add count

* long

* fix pom

* save as strings and rename

* comment

* comment

* comments

Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2020-03-15 15:30:55 +02:00
ohad bitton c3a13dfbeb
stop using jackson-mapper-asl (#123)
Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2020-03-15 12:36:58 +02:00
ohad bitton 9ad55014d6
Better dealing with compression (#119)
* better

* Update pom.xml

* better

* test

* test

Co-authored-by: ohbitton <42732233+ohbitton@users.noreply.github.com>
2020-01-25 16:22:58 +02:00
ohad bitton 9561924dc7
bump version v1.4.1 (#118) 2020-01-22 11:20:03 +02:00
ohad bitton dcc21b4f8e
fix compression for local files (#117)
* fix compression for local files

* correct test

Co-authored-by: ohbitton <42732233+ohbitton@users.noreply.github.com>
2020-01-21 16:06:41 +02:00
ohad bitton 3df6545dc3
Bump version (#116) 2019-12-24 11:59:29 +02:00
ohad bitton 08f5b2ad4d
Support orc format (#115)
* support orc

* Update ResourceManager.java

Co-authored-by: ohbitton <42732233+ohbitton@users.noreply.github.com>
2019-12-24 11:45:12 +02:00
ohad bitton 4ee4f575b1
Update pom.xml (#114) 2019-12-08 10:32:50 +02:00
ohad bitton 5c6c96cbb6
better versioning (#113) 2019-12-05 14:17:17 +02:00