apache/dolphinscheduler · error · UnsupportedOperationException

Aliyun Serverless Spark AdHocDataSourceClient is not support

Error message

Aliyun Serverless Spark AdHocDataSourceClient is not supported

What it means

The Aliyun Serverless Spark datasource plugin only implements pooled data source clients. Its DataSourceChannel.createAdHocDataSourceClient is a stub that unconditionally throws UnsupportedOperationException, because ad-hoc (per-query) connections are not implemented for this database type.

Source

Thrown at dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-aliyunserverlessspark/src/main/java/org/apache/dolphinscheduler/plugin/datasource/aliyunserverlessspark/AliyunServerlessSparkDataSourceChannel.java:30

 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.dolphinscheduler.plugin.datasource.aliyunserverlessspark;

import org.apache.dolphinscheduler.spi.datasource.AdHocDataSourceClient;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.PooledDataSourceClient;
import org.apache.dolphinscheduler.spi.enums.DbType;

public class AliyunServerlessSparkDataSourceChannel implements DataSourceChannel {

    @Override
    public AdHocDataSourceClient createAdHocDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) {
        throw new UnsupportedOperationException("Aliyun Serverless Spark AdHocDataSourceClient is not supported");
    }

    @Override
    public PooledDataSourceClient createPooledDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) {
        throw new UnsupportedOperationException("Aliyun Serverless Spark AdHocDataSourceClient is not supported");
    }
}

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Use the pooled data source client path (createPooledDataSourceClient) for this plugin.
  2. Choose a datasource type that supports ad-hoc clients if ad-hoc execution is required.
  3. Check the plugin version / upstream DolphinScheduler for added ad-hoc support before relying on it.

Example fix

// before
AdHocDataSourceClient client = channel.createAdHocDataSourceClient(param, DbType.ALIYUN_SERVERLESS_SPARK); // throws
// after
PooledDataSourceClient client = channel.createPooledDataSourceClient(param, DbType.ALIYUN_SERVERLESS_SPARK);
Defensive patterns

Strategy: fallback

Validate before calling

if (dbType == DbType.ALIYUN_SERVERLESS_SPARK) {
    // ad-hoc client unsupported; use pooled client path
}

Type guard

boolean supportsAdHoc(DbType t) { return t != DbType.ALIYUN_SERVERLESS_SPARK; }

Try / catch

try {
    client = channel.createAdHocDataSourceClient(param, dbType);
} catch (UnsupportedOperationException e) {
    client = channel.createPooledDataSourceClient(param, dbType);
}

Prevention

When it happens

Trigger: Requesting an ad-hoc (SQL execute-once) client for an Aliyun Serverless Spark datasource — e.g. via the ad-hoc query / SQL execution API paths that call DataSourceClientFactory/adhoc client creation for this DbType.

Common situations: Trying to run ad-hoc SQL queries against an Aliyun Serverless Spark connection in the UI/API; plugin support added for pooled usage only, with ad-hoc paths never implemented.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/137ce7f82d76fc00. Report an issue: GitHub.