示例#1
0
        private FlinkSqlDataReader(FlinkSqlCommand sqlCommand, CommandBehavior behavior, string jobId, ExecuteResultSet resultSet)
        {
            Command  = sqlCommand ?? throw new ArgumentNullException(nameof(sqlCommand));
            Behavior = behavior;

            _jobId            = jobId;
            _currentResultSet = resultSet;

            // with jobId fetch the first result to get column infos
            if (!string.IsNullOrWhiteSpace(jobId))
            {
                Func <Task> fetchJobFirstResultFunc = () => FetchJobNextResultAsync();

                fetchJobFirstResultFunc.RunSync();
            }
        }
示例#2
0
        internal static FlinkSqlDataReader Create(FlinkSqlCommand sqlCommand, CommandBehavior behavior, StatementExecuteResponse executeResponse)
        {
            if (executeResponse == null)
            {
                throw new ArgumentNullException(nameof(executeResponse));
            }

            var resultSet = executeResponse.Results[0];

            if (resultSet.Columns.Count == 1 && string.Compare(resultSet.Columns[0].Name, FlinkSqlConstants.Job_Id, true) == 0)
            {
                var jobId = Convert.ToString(resultSet.Data[0][0]);

                return(new FlinkSqlDataReader(sqlCommand, behavior, jobId, null));
            }

            return(new FlinkSqlDataReader(sqlCommand, behavior, null, resultSet));
        }