Skip to content

Commit 9a68495

Browse files
paul8263voonhous
authored andcommitted
[HUDI-4485] Bump spring shell to 2.1.1 in CLI (apache#6489)
Bumped spring shell to 2.1.1 and updated the default value for show fsview all `pathRegex` parameter.
1 parent 8977daf commit 9a68495

File tree

73 files changed

+1527
-1386
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1527
-1386
lines changed

docker/demo/compaction-bootstrap.commands

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11

2-
# Licensed to the Apache Software Foundation (ASF) under one
3-
# or more contributor license agreements. See the NOTICE file
4-
# distributed with this work for additional information
5-
# regarding copyright ownership. The ASF licenses this file
6-
# to you under the Apache License, Version 2.0 (the
7-
# "License"); you may not use this file except in compliance
8-
# with the License. You may obtain a copy of the License at
9-
#
10-
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
12-
# Unless required by applicable law or agreed to in writing, software
13-
# distributed under the License is distributed on an "AS IS" BASIS,
14-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
# See the License for the specific language governing permissions and
16-
# limitations under the License.
2+
// Licensed to the Apache Software Foundation (ASF) under one
3+
// or more contributor license agreements. See the NOTICE file
4+
// distributed with this work for additional information
5+
// regarding copyright ownership. The ASF licenses this file
6+
// to you under the Apache License, Version 2.0 (the
7+
// "License"); you may not use this file except in compliance
8+
// with the License. You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
1717

1818
connect --path /user/hive/warehouse/stock_ticks_mor_bs
1919
compactions show all

docker/demo/compaction.commands

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11

2-
# Licensed to the Apache Software Foundation (ASF) under one
3-
# or more contributor license agreements. See the NOTICE file
4-
# distributed with this work for additional information
5-
# regarding copyright ownership. The ASF licenses this file
6-
# to you under the Apache License, Version 2.0 (the
7-
# "License"); you may not use this file except in compliance
8-
# with the License. You may obtain a copy of the License at
9-
#
10-
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
12-
# Unless required by applicable law or agreed to in writing, software
13-
# distributed under the License is distributed on an "AS IS" BASIS,
14-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
# See the License for the specific language governing permissions and
16-
# limitations under the License.
2+
// Licensed to the Apache Software Foundation (ASF) under one
3+
// or more contributor license agreements. See the NOTICE file
4+
// distributed with this work for additional information
5+
// regarding copyright ownership. The ASF licenses this file
6+
// to you under the Apache License, Version 2.0 (the
7+
// "License"); you may not use this file except in compliance
8+
// with the License. You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
1717

1818
connect --path /user/hive/warehouse/stock_ticks_mor
1919
compactions show all

docker/demo/sync-validate.commands

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# Licensed to the Apache Software Foundation (ASF) under one
2-
# or more contributor license agreements. See the NOTICE file
3-
# distributed with this work for additional information
4-
# regarding copyright ownership. The ASF licenses this file
5-
# to you under the Apache License, Version 2.0 (the
6-
# "License"); you may not use this file except in compliance
7-
# with the License. You may obtain a copy of the License at
8-
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
11-
# Unless required by applicable law or agreed to in writing, software
12-
# distributed under the License is distributed on an "AS IS" BASIS,
13-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
# See the License for the specific language governing permissions and
15-
# limitations under the License.
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
1616

1717
connect --path /docker_hoodie_sync_valid_test
1818
commits sync --path /docker_hoodie_sync_valid_test_2

hudi-cli/hudi-cli.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ fi
2727

2828
OTHER_JARS=`ls ${DIR}/target/lib/* | grep -v 'hudi-[^/]*jar' | tr '\n' ':'`
2929

30-
echo "Running : java -cp ${HADOOP_CONF_DIR}:${SPARK_CONF_DIR}:${HOODIE_JAR}:${OTHER_JARS}:${CLIENT_JAR} -DSPARK_CONF_DIR=${SPARK_CONF_DIR} -DHADOOP_CONF_DIR=${HADOOP_CONF_DIR} org.springframework.shell.Bootstrap $@"
31-
java -cp ${HADOOP_CONF_DIR}:${SPARK_CONF_DIR}:${HOODIE_JAR}:${OTHER_JARS}:${CLIENT_JAR} -DSPARK_CONF_DIR=${SPARK_CONF_DIR} -DHADOOP_CONF_DIR=${HADOOP_CONF_DIR} org.springframework.shell.Bootstrap $@
30+
echo "Running : java -cp ${HADOOP_CONF_DIR}:${SPARK_CONF_DIR}:${HOODIE_JAR}:${OTHER_JARS}:${CLIENT_JAR} -DSPARK_CONF_DIR=${SPARK_CONF_DIR} -DHADOOP_CONF_DIR=${HADOOP_CONF_DIR} org.apache.hudi.cli.Main $@"
31+
java -cp ${HADOOP_CONF_DIR}:${SPARK_CONF_DIR}:${HOODIE_JAR}:${OTHER_JARS}:${CLIENT_JAR} -DSPARK_CONF_DIR=${SPARK_CONF_DIR} -DHADOOP_CONF_DIR=${HADOOP_CONF_DIR} org.apache.hudi.cli.Main $@

hudi-cli/pom.xml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
<packaging>jar</packaging>
2828

2929
<properties>
30-
<spring.shell.version>1.2.0.RELEASE</spring.shell.version>
31-
<jar.mainclass>org.springframework.shell.Bootstrap</jar.mainclass>
30+
<jar.mainclass>org.apache.hudi.cli.Main</jar.mainclass>
3231
<main.basedir>${project.parent.basedir}</main.basedir>
3332
</properties>
3433

@@ -130,8 +129,26 @@
130129
</plugins>
131130
</build>
132131

133-
134132
<dependencies>
133+
<!-- Spring Boot -->
134+
<dependency>
135+
<groupId>org.springframework.boot</groupId>
136+
<artifactId>spring-boot-starter-test</artifactId>
137+
<scope>test</scope>
138+
<exclusions>
139+
<exclusion>
140+
<groupId>org.springframework.boot</groupId>
141+
<artifactId>spring-boot-starter-logging</artifactId>
142+
</exclusion>
143+
</exclusions>
144+
</dependency>
145+
<dependency>
146+
<groupId>org.junit.platform</groupId>
147+
<artifactId>junit-platform-launcher</artifactId>
148+
<version>${junit.platform.version}</version>
149+
<scope>test</scope>
150+
</dependency>
151+
135152
<!-- Scala -->
136153
<dependency>
137154
<groupId>org.scala-lang</groupId>
@@ -213,7 +230,10 @@
213230
<dependency>
214231
<groupId>org.apache.logging.log4j</groupId>
215232
<artifactId>log4j-core</artifactId>
216-
<scope>compile</scope>
233+
</dependency>
234+
<dependency>
235+
<groupId>org.apache.logging.log4j</groupId>
236+
<artifactId>log4j-api</artifactId>
217237
</dependency>
218238

219239
<dependency>
@@ -239,8 +259,7 @@
239259

240260
<dependency>
241261
<groupId>org.springframework.shell</groupId>
242-
<artifactId>spring-shell</artifactId>
243-
<version>${spring.shell.version}</version>
262+
<artifactId>spring-shell-starter</artifactId>
244263
<exclusions>
245264
<exclusion>
246265
<groupId>com.google.guava</groupId>
@@ -264,12 +283,24 @@
264283
<dependency>
265284
<groupId>org.apache.hadoop</groupId>
266285
<artifactId>hadoop-common</artifactId>
286+
<exclusions>
287+
<exclusion>
288+
<groupId>com.google.code.gson</groupId>
289+
<artifactId>gson</artifactId>
290+
</exclusion>
291+
</exclusions>
267292
</dependency>
268293
<dependency>
269294
<groupId>org.apache.hadoop</groupId>
270295
<artifactId>hadoop-hdfs</artifactId>
271296
</dependency>
272297

298+
<dependency>
299+
<groupId>com.google.code.gson</groupId>
300+
<artifactId>gson</artifactId>
301+
<version>2.6.2</version>
302+
</dependency>
303+
273304
<!-- HDFS test dependencies -->
274305

275306
<dependency>

hudi-cli/src/main/java/org/apache/hudi/cli/HoodiePrompt.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,33 @@
2020

2121
import org.springframework.core.Ordered;
2222
import org.springframework.core.annotation.Order;
23-
import org.springframework.shell.plugin.support.DefaultPromptProvider;
23+
import org.springframework.shell.jline.PromptProvider;
2424
import org.springframework.stereotype.Component;
2525

26+
import org.jline.utils.AttributedString;
27+
2628
/**
2729
* This class deals with displaying prompt on CLI based on the state.
2830
*/
2931
@Component
3032
@Order(Ordered.HIGHEST_PRECEDENCE)
31-
public class HoodiePrompt extends DefaultPromptProvider {
33+
public class HoodiePrompt implements PromptProvider {
3234

3335
@Override
34-
public String getPrompt() {
36+
public AttributedString getPrompt() {
3537
if (HoodieCLI.tableMetadata != null) {
3638
String tableName = HoodieCLI.tableMetadata.getTableConfig().getTableName();
3739
switch (HoodieCLI.state) {
3840
case INIT:
39-
return "hudi->";
41+
return new AttributedString("hudi->");
4042
case TABLE:
41-
return "hudi:" + tableName + "->";
43+
return new AttributedString("hudi:" + tableName + "->");
4244
case SYNC:
43-
return "hudi:" + tableName + " <==> " + HoodieCLI.syncTableMetadata.getTableConfig().getTableName() + "->";
45+
return new AttributedString("hudi:" + tableName + " <==> " + HoodieCLI.syncTableMetadata.getTableConfig().getTableName() + "->");
4446
default:
45-
return "hudi:" + tableName + "->";
47+
return new AttributedString("hudi:" + tableName + "->");
4648
}
4749
}
48-
return "hudi->";
50+
return new AttributedString("hudi->");
4951
}
50-
51-
@Override
52-
public String getProviderName() {
53-
return "Hoodie provider";
54-
}
55-
5652
}

hudi-cli/src/main/java/org/apache/hudi/cli/HoodieSplashScreen.java

Lines changed: 0 additions & 72 deletions
This file was deleted.

hudi-cli/src/main/java/org/apache/hudi/cli/Main.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,19 @@
1818

1919
package org.apache.hudi.cli;
2020

21-
import org.springframework.shell.Bootstrap;
21+
import org.springframework.boot.SpringApplication;
22+
import org.springframework.boot.autoconfigure.SpringBootApplication;
2223

2324
import java.io.IOException;
2425

2526
/**
2627
* Main class that delegates to Spring Shell's Bootstrap class in order to simplify debugging inside an IDE.
2728
*/
29+
@SpringBootApplication
2830
public class Main {
2931

3032
public static void main(String[] args) throws IOException {
3133
System.out.println("Main called");
32-
new HoodieSplashScreen();
33-
Bootstrap.main(args);
34+
SpringApplication.run(Main.class, args);
3435
}
3536
}

0 commit comments

Comments
 (0)