Skip to content

Commit 736a3cc

Browse files
committed
HADOOP-18830. S3 select. final review comments
+update doc with explicit consequences of removal, including the "hadoop s3guard select" command Change-Id: Ica3ffb33d803f8a03e0d733447e4f026d547f8c1
1 parent 7ba1a24 commit 736a3cc

File tree

3 files changed

+63
-9
lines changed

3 files changed

+63
-9
lines changed

hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/select/SelectConstants.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
* so that any application which imports the dependencies will still link.
3232
*/
3333
@InterfaceAudience.Public
34-
@InterfaceStability.Unstable
34+
@InterfaceStability.Stable
35+
@Deprecated
3536
public final class SelectConstants {
3637

3738
public static final String SELECT_UNSUPPORTED = "S3 Select is no longer supported";
@@ -46,13 +47,18 @@ private SelectConstants() {
4647

4748
/**
4849
* This is the big SQL expression: {@value}.
49-
* When used in an open() call, switch to a select operation.
50-
* This is only used in the open call, never in a filesystem configuration.
50+
* When used in an open() call:
51+
* <ol>
52+
* <li>if the option is set in a {@code .may()} clause: warn and continue</li>
53+
* <li>if the option is set in a {@code .must()} clause:
54+
* {@code UnsupportedOperationException}.</li>
55+
* </ol>
5156
*/
5257
public static final String SELECT_SQL = FS_S3A_SELECT + "sql";
5358

5459
/**
5560
* Does the FS Support S3 Select?
61+
* This is false everywhere.
5662
* Value: {@value}.
5763
*/
5864
public static final String S3_SELECT_CAPABILITY = "fs.s3a.capability.select.sql";

hadoop-tools/hadoop-aws/src/site/markdown/tools/hadoop-aws/s3_select.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,52 @@ Any Hadoop release built on the [AWS V2 SDK](./aws_sdk_upgrade.html)
2424
will reject calls to open files using the select APIs.
2525

2626
If a build of Hadoop with S3 Select is desired, the relevant
27-
classes can be found in hadoop trunk commit `8bf72346a59c`.
27+
classes can be found in hadoop trunk commit `8bf72346a59c`.
28+
29+
## Consequences of the removal
30+
31+
The path capabilities probe `fs.s3a.capability.select.sql` returns "false" for any and all
32+
`s3a://` paths.
33+
34+
Any `openFile()` call where a SQL query is passed in as a `must()` clause
35+
SHALL raise `UnsupportedOperationException`:
36+
```java
37+
// fails
38+
openFile("s3a://bucket/path")
39+
.must("fs.s3a.select.sql", "SELECT ...")
40+
.get();
41+
```
42+
43+
Any `openFile()` call to an S3A Path where a SQL query is passed in as a `may()`
44+
clause SHALL be logged at WARN level the first time it is invoked, then ignored.
45+
```java
46+
// ignores the option after printing a warning.
47+
openFile("s3a://bucket/path")
48+
.may("fs.s3a.select.sql", "SELECT ...")
49+
.get();
50+
```
51+
52+
The `hadoop s3guard select` command is no longer supported.
53+
54+
Previously, the command would either generate an S3 select or a error (with exit code 42 being
55+
the one for not enough arguments):
56+
57+
```
58+
hadoop s3guard select
59+
select [OPTIONS] [-limit rows] [-header (use|none|ignore)] [-out path] [-expected rows]
60+
[-compression (gzip|bzip2|none)] [-inputformat csv] [-outputformat csv] <PATH> <SELECT QUERY>
61+
make an S3 Select call
62+
63+
[main] INFO util.ExitUtil (ExitUtil.java:terminate(241)) - Exiting with status 42:
64+
42: Too few arguments
65+
```
66+
67+
Now it will fail with exit code 55 always:
68+
69+
```
70+
hadoop s3guard select
71+
72+
[main] INFO util.ExitUtil (ExitUtil.java:terminate(241)) - Exiting with status 55:
73+
55: S3 Select is no longer supported
74+
75+
```

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/select/ITestSelectUnsupported.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,23 @@ public class ITestSelectUnsupported extends AbstractS3ATestBase {
4747
" WHERE s._1 = 'foo'";
4848

4949
/**
50-
* A {@code .must(SELECT_SQL, _)} option MSUT not fail the build.
50+
* A {@code .must(SELECT_SQL, _)} option MUST raise {@code UnsupportedOperationException}.
5151
*/
5252
@Test
53-
public void testSelectOpenFileMust() throws Throwable {
53+
public void testSelectOpenFileMustFailure() throws Throwable {
5454

5555
intercept(UnsupportedOperationException.class, SELECT_UNSUPPORTED, () ->
5656
getFileSystem().openFile(methodPath())
5757
.must(SELECT_SQL, STATEMENT)
5858
.build()
59-
/**/.get());
59+
.get());
6060
}
6161

6262
/**
63-
* A {@code .opt(SELECT_SQL, _)} option does not fail the build.
63+
* A {@code .opt(SELECT_SQL, _)} option is ignored..
6464
*/
6565
@Test
66-
public void testSelectOpenFileMay() throws Throwable {
66+
public void testSelectOpenFileMayIsIgnored() throws Throwable {
6767

6868
final Path path = methodPath();
6969
final S3AFileSystem fs = getFileSystem();

0 commit comments

Comments
 (0)