Skip to content

Commit 47ebd99

Browse files
committed
Changes to add missing class for ann
1 parent f011403 commit 47ebd99

File tree

4 files changed

+84
-3
lines changed

4 files changed

+84
-3
lines changed

presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,5 +722,4 @@ protected void updateIcebergViewProperties(
722722
{
723723
throw new PrestoException(NOT_SUPPORTED, "Iceberg Hive catalog does not support native Iceberg views for materialized views.");
724724
}
725-
726725
}

presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergNativeMetadata.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,5 +529,4 @@ protected void updateIcebergViewProperties(
529529

530530
icebergViews.remove(viewName);
531531
}
532-
533532
}

presto-iceberg/src/main/java/com/facebook/presto/iceberg/tvf/ApproxNearestNeighborsFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public static class IcebergAnnTableHandle
196196
private final int limit;
197197
public IcebergAnnTableHandle(List<Float> queryVector, int limit, String schema, String table)
198198
{
199-
super(schema, IcebergTableName.from(table), false, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), ImmutableList.of(), ImmutableList.of());
199+
super(schema, IcebergTableName.from(table), false, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), ImmutableList.of(), ImmutableList.of(), Optional.empty());
200200
this.queryVector = queryVector;
201201
this.limit = limit;
202202
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
14+
package com.facebook.presto.spi.connector.classloader;
15+
16+
import com.facebook.presto.spi.ConnectorSession;
17+
import com.facebook.presto.spi.classloader.ThreadContextClassLoader;
18+
import com.facebook.presto.spi.connector.ConnectorTransactionHandle;
19+
import com.facebook.presto.spi.function.table.Argument;
20+
import com.facebook.presto.spi.function.table.ArgumentSpecification;
21+
import com.facebook.presto.spi.function.table.ConnectorTableFunction;
22+
import com.facebook.presto.spi.function.table.ReturnTypeSpecification;
23+
import com.facebook.presto.spi.function.table.TableFunctionAnalysis;
24+
25+
import java.util.List;
26+
import java.util.Map;
27+
28+
import static java.util.Objects.requireNonNull;
29+
30+
public class ClassLoaderSafeConnectorTableFunction
31+
implements ConnectorTableFunction
32+
{
33+
private final ConnectorTableFunction delegate;
34+
private final ClassLoader classLoader;
35+
36+
public ClassLoaderSafeConnectorTableFunction(ConnectorTableFunction delegate, ClassLoader classLoader)
37+
{
38+
this.delegate = requireNonNull(delegate, "delegate is null");
39+
this.classLoader = requireNonNull(classLoader, "classLoader is null");
40+
}
41+
42+
@Override
43+
public String getSchema()
44+
{
45+
try (ThreadContextClassLoader a = new ThreadContextClassLoader(classLoader)) {
46+
return delegate.getSchema();
47+
}
48+
}
49+
50+
@Override
51+
public String getName()
52+
{
53+
try (ThreadContextClassLoader a = new ThreadContextClassLoader(classLoader)) {
54+
return delegate.getName();
55+
}
56+
}
57+
58+
@Override
59+
public List<ArgumentSpecification> getArguments()
60+
{
61+
try (ThreadContextClassLoader a = new ThreadContextClassLoader(classLoader)) {
62+
return delegate.getArguments();
63+
}
64+
}
65+
66+
@Override
67+
public ReturnTypeSpecification getReturnTypeSpecification()
68+
{
69+
try (ThreadContextClassLoader a = new ThreadContextClassLoader(classLoader)) {
70+
return delegate.getReturnTypeSpecification();
71+
}
72+
}
73+
74+
@Override
75+
public TableFunctionAnalysis analyze(ConnectorSession session,
76+
ConnectorTransactionHandle transaction,
77+
Map<String, Argument> arguments)
78+
{
79+
try (ThreadContextClassLoader a = new ThreadContextClassLoader(classLoader)) {
80+
return delegate.analyze(session, transaction, arguments);
81+
}
82+
}
83+
}

0 commit comments

Comments
 (0)