<commit_before>include_recipe "hive2::_configure"

mysql_endpoint = private_recipe_ip("ndb", "mysqld")

hive_downloaded = node.hive2.base_dir + "/.hive_setup"
bash 'setup-hive' do
  user "root"
  group node.hive2.group
  code <<-EOH
#        #{node.ndb.scripts_dir}/mysql-client.sh -e \"CREATE USER '#{node.hive2.mysql_user}'@'localhost' IDENTIFIED BY '#{node.hive2.mysql_password}'\"
#        #{node.ndb.scripts_dir}/mysql-client.sh -e \"REVOKE ALL PRIVILEGES, GRANT OPTION FROM '#{node.hive2.mysql_user}'@'localhost'\"
        #{node.ndb.scripts_dir}/mysql-client.sh -e \"CREATE DATABASE IF NOT EXISTS metastore CHARACTER SET latin1\"
#        #{node.ndb.scripts_dir}/mysql-client.sh -e \"GRANT CREATE,SELECT,INSERT,UPDATE,DELETE,LOCK TABLES,EXECUTE ON metastore.* TO '#{node.hive2.mysql_user}'@'localhost'\"
        #{node.ndb.scripts_dir}/mysql-client.sh -e \"GRANT ALL PRIVILEGES ON metastore.* TO '#{node.hive2.mysql_user}'@'#{mysql_endpoint}' IDENTIFIED BY '#{node.hive2.mysql_password}'\"
        #{node.ndb.scripts_dir}/mysql-client.sh -e \"GRANT SELECT ON hops.hdfs_inodes TO '#{node.hive2.mysql_user}'@'#{mysql_endpoint}' IDENTIFIED BY '#{node.hive2.mysql_password}'\"<commit_msg>Fix access permissions to the database<commit_after>include_recipe "hive2::_configure"

private_ip = my_private_ip()
public_ip = my_public_ip()

bash 'setup-hive' do
  user "root"
  group node.hive2.group
  code <<-EOH
        #{node.ndb.scripts_dir}/mysql-client.sh -e \"CREATE DATABASE IF NOT EXISTS metastore CHARACTER SET latin1\"
        #{node.ndb.scripts_dir}/mysql-client.sh -e \"GRANT ALL PRIVILEGES ON metastore.* TO '#{node.hive2.mysql_user}'@'#{private_ip}' IDENTIFIED BY '#{node.hive2.mysql_password}'\"
        #{node.ndb.scripts_dir}/mysql-client.sh -e \"GRANT ALL PRIVILEGES ON metastore.* TO '#{node.hive2.mysql_user}'@'#{public_ip}' IDENTIFIED BY '#{node.hive2.mysql_password}'\"
        #{node.ndb.scripts_dir}/mysql-client.sh -e \"GRANT ALL PRIVILEGES ON metastore.* TO '#{node.hive2.mysql_user}'@'#{node['hostname']}' IDENTIFIED BY '#{node.hive2.mysql_password}'\"
        #{node.ndb.scripts_dir}/mysql-client.sh -e \"GRANT SELECT ON hops.hdfs_inodes TO '#{node.hive2.mysql_user}'@'#{private_ip}' IDENTIFIED BY '#{node.hive2.mysql_password}'\"
        #{node.ndb.scripts_dir}/mysql-client.sh -e \"GRANT SELECT ON hops.hdfs_inodes TO '#{node.hive2.mysql_user}'@'#{public_ip}' IDENTIFIED BY '#{node.hive2.mysql_password}'\"
        #{node.ndb.scripts_dir}/mysql-client.sh -e \"GRANT SELECT ON hops.hdfs_inodes TO '#{node.hive2.mysql_user}'@'#{node['hostname']}' IDENTIFIED BY '#{node.hive2.mysql_password}'\"
{'fraction_non_alphanumeric': 0.173414820473644, 'fraction_numerical': 0.010313216195569137, 'mean_word_length': 4.620171673819742, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3473258', 'n_tokens_mistral': 1019, 'n_tokens_neox': 1008, 'n_words': 176}