Fix Hive sorted write failure when user identity contains @ sign#18129
Closed
findepi wants to merge 1 commit intotrinodb:masterfrom
Closed
Conversation
It's common for staging path to contain `${USER}` placeholder and be on
local file system. When username contains an AT sign (`name@domain`),
the `setSchemeToFileIfAbsent` used to fail.
Member
Author
|
This is needed because However, it seems the logic doesn't follow how URI class does this: String input = "http:///foo/bar@baz/";
URI uri = new URI(input);
System.out.println("uri.getUserInfo() = " + uri.getUserInfo()); // null
System.out.println("uri.getHost() = " + uri.getHost()); // null
System.out.println("uri.getPath() = " + uri.getPath()); // "/foo/bar@baz/"
Location location = Location.of(input);
System.out.println("location.userInfo() = " + location.userInfo()); // "/foo/bar"
System.out.println("location.host() = " + location.host()); // "baz"
System.out.println("location.path() = " + location.path()); // ""I think the "more correct" approach would be to change |
Member
Author
-> #18131 |
findepi
commented
Jul 4, 2023
| return location; | ||
| } | ||
| return Location.of("file:///" + location.path()); | ||
| return Location.of("file://@/" + location.path()); |
Member
Author
There was a problem hiding this comment.
This works for Location, but we still use Hadoop Path and it chokes on such locations.
In particular, AbstractTestHive.testBucketSortedTables / TestHiveFileMetastore.testBucketSortedTables fails
java.lang.IllegalArgumentException: Wrong FS: file://@/var/folders/dr/jhnfvsrd2zl925dyfsctj0pr0000gn/T/trino-staging-11857319125698218229/temp_path_, expected: file:///
at org.apache.hadoop.fs.FileSystem.checkPath(FileSystem.java:831)
at org.apache.hadoop.fs.RawLocalFileSystem.pathToFile(RawLocalFileSystem.java:119)
at org.apache.hadoop.fs.RawLocalFileSystem.mkdirsWithOptionalPermission(RawLocalFileSystem.java:822)
at org.apache.hadoop.fs.RawLocalFileSystem.mkdirs(RawLocalFileSystem.java:808)
at org.apache.hadoop.fs.ChecksumFileSystem.mkdirs(ChecksumFileSystem.java:997)
at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:722)
at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:709)
at io.trino.hdfs.TrinoFileSystemCache$FileSystemWrapper.create(TrinoFileSystemCache.java:361)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:1240)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:1217)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:1098)
at io.trino.filesystem.hdfs.HdfsOutputFile.lambda$create$1(HdfsOutputFile.java:75)
at io.trino.hdfs.authentication.NoHdfsAuthentication.doAs(NoHdfsAuthentication.java:25)
at io.trino.hdfs.HdfsEnvironment.doAs(HdfsEnvironment.java:125)
at io.trino.filesystem.hdfs.HdfsOutputFile.create(HdfsOutputFile.java:75)
at io.trino.filesystem.hdfs.HdfsOutputFile.create(HdfsOutputFile.java:54)
at io.trino.orc.OutputStreamOrcDataSink.create(OutputStreamOrcDataSink.java:41)
at io.trino.plugin.hive.orc.OrcFileWriterFactory.createOrcDataSink(OrcFileWriterFactory.java:217)
at io.trino.plugin.hive.SortingFileWriter.writeTempFile(SortingFileWriter.java:258)
at io.trino.plugin.hive.SortingFileWriter.flushToTempFile(SortingFileWriter.java:201)
at io.trino.plugin.hive.SortingFileWriter.appendRows(SortingFileWriter.java:125)
at io.trino.plugin.hive.HiveWriter.append(HiveWriter.java:85)
at io.trino.plugin.hive.HivePageSink.writePage(HivePageSink.java:346)
at io.trino.plugin.hive.HivePageSink.doAppend(HivePageSink.java:297)
at io.trino.plugin.hive.HivePageSink.lambda$appendPage$3(HivePageSink.java:285)
at io.trino.hdfs.authentication.HdfsAuthentication.lambda$doAs$0(HdfsAuthentication.java:26)
at io.trino.hdfs.authentication.NoHdfsAuthentication.doAs(NoHdfsAuthentication.java:25)
at io.trino.hdfs.authentication.HdfsAuthentication.doAs(HdfsAuthentication.java:25)
at io.trino.hdfs.HdfsEnvironment.doAs(HdfsEnvironment.java:130)
at io.trino.plugin.hive.HivePageSink.appendPage(HivePageSink.java:285)
at io.trino.plugin.hive.AbstractTestHive.doTestBucketSortedTables(AbstractTestHive.java:2868)
at io.trino.plugin.hive.AbstractTestHive.testBucketSortedTables(AbstractTestHive.java:2813)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
It's common for staging path to contain
${USER}placeholder and be on local file system. When username contains an AT sign (name@domain), thesetSchemeToFileIfAbsentused to fail.Fixes #18132