humlab-sead / sead_change_control

Sane SEAD change control using Sqitch.
1 stars 0 forks source link

Region facet fails to load #75

Closed roger-mahler closed 3 months ago

roger-mahler commented 4 years ago

This facet was not part of the humlab-sead/sead_query_api#13.

Error log says:

[2020-04-29 16:40:31.849 +00:00 INF] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker] [0HLVC816GDFU3:00000001] Executed action SeadQueryAPI.Controllers.FacetsController.Load (sead.query.api) in 239.37ms
[2020-04-29 16:40:31.849 +00:00 INF] [Microsoft.AspNetCore.Routing.EndpointMiddleware] [0HLVC816GDFU3:00000001] Executed endpoint 'SeadQueryAPI.Controllers.FacetsController.Load (sead.query.api)'
[2020-04-29 16:40:31.849 +00:00 ERR] [Microsoft.AspNetCore.Server.Kestrel] [0HLVC816GDFU3:00000001] Connection id "0HLVC816GDFU3", Request id "0HLVC816GDFU3:00000001": An unhandled exception was thrown by the application.
Npgsql.PostgresException (0x80004005): 42601: syntax error at or near "null"
   at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming)
   at Npgsql.NpgsqlDataReader.NextResult()
   at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.RDFacadeExtensions.ExecuteSqlQuery(DatabaseFacade databaseFacade, String sql, Object[] parameters) in /src/sead.query.infra/Repository/DbExecuteSql.cs:line 34
   at SeadQueryInfra.DatabaseQueryProxy.QueryRows[T](String sql, Func`2 selector) in /src/sead.query.infra/Repository/DatabaseQueryProxy.cs:line 42
   at SeadQueryCore.CategoryCountService.Query(String sql) in /src/sead.query.core/Services/CategoryCount/Services/CategoryCountService.cs:line 43
   at SeadQueryCore.CategoryCountService.Load(String facetCode, FacetsConfig2 facetsConfig, String intervalQuery) in /src/sead.query.core/Services/CategoryCount/Services/CategoryCountService.cs:line 32
   at SeadQueryCore.FacetContentService.Load(FacetsConfig2 facetsConfig) in /src/sead.query.core/Services/FacetContent/Services/FacetContentService.cs:line 32
   at SeadQueryAPI.Services.LoadFacetService.Load(FacetsConfig2 facetsConfig) in /src/sead.query.api/Services/LoadFacetService.cs:line 30
   at SeadQueryAPI.Controllers.FacetsController.Load(FacetsConfig2 facetsConfig) in /src/sead.query.api/Controllers/FacetsController.cs:line 106
   at lambda_method(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
  Exception data:
    Severity: ERROR
    SqlState: 42601
    MessageText: syntax error at or near "null"
    Position: 792
    File: scan.l
roger-mahler commented 4 years ago

SQL statement:

SELECT category, count(value) AS count
FROM (
  SELECT tbl_locations.location_id  AS category, tbl_analysis_entities.analysis_entity_id AS value
  FROM tbl_analysis_entities
  INNER JOIN tbl_datasets ON tbl_datasets."dataset_id" = tbl_analysis_entities."dataset_id"
  INNER JOIN tbl_physical_samples ON tbl_physical_samples."physical_sample_id" = tbl_analysis_entities."physical_sample_id"
  INNER JOIN tbl_sample_groups ON tbl_sample_groups."sample_group_id" = tbl_physical_samples."sample_group_id"
  INNER JOIN tbl_sites ON tbl_sites."site_id" = tbl_sample_groups."site_id"
  INNER JOIN tbl_site_locations ON tbl_site_locations."site_id" = tbl_sites."site_id"
  INNER JOIN tbl_locations AS null ON null."location_id" = tbl_site_locations."location_id"
  WHERE 1 = 1
  GROUP BY tbl_locations.location_id , tbl_analysis_entities.analysis_entity_id
) AS x
GROUP BY category
roger-mahler commented 4 years ago

The query engine adds null as alias on tbl_locations.

roger-mahler commented 1 year ago

Fixed by 20200429_DML_FACET_UPDATES.

johanvonboer commented 1 year ago

This facet now behaves like a range filter??

image

roger-mahler commented 3 months ago

Closing since the problem is fixed.