deepak-2605 commented on issue #1262: URL: https://github.com/apache/iceberg-go/issues/1262#issuecomment-5332164434
Write path (table/locations.go): simpleLocationProvider/objectStoreLocationProvider wrap a *url.URL built from url.Parse(rootLocation). When rootLocation is a raw Windows path (no file:// prefix — e.g. what t.TempDir() returns, or any local/Hadoop-catalog warehouse given as a bare path), url.Parse reads the drive letter as a scheme: `u, _ := url.Parse(`C:\Users\me\warehouse`) // Scheme="c" Opaque="\Users\me\warehouse" Path=""` NewDataLocation/NewMetadataLocation/NewTableMetadataFileLocation all build paths via .JoinPath(...), which only ever writes to .Path. url.URL.String() ignores .Path completely whenever .Opaque is set (correct per RFC 3986, but fatal here) — so every one of those methods just returns the bare root, unchanged, regardless of filename, partition, or metadata version. Confirmed this is what's behind table/rolling_data_writer.go's writes failing with open <root>: is a directory — every file resolves to the same path, which is the warehouse root itself. Catalog layer: same mechanism, different call site. getDefaultWarehouseLocation in catalog/internal/utils.go:215-222 does url.JoinPath(warehousepath, namespaceKey+".db", tablename) — package-level url.JoinPath is Parse + JoinPath + String() under the hood, so it hits the identical collapse. Every table in every namespace resolves to the same path under a Windows-style warehouse root. I noticed #1644 already adds a portable internal/fileuri package (FileURI.Parse/.JoinPath/.LocalPath) specifically because JoinPath there preserves hierarchical or opaque form correctly, unlike net/url's. That looks like the right fix for both surfaces above too, rather than writing a third path normalizer. Happy to coordinate with @fallintoplace on sequencing since #1644 is already in flight. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
