The phase (b) analysis engine: typed results (metrics with drill filters, charts as data), column and table profiles, distinct values and duplicates, AnalysisSecurity (analyze permission, table READ, personalized table and field security, analyzable/excluded fields), the effective per-table config, the minimum group size guard, data versions, async exact runs cached in data_analysis_run, and DataAnalysisService as the facade. The AnalysisBackend port has an RC.5 stand-in that pushes down what core supports today and streams the rest with row limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
368 lines
11 KiB
Java
368 lines
11 KiB
Java
/*
|
|
* QQQ - Low-code Application Framework for Engineers.
|
|
* Copyright (C) 2021-2025. Kingsrook, LLC
|
|
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
|
* contact@kingsrook.com
|
|
* https://github.com/Kingsrook/
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* https://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
package com.kingsrook.qbits.dataanalysis.result;
|
|
|
|
|
|
import java.io.Serializable;
|
|
import java.time.Instant;
|
|
import java.util.List;
|
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
|
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QQueryFilter;
|
|
|
|
|
|
/*******************************************************************************
|
|
** Typed DistinctValuesPage contract; independent of any presentation framework.
|
|
*******************************************************************************/
|
|
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
|
|
public class DistinctValuesPage implements Serializable
|
|
{
|
|
private String tableName;
|
|
private QQueryFilter filter;
|
|
private Boolean estimate = false;
|
|
private Long sampleRows = 0L;
|
|
private Boolean truncated = false;
|
|
private Long rowsScanned = 0L;
|
|
private Instant asOf;
|
|
private String dataVersion;
|
|
private List<String> warnings = new java.util.ArrayList<>();
|
|
private String fieldName;
|
|
private Integer page;
|
|
private Integer pageSize;
|
|
private Boolean hasMore;
|
|
private Long totalDistinct;
|
|
private List<ValueCount> values = List.of();
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Getter for tableName.
|
|
*******************************************************************************/
|
|
public String getTableName()
|
|
{
|
|
return (tableName);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Fluent setter for tableName.
|
|
*******************************************************************************/
|
|
public DistinctValuesPage withTableName(String tableName)
|
|
{
|
|
this.tableName = tableName;
|
|
return (this);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Getter for filter.
|
|
*******************************************************************************/
|
|
public QQueryFilter getFilter()
|
|
{
|
|
return (filter);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Fluent setter for filter.
|
|
*******************************************************************************/
|
|
public DistinctValuesPage withFilter(QQueryFilter filter)
|
|
{
|
|
this.filter = filter;
|
|
return (this);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Getter for estimate.
|
|
*******************************************************************************/
|
|
public Boolean getEstimate()
|
|
{
|
|
return (estimate);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Fluent setter for estimate.
|
|
*******************************************************************************/
|
|
public DistinctValuesPage withEstimate(Boolean estimate)
|
|
{
|
|
this.estimate = estimate;
|
|
return (this);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Getter for sampleRows.
|
|
*******************************************************************************/
|
|
public Long getSampleRows()
|
|
{
|
|
return (sampleRows);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Fluent setter for sampleRows.
|
|
*******************************************************************************/
|
|
public DistinctValuesPage withSampleRows(Long sampleRows)
|
|
{
|
|
this.sampleRows = sampleRows;
|
|
return (this);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Getter for truncated.
|
|
*******************************************************************************/
|
|
public Boolean getTruncated()
|
|
{
|
|
return (truncated);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Fluent setter for truncated.
|
|
*******************************************************************************/
|
|
public DistinctValuesPage withTruncated(Boolean truncated)
|
|
{
|
|
this.truncated = truncated;
|
|
return (this);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Getter for rowsScanned.
|
|
*******************************************************************************/
|
|
public Long getRowsScanned()
|
|
{
|
|
return (rowsScanned);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Fluent setter for rowsScanned.
|
|
*******************************************************************************/
|
|
public DistinctValuesPage withRowsScanned(Long rowsScanned)
|
|
{
|
|
this.rowsScanned = rowsScanned;
|
|
return (this);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Getter for asOf.
|
|
*******************************************************************************/
|
|
public Instant getAsOf()
|
|
{
|
|
return (asOf);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Fluent setter for asOf.
|
|
*******************************************************************************/
|
|
public DistinctValuesPage withAsOf(Instant asOf)
|
|
{
|
|
this.asOf = asOf;
|
|
return (this);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Getter for dataVersion.
|
|
*******************************************************************************/
|
|
public String getDataVersion()
|
|
{
|
|
return (dataVersion);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Fluent setter for dataVersion.
|
|
*******************************************************************************/
|
|
public DistinctValuesPage withDataVersion(String dataVersion)
|
|
{
|
|
this.dataVersion = dataVersion;
|
|
return (this);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Getter for warnings.
|
|
*******************************************************************************/
|
|
public List<String> getWarnings()
|
|
{
|
|
return (warnings);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Fluent setter for warnings.
|
|
*******************************************************************************/
|
|
public DistinctValuesPage withWarnings(List<String> warnings)
|
|
{
|
|
this.warnings = warnings;
|
|
return (this);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Getter for fieldName.
|
|
*******************************************************************************/
|
|
public String getFieldName()
|
|
{
|
|
return (fieldName);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Fluent setter for fieldName.
|
|
*******************************************************************************/
|
|
public DistinctValuesPage withFieldName(String fieldName)
|
|
{
|
|
this.fieldName = fieldName;
|
|
return (this);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Getter for page.
|
|
*******************************************************************************/
|
|
public Integer getPage()
|
|
{
|
|
return (page);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Fluent setter for page.
|
|
*******************************************************************************/
|
|
public DistinctValuesPage withPage(Integer page)
|
|
{
|
|
this.page = page;
|
|
return (this);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Getter for pageSize.
|
|
*******************************************************************************/
|
|
public Integer getPageSize()
|
|
{
|
|
return (pageSize);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Fluent setter for pageSize.
|
|
*******************************************************************************/
|
|
public DistinctValuesPage withPageSize(Integer pageSize)
|
|
{
|
|
this.pageSize = pageSize;
|
|
return (this);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Getter for hasMore.
|
|
*******************************************************************************/
|
|
public Boolean getHasMore()
|
|
{
|
|
return (hasMore);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Fluent setter for hasMore.
|
|
*******************************************************************************/
|
|
public DistinctValuesPage withHasMore(Boolean hasMore)
|
|
{
|
|
this.hasMore = hasMore;
|
|
return (this);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Getter for totalDistinct.
|
|
*******************************************************************************/
|
|
public Long getTotalDistinct()
|
|
{
|
|
return (totalDistinct);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Fluent setter for totalDistinct.
|
|
*******************************************************************************/
|
|
public DistinctValuesPage withTotalDistinct(Long totalDistinct)
|
|
{
|
|
this.totalDistinct = totalDistinct;
|
|
return (this);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Getter for values.
|
|
*******************************************************************************/
|
|
public List<ValueCount> getValues()
|
|
{
|
|
return (values);
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
** Fluent setter for values.
|
|
*******************************************************************************/
|
|
public DistinctValuesPage withValues(List<ValueCount> values)
|
|
{
|
|
this.values = values;
|
|
return (this);
|
|
}
|
|
}
|