Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import java.util.Map;

import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;

public class LookupSymbolResolver
Expand All @@ -41,9 +40,8 @@ public LookupSymbolResolver(Map<Symbol, ColumnHandle> assignments, Map<ColumnHan
public Object getValue(Symbol symbol)
{
ColumnHandle column = assignments.get(symbol);
checkArgument(column != null, "Missing column assignment for %s", symbol);

if (!bindings.containsKey(column)) {
if (column == null || !bindings.containsKey(column)) {
return symbol.toSymbolReference();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
package io.trino.plugin.hive;

import io.trino.testing.QueryRunner;
import org.testng.annotations.Test;

import static io.trino.testing.TestingNames.randomNameSuffix;

public class TestHiveConnectorTest
extends BaseHiveConnectorTest
Expand All @@ -24,4 +27,29 @@ protected QueryRunner createQueryRunner()
{
return createHiveQueryRunner(HiveQueryRunner.builder());
}

@Test
public void testPredicatePushdownWithLambdaExpression()
{
String table = "test_predicate_pushdown_" + randomNameSuffix();

assertUpdate("""
CREATE TABLE %s (v, k)
WITH (partitioned_by = ARRAY['k'])
AS (VALUES ('value', 'key'))
""".formatted(table),
1);

try {
assertQuery("""
SELECT *
FROM %s
WHERE k = 'key' AND regexp_replace(v, '(.*)', x -> x[1]) IS NOT NULL
""".formatted(table),
"VALUES ('value', 'key')");
}
finally {
assertUpdate("DROP TABLE " + table);
}
}
}