mirror of
https://github.com/apache/druid.git
synced 2025-02-25 12:35:33 +00:00
Improved the readability and fixed few java warnings (#9163)
* Improved the readability and fixed few java warnings * Fix the checkstyle Co-authored-by: Gian Merlino <gianmerlino@gmail.com>
This commit is contained in:
parent
f707064bed
commit
05258dca37
@ -264,14 +264,9 @@ public class Expressions
|
|||||||
rexNode,
|
rexNode,
|
||||||
postAggregatorVisitor
|
postAggregatorVisitor
|
||||||
);
|
);
|
||||||
|
|
||||||
if (expression == null) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
return expression;
|
return expression;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static DruidExpression literalToDruidExpression(
|
private static DruidExpression literalToDruidExpression(
|
||||||
final PlannerContext plannerContext,
|
final PlannerContext plannerContext,
|
||||||
|
@ -48,7 +48,7 @@ public abstract class TimeArithmeticOperatorConversion implements SqlOperatorCon
|
|||||||
{
|
{
|
||||||
this.operator = operator;
|
this.operator = operator;
|
||||||
this.direction = direction;
|
this.direction = direction;
|
||||||
Preconditions.checkArgument(direction > 0 || direction < 0);
|
Preconditions.checkArgument(direction != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,6 +24,8 @@ import org.apache.druid.query.filter.BoundDimFilter;
|
|||||||
import org.apache.druid.query.filter.SelectorDimFilter;
|
import org.apache.druid.query.filter.SelectorDimFilter;
|
||||||
import org.apache.druid.query.ordering.StringComparator;
|
import org.apache.druid.query.ordering.StringComparator;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class BoundRefKey
|
public class BoundRefKey
|
||||||
{
|
{
|
||||||
private final String dimension;
|
private final String dimension;
|
||||||
@ -82,13 +84,13 @@ public class BoundRefKey
|
|||||||
|
|
||||||
BoundRefKey boundRefKey = (BoundRefKey) o;
|
BoundRefKey boundRefKey = (BoundRefKey) o;
|
||||||
|
|
||||||
if (dimension != null ? !dimension.equals(boundRefKey.dimension) : boundRefKey.dimension != null) {
|
if (!Objects.equals(dimension, boundRefKey.dimension)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (extractionFn != null ? !extractionFn.equals(boundRefKey.extractionFn) : boundRefKey.extractionFn != null) {
|
if (!Objects.equals(extractionFn, boundRefKey.extractionFn)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return comparator != null ? comparator.equals(boundRefKey.comparator) : boundRefKey.comparator == null;
|
return Objects.equals(comparator, boundRefKey.comparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,6 +22,8 @@ package org.apache.druid.sql.calcite.filtration;
|
|||||||
import org.apache.druid.java.util.common.ISE;
|
import org.apache.druid.java.util.common.ISE;
|
||||||
import org.apache.druid.query.ordering.StringComparator;
|
import org.apache.druid.query.ordering.StringComparator;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class BoundValue implements Comparable<BoundValue>
|
public class BoundValue implements Comparable<BoundValue>
|
||||||
{
|
{
|
||||||
private final String value;
|
private final String value;
|
||||||
@ -55,10 +57,10 @@ public class BoundValue implements Comparable<BoundValue>
|
|||||||
|
|
||||||
BoundValue that = (BoundValue) o;
|
BoundValue that = (BoundValue) o;
|
||||||
|
|
||||||
if (value != null ? !value.equals(that.value) : that.value != null) {
|
if (!Objects.equals(value, that.value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return comparator != null ? comparator.equals(that.comparator) : that.comparator == null;
|
return Objects.equals(comparator, that.comparator);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,11 +66,7 @@ public class ConvertSelectorsToIns extends BottomUpTransform
|
|||||||
SimpleExtraction.of(selector.getDimension(), selector.getExtractionFn())
|
SimpleExtraction.of(selector.getDimension(), selector.getExtractionFn())
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
List<SelectorDimFilter> filterList = selectors.get(boundRefKey);
|
List<SelectorDimFilter> filterList = selectors.computeIfAbsent(boundRefKey, k -> new ArrayList<>());
|
||||||
if (filterList == null) {
|
|
||||||
filterList = new ArrayList<>();
|
|
||||||
selectors.put(boundRefKey, filterList);
|
|
||||||
}
|
|
||||||
filterList.add(selector);
|
filterList.add(selector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ import org.apache.druid.sql.calcite.table.RowSignature;
|
|||||||
import org.joda.time.Interval;
|
import org.joda.time.Interval;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class Filtration
|
public class Filtration
|
||||||
{
|
{
|
||||||
@ -162,10 +163,10 @@ public class Filtration
|
|||||||
|
|
||||||
Filtration that = (Filtration) o;
|
Filtration that = (Filtration) o;
|
||||||
|
|
||||||
if (intervals != null ? !intervals.equals(that.intervals) : that.intervals != null) {
|
if (!Objects.equals(intervals, that.intervals)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return dimFilter != null ? dimFilter.equals(that.dimFilter) : that.dimFilter == null;
|
return Objects.equals(dimFilter, that.dimFilter);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public class DruidConvention implements Convention
|
|||||||
@Override
|
@Override
|
||||||
public boolean satisfies(RelTrait trait)
|
public boolean satisfies(RelTrait trait)
|
||||||
{
|
{
|
||||||
return trait == this;
|
return trait.equals(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,6 +34,8 @@ import org.apache.calcite.sql.SqlCall;
|
|||||||
import org.apache.calcite.sql.SqlNode;
|
import org.apache.calcite.sql.SqlNode;
|
||||||
import org.apache.druid.query.DataSource;
|
import org.apache.druid.query.DataSource;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class DruidTable implements TranslatableTable
|
public class DruidTable implements TranslatableTable
|
||||||
{
|
{
|
||||||
private final DataSource dataSource;
|
private final DataSource dataSource;
|
||||||
@ -111,10 +113,10 @@ public class DruidTable implements TranslatableTable
|
|||||||
|
|
||||||
DruidTable that = (DruidTable) o;
|
DruidTable that = (DruidTable) o;
|
||||||
|
|
||||||
if (dataSource != null ? !dataSource.equals(that.dataSource) : that.dataSource != null) {
|
if (!Objects.equals(dataSource, that.dataSource)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return rowSignature != null ? rowSignature.equals(that.rowSignature) : that.rowSignature == null;
|
return Objects.equals(rowSignature, that.rowSignature);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,6 +42,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type signature for a row in a Druid dataSource ("DruidTable") or query result. Rows have an ordering and every
|
* Type signature for a row in a Druid dataSource ("DruidTable") or query result. Rows have an ordering and every
|
||||||
@ -196,10 +197,10 @@ public class RowSignature
|
|||||||
|
|
||||||
RowSignature that = (RowSignature) o;
|
RowSignature that = (RowSignature) o;
|
||||||
|
|
||||||
if (columnTypes != null ? !columnTypes.equals(that.columnTypes) : that.columnTypes != null) {
|
if (!Objects.equals(columnTypes, that.columnTypes)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return columnNames != null ? columnNames.equals(that.columnNames) : that.columnNames == null;
|
return Objects.equals(columnNames, that.columnNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user