-
Notifications
You must be signed in to change notification settings - Fork 139
Es external index #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LinhongLiu
wants to merge
13
commits into
master
Choose a base branch
from
es-external-index
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
dfa11c8
Refactor FiberSensor (#823)
869e1d7
Spark 2.2 support - update code for spark 2.2 (#813)
carsonwang 292261a
Import Vectorized Reader code from spark (#836)
LuciferYang 7ce087f
Spark 2.3 support - update pom.xml for Spark 2.3 (#840)
zhixingheyi-tian cb98660
add es dependency
LinhongLiu 6466e84
OapTransportClient
LinhongLiu 75d3cf7
es module interface
LinhongLiu 826b895
es module with create/insert/drop
LinhongLiu 4ac48e5
fix something
LinhongLiu 439cf1a
disable test suite
LinhongLiu dd97eea
add DDL to create/drop ES index
LinhongLiu aaf1c2f
add spark 2.2 support
LinhongLiu ef177b2
integrate code
LinhongLiu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| sudo: required | ||
| dist: trusty | ||
| language: java | ||
| script: mvn test | ||
| script: | ||
| - mvn clean -Pspark-2.1 test | ||
| - mvn clean -Pspark-2.2 test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
src/main/java/org/apache/spark/sql/execution/datasources/parquet/OapTransportClient.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You 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 | ||
| * | ||
| * http://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 org.apache.spark.sql.execution.datasources.parquet; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.Arrays; | ||
| import java.util.Collection; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.concurrent.TimeUnit; | ||
|
|
||
| import org.elasticsearch.client.transport.TransportClient; | ||
| import org.elasticsearch.common.network.NetworkModule; | ||
| import org.elasticsearch.common.settings.Settings; | ||
| import org.elasticsearch.index.reindex.ReindexPlugin; | ||
| import org.elasticsearch.join.ParentJoinPlugin; | ||
| import org.elasticsearch.percolator.PercolatorPlugin; | ||
| import org.elasticsearch.plugins.Plugin; | ||
| import org.elasticsearch.script.mustache.MustachePlugin; | ||
| import org.elasticsearch.transport.Netty4Plugin; | ||
|
|
||
| import io.netty.util.ThreadDeathWatcher; | ||
| import io.netty.util.concurrent.GlobalEventExecutor; | ||
|
|
||
| public class OapTransportClient extends TransportClient { | ||
|
|
||
| /** | ||
| * Netty wants to do some unwelcome things like use unsafe and replace a private field, or use | ||
| * a poorly considered buffer recycler. This method disables these things by default, but can | ||
| * be overridden by setting the corresponding system properties. | ||
| */ | ||
| private static void initializeNetty() { | ||
| /* | ||
| * We disable three pieces of Netty functionality here: | ||
| * - we disable Netty from being unsafe | ||
| * - we disable Netty from replacing the selector key set | ||
| * - we disable Netty from using the recycler | ||
| * | ||
| * While permissions are needed to read and set these, the permissions needed here are | ||
| * innocuous and thus should simply be granted rather than us handling a security | ||
| * exception here. | ||
| */ | ||
| setSystemPropertyIfUnset("io.netty.noUnsafe", Boolean.toString(true)); | ||
| setSystemPropertyIfUnset("io.netty.noKeySetOptimization", Boolean.toString(true)); | ||
| setSystemPropertyIfUnset("io.netty.recycler.maxCapacityPerThread", Integer.toString(0)); | ||
| } | ||
|
|
||
| private static void setSystemPropertyIfUnset(final String key, final String value) { | ||
| final String currentValue = System.getProperty(key); | ||
| if (currentValue == null) { | ||
| System.setProperty(key, value); | ||
| } | ||
| } | ||
|
|
||
| private static final List<String> OPTIONAL_DEPENDENCIES = Arrays.asList( // | ||
| "org.elasticsearch.transport.Netty3Plugin", // | ||
| "org.elasticsearch.transport.Netty4Plugin"); | ||
|
|
||
| private static final Collection<Class<? extends Plugin>> PRE_INSTALLED_PLUGINS; | ||
|
|
||
| static { | ||
|
|
||
| initializeNetty(); | ||
|
|
||
| List<Class<? extends Plugin>> plugins = new ArrayList<>(); | ||
|
|
||
| plugins.add(Netty4Plugin.class); | ||
| plugins.add(ReindexPlugin.class); | ||
| plugins.add(PercolatorPlugin.class); | ||
| plugins.add(MustachePlugin.class); | ||
| plugins.add(ParentJoinPlugin.class); | ||
|
|
||
| PRE_INSTALLED_PLUGINS = Collections.unmodifiableList(plugins); | ||
| } | ||
|
|
||
| public OapTransportClient(Settings settings) { | ||
| super(settings, PRE_INSTALLED_PLUGINS); | ||
| } | ||
|
|
||
| @Override | ||
| public void close() { | ||
| super.close(); | ||
| if (NetworkModule.TRANSPORT_TYPE_SETTING.exists(settings) == false | ||
| || NetworkModule.TRANSPORT_TYPE_SETTING.get(settings).equals( | ||
| Netty4Plugin.NETTY_TRANSPORT_NAME)) { | ||
| try { | ||
| GlobalEventExecutor.INSTANCE.awaitInactivity(5, TimeUnit.SECONDS); | ||
| } catch (InterruptedException e) { | ||
| Thread.currentThread().interrupt(); | ||
| } | ||
| try { | ||
| ThreadDeathWatcher.awaitInactivity(5, TimeUnit.SECONDS); | ||
| } catch (InterruptedException e) { | ||
| Thread.currentThread().interrupt(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add Spark LICENSE?