Spark 配置

配置

参数 说明 举例
hive.default.fileformat hive 表默认文件格式 默认textfile,可设置parquet,orc 等 代码在:HiveSerDe.scala
spark.hadoop.mapreduce.input.fileinputformat.list-status.num-threads 并发遍历目录的线程,当input 的目录比较多的时候,可提高性能 ,默认是1,建议24-32
spark.sql.sources.parallelPartitionDiscovery.threshold 并发遍历输入目录的阈值,默认是32,表示超过32个才会启动线程并发遍历 建议设置为1 超过1个就并发遍历,并发遍历通常会快很多,并发查询一天的数据,有24个小时分区,设置为1则会并发遍历24个分区目录
spark.sql.statistics.parallelFileListingInStatsComputation.enabled 是否开启多线程并发list,默认为true 建议设置为true,用于目录比较多的情况
添加文件/更改到暂存区 git add filename git add filename
添加所有文件/更改到暂存区 git add . git add ./-A (new,modified,deleted)
提交 git commit -m msg git commit -m “update blog”
从远程仓库拉取最新代码 git pull origin master git pull origin master
推送到远程仓库 git push origin master git push origin master
查看配置信息 git config –list git config –list
查看文件列表 git ls-files git ls-files
比较工作区和暂存区 git diff git diff
比较暂存区和版本库 git diff –cached git diff –cached
比较工作区和版本库 git diff HEAD git diff HEAD
从暂存区移除文件 git reset HEAD filename git reset HEAD filename
查看本地远程仓库配置 git remote -v git remote -v
回滚 git reset –hard 提交SHA git reset –hard origin/master
强制推送到远程仓库 git push -f origin master git push -f origin master
修改上次 commit git commit –amend git commit –amend
推送 tags 到远程仓库 git push –tags git push –tags
推送单个 tag 到远程仓库 git push origin [tagname] git push origin [tagname]
删除远程分支 git push origin –delete [branchName] git push origin –delete [branchName]
远程空分支(等同于删除) git push origin :[branchName] git push origin :[branchName]
查看历史 git log [–pretty=online] git log –pretty=online

Q&A

如何解决gitk中文乱码,git ls-files 中文文件名乱码问题?

在~/.gitconfig中添加如下内容

[core]
   quotepath = false
[gui]
   encoding = utf-8
[i18n]
   commitencoding = utf-8 
[svn]
   pathnameencoding = utf-8 

参考 http://zengrong.net/post/1249.htm

如何处理本地有更改需要从服务器合入新代码的情况?

git stash
git pull
git stash pop

如何合并 fork 的仓库的上游更新?

git remote add upstream https://upstream-repo-url
git fetch upstream
git merge upstream/master

如何通过 TortoiseSVN 带的 TortoiseMerge.exe 处理 git 产生的 conflict?

  • 将 TortoiseMerge.exe 所在路径添加到 path 环境变量。
  • 运行命令 git config --global merge.tool tortoisemerge 将 TortoiseMerge.exe 设置为默认的 merge tool。
  • 在产生 conflict 的目录运行 git mergetool,TortoiseMerge.exe 会跳出来供你 resolve conflict。

    也可以运行 git mergetool -t vimdiff 使用 -t 参数临时指定一个想要使用的 merge tool。

不想跟踪的文件已经被提交了,如何不再跟踪而保留本地文件?

git rm --cached /path/to/file,然后正常 add 和 commit 即可。

如何不建立一个没有 parent 的 branch?

git checkout --orphan newbranch

此时 git branch 是不会显示该 branch 的,直到你做完更改首次 commit。比如你可能会想建立一个空的 gh-pages branch,那么:

git checkout --orphan gh-pages
git rm -rf .
// add your gh-pages branch files
git add .
git commit -m "init commit"

submodule 的常用命令

添加 submodule

git submodule add git@github.com:philsquared/Catch.git Catch

这会在仓库根目录下生成如下 .gitmodules 文件并 clone 该 submodule 到本地。

[submodule "Catch"]
path = Catch
url = git@github.com:philsquared/Catch.git

更新 submodule

git submodule update

当 submodule 的 remote 有更新的时候,需要

git submodule update --remote

删除 submodule

在 .gitmodules 中删除对应 submodule 的信息,然后使用如下命令删除子模块所有文件:

git rm --cached Catch

clone 仓库时拉取 submodule

git submodule update --init --recursive

删除远程 tag

git tag -d v0.0.9
git push origin :refs/tags/v0.0.9

git push origin --delete tag [tagname]

清除未跟踪文件

git clean

可选项:

选项 含义
-q, –quiet 不显示删除文件名称
-n, –dry-run 试运行
-f, –force 强制删除
-i, –interactive 交互式删除
-d 删除文件夹
-e, –exclude 忽略符合 的文件
-x 清除包括 .gitignore 里忽略的文件
-X 只清除 .gitignore 里忽略的文件

windows使用git时出现:warning: LF will be replaced by CRLF

$git config --global core.autocrlf false

忽略文件属性更改

因为临时需求对某个文件 chmod 了一下,结果这个就被记为了更改,有时候这是想要的,有时候这会造成困扰。

git config --global core.filemode false

参考:How do I make Git ignore file mode (chmod) changes?

patch

将未添加到暂存区的更改生成 patch 文件:

git diff > demo.patch

将已添加到暂存区的更改生成 patch 文件:

git diff --cached > demo.patch

合并上面两条命令生成的 patch 文件包含的更改:

git apply demo.patch

将从 HEAD 之前的 3 次 commit 生成 3 个 patch 文件:

(HEAD 可以换成 sha1 码)

git format-patch -3 HEAD

生成 af8e2 与 eaf8e 之间的 commits 的 patch 文件:

(注意 af8e2 比 eaf8e 早)

git format-patch af8e2..eaf8e

合并 format-patch 命令生成的 patch 文件:

git am 0001-Update.patch

git apply 不同,这会直接 add 和 commit。

只下载最新代码

git clone --depth 1 git://xxxxxx

这样 clone 出来的仓库会是一个 shallow 的状态,要让它变成一个完整的版本:

git fetch --unshallow

git pull --unshallow

***unstaged changes

git stash
git pull –rebase
git stash pop

cat /sys/kernel/mm/transparent_hugepage/defrag;

cat /sys/kernel/mm/transparent_hugepage/enabled;

echo never > /sys/kernel/mm/transparent_hugepage/defrag;

echo never > /sys/kernel/mm/transparent_hugepage/enabled;

Search

    Post Directory