Julia treats vectors as different than n x 1 matrices. For example,
julia> x = rand(4, 1) # 4 x 1 matrix
4×1 Matrix{Float64}:
0.5699429434936178
0.38264907855330454
0.2974011813965416
0.9032771294647794
julia> sort(x; dims=1) # works fine
4×1 Matrix{Float64}:
0.2974011813965416
0.38264907855330454
0.5699429434936178
0.9032771294647794
So it’s not about if size(x,2)==1, it’s about the type of the object. Usually code where x is sometimes a vector and sometimes a matrix is avoided (it’s usually type unstable), but if y is a vector, you can reshape it to be an n x 1 matrix via
julia> y = rand(4)
4-element Vector{Float64}:
0.2646642144471312
0.5108444025487056
0.17038220190741749
0.6299368977104578
julia> reshape(y, :, 1)
4×1 Matrix{Float64}:
0.2646642144471312
0.5108444025487056
0.17038220190741749
0.6299368977104578