Skip to content

Commit

Permalink
Merge branch 'ebi/snowflake' into bloomberg-snowflake
Browse files Browse the repository at this point in the history
  • Loading branch information
yuuteng authored Mar 5, 2024
2 parents 943b18f + 8771370 commit 6df3206
Show file tree
Hide file tree
Showing 224 changed files with 4,214 additions and 4,088 deletions.
2 changes: 1 addition & 1 deletion .github/actions/compile-commit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ runs:
# For building with Maven we need MAVEN_OPTS to equal MAVEN_INSTALL_OPTS
export MAVEN_OPTS="${MAVEN_INSTALL_OPTS}"
$MAVEN package \
$MAVEN install \
${MAVEN_COMPILE_COMMITS} `# defaults, kept in sync with ci.yml` \
-Dair.check.skip-all=false -Dair.check.skip-basic=true -Dair.check.skip-extended=true -Dair.check.skip-checkstyle=false \
${MAVEN_GIB}
Expand Down
40 changes: 22 additions & 18 deletions .github/config/labeler-config.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
# Pull Request Labeler Github Action Configuration: https://github.com/marketplace/actions/labeler
"tests:hive":
- lib/trino-orc/**
- lib/trino-parquet/**
- lib/trino-hive-formats/**
- plugin/trino-hive/**
- testing/trino-product-tests/**
- lib/trino-filesystem/**
- lib/trino-filesystem-*/**
- changed-files:
- any-glob-to-any-file: ['lib/trino-orc/**', 'lib/trino-parquet/**', 'lib/trino-hive-formats/**', 'plugin/trino-hive/**', 'testing/trino-product-tests/**', 'lib/trino-filesystem/**', 'lib/trino-filesystem-*/**']

jdbc:
- client/trino-jdbc/**
- changed-files:
- any-glob-to-any-file: 'client/trino-jdbc/**'

bigquery:
- plugin/trino-bigquery/**
- changed-files:
- any-glob-to-any-file: 'plugin/trino-bigquery/**'

delta-lake:
- plugin/trino-delta-lake/**
- changed-files:
- any-glob-to-any-file: 'plugin/trino-delta-lake/**'

hive:
- plugin/trino-hive/**
- changed-files:
- any-glob-to-any-file: 'plugin/trino-hive/**'

hudi:
- plugin/trino-hudi/**
- changed-files:
- any-glob-to-any-file: 'plugin/trino-hudi/**'

iceberg:
- plugin/trino-iceberg/**
- changed-files:
- any-glob-to-any-file: 'plugin/trino-iceberg/**'

mongodb:
- plugin/trino-mongodb/**
- changed-files:
- any-glob-to-any-file: 'plugin/trino-mongodb/**'

docs:
- docs/**
- changed-files:
- any-glob-to-any-file: 'docs/**'

release-notes:
- docs/src/main/sphinx/release/**
- docs/src/main/sphinx/release.rst
- changed-files:
- any-glob-to-any-file: ['docs/src/main/sphinx/release/**', 'docs/src/main/sphinx/release.rst']

ui:
- core/trino-main/src/main/resources/webapp/**
- changed-files:
- any-glob-to-any-file: 'core/trino-main/src/main/resources/webapp/**'
5 changes: 2 additions & 3 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
# Do not sync labels as this reverts manually added "tests:hive" label.
# Syncing labels requires that we define "components" labels.
# See https://github.com/actions/labeler/issues/112#issuecomment-999953377 for why an empty string instead of false.
sync-labels: ''
sync-labels: false
configuration-path: .github/config/labeler-config.yml
1 change: 1 addition & 0 deletions core/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
ARG JDK_VERSION
ENV JAVA_HOME="/usr/lib/jvm/jdk-${JDK_VERSION}"
ENV PATH=$PATH:$JAVA_HOME/bin
ENV CATALOG_MANAGEMENT=static
COPY --from=jdk-download $JAVA_HOME $JAVA_HOME

RUN \
Expand Down
1 change: 1 addition & 0 deletions core/docker/default/etc/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8080
discovery.uri=http://localhost:8080
catalog.management=${ENV:CATALOG_MANAGEMENT}
2 changes: 2 additions & 0 deletions core/docker/default/etc/jvm.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
# Reduce starvation of threads by GClocker, recommend to set about the number of cpu cores (JDK-8192647)
-XX:+UnlockDiagnosticVMOptions
-XX:GCLockerRetryAllocationCount=32
# Allow loading dynamic agent used by JOL
-XX:+EnableDynamicAgentLoading
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
import static io.trino.spi.StandardErrorCode.NOT_SUPPORTED;
import static io.trino.spi.StandardErrorCode.PROCEDURE_CALL_FAILED;
import static io.trino.spi.type.TypeUtils.writeNativeValue;
import static io.trino.sql.analyzer.ExpressionInterpreter.evaluateConstantExpression;
import static io.trino.sql.analyzer.ConstantEvaluator.evaluateConstant;
import static io.trino.sql.analyzer.SemanticExceptions.semanticException;
import static java.util.Arrays.asList;
import static java.util.Objects.requireNonNull;
Expand Down Expand Up @@ -164,7 +164,7 @@ else if (i < procedure.getArguments().size()) {
Expression expression = ExpressionTreeRewriter.rewriteWith(new ParameterRewriter(parameterLookup), callArgument.getValue());

Type type = argument.getType();
Object value = evaluateConstantExpression(expression, type, plannerContext, session, accessControl, parameterLookup);
Object value = evaluateConstant(expression, type, plannerContext, session, accessControl);

values[index] = toTypeObjectValue(session, type, value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
import static io.trino.spi.StandardErrorCode.TYPE_MISMATCH;
import static io.trino.spi.connector.ConnectorCapabilities.MATERIALIZED_VIEW_GRACE_PERIOD;
import static io.trino.sql.SqlFormatterUtil.getFormattedSql;
import static io.trino.sql.analyzer.ExpressionInterpreter.evaluateConstantExpression;
import static io.trino.sql.analyzer.ConstantEvaluator.evaluateConstant;
import static io.trino.sql.analyzer.SemanticExceptions.semanticException;
import static io.trino.type.IntervalDayTimeType.INTERVAL_DAY_TIME;
import static java.util.Locale.ENGLISH;
Expand Down Expand Up @@ -145,13 +145,12 @@ Analysis executeInternal(
if (type != INTERVAL_DAY_TIME) {
throw new TrinoException(TYPE_MISMATCH, "Unsupported grace period type %s, expected %s".formatted(type.getDisplayName(), INTERVAL_DAY_TIME.getDisplayName()));
}
Long milliseconds = (Long) evaluateConstantExpression(
Long milliseconds = (Long) evaluateConstant(
expression,
type,
plannerContext,
session,
accessControl,
parameterLookup);
accessControl);
// Sanity check. Impossible per grammar.
verify(milliseconds != null, "Grace period cannot be null");
return Duration.ofMillis(milliseconds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
import static io.trino.spi.StandardErrorCode.TYPE_MISMATCH;
import static io.trino.spi.type.TimeZoneKey.getTimeZoneKey;
import static io.trino.spi.type.TimeZoneKey.getTimeZoneKeyForOffset;
import static io.trino.sql.analyzer.ConstantEvaluator.evaluateConstant;
import static io.trino.sql.analyzer.ExpressionAnalyzer.createConstantAnalyzer;
import static io.trino.sql.analyzer.ExpressionInterpreter.evaluateConstantExpression;
import static io.trino.util.Failures.checkCondition;
import static java.lang.String.format;
import static java.util.Objects.requireNonNull;
Expand Down Expand Up @@ -105,13 +105,12 @@ private String getTimeZoneId(
throw new TrinoException(TYPE_MISMATCH, format("Expected expression of varchar or interval day-time type, but '%s' has %s type", expression, type.getDisplayName()));
}

Object timeZoneValue = evaluateConstantExpression(
Object timeZoneValue = evaluateConstant(
expression,
type,
plannerContext,
stateMachine.getSession(),
accessControl,
parameterLookup);
accessControl);

TimeZoneKey timeZoneKey;
if (timeZoneValue instanceof Slice) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.trino.plugin.bigquery;
package io.trino.execution.resourcegroups;

import com.google.common.collect.ImmutableMap;
import io.trino.testing.QueryRunner;
import io.trino.server.ResourceGroupInfo;
import io.trino.spi.resourcegroups.ResourceGroupId;

public class TestBigQueryArrowConnectorSmokeTest
extends BaseBigQueryConnectorSmokeTest
import java.util.List;
import java.util.Optional;

public interface ResourceGroupInfoProvider
{
@Override
protected QueryRunner createQueryRunner()
throws Exception
{
return BigQueryQueryRunner.createQueryRunner(
ImmutableMap.of(),
ImmutableMap.of("bigquery.experimental.arrow-serialization.enabled", "true"),
REQUIRED_TPCH_TABLES);
}
Optional<ResourceGroupInfo> tryGetResourceGroupInfo(ResourceGroupId id);

Optional<List<ResourceGroupInfo>> tryGetPathToRoot(ResourceGroupId id);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@

import com.google.errorprone.annotations.ThreadSafe;
import io.trino.execution.ManagedQueryExecution;
import io.trino.server.ResourceGroupInfo;
import io.trino.spi.resourcegroups.ResourceGroupConfigurationManagerFactory;
import io.trino.spi.resourcegroups.ResourceGroupId;
import io.trino.spi.resourcegroups.SelectionContext;
import io.trino.spi.resourcegroups.SelectionCriteria;

import java.util.List;
import java.util.Optional;
import java.util.concurrent.Executor;

/**
Expand All @@ -31,15 +27,12 @@
*/
@ThreadSafe
public interface ResourceGroupManager<C>
extends ResourceGroupInfoProvider
{
void submit(ManagedQueryExecution queryExecution, SelectionContext<C> selectionContext, Executor executor);

SelectionContext<C> selectGroup(SelectionCriteria criteria);

Optional<ResourceGroupInfo> tryGetResourceGroupInfo(ResourceGroupId id);

Optional<List<ResourceGroupInfo>> tryGetPathToRoot(ResourceGroupId id);

void addConfigurationManagerFactory(ResourceGroupConfigurationManagerFactory factory);

void loadConfigurationManager()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ public Optional<OutputStatsEstimateResult> getEstimatedOutputStats(StageExecutio
for (int i = 0; i < outputPartitionsCount; ++i) {
estimateBuilder.add(0);
}
return Optional.of(new OutputStatsEstimateResult(estimateBuilder.build(), 0, OutputStatsEstimateStatus.ESTIMATED_FOR_EAGER_PARENT));
return Optional.of(new OutputStatsEstimateResult(estimateBuilder.build(), 0, "FOR_EAGER_PARENT"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,6 @@ public Optional<OutputStatsEstimateResult> getEstimatedOutputStats(StageExecutio
estimateBuilder.add(inputSizeEstimate / outputPartitionsCount);
}
// TODO: For now we can skip calculating outputRowCountEstimate since we won't run adaptive planner in the case of small inputs
return Optional.of(new OutputStatsEstimateResult(estimateBuilder.build(), 0, OutputStatsEstimateStatus.ESTIMATED_BY_SMALL_INPUT));
return Optional.of(new OutputStatsEstimateResult(estimateBuilder.build(), 0, "BY_SMALL_INPUT"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ public Optional<OutputStatsEstimateResult> getEstimatedOutputStats(StageExecutio
estimateBuilder.add((long) (partitionSize / progress));
}
long outputRowCountEstimate = (long) (stageExecution.getOutputRowCount() / progress);
return Optional.of(new OutputStatsEstimateResult(new OutputDataSizeEstimate(estimateBuilder.build()), outputRowCountEstimate, OutputStatsEstimateStatus.ESTIMATED_BY_PROGRESS));
return Optional.of(new OutputStatsEstimateResult(new OutputDataSizeEstimate(estimateBuilder.build()), outputRowCountEstimate, "BY_PROGRESS"));
}
}
Loading

0 comments on commit 6df3206

Please sign in to comment.