@@ -253,6 +253,8 @@ private Object dispatch(String method, JsonObject params) throws Exception {
253253 }
254254 if (AgentProtocol .METHOD_LIST_OBJECTS .equals (method )) {
255255 switchCatalog (params );
256+ MetadataReadOptions options = metadataReadOptions (params );
257+ if (options .exact ()) return agent .listObjects (params .get ("schema" ).getAsString (), metadataListConstraints (params ), options );
256258 return agent .listObjects (params .get ("schema" ).getAsString (), metadataListConstraints (params ));
257259 }
258260 if (AgentProtocol .METHOD_LIST_DATA_TYPES .equals (method )) {
@@ -265,13 +267,16 @@ private Object dispatch(String method, JsonObject params) throws Exception {
265267 }
266268 if (AgentProtocol .METHOD_GET_OBJECT_SOURCE .equals (method )) {
267269 switchCatalog (params );
270+ MetadataReadOptions options = metadataReadOptions (params );
268271 boolean includeOrigin = params .has ("include_source_origin" ) && params .get ("include_source_origin" ).getAsBoolean ();
269272 String schema = params .get ("schema" ).getAsString ();
270273 String name = params .get ("name" ).getAsString ();
271274 String objectType = params .get ("object_type" ).getAsString ();
272- ObjectSource source = includeOrigin
273- ? agent .getObjectSourceWithOrigin (schema , name , objectType )
274- : agent .getObjectSource (schema , name , objectType );
275+ ObjectSource source = options .exact ()
276+ ? agent .getObjectSource (schema , name , objectType , options )
277+ : includeOrigin
278+ ? agent .getObjectSourceWithOrigin (schema , name , objectType )
279+ : agent .getObjectSource (schema , name , objectType );
275280 if (includeOrigin ) {
276281 JsonObject result = gson .toJsonTree (source ).getAsJsonObject ();
277282 if (source .getSourceOrigin () != null ) {
@@ -303,6 +308,8 @@ private Object dispatch(String method, JsonObject params) throws Exception {
303308 }
304309 if (AgentProtocol .METHOD_LIST_TRIGGERS .equals (method )) {
305310 switchCatalog (params );
311+ MetadataReadOptions options = metadataReadOptions (params );
312+ if (options .exact ()) return agent .listTriggers (params .get ("schema" ).getAsString (), params .get ("table" ).getAsString (), options );
306313 return agent .listTriggers (params .get ("schema" ).getAsString (), params .get ("table" ).getAsString ());
307314 }
308315 if (AgentProtocol .METHOD_LIST_CONSTRAINTS .equals (method )) {
@@ -669,6 +676,15 @@ private MetadataListConstraints metadataListConstraints(JsonObject params) {
669676 );
670677 }
671678
679+ private static MetadataReadOptions metadataReadOptions (JsonObject params ) {
680+ String mode = stringOrNull (params , "identity_mode" );
681+ String alias = stringOrNull (params , "identityMode" );
682+ if (mode != null && alias != null && !mode .equals (alias )) {
683+ throw new IllegalArgumentException ("Conflicting metadata identity modes" );
684+ }
685+ return MetadataReadOptions .fromIdentityMode (mode != null ? mode : alias );
686+ }
687+
672688 private static int intOrDefault (JsonObject object , String key , int defaultValue ) {
673689 Integer value = intOrNull (object , key );
674690 return value == null ? defaultValue : value ;
0 commit comments