Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple query fails after long runtime, ends up being a type error? #64

Open
EMCP opened this issue May 14, 2023 · 1 comment
Open

Simple query fails after long runtime, ends up being a type error? #64

EMCP opened this issue May 14, 2023 · 1 comment

Comments

@EMCP
Copy link

EMCP commented May 14, 2023

I am owner of a Trino server running V415 .. attempting to query it via Julialang.. and the HTTP api doesn't make much sense to me .. so I grabbed JDBC and attempted to query a simple select * from my_table .. but getting an error

here's the code

using JDBC
using Tables

driver_path = "/home/emcp/drivers/trino-jdbc-415.jar"

JDBC.usedriver(driver_path)
JDBC.init()

cnxn = JDBC.Connection("jdbc:trino://mytrino-server:8080/hive/my", props=Dict("user" => "hive")) # create connection
csr = cursor(cnxn) # create cursor from connection

# execute some SQL
execute!(csr, "SELECT * FROM my.table")

# Create a Vector of NamedTuples from the cursor rows
rows_data = NamedTuple.(collect(rows(csr)))

# Convert the rows vector to a Table.jl table
table = Tables(rows_data)

close(csr)

on the collect line it gives

ERROR: TypeError: in typeassert, expected Symbol, got a value of type Char
Stacktrace:
 [1] merge(a::NamedTuple{(), Tuple{}}, itr::Tuple{String, String, String, Int64, String, String, Dates.DateTime})
   @ Base ./namedtuple.jl:304
 [2] NamedTuple(itr::Tuple{String, String, String, Int64, String, String, Dates.DateTime})
   @ Base ./namedtuple.jl:123
 [3] _broadcast_getindex_evalf
   @ ./broadcast.jl:683 [inlined]
 [4] _broadcast_getindex
   @ ./broadcast.jl:656 [inlined]
 [5] getindex
   @ ./broadcast.jl:610 [inlined]
 [6] copy
   @ ./broadcast.jl:912 [inlined]
 [7] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, Type{NamedTuple}, Tuple{Vector{Tuple{String, String, Any, Int64, String, String, Dates.DateTime}}}})
   @ Base.Broadcast ./broadcast.jl:873
 [8] top-level scope
   @ ~/Dev/git/emcp/julia_exploration/src/query_trino_JDBC.jl:17
@EMCP
Copy link
Author

EMCP commented May 14, 2023

as others have remarked the performance was quite bad, but I understand the state of the project is that it's a last ditch sort of thing.. but thought it'd be worth posting this as it may be occurring for others when getting started

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant