3636 * no locations is rejected
3737 * @param formatOptions format branch only — reader options, which BECOME the
3838 * reader's named arguments. Empty for the other kinds
39+ * @param schemaName function branch only — schema containing the named VGI
40+ * function; {@code null} for native/ambiguous functions
3941 */
4042public record ScanBranch (
4143 String functionName ,
@@ -48,7 +50,28 @@ public record ScanBranch(
4850 String sourceTable ,
4951 String formatName ,
5052 List <String > formatLocations ,
51- Map <String , Object > formatOptions ) {
53+ Map <String , Object > formatOptions ,
54+ String schemaName ) {
55+
56+ /**
57+ * Source-compatible constructor for pre-1.5 callers. The worker resolves
58+ * the function schema before serializing the branch.
59+ */
60+ public ScanBranch (
61+ String functionName ,
62+ List <Object > positional ,
63+ Map <String , Object > named ,
64+ String branchFilter ,
65+ boolean writable ,
66+ String sourceCatalog ,
67+ String sourceSchema ,
68+ String sourceTable ,
69+ String formatName ,
70+ List <String > formatLocations ,
71+ Map <String , Object > formatOptions ) {
72+ this (functionName , positional , named , branchFilter , writable , sourceCatalog ,
73+ sourceSchema , sourceTable , formatName , formatLocations , formatOptions , null );
74+ }
5275
5376 /**
5477 * Validates the branch and defensively copies the collections, normalizing
@@ -118,7 +141,7 @@ public record ScanBranch(
118141 public static ScanBranch format (String formatName , List <String > locations ,
119142 Map <String , Object > options ) {
120143 return new ScanBranch ("" , List .of (), Map .of (), null , false , null , null , null ,
121- formatName , locations , options );
144+ formatName , locations , options , null );
122145 }
123146
124147 /**
@@ -129,7 +152,7 @@ public static ScanBranch format(String formatName, List<String> locations,
129152 * @return the branch
130153 */
131154 public static ScanBranch of (String functionName , Object ... positional ) {
132- return new ScanBranch (functionName , List .of (positional ), Map .of (), null , false , null , null , null , null , null , null );
155+ return new ScanBranch (functionName , List .of (positional ), Map .of (), null , false , null , null , null , null , null , null , null );
133156 }
134157
135158 /**
@@ -141,7 +164,7 @@ public static ScanBranch of(String functionName, Object... positional) {
141164 * @return the branch
142165 */
143166 public static ScanBranch filtered (String functionName , String branchFilter , Object ... positional ) {
144- return new ScanBranch (functionName , List .of (positional ), Map .of (), branchFilter , false , null , null , null , null , null , null );
167+ return new ScanBranch (functionName , List .of (positional ), Map .of (), branchFilter , false , null , null , null , null , null , null , null );
145168 }
146169
147170 /**
@@ -152,7 +175,7 @@ public static ScanBranch filtered(String functionName, String branchFilter, Obje
152175 * @return the writable branch
153176 */
154177 public static ScanBranch writable (String functionName , Object ... positional ) {
155- return new ScanBranch (functionName , List .of (positional ), Map .of (), null , true , null , null , null , null , null , null );
178+ return new ScanBranch (functionName , List .of (positional ), Map .of (), null , true , null , null , null , null , null , null , null );
156179 }
157180
158181 /**
@@ -169,6 +192,13 @@ public static ScanBranch writable(String functionName, Object... positional) {
169192 public static ScanBranch catalogTable (
170193 String sourceCatalog , String sourceSchema , String sourceTable , String branchFilter ) {
171194 return new ScanBranch ("" , List .of (), Map .of (), branchFilter , false , sourceCatalog , sourceSchema ,
172- sourceTable , null , null , null );
195+ sourceTable , null , null , null , null );
196+ }
197+
198+ /** Return this branch with an authoritative function schema. */
199+ public ScanBranch withSchemaName (String schema ) {
200+ return new ScanBranch (functionName , positional , named , branchFilter , writable ,
201+ sourceCatalog , sourceSchema , sourceTable , formatName , formatLocations ,
202+ formatOptions , schema );
173203 }
174204}
0 commit comments