Currently using the DISTINCT keyword on a query when exporting data from CosmosDB a BadRequestException is generated, this query executes fine in the Azure Portal using the Data Explorer tool but not with this migration tool v1.8.1.
Full Error:
System.AggregateException: One or more errors occurred. ---> Microsoft.Azure.Documents.BadRequestException: Message: {"errors":[{"severity":"Error","location":{"start":7,"end":15},"code":"SC1001","message":"Syntax error, incorrect syntax near 'distinct'."}]}, documentdb-dotnet-sdk/1.19.0 Host/64-bit MicrosoftWindowsNT/6.2.9200.0 ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A0B00
--- End of inner exception stack trace ---
at Microsoft.Azure.Documents.Query.QueryPartitionProvider.GetPartitionedQueryExecutionInfoInternal(SqlQuerySpec querySpec, PartitionKeyDefinition partitionKeyDefinition, Boolean requireFormattableOrderByQuery, Boolean isContinuationExpected)
at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextBase.d0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextFactory.d5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Documents.Query.MultiCollectionDocumentQueryExecutionContext.d0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextFactory.d0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Documents.Linq.DocumentQuery1.<CreateDocumentQueryExecutionContextAsync>d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Documents.Linq.DocumentQuery1.d2e1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.DataTransfer.DocumentDb.Client.Enumeration.AsyncEnumeratorBase2.d11.MoveNext() in F:_Bld\16189\6357\Sources_repo\DocumentDb\Microsoft.DataTransfer.DocumentDb\Client\Enumeration\AsyncEnumeratorBase.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DataTransfer.DocumentDb.Client.Enumeration.AsyncEnumeratorBase2.<MoveNextAsync>d__9.MoveNext() in F:\_Bld\16189\6357\Sources\_repo\DocumentDb\Microsoft.DataTransfer.DocumentDb\Client\Enumeration\AsyncEnumeratorBase.cs:line 0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.DataTransfer.DocumentDb.Source.DocumentDbSourceAdapter.<ReadNextAsync>d__4.MoveNext() in F:\_Bld\16189\6357\Sources\_repo\DocumentDb\Microsoft.DataTransfer.DocumentDb\Source\DocumentDbSourceAdapter.cs:line 34 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.DataTransfer.Core.Service.DataTransferAction.<ExecuteAsync>d__0.MoveNext() in F:\_Bld\16189\6357\Sources\_repo\Core\Microsoft.DataTransfer.Core\Service\DataTransferAction.cs:line 35 --- End of inner exception stack trace --- at Microsoft.DataTransfer.Core.Service.DataTransferAction.<ExecuteAsync>d__0.MoveNext() in F:\_Bld\16189\6357\Sources\_repo\Core\Microsoft.DataTransfer.Core\Service\DataTransferAction.cs:line 0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.DataTransfer.Core.Service.DataTransferService.<TransferAsync>d__6.MoveNext() in F:\_Bld\16189\6357\Sources\_repo\Core\Microsoft.DataTransfer.Core\Service\DataTransferService.cs:line 71 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.DataTransfer.WpfHost.Steps.Import.ImportStep.<Execute>d__10.MoveNext() in F:\_Bld\16189\6357\Sources\_repo\Wpf\Microsoft.DataTransfer.WpfHost\Steps\Import\ImportStep.cs:line 73 ---> (Inner Exception #0) Microsoft.Azure.Documents.BadRequestException: Message: {"errors":[{"severity":"Error","location":{"start":7,"end":15},"code":"SC1001","message":"Syntax error, incorrect syntax near 'distinct'."}]}, documentdb-dotnet-sdk/1.19.0 Host/64-bit MicrosoftWindowsNT/6.2.9200.0 ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A0B00 --- End of inner exception stack trace --- at Microsoft.Azure.Documents.Query.QueryPartitionProvider.GetPartitionedQueryExecutionInfoInternal(SqlQuerySpec querySpec, PartitionKeyDefinition partitionKeyDefinition, Boolean requireFormattableOrderByQuery, Boolean isContinuationExpected) at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextBase.<GetPartitionedQueryExecutionInfoAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextFactory.<CreateDocumentQueryExecutionContextAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Documents.Query.MultiCollectionDocumentQueryExecutionContext.<CreateAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextFactory.<CreateDocumentQueryExecutionContextAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Documents.Linq.DocumentQuery1.d13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Documents.Linq.DocumentQuery`1.d2e1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.DataTransfer.DocumentDb.Client.Enumeration.AsyncEnumeratorBase2.d11.MoveNext() in F:_Bld\16189\6357\Sources_repo\DocumentDb\Microsoft.DataTransfer.DocumentDb\Client\Enumeration\AsyncEnumeratorBase.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DataTransfer.DocumentDb.Client.Enumeration.AsyncEnumeratorBase`2.d9.MoveNext() in F:_Bld\16189\6357\Sources_repo\DocumentDb\Microsoft.DataTransfer.DocumentDb\Client\Enumeration\AsyncEnumeratorBase.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DataTransfer.DocumentDb.Source.DocumentDbSourceAdapter.d4.MoveNext() in F:_Bld\16189\6357\Sources_repo\DocumentDb\Microsoft.DataTransfer.DocumentDb\Source\DocumentDbSourceAdapter.cs:line 34
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DataTransfer.Core.Service.DataTransferAction.d0.MoveNext() in F:_Bld\16189\6357\Sources_repo\Core\Microsoft.DataTransfer.Core\Service\DataTransferAction.cs:line 35<---
Currently using the DISTINCT keyword on a query when exporting data from CosmosDB a BadRequestException is generated, this query executes fine in the Azure Portal using the Data Explorer tool but not with this migration tool v1.8.1.
Full Error: System.AggregateException: One or more errors occurred. ---> Microsoft.Azure.Documents.BadRequestException: Message: {"errors":[{"severity":"Error","location":{"start":7,"end":15},"code":"SC1001","message":"Syntax error, incorrect syntax near 'distinct'."}]}, documentdb-dotnet-sdk/1.19.0 Host/64-bit MicrosoftWindowsNT/6.2.9200.0 ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A0B00 --- End of inner exception stack trace --- at Microsoft.Azure.Documents.Query.QueryPartitionProvider.GetPartitionedQueryExecutionInfoInternal(SqlQuerySpec querySpec, PartitionKeyDefinition partitionKeyDefinition, Boolean requireFormattableOrderByQuery, Boolean isContinuationExpected) at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextBase.d0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextFactory.d 5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Documents.Query.MultiCollectionDocumentQueryExecutionContext.d0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextFactory.d 0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Documents.Linq.DocumentQueryd2ed 11.MoveNext() in F:_Bld\16189\6357\Sources_repo\DocumentDb\Microsoft.DataTransfer.DocumentDb\Client\Enumeration\AsyncEnumeratorBase.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DataTransfer.DocumentDb.Client.Enumeration.AsyncEnumeratorBased13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Documents.Linq.DocumentQuery`1.d 2ed11.MoveNext() in F:_Bld\16189\6357\Sources_repo\DocumentDb\Microsoft.DataTransfer.DocumentDb\Client\Enumeration\AsyncEnumeratorBase.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DataTransfer.DocumentDb.Client.Enumeration.AsyncEnumeratorBase`2.d 9.MoveNext() in F:_Bld\16189\6357\Sources_repo\DocumentDb\Microsoft.DataTransfer.DocumentDb\Client\Enumeration\AsyncEnumeratorBase.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DataTransfer.DocumentDb.Source.DocumentDbSourceAdapter.d4.MoveNext() in F:_Bld\16189\6357\Sources_repo\DocumentDb\Microsoft.DataTransfer.DocumentDb\Source\DocumentDbSourceAdapter.cs:line 34
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DataTransfer.Core.Service.DataTransferAction.d 0.MoveNext() in F:_Bld\16189\6357\Sources_repo\Core\Microsoft.DataTransfer.Core\Service\DataTransferAction.cs:line 35<---
1.<CreateDocumentQueryExecutionContextAsync>d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Documents.Linq.DocumentQuery
1.1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.DataTransfer.DocumentDb.Client.Enumeration.AsyncEnumeratorBase
2.2.<MoveNextAsync>d__9.MoveNext() in F:\_Bld\16189\6357\Sources\_repo\DocumentDb\Microsoft.DataTransfer.DocumentDb\Client\Enumeration\AsyncEnumeratorBase.cs:line 0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.DataTransfer.DocumentDb.Source.DocumentDbSourceAdapter.<ReadNextAsync>d__4.MoveNext() in F:\_Bld\16189\6357\Sources\_repo\DocumentDb\Microsoft.DataTransfer.DocumentDb\Source\DocumentDbSourceAdapter.cs:line 34 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.DataTransfer.Core.Service.DataTransferAction.<ExecuteAsync>d__0.MoveNext() in F:\_Bld\16189\6357\Sources\_repo\Core\Microsoft.DataTransfer.Core\Service\DataTransferAction.cs:line 35 --- End of inner exception stack trace --- at Microsoft.DataTransfer.Core.Service.DataTransferAction.<ExecuteAsync>d__0.MoveNext() in F:\_Bld\16189\6357\Sources\_repo\Core\Microsoft.DataTransfer.Core\Service\DataTransferAction.cs:line 0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.DataTransfer.Core.Service.DataTransferService.<TransferAsync>d__6.MoveNext() in F:\_Bld\16189\6357\Sources\_repo\Core\Microsoft.DataTransfer.Core\Service\DataTransferService.cs:line 71 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.DataTransfer.WpfHost.Steps.Import.ImportStep.<Execute>d__10.MoveNext() in F:\_Bld\16189\6357\Sources\_repo\Wpf\Microsoft.DataTransfer.WpfHost\Steps\Import\ImportStep.cs:line 73 ---> (Inner Exception #0) Microsoft.Azure.Documents.BadRequestException: Message: {"errors":[{"severity":"Error","location":{"start":7,"end":15},"code":"SC1001","message":"Syntax error, incorrect syntax near 'distinct'."}]}, documentdb-dotnet-sdk/1.19.0 Host/64-bit MicrosoftWindowsNT/6.2.9200.0 ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A0B00 --- End of inner exception stack trace --- at Microsoft.Azure.Documents.Query.QueryPartitionProvider.GetPartitionedQueryExecutionInfoInternal(SqlQuerySpec querySpec, PartitionKeyDefinition partitionKeyDefinition, Boolean requireFormattableOrderByQuery, Boolean isContinuationExpected) at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextBase.<GetPartitionedQueryExecutionInfoAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextFactory.<CreateDocumentQueryExecutionContextAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Documents.Query.MultiCollectionDocumentQueryExecutionContext.<CreateAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextFactory.<CreateDocumentQueryExecutionContextAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Documents.Linq.DocumentQuery
1.1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.DataTransfer.DocumentDb.Client.Enumeration.AsyncEnumeratorBase
2.