I hanno registrato una tabella temporanea con Spark SQL, come descritto in [this section]:Accesso Spark SQL RDD tabelle attraverso il Thrift Server
people.registerTempTable("people")
// I can run queries on it all right.
val teenagers = sqlContext.sql("SELECT name FROM people WHERE age >= 13 AND age <= 19")
Ora voglio accedere a questa tabella in modalità remota tramite JDBC. Avvio del server Thrift come descritto in [this other section].
./sbin/start-thriftserver.sh --master spark://same-master-as-above:7077
Ma la tabella non è visibile.
0: jdbc:hive2://localhost:10000> show tables;
+---------+
| result |
+---------+
+---------+
No rows selected (2.216 seconds)
Credo che questo è perché il tavolo è "temporaneo" (cioè legato alla durata dell'oggetto SqlContext
). Ma come posso creare tabelle non temporanee?
Posso vedere Hive tables attraverso il server di archiviazione, ma non vedo come ho potuto esporre un RDD come questo. Ho trovato a comment che suggerisce che non posso.
O dovrei utilizzare il Thrift Server nella mia applicazione con il mio SqlContext
? Quasi tutte le classi intorno a questo sono private
e questo codice non è in Maven Central (per quanto vedo). Dovrei usare HiveThriftServer2.startWithContext
? Non è documentato e @DeveloperApi
, ma potrebbe funzionare.
Hai trovato una risposta praticabile per questo? – stackit
quando si utilizza pyspark sua non funziona – stackit