Skip to content

Conversation

@rohitagarwal003
Copy link
Contributor

No description provided.

@rohitagarwal003
Copy link
Contributor Author

cc - @vanzin

@rohitagarwal003
Copy link
Contributor Author

cc - @srowen, @andrewor14 Can you please ask Jenkins to run the tests. Thanks!

@andrewor14
Copy link
Contributor

ok to test

@SparkQA
Copy link

SparkQA commented Dec 11, 2015

Test build #47555 has finished for PR 10180 at commit 7625c88.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@rohitagarwal003
Copy link
Contributor Author

Can someone review this or if it seems okay, merge it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine, but maybe slightly less repetitious like ...

val requestURI = req.getRequestURI + (if (req.getQueryString == null) "" else ("?" + req.getQueryString))
res.sendRedirect(res.encodeRedirectURL(requestURI))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or even

val requestURI = req.getRequestURI + req.getQueryString.map("?" + _).getOrElse("")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewor14 Can't use getOrElse:

value getOrElse is not a member of scala.collection.immutable.IndexedSeq[String]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srowen I think having an if statement like that makes it a little harder to read. How about the following, it has lesser repetition.

val requestURI = if (req.getQueryString == null) {
  req.getRequestURI
} else {
  req.getRequestURI + "?" + req.getQueryString
}
res.sendRedirect(res.encodeRedirectURL(requestURI))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what? Isn't req.getQueryString a string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is. I am not sure what you are trying to do in that statement:

scala> "spark".map("?" + _)
res0: scala.collection.immutable.IndexedSeq[String] = Vector(?s, ?p, ?a, ?r, ?k)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh sorry, I meant

val requestURI = req.getRequestURI + Option(req.getQueryString).map("?" + _).getOrElse("")

where

Option(null) == None
Option("something") == Some("something")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@andrewor14
Copy link
Contributor

LGTM once you address the comments.

@SparkQA
Copy link

SparkQA commented Dec 16, 2015

Test build #47839 has finished for PR 10180 at commit 780ee62.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@andrewor14
Copy link
Contributor

retest this please

@SparkQA
Copy link

SparkQA commented Dec 16, 2015

Test build #47853 has finished for PR 10180 at commit 780ee62.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@andrewor14
Copy link
Contributor

Merged into master 1.6

asfgit pushed a commit that referenced this pull request Dec 17, 2015
…ry string when redirecting.

Author: Rohit Agarwal <[email protected]>

Closes #10180 from mindprince/SPARK-12186.

(cherry picked from commit fdb3822)
Signed-off-by: Andrew Or <[email protected]>
@asfgit asfgit closed this in fdb3822 Dec 17, 2015
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

Successfully merging this pull request may close these issues.

4 participants