Giter Site home page Giter Site logo

hive's Introduction

HIVE

Anything Hive

Cheatsheets:

Coding

Settings for ODBC Connection:

Hive metadata

  • use sys; query string

  • use infromation_schema; query string

  • create materialized view table_name

  • constraints:

  • primary key (id) disable novalidate, constraint var foredign key (var) references table(id) disable novalidate

  • create table: var as surraget_key()

  • resource plan + caching:

  • create resource plan plan_name;

  • create pool plan_name.a with alloc_fraction = 0.8 query_parallelism = 5;

  • create pool plan_name.b with alloc_fraction = 0.2 query_parallelism = 20;

  • create rule ... ;

  • add rule downgrade to a;

  • create application maping ...

  • alter plan plan_name ... ;

  • apply plan plan_name;

  • options: hive.query.results.cache.enabled=true on by default

  • works on managed tables

  • store in /tmp/ folder

  • Spark-Hive connect

  • options:

  • hive.executeUpdate("sql String") : Bool

  • df.write.format(hive_warehouse_dconnector).save() "writes ORC files" from spark.

  • df.select() .filter .

  • streaming: - df.write.format(stream_to_stream).start()

Hive Arrays

  • explode: lateral view explode(array_string_field) x as field_name
  • array_contains

Map Field

  • key value pais concept
  • maps can be exploded.

Struct fields

  • must follow specific schema, not so in maps
  • use "dot" formais
  • create table:
  • insert overwrite table select * named_struct( # map() for map 'tiny_int.field_c', tinyint_field, 'tiny_int', tinyint_field ) from

JSON

  • get_json_object(json_col, "$.field[0].name") as var1

Partition field

  • always the last couple of cols.

UDF - create temporary functions

collect() - put data into 1 row, like collect(map())

hive's People

Contributors

fredo-xvii avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.